public void cannot_move_rover() { var rover = new Rover(new Coordinate(0, 0), CameraDirection.West); rover.OnMoving(c => false); Assert.Throws<RoverCannotMoveException>(() => rover.SendInstruction(RoverInstruction.M)); }
public void cannot_move_rover_outside_of_plateau(int x, int y, CameraDirection cameraDirection) { var mars = new Plateau(new Size(1, 1)); var rover = new Rover(new Coordinate(x, y), cameraDirection); mars.PlaceRover(rover); Assert.Throws<RoverCannotMoveException>(() => rover.SendInstruction(RoverInstruction.M)); }
public void moves_west() { var rover = new Rover(new Coordinate(1, 0), CameraDirection.West); rover.SendInstruction(RoverInstruction.M); Assert.AreEqual(new Coordinate(0, 0), rover.Coordinate); }
public void moves_south() { var rover = new Rover(new Coordinate(0, 1), CameraDirection.South); rover.SendInstruction(RoverInstruction.M); Assert.AreEqual(new Coordinate(0, 0), rover.Coordinate); }
public void changes_direction(RoverInstruction instruction, CameraDirection initialDirection, CameraDirection expectedDirection) { var rover = new Rover(new Coordinate(0, 0), initialDirection); rover.SendInstruction(instruction); Assert.AreEqual(expectedDirection, rover.CameraDirection); }
public void cannot_move_rover_if_it_will_collide_with_another_rover() { var mars = new Plateau(new Size(3, 3)); var rover = new Rover(new Coordinate(1, 1), CameraDirection.North); mars.PlaceRover(rover); var rover2 = new Rover(new Coordinate(1, 2), CameraDirection.South); mars.PlaceRover(rover2); Assert.Throws<RoverCannotMoveException>(() => rover2.SendInstruction(RoverInstruction.M)); }