public void WhenControllingARobotOnTheBoardWithACommandObjectListsMakeSureItEndsUpWhereItIsSupposedToBe() { var board = new Board(5, 5); var robot = new ToyRobot(board); var simulator = new Simulator(robot); Assert.IsNotNull(board); Assert.IsNotNull(robot); Assert.IsNotNull(simulator); // move the robot in the simulator via command list or more than 1 command simulator.Execute(new TestCommandList() { new Simulator.PlaceCommand(new Vector2d <ulong>(new Point2d <ulong>(2, 2), Direction.North)), new Simulator.MoveCommand(), new Simulator.MoveCommand(), new Simulator.LeftTurnCommand(), new Simulator.LeftTurnCommand(), new Simulator.MoveCommand(), new Simulator.MoveCommand(), new Simulator.RightTurnCommand(), new Simulator.MoveCommand() }); Assert.IsTrue(robot.HasAPosition); Assert.IsTrue(RobotTests.ComparePosition(robot, 1, 2, Direction.West)); Assert.IsTrue(ValidateReport(simulator)); }
public void WhenControllingARobotOnTheBoardWithSingleCommandObjectsMakeSureItEndsUpWhereItIsSupposedToBe() { var board = new Board(5, 5); var robot = new ToyRobot(board); var simulator = new Simulator(robot); Assert.IsNotNull(board); Assert.IsNotNull(robot); Assert.IsNotNull(simulator); // move the robot in the simulator via explicit commands simulator.Execute(new Simulator.PlaceCommand(new Vector2d <ulong>(new Point2d <ulong>(2, 2), Direction.North))); Assert.IsTrue(robot.HasAPosition); Assert.IsTrue(RobotTests.ComparePosition(robot, 2, 2, Direction.North)); simulator.Execute(new Simulator.MoveCommand()); Assert.IsTrue(robot.HasAPosition); Assert.IsTrue(RobotTests.ComparePosition(robot, 2, 3, Direction.North)); simulator.Execute(new Simulator.MoveCommand()); Assert.IsTrue(robot.HasAPosition); Assert.IsTrue(RobotTests.ComparePosition(robot, 2, 4, Direction.North)); simulator.Execute(new Simulator.RightTurnCommand()); Assert.IsTrue(robot.HasAPosition); Assert.IsTrue(RobotTests.ComparePosition(robot, 2, 4, Direction.East)); simulator.Execute(new Simulator.RightTurnCommand()); Assert.IsTrue(robot.HasAPosition); Assert.IsTrue(RobotTests.ComparePosition(robot, 2, 4, Direction.South)); simulator.Execute(new Simulator.MoveCommand()); Assert.IsTrue(robot.HasAPosition); Assert.IsTrue(RobotTests.ComparePosition(robot, 2, 3, Direction.South)); simulator.Execute(new Simulator.MoveCommand()); Assert.IsTrue(robot.HasAPosition); Assert.IsTrue(RobotTests.ComparePosition(robot, 2, 2, Direction.South)); Assert.IsTrue(ValidateReport(simulator)); }