コード例 #1
0
        public void AddTest()
        {
            CompanyGroup.Domain.WebshopModule.IProductRepository productRepository = new CompanyGroup.Data.WebshopModule.ProductRepository();

            ShoppingCartRepository shoppingCartRepository = new ShoppingCartRepository(); 

            ShoppingCart shoppingCart = new ShoppingCart(1, "alma", "teszt rt", "test2 person", "cart55", "HUF", false); 

            ShoppingCartItem shoppingCartItem = new ShoppingCartItem();

            Product product = productRepository.GetItem(0, "JD990A", "hrp");

            shoppingCartItem.SetProduct(product);

            int cartId = shoppingCartRepository.Add(shoppingCart);

            shoppingCartItem.CartId = cartId;

            shoppingCartRepository.AddLine(shoppingCartItem);

            Assert.IsTrue(cartId > 0, "ShoppingCart cannot be empty!");
        }
コード例 #2
0
        public void AddItemTest()
        {
            CompanyGroup.Domain.WebshopModule.IProductRepository productRepository = new CompanyGroup.Data.WebshopModule.ProductRepository();

            ShoppingCartRepository shoppingCartRepository = new ShoppingCartRepository();

            Product product = productRepository.GetItem(0, "AMVS238H", "hrp");

            ShoppingCartItem shoppingCartItem = new ShoppingCartItem();

            shoppingCartItem.SetProduct(product);

            shoppingCartItem.CartId = 1;

            shoppingCartRepository.AddLine(shoppingCartItem);
        }
コード例 #3
0
        public void UpdateItemQuantityTest()
        {

            ShoppingCartRepository repository = new ShoppingCartRepository();

            int quantity = 4;

            repository.UpdateLineQuantity(1, quantity);

            ShoppingCart shoppingCart = repository.GetShoppingCart(1);

            Assert.IsNotNull(shoppingCart);
        }
コード例 #4
0
        public void RemoveLineTest()
        {
            ShoppingCartRepository repository = new ShoppingCartRepository(); 

            repository.RemoveLine(2);
        }
コード例 #5
0
        public void GetShoppingCartLineTest()
        {
            ShoppingCartRepository repository = new ShoppingCartRepository();

            ShoppingCartItem shoppingCartItem = repository.GetShoppingCartLine(1);

            Assert.IsNotNull(shoppingCartItem);
        }
コード例 #6
0
        public void GetItemsByVisitorIdTest()
        {
            ShoppingCartRepository repository = new ShoppingCartRepository();

            string visitorId = "alma";

            List<ShoppingCart> carts = repository.GetCartCollection(visitorId);

            Assert.IsFalse(carts.Count == 0);
        }
コード例 #7
0
        public void GetShoppingCartTest()
        {
            ShoppingCartRepository repository = new ShoppingCartRepository();

            ShoppingCart cart = repository.GetShoppingCart(20);

            Assert.IsNotNull(cart);
        }