Beispiel #1
0
 public void FirstBuyerWin()
 {
     MakeRegisteredShoppers();
     Assert.AreEqual((int)OrderStatus.Success, _orderBridge1.BuyLotteryTicket("Fanta", storeName, 1, 4).Status);
     Assert.AreEqual((int)OrderStatus.Success, _orderBridge2.BuyLotteryTicket("Fanta", storeName, 1, 4).Status);
     _orderBridge3.Cheat(3);
     Assert.AreEqual((int)OrderStatus.Success, _orderBridge3.BuyLotteryTicket("Fanta", storeName, 1, 4).Status);
     string[] expectedHistoryFirstBuyer =
     {
         "User: Shalom1 Product: DELIVERY : Fanta Store: LotteryStore Sale: Lottery Quantity: 1 Price: 1 Date: " + DateTime.Now.Date.ToString("dd/MM/yyyy"),
         "User: Shalom1 Product: Fanta Store: LotteryStore Sale: Lottery Quantity: 1 Price: 4 Date: " + DateTime.Now.Date.ToString("dd/MM/yyyy"),
     };
     string[] expectedHistorySecondBuyer =
     {
         "User: Shalom2 Product: Fanta Store: LotteryStore Sale: Lottery Quantity: 1 Price: 4 Date: " + DateTime.Now.Date.ToString("dd/MM/yyyy"),
     };
     string[] expectedHistoryThirdBuyer =
     {
         "User: Shalom3 Product: Fanta Store: LotteryStore Sale: Lottery Quantity: 1 Price: 4 Date: " + DateTime.Now.Date.ToString("dd/MM/yyyy"),
     };
     string[] actualHistoryFirstBuyer  = _adminBridge.ViewPurchaseHistoryByUser("Shalom1").ReportList;
     string[] actualHistorySecondBuyer = _adminBridge.ViewPurchaseHistoryByUser("Shalom2").ReportList;
     string[] actualHistoryThirdBuyer  = _adminBridge.ViewPurchaseHistoryByUser("Shalom3").ReportList;
     lotteryEventReport(expectedHistoryFirstBuyer, expectedHistorySecondBuyer, expectedHistoryThirdBuyer,
                        actualHistoryFirstBuyer, actualHistorySecondBuyer, actualHistoryThirdBuyer);
 }
Beispiel #2
0
 public MarketAnswer BuyLotteryTicket(string itemName, string store, int quantity, double unitPrice)
 {
     if (real != null)
     {
         return(real.BuyLotteryTicket(itemName, store, quantity, unitPrice));
     }
     throw new NotImplementedException();
 }
Beispiel #3
0
 public void LotteryFailGuest()
 {
     _buyerGuestBridge = UserDriver.getBridge();
     _buyerGuestBridge.EnterSystem();
     _orderBridge1 = OrderDriver.getBridge();
     _orderBridge1.GetOrderService(_buyerGuestBridge.GetUserSession());
     Assert.AreEqual((int)OrderStatus.InvalidUser, _orderBridge1.BuyLotteryTicket("Fanta", storeName, 1, 4).Status);
 }
Beispiel #4
0
 public void LotteryStillGoing()
 {
     MakeRegisteredShoppers();
     Assert.AreEqual((int)OrderStatus.Success, _orderBridge1.BuyLotteryTicket("Fanta", storeName, 1, 4).Status);
     string[] expectedHistoryFirstBuyer =
     {
         "User: Shalom1 Product: Fanta Store: LotteryStore Sale: Lottery Quantity: 1 Price: 4 Date: " + DateTime.Now.Date.ToString("dd/MM/yyyy"),
     };
     string[] actualHistoryFirstBuyer = _adminBridge.ViewPurchaseHistoryByUser("Shalom1").ReportList;
     Assert.AreEqual(expectedHistoryFirstBuyer.Length, actualHistoryFirstBuyer.Length);
     for (int i = 0; i < expectedHistoryFirstBuyer.Length; i++)
     {
         Assert.AreEqual(expectedHistoryFirstBuyer[i], actualHistoryFirstBuyer[i]);
     }
 }