public async Task ShouldFailFirstPlaceCommand(int x, int y) { var robot = new Robot(Table.GetTableInstance()); Position position = new Position(x, y, Direction.NORTH); var command = new PlaceCommand(); var result = await command.Excute(robot, position); result.ShouldBe(null); // Set up a location for robot robot.SetPosition(new Position(2, 3, Direction.NORTH)); // execut the command and make sure it doesnot result = await command.Excute(robot, position); result.ShouldBe(null); }
public async Task ShouldSucceedPlaceRobotForRobotNotOnTable(int x, int y, Direction direction) { // Setup var robot = new Robot(Table.GetTableInstance()); Position position = new Position(x, y, direction); var command = new PlaceCommand(); // Excute var result = await command.Excute(robot, position); // Validate result.XEastWestAxis.ShouldBe(x); result.YNorthSouthAxis.ShouldBe(y); result.Direction.ShouldBe(direction); }
public async Task ShouldFailPlaceCommandWithExistingLocation(int x, int y) { // Setup var robot = new Robot(Table.GetTableInstance()); Position position = new Position(x, y, Direction.NORTH); var command = new PlaceCommand(); var newPosition = new Position(2, 3, Direction.NORTH); // Set up a location for robot robot.SetPositionOnTable(newPosition); // Excute var result = await command.Excute(robot, position); // Validate result.ShouldBe(null); robot.GetPosition().ShouldBe(newPosition); }