public void BeFalseWhenAnyCommandIsOutBounds() { RoverController controller = new RoverController(new Size(2, 2), new Coordinates(0, 0), CardinalPoint.North); Commands[] commands = new[] { Commands.A, Commands.A, Commands.A }; Assert.False(controller.Handle(commands)); }
public void BeTrueWhenAllCommandsIsInBounds() { RoverController controller = new RoverController(new Size(10, 10), new Coordinates(0, 0), CardinalPoint.North); Commands[] commands = new[] { Commands.A, Commands.A, Commands.A }; Assert.True(controller.Handle(commands)); }
public void IncreaseYWhenAdvanceToNorth() { RoverController controller = new RoverController(new Size(2, 2), new Coordinates(0, 0), CardinalPoint.North); Commands[] commands = new[] { Commands.A }; controller.Handle(commands); Assert.Equal(new Coordinates(0, 1), controller.CurrentCoordinates); }
public void RotateLeftFromWestToSouthOnLCommand() { RoverController controller = new RoverController(new Size(10, 10), new Coordinates(0, 0), CardinalPoint.West); Commands[] commands = new[] { Commands.L }; controller.Handle(commands); Assert.Equal(CardinalPoint.South, controller.CurrentCardinalPoint); }
public void RotateRightFromNorthToEastOnRCommand() { RoverController controller = new RoverController(new Size(10, 10), new Coordinates(0, 0), CardinalPoint.North); Commands[] commands = new[] { Commands.R }; controller.Handle(commands); Assert.Equal(CardinalPoint.East, controller.CurrentCardinalPoint); }
public void NotMoveToTheNextPositionWhenACommandIsOutOfBounds() { RoverController controller = new RoverController(new Size(2, 2), new Coordinates(0, 0), CardinalPoint.North); Commands[] commands = new[] { Commands.A, Commands.A, Commands.L, Commands.A, Commands.A }; controller.Handle(commands); Assert.Equal(new Coordinates(0, 2), controller.CurrentCoordinates); }
public void MoveToTheNextPositionWithinBounds() { RoverController controller = new RoverController(new Size(10, 10), new Coordinates(0, 0), CardinalPoint.North); Commands[] commands = new[] { Commands.A, Commands.A, Commands.A }; controller.Handle(commands); Assert.Equal(new Coordinates(0, 3), controller.CurrentCoordinates); }
public void DecreaseXWhenAdvanceToWest() { RoverController controller = new RoverController(new Size(2, 2), new Coordinates(1, 0), CardinalPoint.West); Commands[] commands = new[] { Commands.A }; controller.Handle(commands); Assert.Equal(new Coordinates(0, 0), controller.CurrentCoordinates); }