1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-22 14:08:48 +00:00

refactor(test): remove IEnumerator tests

Use synchronous NUnit tests
This commit is contained in:
Oliver Booth 2023-04-10 13:38:56 +01:00
parent 77ab429f72
commit 0b5bb074c8
No known key found for this signature in database
GPG Key ID: 20BEB9DC87961025

View File

@ -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<Rigidbody>();
@ -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;
}
}
}