public void TestProcessCommand_MoveToyRobot()
        {
            ISquareBoard squareBoard = new SquareBoard(5, 5);
            IInputParser inputParser = new InputParser();
            IToyRobot robot = new ToyRobot();

            var simulator = new Simulator.Simulator(robot, squareBoard, inputParser);
            simulator.ProcessCommand("PLACE 0,0,NORTH".Split(' '));
            simulator.ProcessCommand("MOVE".Split(' '));

            Assert.AreEqual("Output: 0,1,NORTH", simulator.GetReport());
        }
        public void TestProcessCommand_TryDestroyToyRobot()
        {
            ISquareBoard squareBoard = new SquareBoard(5, 5);
            IInputParser inputParser = new InputParser();
            IToyRobot robot = new ToyRobot();

            var simulator = new Simulator.Simulator(robot, squareBoard, inputParser);
            simulator.ProcessCommand("PLACE 0,0,NORTH".Split(' '));
            simulator.ProcessCommand("MOVE".Split(' '));
            simulator.ProcessCommand("LEFT".Split(' '));

            // if the robot goes out of the board it ignores the command
            simulator.ProcessCommand("MOVE".Split(' '));

            Assert.AreEqual("Output: 0,1,WEST", simulator.GetReport());

        }
        public void TestProcessCommand_InvalidRobotPlacement()
        {
            ISquareBoard squareBoard = new SquareBoard(5, 5);
            IInputParser inputParser = new InputParser();
            IToyRobot robot = new ToyRobot();

            var simulator = new Simulator.Simulator(robot, squareBoard, inputParser);
            simulator.ProcessCommand("PLACE 6,6,EAST".Split(' '));

            Assert.IsNull(robot.Position);
        }
        public void TestProcessCommand_PlaceToyRobot()
        {
            ISquareBoard squareBoard = new SquareBoard(5, 5);
            IInputParser inputParser = new InputParser();
            IToyRobot robot = new ToyRobot();

            var simulator = new Simulator.Simulator(robot, squareBoard, inputParser);
            simulator.ProcessCommand("PLACE 1,2,EAST".Split(' '));

            Assert.AreEqual(1, robot.Position.X);
            Assert.AreEqual(2, robot.Position.Y);
            Assert.AreEqual(Direction.East, robot.Direction);
        }
        public void TestProcessCommand_RotateAndMove()
        {
            ISquareBoard squareBoard = new SquareBoard(5, 5);
            IInputParser inputParser = new InputParser();
            IToyRobot robot = new ToyRobot();

            var simulator = new Simulator.Simulator(robot, squareBoard, inputParser);
            simulator.ProcessCommand("PLACE 0,0,NORTH".Split(' '));
            simulator.ProcessCommand("RIGHT".Split(' '));
            simulator.ProcessCommand("MOVE".Split(' '));
            simulator.ProcessCommand("LEFT".Split(' '));
            simulator.ProcessCommand("MOVE".Split(' '));
            var output = simulator.ProcessCommand("REPORT".Split(' '));

            Assert.AreEqual("Output: 1,1,NORTH", output);
        }
        public void TestProcessCommand_ReportCommand()
        {
            ISquareBoard squareBoard = new SquareBoard(5, 5);
            IInputParser inputParser = new InputParser();
            IToyRobot robot = new ToyRobot();

            var simulator = new Simulator.Simulator(robot, squareBoard, inputParser);
            simulator.ProcessCommand("PLACE 1,2,EAST".Split(' '));
            simulator.ProcessCommand("MOVE".Split(' '));
            simulator.ProcessCommand("MOVE".Split(' '));
            simulator.ProcessCommand("LEFT".Split(' '));
            simulator.ProcessCommand("MOVE".Split(' '));
            var output = simulator.ProcessCommand("REPORT".Split(' '));

            Assert.AreEqual("Output: 3,3,NORTH", output);
        }