public void simplePayment() { us.login(zahi, "zahi", "123456"); LinkedList <Sale> saleList = ss.viewSalesByStore(store.getStoreId()); Assert.IsTrue(sellS.addProductToCart(zahi, saleList.First.Value.SaleId, 1) > 0); sellS.getShoppingCartBeforeCheckout(zahi); Tuple <int, LinkedList <UserCart> > ans = sellS.checkout(zahi, "Rager 214 Bash", "Israel", "123456"); Assert.IsTrue(paymentProxy.payForProduct("123", zahi, ans.Item2.First.Value)); }
public void simpleViewCart() { LinkedList <Sale> saleList = ss.viewSalesByStore(store); sellS.addProductToCart(niv, saleList.First.Value.SaleId, 1); LinkedList <UserCart> sc = sellS.viewCart(niv); Assert.AreEqual(sc.Count, 1); UserCart uc = sc.First.Value; Assert.AreEqual(uc.getUserName(), "niv"); Assert.AreEqual(uc.getAmount(), 1); }
public void simpleEditAmount() { LinkedList <Sale> saleList = ss.viewSalesByStore(store); sellS.addProductToCart(niv, saleList.First.Value.SaleId, 2); Boolean check = sellS.editCart(niv, saleList.First.Value.SaleId, 4) > -1; Assert.IsTrue(check); LinkedList <UserCart> nivCart = niv.getShoppingCart(); UserCart uc = nivCart.First.Value; Assert.AreEqual(uc.getAmount(), 4); }
public void removeExistingFromCart() { LinkedList <Sale> saleList = ss.viewSalesByStore(store.getStoreId()); sellS.addProductToCart(niv, saleList.First.Value.SaleId, 2); LinkedList <UserCart> uc = sellS.viewCart(niv); int beforeDeletion = uc.Count; int check = sellS.removeFromCart(niv, saleList.First.Value.SaleId); Assert.IsTrue(check > -1); uc = sellS.viewCart(niv); int afterDeletion = uc.Count; Assert.AreEqual(beforeDeletion, afterDeletion + 1); }
public void simpleAddRaffleProductToCart() { us.login(zahi, "zahi", "123456"); LinkedList <Sale> saleList = ss.viewSalesByStore(store.getStoreId()); Assert.IsTrue(sellS.addRaffleProductToCart(zahi, saleList.First.Value.SaleId, 1) > 0); }
public void simpleViewSlaeInStore() { int saleId = ss.addSaleToStore(itamar, store.getStoreId(), cola.getProductInStoreId(), 1, 1, "20/5/2018"); LinkedList <Sale> saleList = ss.viewSalesByStore(store.getStoreId()); Assert.AreEqual(saleList.Count, 1); Assert.AreEqual(saleId, saleList.First.Value.SaleId); }
public void init() { CleanDB cDB = new CleanDB(); cDB.emptyDB(); ProductManager.restartInstance(); SalesManager.restartInstance(); StoreManagement.restartInstance(); UserManager.restartInstance(); UserCartsManager.restartInstance(); BuyHistoryManager.restartInstance(); CouponsManager.restartInstance(); DiscountsManager.restartInstance(); RaffleSalesManager.restartInstance(); StorePremissionsArchive.restartInstance(); us = userServices.getInstance(); ss = storeServices.getInstance(); ses = sellServices.getInstance(); zahi = us.startSession(); us.register(zahi, "zahi", "123456"); us.login(zahi, "zahi", "123456"); itamar = us.startSession(); us.register(itamar, "itamar", "123456"); us.login(itamar, "itamar", "123456"); int storeid = ss.createStore("abowim", zahi); store = StoreManagement.getInstance().getStore(storeid); int colaId = ss.addProductInStore("cola", 10, 100, zahi, storeid, "Drinks"); cola = ProductManager.getInstance().getProductInStore(colaId); ss.addSaleToStore(zahi, store.getStoreId(), cola.getProductInStoreId(), 1, 20, "20/8/2018"); LinkedList <Sale> SL = ss.viewSalesByStore(store.getStoreId()); foreach (Sale sale in SL) { if (sale.ProductInStoreId == cola.getProductInStoreId()) { colaSale = sale; } } }
public void allGood() { us.login(zahi, "zahi", "123456"); LinkedList <Sale> saleList = ss.viewSalesByStore(store.getStoreId()); Assert.IsTrue(sellS.addProductToCart(zahi, saleList.First.Value.SaleId, 1) > 0); sellS.getShoppingCartBeforeCheckout(zahi); Tuple <int, LinkedList <UserCart> > ans = sellS.checkout(zahi, "Rager 214 Bash", "Israel", "123456"); Assert.IsTrue(shippingProxy.sendShippingRequest(zahi, "Italy", "Rome", "123456")); }
public void simpleSetAmountPolicyOnStore() { Assert.IsTrue(ss.setAmountPolicyOnStore(zahi, store.getStoreId(), 2, 10) > -1); LinkedList <Sale> SL = ss.viewSalesByStore(store.getStoreId()); Sale sale = SL.First.Value; Assert.IsTrue(ses.addProductToCart(itamar, sale.SaleId, 2) > 0); LinkedList <UserCart> sc = ses.getShoppingCartBeforeCheckout(itamar); Tuple <int, LinkedList <UserCart> > checkOut = ses.checkout(itamar, "israel", "mezada 69", "1234"); Assert.IsTrue(checkOut.Item1 == -1); }
public void simpleRemoveSale() { Assert.AreEqual(ss.removeSaleFromStore(zahi, store.getStoreId(), colaSale.SaleId), 0); Assert.AreEqual(ss.viewSalesByStore(store.getStoreId()).Count, 0); }