Exemplo n.º 1
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>();
        }
        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);
        }