From 98cd96d5cbf1b57ea026e3c9afed533e5bde00f1 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Mon, 10 Apr 2023 13:45:39 +0100 Subject: [PATCH] fix(test): fix malformed test The child was not being assigned a new parent, causing GetComponentsInChildrenOnly to return empty array and the subsequent line: Assert.That(components, Has.Length.EqualTo(1)); was resulting in a test fail. --- X10D.Unity.Tests/Assets/Tests/ComponentTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/X10D.Unity.Tests/Assets/Tests/ComponentTests.cs b/X10D.Unity.Tests/Assets/Tests/ComponentTests.cs index b7e4c69..126e435 100644 --- a/X10D.Unity.Tests/Assets/Tests/ComponentTests.cs +++ b/X10D.Unity.Tests/Assets/Tests/ComponentTests.cs @@ -17,6 +17,7 @@ namespace X10D.Unity.Tests var rigidbody = parent.AddComponent(); var child = new GameObject(); + child.transform.SetParent(parent.transform); child.AddComponent(); Rigidbody[] components = rigidbody.GetComponentsInChildrenOnly();