예제 #1
0
        public void WhenPlaceStringValidParameterReceivedGetCommandMethodIsCalled()
        {
            var commandParser     = new CommandBroker();
            var mockCommandParser = new Mock <ICommandParser>();

            commandParser.ResetParsers(mockCommandParser.Object);
            var result = commandParser.GetCommand("place 0,0,NORTH");

            mockCommandParser.Verify(calc => calc.GetCommand(It.IsAny <string>(), It.IsAny <string>()));
        }
예제 #2
0
        public void Execute(string input)
        {
            if (input == null)
            {
                throw new ArgumentException(nameof(input));
            }
            _commandBroker.ResetParsers(RegistrationService.Container.ResolveKeyed <ICommandParser>(nameof(PlaceParser)));
            var result = _commandBroker.GetCommand(input);

            if (result.found)
            {
                _robot.Execute(result.command);
            }
        }