Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. namespace MHS.Tests {
  4. public class MyLogic {
  5. public int speed = 5;
  6. public int position = 0;
  7. public void tick(float timeStep) {
  8. position = position + speed*time;
  9. }
  10. }
  11.  
  12. [TestFixture]
  13. MyLogicTest {
  14. private MyLogic logic;
  15. public MyLogicTest() {
  16. logic = new MyLogic();
  17. }
  18.  
  19. [Test]
  20. public onTickPositionShouldAdvanceBySpeedTimesTime() {
  21. //arrange
  22. float time = 0.02f;
  23. logic.speed = 5;
  24.  
  25. //act
  26. logic.tick(time);
  27.  
  28. //assert
  29. Assert.AreEqual(logic.position, 0.1f); // 5 * 0.2f
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement