示例#1
0
        static void Main(string[] args)
        {
            RobotControlCenter robot = new RobotControlCenter();
            //input 1
            List <string> allinputs = new List <string>()
            {
                "PLACE 0,0,NORTH", "MOVE", "REPORT"
            };

            Console.WriteLine(robot.MissionControl(allinputs));

            //input 2
            List <string> allinputs2 = new List <string>()
            {
                "PLACE 0,0,NORTH", "LEFT", "REPORT"
            };

            Console.WriteLine(robot.MissionControl(allinputs2));

            //input 3
            List <string> allinputs3 = new List <string>()
            {
                "PLACE 1,2,EAST", "MOVE", "MOVE", "LEFT", "MOVE", "REPORT"
            };

            Console.WriteLine(robot.MissionControl(allinputs3));

            //input with no place at the begining
            List <string> allinputs4 = new List <string>()
            {
                "1,2,EAST", "MOVE", "MOVE", "LEFT", "MOVE", "REPORT"
            };

            Console.WriteLine(robot.MissionControl(allinputs4));
        }
        public void InputCase_3_when_1_2_east_move_move_left_move_report()
        {
            RobotControlCenter mission   = new RobotControlCenter();
            List <string>      allinputs = new List <string>()
            {
                "PLACE 1,2,EAST", "MOVE", "MOVE", "LEFT", "MOVE", "REPORT"
            };

            Assert.Equal("3,3,NORTH", mission.MissionControl(allinputs));
        }
        public void InputCase_2_when_0_0_north_move_left_report()
        {
            RobotControlCenter mission   = new RobotControlCenter();
            List <string>      allinputs = new List <string>()
            {
                "PLACE 0,0,NORTH", "LEFT", "REPORT"
            };

            Assert.Equal("0,0,WEST", mission.MissionControl(allinputs));
        }
        public void InputCase_exceptionInvalidInput_without_place_at_the_begining()
        {
            RobotControlCenter mission   = new RobotControlCenter();
            List <string>      allinputs = new List <string>()
            {
                "1,2,EAST", "MOVE", "MOVE", "LEFT", "MOVE", "REPORT"
            };

            var ex = Assert.Throws <ArgumentException>(() => mission.MissionControl(allinputs));

            Assert.Equal("instruction should begin with >>>place<<<", ex.Message);
        }