public CommandInterpreterTests(ITestOutputHelper output) { _output = output; //Set URL of the WS _settings = new Settings() { QueueUrl = "localhost", StockWebServiceUrl = "https://stooq.com/q/l/?s={stock_code}&f=sd2t2ohlcv&h&e=csv" }; _options = Options.Create(_settings); _commandInterpreter = new CommandInterpreterService(_options); }
public QueueConsumerService(IOptions <Settings> settings) { _settings = settings.Value; var factory = new ConnectionFactory() { HostName = _settings.QueueUrl }; var connection = factory.CreateConnection(); _channel = connection.CreateModel(); _command = new CommandInterpreterService(settings); }
public async Task ShouldSucceedValidCommandsAsync(string commandStr, Command command) { Mock <ICommandService> mock = new Mock <ICommandService>(); mock.Setup(x => x.Left()).Returns(Task.FromResult(true)); mock.Setup(x => x.Right()).Returns(Task.FromResult(true)); mock.Setup(x => x.Move()).Returns(Task.FromResult(true)); Mock <ICommandInterpreter> commandInterpreterMock = new Mock <ICommandInterpreter>(); Tuple <Command, IPosition> interpreterResult = new Tuple <Command, IPosition>(command, null); commandInterpreterMock.Setup(x => x.Interpret(commandStr)).Returns(interpreterResult); var service = new CommandInterpreterService(commandInterpreterMock.Object, mock.Object); var result = await service.Execute(commandStr); result.Succeeded.ShouldBe(true); result.HasPoistionOutput.ShouldBe(false); }