Beispiel #1
0
        public void TestOrderSet()
        {
            _robot.SetOrders("FRL");

            Assert.AreEqual(_robot.GetNextOrder(), 'F');
            Assert.AreEqual(_robot.GetNextOrder(), 'R');
            Assert.AreEqual(_robot.GetNextOrder(), 'L');
        }
Beispiel #2
0
        public void ExecuteNextCommand(IRobot robot)
        {
            var robotCommand = robot.GetNextOrder();

            if (!_instructions.ContainsKey(robotCommand))
            {
                throw new ArgumentException($"Unknown command '{robotCommand}'");
            }
            Console.WriteLine($"Execution command \"{robotCommand}\":");
            _instructions[robotCommand].ExecuteCommandFor(robot);
        }