Beispiel #1
0
 private void User1MakeOrder()
 {
     _orderBridge = OrderDriver.getBridge();
     _orderBridge.GetOrderService(_userBridge.GetUserSession());
     _orderBridge.BuyItemFromImmediate("hello", "blahblah", 2, 10, null);
     _orderBridge.BuyItemFromImmediate("Goodbye", "blahblah2", 2, 10, null);
 }
Beispiel #2
0
 private void CreateOrder()
 {
     _storeManager1.AddNewProduct("Yolo", 5, "Once", 10);
     _storeBridge.AddProductToCart("Volcano", "Yolo", 2);
     _orderBridge = OrderDriver.getBridge();
     _orderBridge.GetOrderService(_bridgeSignUp.GetUserSession());
     _orderBridge.BuyEverythingFromCart(new string[] { null });
 }
Beispiel #3
0
 private void MakeRegisteredShopper3()
 {
     _buyerRegisteredUserBridge3 = UserDriver.getBridge();
     _buyerRegisteredUserBridge3.EnterSystem();
     _buyerRegisteredUserBridge3.SignUp("Shalom3", "Bye3", "555", "55555555");
     _orderBridge3 = OrderDriver.getBridge();
     _orderBridge3.GetOrderService(_buyerRegisteredUserBridge3.GetUserSession());
 }
Beispiel #4
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 #5
0
        private void CreateOrderWithCouponInvalidCoupon(string coupon)
        {
            _orderBridge = OrderDriver.getBridge();
            _orderBridge.GetOrderService(_userBuyer.GetUserSession());
            MarketAnswer res = _orderBridge.BuyItemFromImmediate("Ouch", "Toy", 2, 30, coupon);

            Assert.AreEqual((int)OrderStatus.InvalidCoupon, res.Status);
        }
Beispiel #6
0
        public void SuccessBuyingProductsRegisterUser()
        {
            AddProductsToCartRegisteredUser();
            _orderBridge.GetOrderService(_buyerRegisteredUserBridge.GetUserSession());
            MarketAnswer res = _orderBridge.BuyEverythingFromCart(new string[] { null, null });

            Assert.AreEqual((int)OrderStatus.Success, res.Status);
            MarketAnswer puchaseHistory = _adminBridge.ViewPurchaseHistoryByUser("Shalom");

            Assert.AreEqual((int)ViewPurchaseHistoryStatus.Success, puchaseHistory.Status);
            string[] receivedHistory = puchaseHistory.ReportList;
            string[] expectedHistory =
            {
                "User: Shalom Product: Coffee Store: HAHAHA Sale: Immediate Quantity: 3 Price: 30 Date: " +
                DateTime.Now.Date.ToString("dd/MM/yyyy"),
                "User: Shalom Product: Tea Store: Yalla Sale: Immediate Quantity: 4 Price: 40 Date: " +
                DateTime.Now.Date.ToString("dd/MM/yyyy")
            };
            Assert.AreEqual(expectedHistory.Length, receivedHistory.Length);
            for (int i = 0; i < expectedHistory.Length; i++)
            {
                Assert.AreEqual(expectedHistory[i], receivedHistory[i]);
            }
            MarketAnswer cartDetails = _buyerRegisteredUserBridge.ViewCart();

            string[] expectedCart = { };
            string[] receivedCart = cartDetails.ReportList;
            Assert.AreEqual(expectedCart.Length, receivedCart.Length);
            //TODO: check the stock
            MarketAnswer stock1 = _shoppingBridge.ViewStoreStock("Yalla");

            string[] expectedYallaStock =
            {
                " name: Tea base price: 10 description: CherryFlavour Discount: {null} Purchase Way: Immediate Quantity: 2"
            };
            Assert.AreEqual(expectedYallaStock[0], stock1.ReportList[0]);
            MarketAnswer stock2 = _shoppingBridge.ViewStoreStock("HAHAHA");

            string[] expectedHahahaStock =
            {
                " name: Coffee base price: 10 description: Black Discount: {null} Purchase Way: Immediate Quantity: 3"
            };
            Assert.AreEqual(expectedHahahaStock[0], stock2.ReportList[0]);
        }
Beispiel #7
0
 public void GetOrderService(IUserService userService)
 {
     if (real != null)
     {
         real.GetOrderService(userService);
     }
     else
     {
         throw new NotImplementedException();
     }
 }
Beispiel #8
0
 private void CreateOrder()
 {
     _orderBridge = OrderDriver.getBridge();
     _orderBridge.GetOrderService(_userBuyer.GetUserSession());
     _orderBridge.BuyEverythingFromCart(new string[] { null });
 }