From 0b5bb074c8b33746b56bd44ac2a565d2e8a797d0 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Mon, 10 Apr 2023 13:38:56 +0100 Subject: [PATCH] refactor(test): remove IEnumerator tests Use synchronous NUnit tests --- .../Assets/Tests/GameObjectTests.cs | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/X10D.Unity.Tests/Assets/Tests/GameObjectTests.cs b/X10D.Unity.Tests/Assets/Tests/GameObjectTests.cs index dca113b..565d455 100644 --- a/X10D.Unity.Tests/Assets/Tests/GameObjectTests.cs +++ b/X10D.Unity.Tests/Assets/Tests/GameObjectTests.cs @@ -1,18 +1,16 @@ #nullable enable -using System.Collections; using System.Diagnostics.CodeAnalysis; using NUnit.Framework; using UnityEngine; -using UnityEngine.TestTools; using Object = UnityEngine.Object; namespace X10D.Unity.Tests { public class GameObjectTests { - [UnityTest] - public IEnumerator GetComponentsInChildrenOnly_ShouldIgnoreParent() + [Test] + public void GetComponentsInChildrenOnly_ShouldIgnoreParent() { var parent = new GameObject(); parent.AddComponent(); @@ -27,12 +25,11 @@ namespace X10D.Unity.Tests Object.Destroy(parent); Object.Destroy(child); - yield break; } - [UnityTest] + [Test] [SuppressMessage("ReSharper", "Unity.InefficientPropertyAccess", Justification = "False positive.")] - public IEnumerator LookAt_ShouldRotateSameAsTransform() + public void LookAt_ShouldRotateSameAsTransform() { var first = new GameObject {transform = {position = Vector3.zero, rotation = Quaternion.identity}}; var second = new GameObject {transform = {position = Vector3.right, rotation = Quaternion.identity}}; @@ -65,11 +62,10 @@ namespace X10D.Unity.Tests Object.Destroy(first); Object.Destroy(second); - yield break; } - [UnityTest] - public IEnumerator SetLayerRecursively_ShouldSetLayerRecursively() + [Test] + public void SetLayerRecursively_ShouldSetLayerRecursively() { var parent = new GameObject(); var child = new GameObject(); @@ -92,12 +88,11 @@ namespace X10D.Unity.Tests Object.Destroy(parent); Object.Destroy(child); Object.Destroy(grandChild); - yield break; } - [UnityTest] + [Test] [SuppressMessage("ReSharper", "Unity.InefficientPropertyAccess", Justification = "False positive.")] - public IEnumerator SetParent_ShouldSetParent() + public void SetParent_ShouldSetParent() { var first = new GameObject {transform = {position = Vector3.zero, rotation = Quaternion.identity}}; var second = new GameObject {transform = {position = Vector3.right, rotation = Quaternion.identity}}; @@ -116,7 +111,6 @@ namespace X10D.Unity.Tests Object.Destroy(first); Object.Destroy(second); - yield break; } } }