public void RoverEngine_Initialise() { var engine = new RoverEngine(5, 2, EDirection.S, _gridHeight, _gridWidth, _mockObstacleDetector.Object); var position = engine.GetPosition(); Assert.AreEqual(5, position.X); Assert.AreEqual(2, position.Y); Assert.AreEqual(EDirection.S, position.Direction); }
public void RoverEngine_WrapWest_MoveBack150_From15W_To51_5W() { var engine = new RoverEngine(1, 5, EDirection.W, _gridHeight, _gridWidth, _mockObstacleDetector.Object); for (int i = 0; i < 150; i++) { engine.MoveBack(); } var newPosition = engine.GetPosition(); Assert.AreEqual(51, newPosition.X); Assert.AreEqual(5, newPosition.Y); Assert.AreEqual(EDirection.W, newPosition.Direction); }
public void RoverEngine_WrapWest_MoveBack100_ArriveAtSameSpot() { var engine = new RoverEngine(0, 0, EDirection.W, _gridHeight, _gridWidth, _mockObstacleDetector.Object); for (int i = 0; i < 100; i++) { engine.MoveBack(); } var newPosition = engine.GetPosition(); Assert.AreEqual(0, newPosition.X); Assert.AreEqual(0, newPosition.Y); Assert.AreEqual(EDirection.W, newPosition.Direction); }
public void RoverEngine_WrapSouth_MoveForward150_From15S_To1_55S() { var engine = new RoverEngine(1, 5, EDirection.S, _gridHeight, _gridWidth, _mockObstacleDetector.Object); for (int i = 0; i < 150; i++) { engine.MoveForward(); } var newPosition = engine.GetPosition(); Assert.AreEqual(1, newPosition.X); Assert.AreEqual(55, newPosition.Y); Assert.AreEqual(EDirection.S, newPosition.Direction); }