Example #1
0
        public void UpdateProduct()
        {
            Product product;

            using (var db = new ShoppingContext())
            {
                var service = new Repository.Repository(db);
                product = service.GetProduct(1);
            }
            using (var db = new ShoppingContext())
            {
                product.Name = "Ravioles";
                var service = new Repository.Repository(db);
                int i       = service.UpdateProduct(product);

                Assert.IsTrue(i > 0);
            }
        }
Example #2
0
        public void RemuveProduct()
        {
            Product product;

            using (var db = new ShoppingContext())
            {
                var service = new Repository.Repository(db);
                product = service.GetProduct(1);
            }
            if (product != null)
            {
                using (var db = new ShoppingContext())
                {
                    var service = new Repository.Repository(db);
                    int i       = service.RemuveProduct(product);

                    Assert.IsTrue(i > 0);
                }
            }
            else
            {
                Assert.Fail("Product id: " + 1 + " not exist");
            }
        }