Пример #1
0
        public void Save_Deveria_Gravar_Uma_Nova_Venda()
        {
            //Action-Arrange
            Venda resultVenda = _vendaRepository.Save(_vendaDefault);

            //Assert
            Venda resultGet = _vendaRepository.Get(resultVenda.Id);

            resultVenda.Should().NotBeNull();
            resultVenda.ProdutoVenda.Should().NotBeNull();
            resultGet.Should().NotBeNull();
            resultGet.Id.Should().Be(resultVenda.Id);
        }
        public VendaQuery(VendaRepository vendaRepository, ProdutoRepository produtoRepository)
        {
            Field <ListGraphType <VendaType> >(
                "vendas",
                resolve: context =>
            {
                var produtos = vendaRepository.Get();
                return(produtos);
            });

            //Field<ListGraphType<ProdutoType>>("produtos",
            //    resolve: context =>
            //    {
            //        return produtoRepository.Get();
            //    });
        }
Пример #3
0
        public List <VendaModel> Get( )
        {
            VendaRepository   vendaRepository;
            List <VendaModel> produtos;

            try
            {
                vendaRepository = new VendaRepository(_loggerFactory, _config);

                produtos = vendaRepository.Get();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(produtos);
        }
Пример #4
0
        public VendaModel Get(int id)
        {
            VendaRepository vendaRepository;
            VendaModel      venda;

            try
            {
                vendaRepository = new VendaRepository(_loggerFactory, _config);

                venda = vendaRepository.Get(id);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(venda);
        }
        public void Busca_venda_pelo_identificador()
        {
            var   id    = 1;
            Venda venda = _vendaRepository.Get(id);

            Assert.AreEqual(id, venda.Id);

            var numeroItens = 2;

            Assert.AreEqual(numeroItens, venda.ItensVenda.Count);

            var values = venda.ItensVenda.Select(item =>
            {
                if (item.Disco == null)
                {
                    return(null);
                }
                return(item);
            }).ToList();

            values.ForEach(value => Assert.IsNotNull(value));
        }
Пример #6
0
 public ActionResult <Venda> Get(int id)
 {
     return(_vendaRepository.Get(id));
 }
Пример #7
0
        public void VendaRepository_Get_ShouldBeOk()
        {
            var vendaPega = _repository.Get(1);

            vendaPega.cliente.Should().Be("Pedro");
        }