1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-09 23:25:43 +00:00

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.
This commit is contained in:
Oliver Booth 2023-04-10 13:45:39 +01:00
parent f4d6c9083b
commit 98cd96d5cb
No known key found for this signature in database
GPG Key ID: 20BEB9DC87961025

View File

@ -17,6 +17,7 @@ namespace X10D.Unity.Tests
var rigidbody = parent.AddComponent<Rigidbody>(); var rigidbody = parent.AddComponent<Rigidbody>();
var child = new GameObject(); var child = new GameObject();
child.transform.SetParent(parent.transform);
child.AddComponent<Rigidbody>(); child.AddComponent<Rigidbody>();
Rigidbody[] components = rigidbody.GetComponentsInChildrenOnly<Rigidbody>(); Rigidbody[] components = rigidbody.GetComponentsInChildrenOnly<Rigidbody>();