public async Task Create([FromBody] CreateTabModel model) { var openTabCommand = CreateOpenTabCommand(model); _logger.Debug($"Sending {nameof(OpenTabCommand)} command [Id {openTabCommand.Id} for aggregate {openTabCommand.AggregateId}]"); await _commandSender.Send(openTabCommand); }
private OpenTabCommand CreateOpenTabCommand(CreateTabModel model) { return(new OpenTabCommand { Id = Guid.NewGuid(), AggregateId = Guid.NewGuid(), Waiter = model.Waiter, TableNumber = model.TableNumber }); }
public void SetUp() { _model = new CreateTabModel { Waiter = Waiter, TableNumber = TableNumber }; _sendEndpoint = Substitute.For <ISendEndpoint>(); _sendEndpointProvider = Substitute.For <ISendEndpointProvider>(); _sendEndpointProvider.GetSendEndpoint(Arg.Is <string>(queueName => queueName == CommandServiceQueueName)).Returns(Task.FromResult(_sendEndpoint)); _commandSendConfiguration = Substitute.For <ICommandSendConfiguration>(); _commandSendConfiguration.QueueName.Returns(CommandServiceQueueName); _commandSender = new CommandSender(_sendEndpointProvider, _commandSendConfiguration); }