Exemple #1
0
        public void addCouponWithManagerPermission()
        {
            ProductInStore pis = ProductManager.getInstance().getProductInStore(ss.addProductInStore("cola", 150, 100, zahi, store.getStoreId(), "Drink"));

            ss.removeManagerPermission("addNewCoupon", store.getStoreId(), aviad.getUserName(), zahi);
            Boolean added = ss.addCouponDiscount(aviad, store, "coupon", pis, 10, DateTime.Now.AddYears(1).ToString());

            Assert.AreEqual(false, added);
        }
        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();
            ca = CouponsManager.getInstance();

            zahi = us.startSession();
            us.register(zahi, "zahi", "123456");
            us.login(zahi, "zahi", "123456");

            int   storeid = ss.createStore("abowim", zahi);
            Store 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, 2, "20/8/2018");

            LinkedList <Sale> SL = ss.viewSalesByStore(store.getStoreId());

            foreach (Sale sale in SL)
            {
                if (sale.ProductInStoreId == cola.getProductInStoreId())
                {
                    colaSale = sale;
                }
            }
            ss.addCouponDiscount(zahi, store, "copun", cola, 10, "20/6/2018");
        }