Ejemplo n.º 1
0
        public void ShoppingCart()
        {
            var conn = new NHibernateConnection();
            var repo = new ShoppingCartRepository(conn);
            var producRepo = new ProductsRepository(conn);
            IList<Products> products = producRepo.GetAll();

            Products product1 = products.First();
            IEnumerable<Products> product2 = products.Where(x => x.IsRecent).Take(1);

            var shoppingCart = new ShoppingCarts(product1, 1, "12345678", DateTime.Now);

            repo.Save(shoppingCart);

            ShoppingCarts fromDB = repo.GetAll().Where(x => x.CartId == "12345678").FirstOrDefault();

            Assert.IsNotNull(fromDB);
        }