Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Example Automatic Test
using UnityEngine;
namespace MHS.Tests {
public class MyLogic {
public int speed = 5;
public int position = 0;
public void tick(float timeStep) {
position = position + speed*time;
}
}
[TestFixture]
MyLogicTest {
private MyLogic logic;
public MyLogicTest() {
logic = new MyLogic();
}
[Test]
public onTickPositionShouldAdvanceBySpeedTimesTime() {
//arrange
float time = 0.02f;
logic.speed = 5;
//act
logic.tick(time);
//assert
Assert.AreEqual(logic.position, 0.1f); // 5 * 0.2f
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment