Files
unity-test-runner/unity-project-with-correct-tests/Assets/Tests/PlayMode/SamplePlayModeTest.cs
Vladimir Kryukov e1be8325cd 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
2021-01-11 01:05:44 +01:00

43 lines
891 B
C#

using System.Collections;
using NUnit.Framework;
using UnityEngine.TestTools;
namespace Tests
{
public class SamplePlayModeTest
{
// A Test behaves as an ordinary method
[Test]
public void NewTestScriptSimplePasses()
{
// Given
var counter = new BasicCounter(0);
// When
counter.Increment();
// Then
Assert.AreEqual(1, counter.Count);
}
// A UnityTest behaves like a coroutine in Play Mode. In Edit Mode you can use
// `yield return null;` to skip a frame.
[UnityTest]
public IEnumerator NewTestScriptWithEnumeratorPasses()
{
// Given
var counter = new BasicCounter(3);
// Use the Assert class to test conditions.
// Use yield to skip a frame.
yield return null;
// When
counter.Increment();
// Then
Assert.AreEqual(4, counter.Count);
}
}
}