mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-22 19:28:48 +00:00
refactor(test): remove IEnumerator tests
Use synchronous NUnit tests
This commit is contained in:
parent
77ab429f72
commit
0b5bb074c8
@ -1,18 +1,16 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
|
|
||||||
using System.Collections;
|
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.TestTools;
|
|
||||||
using Object = UnityEngine.Object;
|
using Object = UnityEngine.Object;
|
||||||
|
|
||||||
namespace X10D.Unity.Tests
|
namespace X10D.Unity.Tests
|
||||||
{
|
{
|
||||||
public class GameObjectTests
|
public class GameObjectTests
|
||||||
{
|
{
|
||||||
[UnityTest]
|
[Test]
|
||||||
public IEnumerator GetComponentsInChildrenOnly_ShouldIgnoreParent()
|
public void GetComponentsInChildrenOnly_ShouldIgnoreParent()
|
||||||
{
|
{
|
||||||
var parent = new GameObject();
|
var parent = new GameObject();
|
||||||
parent.AddComponent<Rigidbody>();
|
parent.AddComponent<Rigidbody>();
|
||||||
@ -27,12 +25,11 @@ namespace X10D.Unity.Tests
|
|||||||
|
|
||||||
Object.Destroy(parent);
|
Object.Destroy(parent);
|
||||||
Object.Destroy(child);
|
Object.Destroy(child);
|
||||||
yield break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[UnityTest]
|
[Test]
|
||||||
[SuppressMessage("ReSharper", "Unity.InefficientPropertyAccess", Justification = "False positive.")]
|
[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 first = new GameObject {transform = {position = Vector3.zero, rotation = Quaternion.identity}};
|
||||||
var second = new GameObject {transform = {position = Vector3.right, 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(first);
|
||||||
Object.Destroy(second);
|
Object.Destroy(second);
|
||||||
yield break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[UnityTest]
|
[Test]
|
||||||
public IEnumerator SetLayerRecursively_ShouldSetLayerRecursively()
|
public void SetLayerRecursively_ShouldSetLayerRecursively()
|
||||||
{
|
{
|
||||||
var parent = new GameObject();
|
var parent = new GameObject();
|
||||||
var child = new GameObject();
|
var child = new GameObject();
|
||||||
@ -92,12 +88,11 @@ namespace X10D.Unity.Tests
|
|||||||
Object.Destroy(parent);
|
Object.Destroy(parent);
|
||||||
Object.Destroy(child);
|
Object.Destroy(child);
|
||||||
Object.Destroy(grandChild);
|
Object.Destroy(grandChild);
|
||||||
yield break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[UnityTest]
|
[Test]
|
||||||
[SuppressMessage("ReSharper", "Unity.InefficientPropertyAccess", Justification = "False positive.")]
|
[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 first = new GameObject {transform = {position = Vector3.zero, rotation = Quaternion.identity}};
|
||||||
var second = new GameObject {transform = {position = Vector3.right, 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(first);
|
||||||
Object.Destroy(second);
|
Object.Destroy(second);
|
||||||
yield break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user