示例#1
0
 public void MarketBuilder()
 {
     MarketDB.Instance.InsertByForce();
     _ownerStoreBridge = StoreManagementDriver.getBridge();
     _userBridge       = UserDriver.getBridge();
     _userBridge.EnterSystem();
     _userBridge.SignUp("Pnina", "misholSusia", "852852", "77777777");
     _storeShopping = StoreShoppingDriver.getBridge();
     _storeShopping.GetStoreShoppingService(_userBridge.GetUserSession());
     _storeShopping.OpenStore("HistoryShop", "blah");
     _ownerStoreBridge.GetStoreManagementService(_userBridge.GetUserSession(), "HistoryShop");
 }
示例#2
0
        public void AddDiscountAndDontReceiveItBecauseDatePassed()
        {
            //check there is no discount for ouch
            CheckNoDiscountAdded();

            MarketAnswer res = _storeManagementBridge.AddDiscountToProduct("Ouch", Convert.ToDateTime("14/04/2018"), Convert.ToDateTime("15/04/2018"), 10, "VISIBLE", false);

            Assert.AreEqual((int)DiscountStatus.Success, res.Status);

            MarketYard.SetDateTime(Convert.ToDateTime("16/04/2018"));

            //check the discount was added to the product in the stock
            MarketAnswer stock = _storeShoppingBridge.ViewStoreStock("Toy");

            string[] receivedStock = stock.ReportList;
            string[] expectedStock =
            {
                " name: Ouch base price: 30 description: Ouchouch Discount: {DiscountAmount: 10 Start Date: " + Convert.ToDateTime("14/04/2018").Date.ToString("d") + "" +
                " End Date: " + Convert.ToDateTime("15/04/2018").Date.ToString("d") + " type is: visible} Purchase Way: Immediate Quantity: 6"
            };
            Assert.AreEqual(expectedStock.Length, receivedStock.Length);
            for (int i = 0; i < receivedStock.Length; i++)
            {
                Assert.AreEqual(expectedStock[i], receivedStock[i]);
            }

            SignUp(ref _userBuyer, "Vika", "Arad", "5555", "55555555");

            _storeShoppingBridge2 = StoreShoppingDriver.getBridge();
            _storeShoppingBridge2.GetStoreShoppingService(_userBuyer.GetUserSession());
            _storeShoppingBridge2.AddProductToCart("Toy", "Ouch", 3);

            CreateOrder();

            SignInAdmin("Arik1", "123");
            _userAdminBridge = AdminDriver.getBridge();
            _userAdminBridge.GetAdminService(_userAdmin.GetUserSession());
            MarketAnswer purchaseHistory = _userAdminBridge.ViewPurchaseHistoryByUser("Vika");

            //make sure the price presented is without the discount
            string[] purchaseReceived = purchaseHistory.ReportList;
            string[] purchaseExpected =
            {
                "User: Vika Product: Ouch Store: Toy Sale: Immediate Quantity: 3 Price: 90 Date: " +
                DateTime.Now.Date.ToString("dd/MM/yyyy"),
            };
            Assert.AreEqual(purchaseExpected.Length, purchaseReceived.Length);
            for (int i = 0; i < purchaseReceived.Length; i++)
            {
                Assert.AreEqual(purchaseExpected[i], purchaseReceived[i]);
            }
        }
示例#3
0
 public void MarketBuilder()
 {
     MarketDB.Instance.InsertByForce();
     _storeBridge = StoreShoppingDriver.getBridge();
     SignUp("Pnina", "mishol", "7894", "12345678");
     _storeBridge.GetStoreShoppingService(_bridgeSignUp.GetUserSession());
     Assert.AreEqual((int)OpenStoreStatus.Success, _storeBridge.OpenStore("OOF", "BASA").Status);
     _storeManagementBridge = StoreManagementDriver.getBridge();
     _storeManagementBridge.GetStoreManagementService(_bridgeSignUp.GetUserSession(), "OOF");
     _storeManagementBridge.AddNewProduct("Toy", 20, "OuchOuch", 10);
     _userWatchStock   = null;
     _storeBridgeGuest = null;
 }
示例#4
0
 private void OpenStoreAndAddProducts()
 {
     _shoppingBridge = StoreShoppingDriver.getBridge();
     _shoppingBridge.GetStoreShoppingService(_storeOwnerBridge.GetUserSession());
     _shoppingBridge.OpenStore("Yalla", "Balagan");
     _storeManagementBridge = StoreManagementDriver.getBridge();
     _storeManagementBridge.GetStoreManagementService(_storeOwnerBridge.GetUserSession(), "Yalla");
     _storeManagementBridge.AddNewProduct("Tea", 10, "CherryFlavour", 6);
     _shoppingBridge.OpenStore("HAHAHA", "LOLOLO");
     _storeManagementBridge2 = StoreManagementDriver.getBridge();
     _storeManagementBridge2.GetStoreManagementService(_storeOwnerBridge.GetUserSession(), "HAHAHA");
     _storeManagementBridge2.AddNewProduct("Coffee", 10, "Black", 6);
 }
示例#5
0
        public void AddToCartInvalidUser()
        {
            //User didn't enter the system
            _storeBridge3 = StoreShoppingDriver.getBridge();
            _storeBridge3.GetStoreShoppingService(_bridgeSignUp.GetUserSession());
            MarketAnswer res1 = _storeBridge3.AddProductToCart("BlahStore", "bisli", 1);

            //TODO: when lior fixes the states - this should be invalid user
            Assert.AreEqual((int)StoreEnum.NoPermission, res1.Status);
            //the user can't even watch his cart until entering the system
            MarketAnswer cartDetails = _bridgeSignUp.ViewCart();

            Assert.AreEqual((int)ViewCartStatus.DidntEnterSystem, cartDetails.Status);
        }
示例#6
0
        public void GuestViewStore()
        {
            _userWatchStore = UserDriver.getBridge();
            _userWatchStore.EnterSystem();
            _storeBridgeGuest = StoreShoppingDriver.getBridge();
            _storeBridgeGuest.GetStoreShoppingService(_userWatchStore.GetUserSession());
            MarketAnswer storeDetails = _storeBridgeGuest.ViewStoreInfo("OOF");

            Assert.AreEqual((int)ViewStoreStatus.Success, storeDetails.Status);
            string expectedAnswer = "_storeName: OOF StoreAddress: BASA";
            string receivedAnswer = "_storeName: " + storeDetails.ReportList[0] + " StoreAddress: " + storeDetails.ReportList[1];

            Assert.AreEqual(expectedAnswer, receivedAnswer);
        }
示例#7
0
        public void ProductQuantityNegativeGuest()
        {
            _bridgeSignUp.EnterSystem();
            _storeBridge3 = StoreShoppingDriver.getBridge();
            _storeBridge3.GetStoreShoppingService(_bridgeSignUp.GetUserSession());
            MarketAnswer res1 = _storeBridge3.AddProductToCart("BlahStore", "bisli", -5);

            Assert.AreEqual((int)StoreEnum.QuantityIsNegative, res1.Status);
            //the cart should remain empty
            MarketAnswer cartDetails = _bridgeSignUp.ViewCart();

            string[] cartItemsReceived = cartDetails.ReportList;
            string[] cartItemsExpected = { };
            Assert.AreEqual(cartItemsExpected.Length, cartItemsReceived.Length);
        }
示例#8
0
        public void MarketBuilder()
        {
            MarketDB.Instance.InsertByForce();
            SignUp(ref _userBridge, "Pnina", "lo kef", "777777", "88888888");
            _storeBridge = StoreShoppingDriver.getBridge();
            _storeBridge.GetStoreShoppingService(_userBridge.GetUserSession());
            _storeBridge.OpenStore("lokef", "li");
            _storeManage1 = StoreManagementDriver.getBridge();
            _storeManage1.GetStoreManagementService(_userBridge.GetUserSession(), "lokef");
            MarketAnswer res1 = _storeManage1.AddNewProduct("bamba", 90, "nice snack", 30);

            Assert.AreEqual((int)StoreEnum.Success, res1.Status);
            _userBridge2  = null;
            _storeManage2 = null;
        }
示例#9
0
        public void MarketBuilder()
        {
            MarketDB.Instance.InsertByForce();
            SignUp(ref _bridgeSignUp, "LAMA", "ANI TZRIHA", "121112", "85296363");
            SignUp(ref _userToPromoteBridge, "eurovision", "France", "852963", "78945678");
            SignUp(ref _userToPromoteBridge2, "blah", "NotNice", "98989", "88888888");
            _storeBridge = StoreShoppingDriver.getBridge();
            _storeBridge.GetStoreShoppingService(_bridgeSignUp.GetUserSession());
            MarketAnswer res = _storeBridge.OpenStore("basush", "rezahhhhh");

            Assert.AreEqual((int)OpenStoreStatus.Success, res.Status);
            _storeManager1 = StoreManagementDriver.getBridge();
            _storeManager2 = null;
            _signInBridge  = null;
            _adminBridge   = null;
        }
示例#10
0
        public void MarketBuilder()
        {
            MarketDB.Instance.InsertByForce();
            SignUp(ref _bridgeSignUp, "Odin", "Valhalla", "121112", "85296363");
            SignUp(ref _userToPromoteBridge, "Thor", "Midgard", "121112", "78945678");
            SignUp(ref _userToPromoteBridge2, "Loki", "Somewhere Else", "121112", "88888888");
            _storeBridge = StoreShoppingDriver.getBridge();
            _storeBridge.GetStoreShoppingService(_bridgeSignUp.GetUserSession());
            MarketAnswer res = _storeBridge.OpenStore("Volcano", "Iceland");

            Assert.AreEqual((int)OpenStoreStatus.Success, res.Status);
            _storeManager1 = StoreManagementDriver.getBridge();
            _storeManager2 = null;
            _signInBridge  = null;
            _adminBridge   = null;
            _guestBridge   = null;
        }
示例#11
0
        public void SuccessInOpeningAStore()
        {
            MarketDB.Instance.InsertByForce();
            SignUp("Pnina", "mishol", "7894", "12345678");
            _storeBridge.GetStoreShoppingService(_bridgeSignUp.GetUserSession());
            Assert.AreEqual((int)OpenStoreStatus.Success, _storeBridge.OpenStore("PninaStore", "Ben-Gurion").Status);
            MarketAnswer storeDetails   = _storeBridge.ViewStoreInfo("PninaStore");
            string       expectedAnswer = "_storeName: PninaStore StoreAddress: Ben-Gurion";
            string       receivedAnswer = "_storeName: " + storeDetails.ReportList[0] + " StoreAddress: " + storeDetails.ReportList[1];

            Assert.AreEqual(expectedAnswer, receivedAnswer);
        }
示例#12
0
        private void AddProductsToCartGuest()
        {
            _buyerGuestBridge = UserDriver.getBridge();
            _buyerGuestBridge.EnterSystem();
            _shoppingBridge2 = StoreShoppingDriver.getBridge();
            _shoppingBridge2.GetStoreShoppingService(_buyerGuestBridge.GetUserSession());
            _shoppingBridge2.AddProductToCart("Yalla", "Tea", 4);
            _shoppingBridge2.AddProductToCart("HAHAHA", "Coffee", 3);
            MarketAnswer cartDetails = _buyerGuestBridge.ViewCart();

            string[] received = cartDetails.ReportList;
            string[] expected =
            {
                "Name : Coffee Store : HAHAHA Quantity : 3 Unit Price : 10 Final Price : 30",
                "Name : Tea Store : Yalla Quantity : 4 Unit Price : 10 Final Price : 40"
            };

            Assert.AreEqual(expected.Length, cartDetails.ReportList.Length);
            for (int i = 0; i < received.Length; i++)
            {
                Assert.AreEqual(expected[i], received[i]);
            }
        }
示例#13
0
 private void CreateStoreBlahblah()
 {
     _storeShopping = StoreShoppingDriver.getBridge();
     _storeShopping.GetStoreShoppingService(_userBridge.GetUserSession());
     _storeShopping.OpenStore("blahblah", "blah");
 }
示例#14
0
        public void AddDiscountAndReceiveItInOrderSuccessfully()
        {
            //check there is no discount for ouch
            CheckNoDiscountAdded();

            MarketAnswer res = _storeManagementBridge.AddDiscountToProduct("Ouch", Convert.ToDateTime("14/04/2018"), Convert.ToDateTime("20/04/2018"), 10, "HIDDEN", false);

            Assert.AreEqual((int)DiscountStatus.Success, res.Status);
            string coupon = res.ReportList[0];

            //check the discount was added to the product in the stock
            MarketAnswer stock = _storeShoppingBridge.ViewStoreStock("Toy");

            string[] receivedStock = stock.ReportList;
            string[] expectedStock =
            {
                " name: Ouch base price: 30 description: Ouchouch Discount: {type is: hidden} Purchase Way: Immediate Quantity: 6"
            };
            Assert.AreEqual(expectedStock.Length, receivedStock.Length);
            for (int i = 0; i < receivedStock.Length; i++)
            {
                Assert.AreEqual(expectedStock[i], receivedStock[i]);
            }


            SignUp(ref _userBuyer, "Vika", "Arad", "5555", "55555555");

            _storeShoppingBridge2 = StoreShoppingDriver.getBridge();
            _storeShoppingBridge2.GetStoreShoppingService(_userBuyer.GetUserSession());
            _storeShoppingBridge2.AddProductToCart("Toy", "Ouch", 3);


            //make sure the price in the cart is the original price
            MarketAnswer cartDetails = _userBuyer.ViewCart();

            string[] receivedItems = cartDetails.ReportList;
            string[] expectedItems =
            {
                "Name : Ouch Store : Toy Quantity : 3 Unit Price : 30 Final Price : 90",
            };
            Assert.AreEqual(expectedItems.Length, receivedItems.Length);
            for (int i = 0; i < receivedItems.Length; i++)
            {
                Assert.AreEqual(expectedItems[i], receivedItems[i]);
            }


            CreateOrderWithCoupon(coupon);

            SignInAdminSystem();
            MarketAnswer purchaseHistory = _userAdminBridge.ViewPurchaseHistoryByUser("Vika");

            //make sure the price presented is after the discount
            string[] purchaseReceived = purchaseHistory.ReportList;
            string[] purchaseExpected =
            {
                "User: Vika Product: Ouch Store: Toy Sale: Immediate Quantity: 2 Price: 40 Date: " +
                DateTime.Now.Date.ToString("dd/MM/yyyy"),
            };
            Assert.AreEqual(purchaseExpected.Length, purchaseReceived.Length);
            for (int i = 0; i < purchaseReceived.Length; i++)
            {
                Assert.AreEqual(purchaseExpected[i], purchaseReceived[i]);
            }
        }