Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement