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));
     }
 }
Beispiel #2
0
 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);
 }
Beispiel #3
0
        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();
        }
Beispiel #4
0
 public IEnumerable <VendaViewModel> GetAll()
 {
     return(Mapper.Map <IEnumerable <Venda>, IEnumerable <VendaViewModel> >(_vendaService.GetAll()));
 }
Beispiel #5
0
        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));
        }