Пример #1
0
        public static Store initValidStore()
        {
            StoreManagment sm          = StoreManagment.Instance;
            UserManager    userManager = UserManager.Instance;

            userManager.Register("shimon", "123");
            userManager.Login("shimon", "123", false);
            sm.createStore("shimon", "Store");
            userManager.Register("yosi", "123");
            userManager.Login("yosi", "123");
            userManager.Register("shmuel", "123");
            userManager.Login("shmuel", "123");
            AppoitmentManager appmgr = AppoitmentManager.Instance;

            appmgr.AppointStoreManager("shimon", "shmuel", 100);
            appmgr.AppointStoreManager("shimon", "yosi", 100);
            userManager.GetAtiveUser("shmuel").setPermmisions(100, new int[] { 0, 0, 1, 0, 0 });
            userManager.GetAtiveUser("yosi").setPermmisions(100, new int[] { 1, 1, 0, 0, 0 });

            Store validStore = sm.getStore(100);

            validStore.Inventory = InventoryTest.getInventory(InventoryTest.getValidInventroyProdList());

            return(validStore);
        }
        public static StoreManagment getValidStoreManagmet()
        {
            UserManager userManger = UserManager.Instance;

            userManger.Register("liav", "123");
            userManger.Register("sundy", "125");
            userManger.Register("yosef", "127");
            userManger.Login("liav", "123", false);
            userManger.Login("sundy", "125");

            List <Tuple <Product, int> > lstProds = new List <Tuple <Product, int> >();
            Product p1_firstStore = new Product(pid: 1, sid: 1, price: 10000, name: "Dell Xps 9560", rank: 4, category: CommonStr.ProductCategoty.Computers);

            lstProds.Add(new Tuple <Product, int>(p1_firstStore, 100));
            lstProds.Add(new Tuple <Product, int>(new Product(pid: 2, sid: 1, name: "Ninja Blender V3", price: 450, rank: 2, category: CommonStr.ProductCategoty.Kitchen), 200));
            lstProds.Add(new Tuple <Product, int>(new Product(pid: 3, sid: 1, name: "MegaMix", price: 1000, rank: 5, category: CommonStr.ProductCategoty.Kitchen), 300));
            lstProds.Add(new Tuple <Product, int>(new Product(pid: 4, sid: 1, name: "makeup loreal paris", price: 200, rank: 3, category: CommonStr.ProductCategoty.Beauty), 0));
            Inventory inv_store_1 = InventoryTest.getInventory(lstProds);
            Store     store1      = StoreTest.StoreTest.openStore(storeId: 1, user: userManger.GetUser("liav"), inv: inv_store_1, rank: 4, CommonStr.StoreParams.StoreName);

            List <Tuple <Product, int> > lstProds2 = new List <Tuple <Product, int> >();

            lstProds2.Add(new Tuple <Product, int>(new Product(pid: 1, sid: 2, price: 650, name: "Keyboard Mx95 Lgoitech", rank: 4, category: CommonStr.ProductCategoty.Computers), 100));
            lstProds2.Add(new Tuple <Product, int>(new Product(pid: 2, sid: 2, name: "Elctricty Knife", price: 450, rank: 5, category: CommonStr.ProductCategoty.Kitchen), 200));
            lstProds2.Add(new Tuple <Product, int>(new Product(pid: 3, sid: 2, name: "MegaMix v66", price: 1500, rank: 1, category: CommonStr.ProductCategoty.Kitchen), 300));
            lstProds2.Add(new Tuple <Product, int>(new Product(pid: 4, sid: 2, name: "Lipstick in955", price: 200, rank: 3, category: CommonStr.ProductCategoty.Beauty), 10));
            Inventory inv_store_2 = InventoryTest.getInventory(lstProds2);
            Store     store2      = StoreTest.StoreTest.openStore(storeId: 2, user: userManger.GetUser("sundy"), inv: inv_store_2, rank: 3);

            List <Tuple <Product, int> > lstProd3 = new List <Tuple <Product, int> >();

            lstProd3.Add(new Tuple <Product, int>(new Product(pid: 1, sid: 3, price: 50, name: "Mouse Mx95 Lgoitech", rank: 2, category: CommonStr.ProductCategoty.Computers), 100));
            lstProd3.Add(new Tuple <Product, int>(new Product(pid: 2, sid: 3, name: "Nespresso Latsima Touch Coffe Machine", price: 1400, rank: 2, category: CommonStr.ProductCategoty.Kitchen), 200));
            lstProd3.Add(new Tuple <Product, int>(new Product(pid: 3, sid: 3, name: "MegaMix v41", price: 1500, rank: 4, category: CommonStr.ProductCategoty.Kitchen), 300));
            lstProd3.Add(new Tuple <Product, int>(new Product(pid: 4, sid: 3, name: "makeup loreal paris", price: 200, rank: 5, category: CommonStr.ProductCategoty.Beauty), 10));
            Inventory inv_store_3 = InventoryTest.getInventory(lstProd3);
            Store     store3      = StoreTest.StoreTest.openStore(storeId: 3, user: userManger.GetUser("yosef"), inv: inv_store_3, rank: 1);

            store3.ActiveStore = false;

            Dictionary <int, Store> storesDictionary = new Dictionary <int, Store>();

            storesDictionary.Add(1, store1);
            storesDictionary.Add(2, store2);
            storesDictionary.Add(3, store3);

            StoreManagment.Instance.setStores(storesDictionary);
            return(StoreManagment.Instance);
        }
Пример #3
0
        public void TestInitialize()
        {
            User user = new User(1, null, true, true);

            List <Tuple <Product, int> > lstProds = new List <Tuple <Product, int> >();

            lstProds.Add(new Tuple <Product, int>(new Product(pid: 1, sid: 1, price: 10000, name: "Dell Xps 9560", rank: 4, category: CommonStr.ProductCategoty.Computers), 100));
            lstProds.Add(new Tuple <Product, int>(new Product(pid: 2, sid: 1, name: "Ninja Blender V3", price: 450, rank: 2, category: CommonStr.ProductCategoty.Kitchen), 200));
            lstProds.Add(new Tuple <Product, int>(new Product(pid: 3, sid: 1, name: "MegaMix", price: 1000, rank: 5, category: CommonStr.ProductCategoty.Kitchen), 300));
            lstProds.Add(new Tuple <Product, int>(new Product(pid: 4, sid: 1, name: "makeup loreal paris", price: 200, rank: 3, category: CommonStr.ProductCategoty.Beauty), 0));
            inv_store_1 = InventoryTest.getInventory(lstProds);
            Store store1 = StoreTest.StoreTest.openStore(storeId: 1, user: user, inv: inv_store_1, rank: 4);

            List <Tuple <Product, int> > lstProds2 = new List <Tuple <Product, int> >();

            lstProds2.Add(new Tuple <Product, int>(new Product(pid: 1, sid: 2, price: 650, name: "Keyboard Mx95 Lgoitech", rank: 4, category: CommonStr.ProductCategoty.Computers), 100));
            lstProds2.Add(new Tuple <Product, int>(new Product(pid: 2, sid: 2, name: "Elctricty Knife", price: 450, rank: 5, category: CommonStr.ProductCategoty.Kitchen), 200));
            lstProds2.Add(new Tuple <Product, int>(new Product(pid: 3, sid: 2, name: "MegaMix v66", price: 1500, rank: 1, category: CommonStr.ProductCategoty.Kitchen), 300));
            lstProds2.Add(new Tuple <Product, int>(new Product(pid: 4, sid: 2, name: "Lipstick in955", price: 200, rank: 3, category: CommonStr.ProductCategoty.Beauty), 10));
            inv_store_2 = InventoryTest.getInventory(lstProds2);
            Store store2 = StoreTest.StoreTest.openStore(storeId: 2, user: user, inv: inv_store_2, rank: 3);

            List <Tuple <Product, int> > lstProd3 = new List <Tuple <Product, int> >();

            lstProd3.Add(new Tuple <Product, int>(new Product(pid: 1, sid: 3, price: 50, name: "Mouse Mx95 Lgoitech", rank: 2, category: CommonStr.ProductCategoty.Computers), 100));
            lstProd3.Add(new Tuple <Product, int>(new Product(pid: 2, sid: 3, name: "Nespresso Latsima Touch Coffe Machine", price: 1400, rank: 2, category: CommonStr.ProductCategoty.Kitchen), 200));
            lstProd3.Add(new Tuple <Product, int>(new Product(pid: 3, sid: 3, name: "MegaMix v41", price: 1500, rank: 4, category: CommonStr.ProductCategoty.Kitchen), 300));
            lstProd3.Add(new Tuple <Product, int>(new Product(pid: 4, sid: 3, name: "makeup loreal paris", price: 200, rank: 5, category: CommonStr.ProductCategoty.Beauty), 10));
            inv_store_3 = InventoryTest.getInventory(lstProd3);
            Store store3 = StoreTest.StoreTest.openStore(storeId: 3, user: user, inv: inv_store_3, rank: 1);

            Dictionary <int, Store> storesDictionary = new Dictionary <int, Store>();

            storesDictionary.Add(1, store1);
            storesDictionary.Add(2, store2);
            storesDictionary.Add(3, store3);
            storeManagment = StoreManagment.Instance;
            storeManagment.setStores(storesDictionary);
            searcher = new Searcher(storeManagment);
        }