예제 #1
0
파일: UseCase3_7.cs 프로젝트: maorRoz/Sadna
 private void User1MakeOrder()
 {
     _orderBridge = OrderDriver.getBridge();
     _orderBridge.GetOrderService(_userBridge.GetUserSession());
     _orderBridge.BuyItemFromImmediate("hello", "blahblah", 2, 10, null);
     _orderBridge.BuyItemFromImmediate("Goodbye", "blahblah2", 2, 10, null);
 }
예제 #2
0
파일: UseCase1_7.cs 프로젝트: maorRoz/Sadna
        public void SuccessBuyingLessThenInCart()
        {
            AddProductsToCartRegisteredUser();
            _orderBridge.GetOrderService(_buyerRegisteredUserBridge.GetUserSession());
            MarketAnswer res = _orderBridge.BuyItemFromImmediate("Tea", "Yalla", 3, 10, null);

            Assert.AreEqual((int)OrderStatus.Success, res.Status);
            res = _orderBridge.BuyItemFromImmediate("Coffee", "HAHAHA", 1, 10, null);
            Assert.AreEqual((int)OrderStatus.Success, res.Status);
            res = _orderBridge.BuyEverythingFromCart(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: 1 Price: 10 Date: " +
                DateTime.Now.Date.ToString("dd/MM/yyyy"),
                "User: Shalom Product: Coffee Store: HAHAHA Sale: Immediate Quantity: 2 Price: 20 Date: " +
                DateTime.Now.Date.ToString("dd/MM/yyyy"),
                "User: Shalom Product: Tea Store: Yalla Sale: Immediate Quantity: 3 Price: 30 Date: " +
                DateTime.Now.Date.ToString("dd/MM/yyyy"),
                "User: Shalom Product: Tea Store: Yalla Sale: Immediate Quantity: 1 Price: 10 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]);
            }
        }
예제 #3
0
파일: UseCase7_1.cs 프로젝트: maorRoz/Sadna
        public void FailPurchaseProductBuyMoreThanExistsInCart()
        {
            AddProductsToCartRegisteredUser();
            _orderBridge.GetOrderService(_buyerRegisteredUserBridge.GetUserSession());
            MarketAnswer res = _orderBridge.BuyItemFromImmediate("Tea", "Yalla", 100, 10, null);

            Assert.AreEqual((int)OrderItemStatus.InvalidDetails, res.Status);
            CheckHistoryNullCartSameStockNotChangedRegisterUser();
        }
예제 #4
0
 public MarketAnswer BuyItemFromImmediate(string itemName, string store, int quantity, double unitPrice, string coupon)
 {
     if (real != null)
     {
         return(real.BuyItemFromImmediate(itemName, store, quantity, unitPrice, coupon));
     }
     throw new NotImplementedException();
 }
예제 #5
0
파일: UseCase8_3.cs 프로젝트: maorRoz/Sadna
        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);
        }