Пример #1
0
 public void init()
 {
     //              ARCHIVE INIT
     WebServices.DAL.CleanDB cDB = new WebServices.DAL.CleanDB();
     cDB.emptyDB();
     PurchasePolicyManager.restartInstance();
     SalesManager.restartInstance();
     DiscountsManager.restartInstance();
     CouponsManager.restartInstance();
     StoreManagement.restartInstance();
     UserManager.restartInstance();
     ProductManager.restartInstance();
     UserCartsManager.restartInstance();
     purchasePolicyArchive = PurchasePolicyManager.getInstance();
     salesArchive          = SalesManager.getInstance();
     discountsArchive      = DiscountsManager.getInstance();
     couponsArchive        = CouponsManager.getInstance();
     productArchive        = ProductManager.getInstance();
     StoreManagement       = StoreManagement.getInstance();
     userArchive           = UserManager.getInstance();
     //              USERS INIT
     admin = new User("admin", "123456");
     admin.register("admin", "123456");
     admin.login("admin", "123456");
     storeOwner = new User("owner", "123456");
     storeOwner.register("owner", "123456");
     storeOwner.login("owner", "123456");
     itamar = new User("itamar", "123456");
     itamar.register("itamar", "123456");
     itamar.login("itamar", "123456");
     shay = new User("shay", "123456");
     shay.register("shay", "123456");
     shay.login("shay", "123456");
     //             PRODUCTS INIT
     cola   = productArchive.addProduct("cola");
     sprite = productArchive.addProduct("sprite");
     //             STORES AND PRODUCTS IN STORES
     store         = StoreManagement.addStore("samsung", storeOwner);
     colaInStore   = productArchive.addProductInStore(cola, store, 200, 500, "cola category");
     spriteInStore = productArchive.addProductInStore(sprite, store, 100, 200, "sprite category");
     //             SALES INIT
     colaRegularSale  = salesArchive.addSale(colaInStore.getProductInStoreId(), regularSale, 50, DateTime.Now.AddDays(10).ToString());
     spriteRaffleSale = salesArchive.addSale(spriteInStore.getProductInStoreId(), raffleSale, 3, DateTime.Now.AddDays(20).ToString());
 }
        public void init()
        {
            WebServices.DAL.CleanDB cDB = new WebServices.DAL.CleanDB();
            cDB.emptyDB();
            ProductManager.restartInstance();
            SalesManager.restartInstance();
            StoreManagement.restartInstance();
            UserManager.restartInstance();
            UserCartsManager.restartInstance();
            DiscountsManager.restartInstance();
            CouponsManager.restartInstance();
            RaffleSalesManager.restartInstance();
            pA        = ProductManager.getInstance();
            saleA     = SalesManager.getInstance();
            storeA    = StoreManagement.getInstance();
            userA     = UserManager.getInstance();
            userCartA = UserCartsManager.getInstance();
            discountA = DiscountsManager.getInstance();
            couponA   = CouponsManager.getInstance();
            raffleA   = RaffleSalesManager.getInstance();

            p1 = pA.addProduct("Milk");
            p2 = pA.addProduct("Bread");
            p3 = pA.addProduct("T.V");

            zahi  = new User("zahi", "123456");
            aviad = new User("aviad", "123456");
            aviad.register("aviad", "123456");
            zahi.register("zahi", "123456");

            store = storeA.addStore("zahi inc", zahi);

            pis1 = ProductManager.getInstance().addProductInStore(p1, store, 20, 10);
            pis2 = ProductManager.getInstance().addProductInStore(p2, store, 30, 15);
            pis3 = ProductManager.getInstance().addProductInStore(p3, store, 40, 50);

            sale1 = saleA.addSale(pis1.getProductInStoreId(), 1, 10, "1/5/2020");
            sale2 = saleA.addSale(pis2.getProductInStoreId(), 1, 10, "1/5/2020");
            sale3 = saleA.addSale(pis3.getProductInStoreId(), 3, 1, "1/5/2020");

            cart = new ShoppingCart();
        }
Пример #3
0
 public void addNewStore()
 {
     sa.addStore("vadim and sons", new User("checker", "123456"));
     Assert.AreEqual(1, sa.getAllStore().Count);
 }