public void RobotDriver_PlacedAndTurnedRight_ReportsCorrectPosition()
        {
            var driver = new RobotDriver(new Robot());

            driver.Command("PLACE 1,1,NORTH");
            driver.Command("RIGHT");
            Assert.AreEqual("1,1,EAST", driver.Command("REPORT"));
        }
        public void RobotDriver_PlacedAndMovedOffTable_CannotBeMoved()
        {
            var driver = new RobotDriver(new Robot());

            driver.Command("PLACE 5,5,NORTH");
            driver.Command("MOVE");
            Assert.AreEqual("5,5,NORTH", driver.Command("REPORT"));
        }
        public void RobotDriver_PlacedAndMoved_ReportsCorrectPosition()
        {
            var driver = new RobotDriver(new Robot());

            driver.Command("PLACE 1,1,NORTH");
            driver.Command("MOVE");
            Assert.AreEqual("1,2,NORTH", driver.Command("REPORT"));
        }
        public void RobotDriver_PlaceCommandWithInvalidArguments_ReportsInvalid()
        {
            var driver   = new RobotDriver(new Robot());
            var response = driver.Command("PLACE XXX");

            Assert.AreEqual("Invalid command.", response);
            response = driver.Command("PLACE 1,X,NORTH");
            Assert.AreEqual("Invalid command.", response);
            response = driver.Command("PLACE X,1,NORTH");
            Assert.AreEqual("Invalid command.", response);
            response = driver.Command("PLACE 1,1,XXX");
            Assert.AreEqual("Invalid command.", response);
        }
        public void RobotDriver_PlaceCommandWithNoArguments_ReportsInvalid()
        {
            var driver   = new RobotDriver(new Robot());
            var response = driver.Command("PLACE");

            Assert.AreEqual("Invalid command.", response);
        }
        public void RobotDriver_RecognisedCommand_ReportsValid()
        {
            var driver   = new RobotDriver(new Robot());
            var response = driver.Command("MOVE");

            Assert.AreEqual("Robot cannot move until it has been placed on the table.", response);
        }
        public void RobotDriver_UnrecognisedCommand_ReportsInvalid()
        {
            var driver   = new RobotDriver(new Robot());
            var response = driver.Command("XXXX");

            Assert.AreEqual("Invalid command.", response);
        }
        public void RobotDriver_EmptyCommand_ReportsInvalid()
        {
            var driver   = new RobotDriver(new Robot());
            var response = driver.Command("");

            Assert.AreEqual("Invalid command.", response);
        }
        static void Main(string[] args)
        {
            DisplayWelcome();

            var driver = new RobotDriver(new Robot());

            while (true)
            {
                string command = PromptForCommand();
                if (command.ToUpper() == "EXIT" || command.ToUpper() == "QUIT")
                {
                    Environment.Exit(0);
                }
                Console.WriteLine(driver.Command(command));
            }
        }