Ejemplo n.º 1
0
        public void PlaceRobotInMap()
        {
            /*
             * Should test each of the cases where a robot can be placed in a map
             * 1. Test initial state
             * 2. Out of bounds
             * 3. Between (0,0) and (4,4)
             */

            //1
            Assert.Throws <ToyRobotHasNotBeenPlacedException>(() => toyRobot.GetCurrentPosition());
            Assert.IsFalse(toyRobot.HasBeenPlaced());

            //2
            var          args         = "-1,0,WEST";
            PlaceCommand placeCommand = new PlaceCommand(map, args);

            Assert.Throws <InvalidPlaceCommandException>(() => toyRobot.Execute(placeCommand));

            //2.1
            args         = "2,5,WEST";
            placeCommand = new PlaceCommand(map, args);
            Assert.Throws <InvalidPlaceCommandException>(() => toyRobot.Execute(placeCommand));

            //3
            args         = "0,0,NORTH";
            placeCommand = new PlaceCommand(map, args);
            toyRobot.Execute(placeCommand);

            //3.1
            args         = "3,4,NORTH";
            placeCommand = new PlaceCommand(map, args);
            toyRobot.Execute(placeCommand);
        }