public async Task removeProductInCartSuccess()
        {
            string           username = marketUsers.AddGuest();
            User             u        = marketUsers.GetUserByUserName(username);
            Result <Product> result   = await MarketStores.Instance.AddProduct(product1, store.Id, "founder");

            ShoppingBasket b = await u.ShoppingCart.GetShoppingBasket(store);

            await b.addProduct(result.Ret, 4);

            Assert.AreEqual("product removed from shopping basket", marketUsers.RemoveProductFromCart(username, result.Ret.Id));
            Assert.IsFalse(b.GetProducts().Contains(result.Ret));
        }
Esempio n. 2
0
        public async Task removeProductInCartSuccess()
        {
            string  username = m.AddGuest();
            User    u        = m.GetUserByUserName(username);
            Product p        = new Product(new Guid(), "lala3", 8, 50, 500, "category");
            Store   s        = new Store("lalalil55", null, null);

            s.Products.Add(p);
            marketStores.LoadedStores.TryAdd(s.GetId(), s);
            ShoppingBasket b = await u.ShoppingCart.GetShoppingBasket(s);

            await b.addProduct(p, 4);

            Assert.AreEqual("product removed from shopping basket", m.RemoveProductFromCart(username, p.Id));
            Assert.IsFalse(b.GetProducts().Contains(p));
        }
        public void removeProductInCartSuccess()
        {
            ProxyMarketContext.Instance.IsDebug = true;
            string username            = m.AddGuest();
            User   u                   = m.GetUserByUserName(username);
            Mock <ShoppingCart>   cart = new Mock <ShoppingCart>();
            Mock <ShoppingBasket> bask = new Mock <ShoppingBasket>();

            cart.Setup(c => c.TryGetShoppingBasket(It.IsAny <Store>())).Returns(bask.Object);
            bask.Setup(b => b.RemoveProduct(It.IsAny <Product>())).Returns(true);
            u.ShoppingCart = cart.Object;
            Product p = new Product(new Guid(), "lala3", 8, 50, 500, "category");
            Store   s = new Store("lalalil55", null, null);

            s.Products.Add(p);
            marketStores.LoadedStores.TryAdd(s.GetId(), s);
            Assert.AreEqual("product removed from shopping basket", m.RemoveProductFromCart(username, p.Id));
        }