Пример #1
0
 public void GenerateCpf()
 {
     Assert.True(CpfHelper.IsCpfValid(CpfHelper.GenerateCpf()));
     Assert.True(CpfHelper.IsCpfValid(CpfHelper.GenerateCpf()));
     Assert.True(CpfHelper.IsCpfValid(CpfHelper.GenerateCpf()));
     Assert.True(CpfHelper.IsCpfValid(CpfHelper.GenerateCpf()));
     Assert.True(CpfHelper.IsCpfValid(CpfHelper.GenerateCpf()));
 }
Пример #2
0
        public void deve_adicionar_um_clientes()
        {
            var customer = new Customer
            {
                Id         = Guid.NewGuid(),
                Name       = "NameTest",
                Created_at = DateTime.Now,
                Cpf        = CpfHelper.GenerateCpf(),
                Email      = "*****@*****.**"
            };

            var id   = _service.Add(customer);
            var user = _service.Get(id);

            Assert.IsTrue(user != null);
        }
Пример #3
0
        public static void Run(DataContext context)
        {
            if (context.Set <Order>().Any())
            {
                return;
            }
            var product = context.Set <Product>().Add(new Product()
            {
                Id         = Guid.NewGuid(),
                Created_at = DateTime.Now,
                Name       = "ProductName",
                Sku        = Guid.NewGuid(),
                Updated_at = DateTime.Now,
                Price      = 1000
            });

            var customer = context.Set <Customer>().Add(new Customer()
            {
                Id         = Guid.NewGuid(),
                Created_at = DateTime.Now,
                Name       = "CustomerName",
                Cpf        = CpfHelper.GenerateCpf(),
                Email      = "*****@*****.**",
                Updated_At = DateTime.Now
            });

            var order = context.Set <Order>().Add(new Order()
            {
                Id         = Guid.NewGuid(),
                Created_at = DateTime.Now,
                Total      = 1000,
                Status     = "CONCLUDED",
                CustomerId = customer.Entity.Id
            });

            var orderItens = context.Set <OrderItens>().Add(new OrderItens()
            {
                Id         = Guid.NewGuid(),
                OrderId    = order.Entity.Id,
                Total      = 1000,
                ProductId  = product.Entity.Id,
                Amount     = 1,
                price_unit = 1000
            });

            context.SaveChanges();
        }
Пример #4
0
        public void deve_adicionar_um_produto()
        {
            var order = new Order
            {
                Id         = Guid.NewGuid(),
                Created_at = DateTime.Now,
                Total      = 800,
                CustomerId = customerService.Add(new Customer {
                    Id = Guid.NewGuid(), Created_at = DateTime.Now, Name = "NameForOrderTest", Cpf = CpfHelper.GenerateCpf(), Email = "*****@*****.**", Updated_At = DateTime.Now
                }),
                Status = "CONCLUDED",
            };

            var id   = _service.Add(order);
            var temp = _service.Get(id);

            Assert.IsTrue(temp != null);
        }