示例#1
0
        public void TestValidBehaviourMove()
        {
            // arrange
            IToyBoard    squareBoard = new ToyBoard.ToyBoard(5, 5);
            IInputParser inputParser = new InputParser();
            IToyRobot    robot       = new ToyRobot();
            var          simulator   = new Behaviours.Behaviour(robot, squareBoard, inputParser);

            // act
            simulator.ProcessCommand("PLACE 3,2,SOUTH".Split(' '));
            simulator.ProcessCommand("MOVE".Split(' '));

            // assert
            Assert.AreEqual("Output: 3,1,SOUTH", simulator.GetReport());
        }
示例#2
0
        public void TestInvalidBehaviourMove()
        {
            // arrange
            IToyBoard    squareBoard = new ToyBoard.ToyBoard(5, 5);
            IInputParser inputParser = new InputParser();
            IToyRobot    robot       = new ToyRobot();
            var          simulator   = new Behaviours.Behaviour(robot, squareBoard, inputParser);

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

            // assert
            Assert.AreEqual("Output: 2,4,NORTH", simulator.GetReport());
        }