public void ViewProductInMultipleStores()
        {
            userServices us      = userServices.getInstance();
            User         session = us.startSession();

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

            us.register(aviad, "aviad", "123456");
            us.login(aviad, "aviad", "123456");
            storeServices ss  = storeServices.getInstance();
            int           id1 = ss.createStore("abowim", session);
            int           id2 = ss.createStore("bros", aviad);

            ss.addProductInStore("cola", 3.2, 10, session, id1, "drinks");
            ss.addProductInStore("sprite", 3.2, 10, session, id1, "drinks");
            ss.addProductInStore("milk", 3.2, 10, aviad, id2, "milk");
            LinkedList <ProductInStore> pisList     = us.viewProductsInStore(id1);
            LinkedList <ProductInStore> pisList2    = us.viewProductsInStore(id2);
            LinkedList <ProductInStore> piStorsList = us.viewProductsInStores();

            Assert.AreEqual(pisList.Count, 2);
            Assert.AreEqual(pisList2.Count, 1);
            Assert.AreEqual(piStorsList.Count, 3);
        }
Exemple #2
0
        public void AddSaleWithProductNotInStore()
        {
            int            storeid = ss.createStore("admin store", admin);
            Store          store2  = StoreManagement.getInstance().getStore(storeid);
            int            m       = ss.addProductInStore("milk", 3.2, 10, admin, storeid, "Drinks");
            ProductInStore milk    = ProductManager.getInstance().getProductInStore(m);

            Assert.AreEqual(ss.addSaleToStore(itamar, store.getStoreId(), milk.getProductInStoreId(), 1, 1, DateTime.Now.AddMonths(1).ToString()), -13); //-13 product not in this store
        }
        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");
        }
Exemple #4
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();
            zahi = us.startSession();
            us.register(zahi, "zahi", "123456");
            us.login(zahi, "zahi", "123456");
            int storeid = ss.createStore("abowim", zahi);

            store = StoreManagement.getInstance().getStore(storeid);
            int c = ss.addProductInStore("cola", 3.2, 10, zahi, storeid, "Drinks");

            cola = ProductManager.getInstance().getProductInStore(c);
        }
Exemple #5
0
        public void StoreCreateWithNullUser()
        {
            storeServices ss    = storeServices.getInstance();
            int           store = ss.createStore("aboim", null);

            Assert.AreEqual(store, -1);
        }
Exemple #6
0
        public void StoreCreateWithNoneExistUser()
        {
            User          zahi  = new User("zahi", "123456");
            storeServices ss    = storeServices.getInstance();
            int           store = ss.createStore("abowim", zahi);

            Assert.AreEqual(store, -1);
        }
Exemple #7
0
        public void simpleViewHistory()
        {
            User aviad = us.startSession();

            Assert.IsNotNull(aviad);
            int store = ss.createStore("abowim", zahi);

            Assert.IsNotNull(store);
            Assert.IsTrue(us.register(aviad, "aviad", "123456") > -1);
            Assert.IsTrue(us.login(aviad, "aviad", "123456") > -1);
            int pis    = ss.addProductInStore("cola", 3.2, 10, zahi, store, "drinks");
            int saleId = ss.addSaleToStore(zahi, store, pis, 1, 8, DateTime.Now.AddDays(10).ToString());
            LinkedList <Sale> sales = ses.viewSalesByProductInStoreId(pis);

            Assert.IsTrue(sales.Count == 1);
            Sale sale = sales.First.Value;

            Assert.IsTrue(ses.addProductToCart(aviad, sale.SaleId, 2) > -1);
            LinkedList <UserCart> sc = ses.viewCart(aviad);

            Assert.IsTrue(sc.Count == 1);
            Assert.IsTrue(sc.First.Value.getSaleId() == saleId);
            Assert.IsTrue(ses.buyProducts(aviad, "1234", ""));
            LinkedList <Purchase> historyList = ss.viewStoreHistory(zahi, store);

            Assert.IsTrue(historyList.Count == 1);
            Assert.IsTrue(historyList.First.Value.ProductId == ProductManager.getInstance().getProductInStore(pis).getProduct().getProductId());
            Assert.IsTrue(historyList.First.Value.Amount == 2);
        }
Exemple #8
0
        public void StoreCreateWithNameOfExistingStore()
        {
            userServices us   = userServices.getInstance();
            User         zahi = us.startSession();

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

            Assert.AreEqual(store2.getStoreName(), "abowim");
            LinkedList <StoreOwner> owners = store2.getOwners();

            Assert.AreEqual(owners.Count, 1);
            Assert.IsTrue(owners.First.Value.getUser() == 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();

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

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

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

            int sId  = ss.createStore("makolet", partislav);
            int s2Id = ss.createStore("makolet", partislav);

            s  = StoreManagement.getInstance().getStore(sId);
            s2 = StoreManagement.getInstance().getStore(s2Id);

            ownerRole  = StoreRole.getStoreRole(s, partislav);
            ownerRole2 = StoreRole.getStoreRole(s, partislav);

            ownerRole.addStoreManager(partislav, s, "manager1");
            ownerRole.addStoreManager(partislav, s, "manager2");
            ownerRole.addStoreManager(partislav, s2, "manager1");
            ownerRole.addStoreManager(partislav, s2, "manager2");
        }
Exemple #10
0
        public void ViewMultipuleStores()
        {
            userServices us      = userServices.getInstance();
            User         session = us.startSession();

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

            us.register(aviad, "aviad", "123456");
            us.login(aviad, "aviad", "123456");
            storeServices ss = storeServices.getInstance();

            ss.createStore("abowim", session);
            ss.createStore("abowim2", session);
            ss.createStore("bros", aviad);
            LinkedList <Store> Lstore = us.viewStores();

            Assert.AreEqual(Lstore.Count, 3);
        }
Exemple #11
0
        public void RemoveMannegerInFewStores()
        {
            int   s2     = ss.createStore("admin store", admin);
            Store store2 = StoreManagement.getInstance().getStore(s2);

            ss.addStoreManager(store2.getStoreId(), "niv", admin);
            Assert.IsTrue(us.removeUser(admin, "niv") >= 0);
            Assert.IsFalse(us.login(niv, "niv", "123456") >= 0);
            Assert.AreEqual(store.getManagers().Count, 0);
            Assert.AreEqual(store2.getManagers().Count, 0);
        }
Exemple #12
0
        public void StoreCreateWithNotLoggedInUser()
        {
            userServices us   = userServices.getInstance();
            User         zahi = us.startSession();

            us.register(zahi, "zahi", "123456");
            storeServices ss    = storeServices.getInstance();
            int           store = ss.createStore("aboim", zahi);

            Assert.AreEqual(store, -1);
        }
Exemple #13
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 #14
0
        public void StoreCreateWithOnlySpaces()
        {
            userServices us   = userServices.getInstance();
            User         zahi = us.startSession();

            us.register(zahi, "zahi", "123456");
            us.login(zahi, "zahi", "123456");
            storeServices ss    = storeServices.getInstance();
            int           store = ss.createStore("          ", zahi);

            Assert.AreEqual(store, -3);
        }
        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());
        }
        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);
            }
        }
Exemple #17
0
        public void SimpleViewStore()
        {
            userServices us      = userServices.getInstance();
            User         session = us.startSession();

            us.register(session, "zahi", "123456");
            us.login(session, "zahi", "123456");
            storeServices ss = storeServices.getInstance();

            ss.createStore("abowim", session);
            LinkedList <Store> Lstore = us.viewStores();

            Assert.AreEqual(Lstore.Count, 1);
        }
Exemple #18
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 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);
        }
Exemple #20
0
        public void ViewSlaeInStoreFewStors()
        {
            int saleId1 = ss.addSaleToStore(itamar, store.getStoreId(), cola.getProductInStoreId(), 1, 1, "20/5/2018");
            LinkedList <Sale> saleList1 = ss.viewSalesByStore(store.getStoreId());
            int               storeId   = ss.createStore("admin store", admin);
            Store             store2    = StoreManagement.getInstance().getStore(storeId);
            int               milkId    = ss.addProductInStore("milk", 3.2, 10, admin, store2.getStoreId(), "Drinks");
            ProductInStore    milk      = ProductManager.getInstance().getProductInStore(milkId);
            int               saleId2   = ss.addSaleToStore(admin, store2.getStoreId(), milk.getProductInStoreId(), 1, 1, "20/5/2018");
            LinkedList <Sale> saleList2 = ss.viewSalesByStore(store2.getStoreId());

            Assert.AreEqual(saleList1.Count, 1);
            Assert.AreEqual(saleId1, saleList1.First.Value.SaleId);
            Assert.AreEqual(saleList2.Count, 1);
            Assert.AreEqual(saleId2, saleList2.First.Value.SaleId);
        }
        public void ViewProductWhenThereIsNoProducts()
        {
            userServices us      = userServices.getInstance();
            User         session = us.startSession();

            us.register(session, "zahi", "123456");
            us.login(session, "zahi", "123456");
            storeServices ss = storeServices.getInstance();
            int           id = ss.createStore("abowim", session);
            Product       p  = new Product("cola");
            LinkedList <ProductInStore> pisList     = us.viewProductsInStore(id);
            LinkedList <ProductInStore> piStorsList = us.viewProductsInStores();

            Assert.AreEqual(pisList.Count, 0);
            Assert.AreEqual(piStorsList.Count, 0);
        }
Exemple #22
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();
            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 SimpleViewProductWithOneProduct()
        {
            userServices us      = userServices.getInstance();
            User         session = us.startSession();

            us.register(session, "zahi", "123456");
            us.login(session, "zahi", "123456");
            storeServices ss  = storeServices.getInstance();
            int           id  = ss.createStore("abowim", session);
            Store         s   = StoreManagement.getInstance().getStore(id);
            int           pis = ss.addProductInStore("cola", 3.2, 10, session, id, "drinks");
            LinkedList <ProductInStore> pisList     = us.viewProductsInStore(id);
            LinkedList <ProductInStore> piStorsList = us.viewProductsInStores();

            Assert.AreEqual(pisList.Count, 1);
            Assert.AreEqual(piStorsList.Count, 1);
        }
        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");
        }
        public void AddMyselfAsStoreOwnerWithoutBeingOwner()
        {
            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.addStoreOwner(store.getStoreId(), "aviad", aviad);
            LinkedList <StoreOwner> Userowners = store.getOwners();
            LinkedList <User>       owners     = new LinkedList <User>();

            foreach (StoreOwner o in Userowners)
            {
                owners.AddFirst(o.getUser());
            }
            Assert.AreEqual(owners.Count, 1);
            Assert.IsTrue(owners.Contains(zahi));
        }
        public void simpleAddStoreOwner()
        {
            User aviad = us.startSession();

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

            ss.addStoreOwner(store.getStoreId(), "aviad", zahi);
            LinkedList <StoreOwner> Userowners = store.getOwners();
            LinkedList <String>     owners     = new LinkedList <String>();

            foreach (StoreOwner o in Userowners)
            {
                owners.AddFirst(o.getUser().getUserName());
            }
            Assert.AreEqual(owners.Count, 2);
            Assert.IsTrue(owners.Contains("zahi"));
            Assert.IsTrue(owners.Contains("aviad"));
        }
        public void SimpleAddProduct()
        {
            int            storeid = ss.createStore("abowim", zahi);
            Store          s       = StoreManagement.getInstance().getStore(storeid);
            int            p       = ss.addProductInStore("cola", 3.2, 10, zahi, storeid, "Drinks");
            ProductInStore pis     = ProductManager.getInstance().getProductInStore(p);

            Assert.AreEqual(pis.getPrice(), 3.2);
            Assert.AreEqual(pis.getAmount(), 10);
            Assert.AreEqual(pis.getStore().getStoreId(), s.getStoreId());
            LinkedList <ProductInStore> pList = s.getProductsInStore();

            Assert.IsTrue(pList.Contains(pis));
            Assert.AreEqual(pList.Count, 1);
        }
        public void SimpleRemoveProduct()
        {
            us.login(zahi, "zahi", "123456");
            int            storeId = ss.createStore("abowim", zahi);
            Store          s       = StoreManagement.getInstance().getStore(storeId);
            int            pisId   = ss.addProductInStore("cola", 3.2, 10, zahi, storeId, "Drink");
            ProductInStore pis     = ProductManager.getInstance().getProductInStore(pisId);
            int            result  = ss.removeProductFromStore(s.storeId, pis.productInStoreId, zahi);

            Assert.IsTrue(result > -1);
            LinkedList <ProductInStore> LPIS = us.viewProductsInStores();

            Assert.AreEqual(LPIS.Count, 0);
        }