Beispiel #1
0
 private void UserWatchStockInitialize()
 {
     _userWatchStock = UserDriver.getBridge();
     _userWatchStock.EnterSystem();
     _storeBridgeGuest = StoreShoppingDriver.getBridge();
     _storeBridgeGuest.GetStoreShoppingService(_userWatchStock.GetUserSession());
 }
Beispiel #2
0
        public void SuccessAddingProductToCartGuest()
        {
            _bridgeSignUp.EnterSystem();
            _storeBridge3 = StoreShoppingDriver.getBridge();
            _storeBridge3.GetStoreShoppingService(_bridgeSignUp.GetUserSession());
            MarketAnswer res1 = _storeBridge3.AddProductToCart("BlahStore", "bisli", 1);

            Assert.AreEqual((int)StoreEnum.Success, res1.Status);
            MarketAnswer res2 = _storeBridge3.AddProductToCart("BlahStore", "cheaps", 2);

            Assert.AreEqual((int)StoreEnum.Success, res2.Status);
            MarketAnswer res3 = _storeBridge3.AddProductToCart("BlahStore2", "doritos", 3);

            Assert.AreEqual((int)StoreEnum.Success, res3.Status);
            //Lets view to cart to see the products were indeed added.
            MarketAnswer cartDetails = _bridgeSignUp.ViewCart();

            string[] cartItemsExpected =
            {
                "Name : bisli Store : BlahStore Quantity : 1 Unit Price : 200 Final Price : 200",
                "Name : cheaps Store : BlahStore Quantity : 2 Unit Price : 20 Final Price : 40",
                "Name : doritos Store : BlahStore2 Quantity : 3 Unit Price : 30 Final Price : 90"
            };

            string[] cartItemsReceived = cartDetails.ReportList;
            Assert.AreEqual(cartItemsExpected.Length, cartItemsReceived.Length);
            for (int i = 0; i < cartItemsReceived.Length; i++)
            {
                Assert.AreEqual(cartItemsExpected[i], cartItemsReceived[i]);
            }
        }
Beispiel #3
0
 private void GuestAddToCart()
 {
     _storeGuestBridge = StoreShoppingDriver.getBridge();
     _storeGuestBridge.GetStoreShoppingService(_bridgeGuest.GetUserSession());
     _storeGuestBridge.AddProductToCart("BlahStore", "cheaps", 2);
     _storeGuestBridge.AddProductToCart("BlahStore2", "doritos", 3);
 }
Beispiel #4
0
        private void CreateStoreBlahblah2()
        {
            _storeShopping2 = StoreShoppingDriver.getBridge();
            _storeShopping2.GetStoreShoppingService(_userBridge2.GetUserSession());
            MarketAnswer res20 = _storeShopping2.OpenStore("blahblah2", "blah");

            Assert.AreEqual((int)OpenStoreStatus.Success, res20.Status);
        }
Beispiel #5
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, "HIDDEN", false);

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

            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: {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]);
            }


            CreateOrderWithCouponInvalidCoupon(coupon);

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

            //make sure the purchase didn't complete
            string[] purchaseReceived = purchaseHistory.ReportList;
            Assert.IsNull(purchaseReceived);
        }
Beispiel #6
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);
 }
Beispiel #7
0
 private void OpenStoreAndProducts()
 {
     _storeShoppingBridge = StoreShoppingDriver.getBridge();
     _storeShoppingBridge.GetStoreShoppingService(_storeOwnerUserBridge.GetUserSession());
     _storeShoppingBridge.OpenStore("Toy", "notYour");
     _storeManagementBridge = StoreManagementDriver.getBridge();
     _storeManagementBridge.GetStoreManagementService(_storeOwnerUserBridge.GetUserSession(), "Toy");
     _storeManagementBridge.AddNewProduct("Ouch", 30, "Ouchouch", 6);
 }
Beispiel #8
0
 private void CreateStore2AndProducts()
 {
     _storeBridge2 = StoreShoppingDriver.getBridge();
     _storeBridge2.GetStoreShoppingService(_signInBridge.GetUserSession());
     _storeBridge2.OpenStore("BlahStore2", "BlahStreet2");
     _storeManage2 = StoreManagementDriver.getBridge();
     _storeManage2.GetStoreManagementService(_signInBridge.GetUserSession(), "BlahStore2");
     _storeManage2.AddNewProduct("doritos", 30, "yammy3!", 30);
 }
Beispiel #9
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);
     _userWatchStore   = null;
     _storeBridgeGuest = null;
 }
Beispiel #10
0
 private void CreateStore1AndProducts()
 {
     _storeBridge = StoreShoppingDriver.getBridge();
     _storeBridge.GetStoreShoppingService(_bridge1.GetUserSession());
     _storeBridge.OpenStore("BlahStore", "BlahStreet");
     _storeManage1 = StoreManagementDriver.getBridge();
     _storeManage1.GetStoreManagementService(_bridge1.GetUserSession(), "BlahStore");
     _storeManage1.AddNewProduct("bisli", 200, "yammy!", 5);
     _storeManage1.AddNewProduct("cheaps", 20, "yammy2!", 80);
 }
Beispiel #11
0
 private void AddProductsToCartRegisteredUser()
 {
     _buyerRegisteredUserBridge = UserDriver.getBridge();
     _buyerRegisteredUserBridge.EnterSystem();
     _buyerRegisteredUserBridge.SignUp("Shalom", "Bye", "555", "55555555");
     _shoppingBridge2 = StoreShoppingDriver.getBridge();
     _shoppingBridge2.GetStoreShoppingService(_buyerRegisteredUserBridge.GetUserSession());
     _shoppingBridge2.AddProductToCart("Yalla", "Tea", 4);
     _shoppingBridge2.AddProductToCart("HAHAHA", "Coffee", 3);
 }
Beispiel #12
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();
     _userBridge2  = null;
 }
Beispiel #13
0
        public void InvalidUserDidntEnterSystem()
        {
            _userWatchStore   = UserDriver.getBridge();
            _storeBridgeGuest = StoreShoppingDriver.getBridge();
            _storeBridgeGuest.GetStoreShoppingService(_userWatchStore.GetUserSession());
            MarketAnswer storeDetails = _storeBridgeGuest.ViewStoreInfo("OOF");

            Assert.AreEqual((int)ViewStoreStatus.InvalidUser, storeDetails.Status);
            Assert.AreEqual(null, storeDetails.ReportList);
        }
Beispiel #14
0
 private void OpenStoreAndAddProducts()
 {
     _shoppingBridge = StoreShoppingDriver.getBridge();
     _shoppingBridge.GetStoreShoppingService(_storeOwnerBridge.GetUserSession());
     _shoppingBridge.OpenStore(storeName, "Great Place");
     _storeManagementBridge = StoreManagementDriver.getBridge();
     _storeManagementBridge.GetStoreManagementService(_storeOwnerBridge.GetUserSession(), storeName);
     _storeManagementBridge.AddNewLottery("Fanta", 12, "very nice fanta", Convert.ToDateTime("14/04/2018"), Convert.ToDateTime("28/12/2018"));
     _storeManagementBridge.AddNewLottery("Cola", 24, "very nice cola", Convert.ToDateTime("14/04/2018"), Convert.ToDateTime("28/12/2018"));
 }
Beispiel #15
0
 public void MarketBuilder()
 {
     MarketDB.Instance.InsertByForce();
     _adminBridge = AdminDriver.getBridge();
     SignUp(ref _signUpBridge1, userSoleStoreOwner, "mishol", userSoleStoreOwnerPass, "12345678");
     SignUp(ref _signUpBridge2, userNotSoleStoreOwner, "susia", userNotSoleStoreOwnerPass, "12345678");
     _storeBridge = StoreShoppingDriver.getBridge();
     _storeBridge.GetStoreShoppingService(_signUpBridge1.GetUserSession());
     _storeBridge.OpenStore("blah", "blah2");
     _managerBridge = null;
 }
Beispiel #16
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");
 }
Beispiel #17
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]);
            }
        }
Beispiel #18
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);
 }
Beispiel #19
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);
        }
Beispiel #20
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);
        }
Beispiel #21
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);
        }
Beispiel #22
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;
        }
Beispiel #23
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;
        }
Beispiel #24
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;
        }
Beispiel #25
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]);
            }
        }
Beispiel #26
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]);
            }
        }
Beispiel #27
0
 private void CreateStoreBlahblah()
 {
     _storeShopping = StoreShoppingDriver.getBridge();
     _storeShopping.GetStoreShoppingService(_userBridge.GetUserSession());
     _storeShopping.OpenStore("blahblah", "blah");
 }
Beispiel #28
0
 public void MarketBuilder()
 {
     _storeBridge = StoreShoppingDriver.getBridge();
 }