public async Task <ActionResult> GetAll() { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { return(Ok(await _service.GetAll())); } catch (ArgumentException ex) { return(StatusCode((int)HttpStatusCode.InternalServerError, ex.Message)); } }
public void VendaService_GetAll_ShouldBeOk() { _vendas = ObjectMotherSale.GetVendas(); _vendaRepository.Setup(x => x.GetAll()).Returns(_vendas); _vendas = _vendaService.GetAll(); _vendaRepository.Verify(x => x.GetAll()); _vendas.Should().NotBeNull(); _vendas.Should().HaveCount(1); }
public void GetAllShouldReturnVendaList() { // Arrange var listaVenda = new List <Venda> { new Venda(1, 80000.00, "Comprador") }; vendaRepository.GetAll().Returns(listaVenda); // Act var result = service.GetAll(); // Assert result.Should().NotBeNull(); result.Should().Equals(listaVenda); vendaRepository.Received().GetAll(); }
public IEnumerable <VendaViewModel> GetAll() { return(Mapper.Map <IEnumerable <Venda>, IEnumerable <VendaViewModel> >(_vendaService.GetAll())); }
public void Integration_GetAllSale_ShouldBeOkay() { IEnumerable <Venda> venda = _service.GetAll(); venda.Count().Should().BeGreaterThan(0); }
public IActionResult GetAll() { var result = service.GetAll(); return(Ok(result)); }