Beispiel #1
0
        public void GetLotteryByProductID()
        {
            Product P = handler.GetProductID("P1");                                                                                                         //exist in DL by SQL injection
            LotterySaleManagmentTicket expected = new LotterySaleManagmentTicket("L1", "X", P, DateTime.Parse("01/01/2018"), DateTime.Parse("31/12/2018")); //exist in DL by SQL injection
            LotterySaleManagmentTicket find     = handler.GetLotteryByProductID(P.SystemId);

            Assert.AreEqual(expected, find);
        }
Beispiel #2
0
        public void BuildStore()
        {
            MarketDB.Instance.InsertByForce();
            handler = StoreDL.Instance;
            Product P = new Product("P10000", "name", 100, "ds");

            ProductToDelete = new StockListItem(1, P, null, PurchaseEnum.Lottery, "S7");
            LotteryToDelete = new LotterySaleManagmentTicket("L100", "T", P, DateTime.Parse("31/12/2019"), DateTime.Parse("31/12/2020"));
            handler.AddStockListItemToDataBase(ProductToDelete);
            handler.AddLottery(LotteryToDelete);
            tickets = new LinkedList <LotteryTicket>();
        }
Beispiel #3
0
 public static void CleanSession()
 {
     MarketException.RemoveErrors();
     MarketBackUpDB.Instance.CleanByForce();
     Publisher.CleanPublisher();
     Category.RestartCategoryID();
     Product.RestartProductID();
     Store.RestartStoreID();
     LotteryTicket.RestartLotteryTicketID();
     LotterySaleManagmentTicket.RestartLotteryID();
     Discount.RestartDiscountID();
 }
Beispiel #4
0
        public void removeLottery()
        {
            Product P = handler.GetProductID("P3");//exist in DL by SQL injection
            LotterySaleManagmentTicket expected = new LotterySaleManagmentTicket("L102", "X", P, DateTime.Parse("01/01/2018"), DateTime.Parse("31/12/2018"));

            handler.AddLottery(expected);
            LotterySaleManagmentTicket find = handler.GetLotteryByProductID(P.SystemId);

            Assert.AreEqual(expected, find);
            handler.RemoveLottery(expected);
            find = handler.GetLotteryByProductID(P.SystemId);
            Assert.IsNull(find);
        }
Beispiel #5
0
        public void EditLotteryInDatabase()
        {
            Product P = handler.GetProductID("P3");//exist in DL by SQL injection
            LotterySaleManagmentTicket expected = new LotterySaleManagmentTicket("L101", "X", P, DateTime.Parse("01/01/2018"), DateTime.Parse("31/12/2018"));

            handler.AddLottery(expected);
            LotterySaleManagmentTicket find = handler.GetLotteryByProductID(P.SystemId);

            Assert.AreEqual(expected, find);
            expected.TotalMoneyPayed = 50;
            Assert.AreNotEqual(expected, find);
            handler.EditLotteryInDatabase(expected);
            find = handler.GetLotteryByProductID("P3");
            Assert.AreEqual(expected, find);;
        }
        public void ChangeToImmediateSuccessLottery()
        {
            userService.EnterSystem();
            userService.SignIn("Arik1", "123");
            StoreManagementService liorSession = (StoreManagementService)market.GetStoreManagementService(userService, "X");
            Product P = new Product("P1345678", "OBJ", 9, "des");

            ProductToDelete = new StockListItem(4, P, null, PurchaseEnum.Lottery, "S1");
            lotteryToDelete = new LotterySaleManagmentTicket("L1000", "X", P, DateTime.Parse("31/12/2018"), DateTime.Parse("31/12/2020"));
            handler.AddStockListItemToDataBase(ProductToDelete);
            handler.AddLottery(lotteryToDelete);
            MarketAnswer  ans  = liorSession.ChangeProductPurchaseWayToImmediate("OBJ");
            StockListItem find = handler.GetProductFromStore("X", "OBJ");

            Assert.AreEqual((int)PurchaseEnum.Immediate, (int)find.PurchaseWay);
            Assert.AreEqual((int)StoreEnum.Success, ans.Status);
        }