public void Move_TableTop5Into5Placed3Into3RobotMovedFiveTimesForward() { //arrange TableTop tt = new TableTop(5, 5); ToyRobot tr = new ToyRobot(); CommandModel cm = new CommandModel() { Command = Command.PLACE, Coordinate = new Coordinate(3, 3), Facing = Facing.NORTH }; ICommandInterface placeCommand = new PlaceRobotCommand(cm, tr, tt); placeCommand.Execute(); ICommandInterface moveCommand = new MoveForwardCommand(tr, tt); //act moveCommand.Execute(); moveCommand.Execute(); moveCommand.Execute(); moveCommand.Execute(); moveCommand.Execute(); //assert: actual/expected Assert.IsTrue(tr.RobotStillOnTableTop(tt)); }
public void Turnleft_TableTop5Into5RobotTurnedLeftFourTimesSameFaing_IsTrue() { //arrange TableTop tt = new TableTop(5, 5); ToyRobot tr = new ToyRobot(); CommandModel cm = new CommandModel() { Command = Command.PLACE, Coordinate = new Coordinate(3, 4), Facing = Facing.NORTH }; ICommandInterface placeCommand = new PlaceRobotCommand(cm, tr, tt); placeCommand.Execute(); ICommandInterface leftCommand = new TurnLeftCommand(tr); //act leftCommand.Execute(); leftCommand.Execute(); leftCommand.Execute(); leftCommand.Execute(); //assert Assert.AreEqual(tr.robotDirection, Facing.NORTH); }
public void Move_TableTopFiveIntoFiveAlreadyPlacedMovedTwiceForward() { //arrange TableTop tt = new TableTop(5, 5); ToyRobot tr = new ToyRobot(); CommandModel cm = new CommandModel() { Command = Command.PLACE, Coordinate = new Coordinate(3, 3), Facing = Facing.NORTH }; ICommandInterface placeCommand = new PlaceRobotCommand(cm, tr, tt); placeCommand.Execute(); ICommandInterface moveCommand = new MoveForwardCommand(tr, tt); //act moveCommand.Execute(); moveCommand.Execute(); //assert: actual/expected Assert.AreEqual(tr.GetCurrentRobotPosition(), new ToyRobot(new Coordinate(3, 5), Facing.NORTH).GetCurrentRobotPosition()); }
public void Place_TableTopFiveIntoFivePlaceCoordinatesToThreeIntoFourAreEqual() { //arrange TableTop tt = new TableTop(5, 5); ToyRobot tr = new ToyRobot(); CommandModel cm = new CommandModel() { Command = Command.PLACE, Coordinate = new Coordinate(3, 4), Facing = Facing.NORTH }; ICommandInterface placeCommand = new PlaceRobotCommand(cm, tr, tt); //act placeCommand.Execute(); //assert Assert.AreEqual(tr.GetCurrentRobotPosition(), new ToyRobot(new Coordinate(3, 4), Facing.NORTH).GetCurrentRobotPosition()); }
public void Place_TableTop5Into5PlaceCommandRobotNotPlaced() { //arrange TableTop tt = new TableTop(5, 5); ToyRobot tr = new ToyRobot(); CommandModel cm = new CommandModel() { Command = Command.PLACE, Coordinate = new Coordinate(3, 6), Facing = Facing.NORTH }; ICommandInterface placeCommand = new PlaceRobotCommand(cm, tr, tt); //act placeCommand.Execute(); //assert Assert.IsFalse(tr.isRobotPlaced); }
public void ToyRobot_TableTop5Into5PlaceRobot3Into3AndRobotOnTableTopIsTrue() { //arrange //arrange TableTop tt = new TableTop(5, 5); ToyRobot tr = new ToyRobot(); CommandModel cm = new CommandModel() { Command = Command.PLACE, Coordinate = new Coordinate(3, 3), Facing = Facing.NORTH }; ICommandInterface placeCommand = new PlaceRobotCommand(cm, tr, tt); //act placeCommand.Execute(); //assert Assert.IsTrue(tr.RobotStillOnTableTop(tt)); }
public void Turnleft_TableTopFiveIntoFiveRobotIsPlacedBeforeMove() { //arrange TableTop tt = new TableTop(5, 5); ToyRobot tr = new ToyRobot(); CommandModel cm = new CommandModel() { Command = Command.PLACE, Coordinate = new Coordinate(3, 4), Facing = Facing.NORTH }; ICommandInterface placeCommand = new PlaceRobotCommand(cm, tr, tt); placeCommand.Execute(); ICommandInterface leftCommand = new TurnLeftCommand(tr); //act leftCommand.Execute(); //assert Assert.IsTrue(tr.isRobotPlaced); }
public void Turnright_TableTop5Into5RobotTurnedRightTwice() { //arrange TableTop tt = new TableTop(5, 5); ToyRobot tr = new ToyRobot(); CommandModel cm = new CommandModel() { Command = Command.PLACE, Coordinate = new Coordinate(3, 3), Facing = Facing.NORTH }; ICommandInterface placeCommand = new PlaceRobotCommand(cm, tr, tt); placeCommand.Execute(); ICommandInterface rightCommand = new TurnRightCommand(tr); //act rightCommand.Execute(); rightCommand.Execute(); //assert Assert.AreEqual(tr.robotDirection, Facing.SOUTH); }
public void Move_TableTop5Into5Placed2Into3RobotMovedOnceSameFacing() { //arrange TableTop tt = new TableTop(5, 5); ToyRobot tr = new ToyRobot(); CommandModel cm = new CommandModel() { Command = Command.PLACE, Coordinate = new Coordinate(2, 3), Facing = Facing.NORTH }; ICommandInterface placeCommand = new PlaceRobotCommand(cm, tr, tt); placeCommand.Execute(); ICommandInterface moveCommand = new MoveForwardCommand(tr, tt); //act moveCommand.Execute(); //assert: actual/expected // Assert.AreEqual(tr.GetCurrentRobotPosition(), new ToyRobot(new Coordinate(3, 5), Facing.NORTH).GetCurrentRobotPosition()); Assert.AreEqual(tr.robotDirection, Facing.NORTH); }