Exemplo n.º 1
0
        public void RemuveCategory()
        {
            Category category;

            using (var db = new ShoppingContext())
            {
                var service = new Repository.Repository(db);
                category = service.GetCategory(1, "Carnes");
            }
            using (var db = new ShoppingContext())
            {
                var service = new Repository.Repository(db);
                int i       = service.RemoveCategority(category);

                Assert.IsTrue(i > 0);
            }
        }
Exemplo n.º 2
0
        public void UpdateCategory()
        {
            Category category;

            using (var db = new ShoppingContext())
            {
                var service = new Repository.Repository(db);
                category = service.GetCategory(1, "Pastas");
            }
            using (var db = new ShoppingContext())
            {
                category.Name = "Carnes";
                var service = new Repository.Repository(db);
                int i       = service.UpdateCategority(category);

                Assert.IsTrue(i > 0);
            }
        }
Exemplo n.º 3
0
        public void AddProduct()
        {
            using (var db = new ShoppingContext())
            {
                var product = new Product
                {
                    Name        = "Ravioles",
                    Code        = "123456",
                    Description = "Ravioles",
                    Price       = 200
                };
                var service = new Repository.Repository(db);
                product.CategorityId = service.GetCategory(1, "Pastas").Id;
                int i = service.AddProduct(product);

                Assert.IsTrue(i > 0);
            }
        }