public void Test_Rover_Can_Move_Forward_One_Square_When_Facing_West() { var startPosition = new Position { Direction = Direction.West, X = 1, Y = 0 }; var rover = new Rover(startPosition); rover.MoveFoward(); var newPosition = rover.GetCurrentPosition(); var expectedPosition = new Position { Direction = Direction.West, 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(); }