public async Task Error_NotFound(int id) { var query = new GetVendaQuery() { Id = id }; await Assert.ThrowsAsync <NotFoundException>(() => _queryHandler.Handle(query, CancellationToken.None)); }
public async Task <ActionResult <VendaViewModel> > Get(int id) { var query = new GetVendaQuery() { Id = id }; return(Ok(await Mediator.Send(query))); }
public async Task Success_GetVenda() { var vendas = _context.Venda.ToList(); foreach (var venda in vendas) { var query = new GetVendaQuery() { Id = venda.IdVenda }; var result = await _queryHandler.Handle(query, CancellationToken.None); Assert.NotNull(result); Assert.Equal(venda.IdVenda, result.IdVenda); } }