Add some component tests to reference unity project (#86)

* Add some component tests to reference unity project

* Use action/setup-node@v2 to avoid problems with build
This commit is contained in:
Vladimir Kryukov
2021-01-11 02:05:44 +02:00
committed by GitHub
parent 26807aaf05
commit e1be8325cd
10 changed files with 180 additions and 6 deletions

View File

@@ -0,0 +1,31 @@
using System.Collections;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.TestTools;
namespace Tests
{
public class SampleComponentTest
{
private GameObject target;
private SampleComponent component;
[SetUp]
public void Setup()
{
target = GameObject.Instantiate(new GameObject());
component = target.AddComponent<SampleComponent>();
}
[UnityTest]
public IEnumerator TestIncrementOnUpdateAfterNextFrame()
{
// Save the current value, since it was updated after component Start() method called
var count = component.Counter.Count;
// Skip frame and assert the new value
yield return null;
Assert.AreEqual(count + 1, component.Counter.Count);
}
}
}