Exemple #1
0
 public void RemoveManager()
 {
     us.login(niv, "niv", "123456");
     ss.addStoreManager(store.getStoreId(), "niv", itamar);
     Assert.IsTrue(us.removeUser(admin, "niv") >= 0);
     Assert.IsFalse(us.login(niv, "niv", "123456") >= 0);
     Assert.AreEqual(store.getManagers().Count, 0);
 }
Exemple #2
0
        public void addStoreManagerWithManagerPermission()
        {
            User newManager;

            newManager = us.startSession();
            us.register(newManager, "newManager", "123456");
            us.login(newManager, "newManager", "123456");
            ss.removeManagerPermission("addStoreManager", store.getStoreId(), aviad.getUserName(), zahi);
            ss.addStoreManager(store.getStoreId(), newManager.getUserName(), aviad);
            Assert.AreEqual(1, store.getManagers().Count);
        }
        public void SimpleAddStoreManager()
        {
            User aviad = us.startSession();

            us.register(aviad, "aviad", "123456");
            us.login(aviad, "aviad", "123456");

            int   storeid = ss.createStore("abowim", zahi);
            Store store   = StoreManagement.getInstance().getStore(storeid);
            LinkedList <StoreManager> managers = store.getManagers();

            Assert.AreEqual(managers.Count, 0);

            ss.addStoreManager(store.getStoreId(), "aviad", zahi);
            managers = store.getManagers();
            Assert.AreEqual(managers.Count, 1);
            StoreManager SM = managers.First.Value;

            Assert.AreEqual(SM.getUser().getUserName(), aviad.getUserName());
            Assert.AreEqual(SM.getStore(), store);

            Premissions SP = SM.getPremissions(aviad, store);
            Dictionary <string, Boolean> Dict = SP.getPrivileges();

            foreach (KeyValuePair <string, Boolean> entry in Dict)
            {
                Assert.IsFalse(entry.Value);
            }
        }
        public void init()
        {
            WebServices.DAL.CleanDB cDB = new WebServices.DAL.CleanDB();
            cDB.emptyDB();
            configuration.DB_MODE = "Testing";
            ProductManager.restartInstance();
            SalesManager.restartInstance();
            StoreManagement.restartInstance();
            UserManager.restartInstance();
            UserCartsManager.restartInstance();
            BuyHistoryManager.restartInstance();
            CouponsManager.restartInstance();
            DiscountsManager.restartInstance();
            RaffleSalesManager.restartInstance();
            StorePremissionsArchive.restartInstance();

            shippingProxy = new ShippingProxy();

            us    = userServices.getInstance();
            ss    = storeServices.getInstance();
            sellS = sellServices.getInstance();

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

            admin1 = us.startSession();
            us.register(admin1, "admin1", "123456");

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

            itamar = us.startSession();
            us.register(itamar, "itamar", "123456");
            us.login(itamar, "itamar", "123456");
            int storeId = ss.createStore("Maria&Netta Inc.", itamar);

            store = StoreManagement.getInstance().getStore(storeId);

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

            ss.addStoreManager(storeId, "niv", itamar);

            int colaId = ss.addProductInStore("cola", 3.2, 10, itamar, storeId, "Drinks");

            cola = ProductManager.getInstance().getProductInStore(colaId);
            int spriteId = ss.addProductInStore("sprite", 5.2, 100, itamar, storeId, "Drinks");

            sprite = ProductManager.getInstance().getProductInStore(spriteId);
            ss.addSaleToStore(itamar, storeId, cola.getProductInStoreId(), 1, 10, DateTime.Now.AddMonths(10).ToString());
        }
Exemple #5
0
        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();
            admin = us.startSession();
            us.register(admin, "admin", "123456");
            us.login(admin, "admin", "123456");

            admin1 = us.startSession();
            us.register(admin1, "admin1", "123456");

            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("MariaNettaInc", itamar);

            store = StoreManagement.getInstance().getStore(storeid);

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

            ss.addStoreManager(store.getStoreId(), "niv", itamar);

            int c = ss.addProductInStore("cola", 3.2, 10, itamar, storeid, "Drinks");
            int s = ss.addProductInStore("sprite", 5.3, 20, itamar, storeid, "Drinks");

            cola       = ProductManager.getInstance().getProductInStore(c);
            sprite     = ProductManager.getInstance().getProductInStore(s);
            saleId     = ss.addSaleToStore(itamar, store.getStoreId(), cola.getProductInStoreId(), 1, 1, "20.5.2018");
            raffleSale = ss.addSaleToStore(itamar, store.getStoreId(), cola.getProductInStoreId(), 3, 1, "20.5.2018");
        }
Exemple #6
0
        public void init()
        {
            CleanDB cDB = new CleanDB();

            cDB.emptyDB();
            ProductManager.restartInstance();
            SalesManager.restartInstance();
            StoreManagement.restartInstance();
            UserManager.restartInstance();
            UserCartsManager.restartInstance();
            StorePremissionsArchive.restartInstance();

            BuyHistoryManager.restartInstance();
            CouponsManager.restartInstance();
            DiscountsManager.restartInstance();
            RaffleSalesManager.restartInstance();
            StorePremissionsArchive.restartInstance();
            us   = userServices.getInstance();
            zahi = us.startSession();
            us.register(zahi, "zahi", "123456");
            us.login(zahi, "zahi", "123456");
            aviad = us.startSession();
            us.register(aviad, "aviad", "123456");
            us.login(aviad, "aviad", "123456");
            shay = us.startSession();
            us.register(shay, "shay", "123456");
            us.login(shay, "shay", "123456");
            itamar = new User("itamar", "123456");
            niv    = us.startSession();
            us.register(niv, "niv", "123456");
            ss    = storeServices.getInstance();
            store = StoreManagement.getInstance().getStore(ss.createStore("abowim", zahi));
            ss.addStoreManager(store.getStoreId(), "aviad", zahi);
            niv.logOut();
            //ADD ALL PERMISSIONS
            ss.addManagerPermission("addProductInStore", store.getStoreId(), "aviad", zahi);
            ss.addManagerPermission("editProductInStore", store.getStoreId(), "aviad", zahi);
            ss.addManagerPermission("removeProductFromStore", store.getStoreId(), "aviad", zahi);
            ss.addManagerPermission("addStoreManager", store.getStoreId(), aviad.getUserName(), zahi);
            ss.addManagerPermission("removeStoreManager", store.getStoreId(), aviad.getUserName(), zahi);
            ss.addManagerPermission("addManagerPermission", store.getStoreId(), aviad.getUserName(), zahi);
            ss.addManagerPermission("removeManagerPermission", store.getStoreId(), aviad.getUserName(), zahi);
            ss.addManagerPermission("addSaleToStore", store.getStoreId(), aviad.getUserName(), zahi);
            ss.addManagerPermission("removeSaleFromStore", store.getStoreId(), aviad.getUserName(), zahi);
            ss.addManagerPermission("editSale", store.getStoreId(), aviad.getUserName(), zahi);
            ss.addManagerPermission("addDiscount", store.getStoreId(), aviad.getUserName(), zahi);
            ss.addManagerPermission("removeDiscount", store.getStoreId(), aviad.getUserName(), zahi);
            ss.addManagerPermission("addNewCoupon", store.getStoreId(), aviad.getUserName(), zahi);
            ss.addManagerPermission("removeCoupon", store.getStoreId(), aviad.getUserName(), zahi);
        }
        public void init()
        {
            WebServices.DAL.CleanDB cDB = new WebServices.DAL.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();
            sellS = sellServices.getInstance();

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

            admin1 = us.startSession();
            us.register(admin1, "admin1", "123456");

            zahi = us.startSession();
            us.register(zahi, "zahi", "123456");
            us.login(zahi, "zahi", "123456");
            store2 = ss.createStore("Darkness Inc.", zahi);

            itamar = us.startSession();
            us.register(itamar, "itamar", "123456");
            us.login(itamar, "itamar", "123456");
            store = ss.createStore("Maria&Netta Inc.", itamar);

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

            ss.addStoreManager(store, "niv", itamar);

            cola    = ss.addProductInStore("cola", 3.2, 10, itamar, store, "drinks");
            sprite  = ss.addProductInStore("sprite", 5.3, 20, itamar, store, "drinks");
            chicken = ss.addProductInStore("chicken", 50, 20, zahi, store2, "drinks");
            cow     = ss.addProductInStore("cow", 80, 40, zahi, store2, "food");
            saleId1 = ss.addSaleToStore(itamar, store, cola, 1, 5, "20/5/2018");
            saleId2 = ss.addSaleToStore(zahi, store2, chicken, 1, 15, "20/7/2019");
        }
        public void TryToAddStoreManagerToNullStore()
        {
            User aviad = us.startSession();

            us.register(aviad, "aviad", "123456");
            us.login(aviad, "aviad", "123456");
            storeServices ss      = storeServices.getInstance();
            int           storeid = ss.createStore("abowim", zahi);
            Store         store   = StoreManagement.getInstance().getStore(storeid);

            ss.addStoreManager(-7, "aviad", zahi);
            LinkedList <StoreManager> managers = store.getManagers();

            Assert.AreEqual(managers.Count, 0);
        }
        public void init()
        {
            WebServices.DAL.CleanDB cDB = new WebServices.DAL.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();
            sell = sellServices.getInstance();

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

            admin1 = us.startSession();
            us.register(admin1, "admin1", "123456");

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

            itamar = us.startSession();
            us.register(itamar, "itamar", "123456");
            us.login(itamar, "itamar", "123456");
            store = ss.createStore("Maria&Netta Inc.", itamar);

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

            ss.addStoreManager(store, "niv", itamar);

            cola       = ss.addProductInStore("cola", 3.2, 10, itamar, store, "drinks");
            saleId     = ss.addSaleToStore(itamar, store, cola, 1, 1, "20.5.2018");
            raffleSale = ss.addSaleToStore(itamar, store, cola, 3, 1, "20.5.2018");
        }
Exemple #10
0
        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();
            admin = us.startSession();
            us.register(admin, "admin", "123456");
            us.login(admin, "admin", "123456");

            admin1 = us.startSession();
            us.register(admin1, "admin1", "123456");

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

            itamar = us.startSession();
            us.register(itamar, "itamar", "123456");
            itamar.login("itamar", "123456");
            store = StoreManagement.getInstance().getStore(itamar.createStore("Maria&Netta Inc."));

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

            ss.addStoreManager(store.getStoreId(), "niv", itamar);
        }