Esempio n. 1
0
 public void MarketBuilder()
 {
     MarketDB.Instance.InsertByForce();
     marketSession      = MarketYard.Instance;
     userServiceSession = (UserService)marketSession.GetUserService();
     userServiceSession.EnterSystem();
     orderServiceSession = (OrderService)marketSession.GetOrderService(ref userServiceSession);
     userBuyerHarmony    = new UserBuyerHarmony(ref userServiceSession);
 }
Esempio n. 2
0
 public void MarketBuilder()
 {
     MarketDB.Instance.InsertByForce();
     marketSession      = MarketYard.Instance;
     userServiceSession = (UserService)marketSession.GetUserService();
     userServiceSession.EnterSystem();
     orderServiceSession = (OrderService)marketSession.GetOrderService(ref userServiceSession);
     storeServiceSession = StockSyncher.Instance;
     storeSyncherHarmony = new StoresSyncherHarmony();
 }
Esempio n. 3
0
 public void UserReportTest()
 {
     ToSignIn(adminName, adminPass);
     adminServiceSession  = (SystemAdminService)marketSession.GetSystemAdminService(userServiceSession);
     storeShoppingService = marketSession.GetStoreShoppingService(ref userServiceSession);
     Assert.AreEqual((int)StoreEnum.Success, storeShoppingService.AddProductToCart("The Red Rock", "Goldstar", 5).Status);
     orderService = marketSession.GetOrderService(ref userServiceSession);
     Assert.AreEqual((int)OrderStatus.Success, orderService.BuyEverythingFromCart(new string[] { null }).Status);
     Assert.AreEqual((int)ViewPurchaseHistoryStatus.Success, adminServiceSession.ViewPurchaseHistoryByUser("Arik1").Status);
     string[] actualHistory   = adminServiceSession.ViewPurchaseHistoryByUser("Arik1").ReportList;
     string[] expectedHistory =
     {
         new PurchaseHistory("Arik1", "Goldstar",      "The Red Rock", "Immediate", 5,   55, DateTime.Now.Date.ToString("dd/MM/yyyy")).ToString(),
         new PurchaseHistory("Arik1", "Health Potion", "X",            "Immediate", 2, 11.5, "29/12/2018").ToString(),
         new PurchaseHistory("Arik1", "INT Potion",    "Y",            "Lottery",   2,  8.0, "29/12/2018").ToString(),
         new PurchaseHistory("Arik1", "Mana Potion",   "Y",            "Lottery",   3, 12.0, "29/12/2018").ToString()
     };
     Assert.AreEqual(expectedHistory.Length, actualHistory.Length);
     for (int i = 0; i < expectedHistory.Length; i++)
     {
         Assert.AreEqual(expectedHistory[i], actualHistory[i]);
     }
 }
 public void MarketBuilder()
 {
     MarketDB.Instance.InsertByForce();
     marketSession       = MarketYard.Instance;
     userServiceSession  = (UserService)marketSession.GetUserService();
     userServiceSession2 = (UserService)marketSession.GetUserService();
     userServiceSession3 = (UserService)marketSession.GetUserService();
     userServiceSession2.EnterSystem();
     userServiceSession3.EnterSystem();
     userServiceSession2.SignIn(sysadmin, pass);
     sysadminSession = marketSession.GetSystemAdminService(userServiceSession2);
     userServiceSession.EnterSystem();
     orderServiceSession = (OrderService)marketSession.GetOrderService(ref userServiceSession);
     storeServiceSession = (StoreShoppingService)marketSession.GetStoreShoppingService(ref userServiceSession);
 }
Esempio n. 5
0
        public void BuildOrderPool()
        {
            MarketDB.Instance.InsertByForce();
            market       = MarketYard.Instance;
            userService  = market.GetUserService();
            orderService = (OrderService)market.GetOrderService(ref userService);
            IUserBuyer buyer = new UserBuyerHarmony(ref userService);

            slave1 = new PurchaseItemSlave(buyer, new StoresSyncherHarmony(), OrderDL.Instance, Publisher.Instance, market.GetPolicyChecker());
            slave2 = new PurchaseEverythingSlave(buyer, new StoresSyncherHarmony(), OrderDL.Instance, Publisher.Instance, market.GetPolicyChecker());
            orderService.GiveDetails("Big Smoke", "Grove Street", "54238521");
            item1 = new OrderItem("Cluckin Bell", null, "#9", 5.00, 2);
            item2 = new OrderItem("Cluckin Bell", null, "#9 Large", 7.00, 1);
            item3 = new OrderItem("Cluckin Bell", null, "#6 Extra Dip", 8.50, 1);
        }
Esempio n. 6
0
 public void GetOrderService(IUserService userService)
 {
     _orderService = _market.GetOrderService(ref userService);
 }