Created
February 8, 2016 15:53
-
-
Save jagwire/cdd4769ef4e389868813 to your computer and use it in GitHub Desktop.
Example Automatic Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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