public void ThenRobotPositionIsUpdatedAsExpected(int inputX, int inputY,
                                                         bool hasResult)
        {
            var position = new Position
            {
                X         = inputX,
                Y         = inputY,
                Direction = 0
            };

            Robot   = new Robot(new TableDimensions(TableSize, TableSize));
            Command = new PlaceCommand(Robot, position);

            Command.Execute();

            if (hasResult)
            {
                Robot.CurrentPosition().X.Should().Be(inputX);
                Robot.CurrentPosition().Y.Should().Be(inputY);
            }
            else
            {
                Robot.CurrentPosition().Should().Be(null);
            }
        }
        public void ThenRobotPositionIsUpdatedAsExpected(Direction startingDirection, Direction outputDirection)
        {
            var position = new Position
            {
                X         = 0,
                Y         = 0,
                Direction = startingDirection
            };

            Robot.SetPosition(position);

            Command.Execute();

            Robot.CurrentPosition().Direction.Should().Be(outputDirection);
        }
Ejemplo n.º 3
0
        public void ThenRobotPositionIsUpdatedAsExpected(Direction startingDirection, int inputX, int inputY,
                                                         int outputX, int outputY)
        {
            var position = new Position
            {
                X         = inputX,
                Y         = inputY,
                Direction = startingDirection
            };

            Robot.SetPosition(position);

            Command.Execute();

            Robot.CurrentPosition().X.Should().Be(outputX);
            Robot.CurrentPosition().Y.Should().Be(outputY);
        }
Ejemplo n.º 4
0
        public String ExecuteCommand(String command)
        {
            IRobotCommand robotCommand = commandFactory.GetCommand(command);

            return(robotCommand.Execute());
        }
 public void Execute(IRobotCommand command, IStringResponse response = null)
 {
     command?.Execute(TheRobot, response);
 }
Ejemplo n.º 6
0
		public void Execute(IRobotCommand command)
		{
			command.Execute(_ioCommunicator);
			Console.WriteLine("{0} {1} sent to iRobot", DateTime.Now, command);
		}