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>())); }
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); } }