public void Test_Rover_Can_Rotate_90_Degrees(Direction startDirection, Rotation rotateDirection, Direction endDirection) { var startPosition = new Position { Direction = startDirection, X = 0, Y = 0 }; var rover = new Rover(startPosition); rover.Rotate(rotateDirection); var newPosition = rover.GetCurrentPosition(); var expectedPosition = new Position { Direction = endDirection, X = 0, Y = 0 }; Assert.AreEqual(newPosition, expectedPosition); }
public Position ExploreTerrain(Plateau plateau, Rover rover, List<Command> commands) { /* Need to do some out of bounds validation here, hence I passed the plateau in, but it is not mentioned in the 'spec' */ foreach (var command in commands) { switch(command) { case Command.MoveForward: rover.MoveFoward(); break; case Command.TurnLeft: rover.Rotate(Rotation.Left); break; case Command.TurnRight: rover.Rotate(Rotation.Right); break; } } return rover.GetCurrentPosition(); }