public async Task <IActionResult> Post([FromBody] CreateLancamento command) { command.Id = Guid.NewGuid(); command.Data = DateTime.UtcNow; await _busClient.PublishAsync(command); return(Accepted($"lancamento/{command.Id}")); }
public async void Lancamentos_Controller_Post_Deve_Retornar_Accepted() { var command = new CreateLancamento { Id = Guid.NewGuid(), Data = DateTime.UtcNow, ContaOrigem = 123, ContaDestino = 321, Valor = 870 }; var result = await _controller.Post(command); var contentResult = result as AcceptedResult; contentResult.Should().NotBeNull(); contentResult.Location.ShouldBeEquivalentTo($"lancamento/{command.Id}"); }