Пример #1
0
        public void AddToCartWhenHasNoPermission()
        {
            StoreShoppingService liorSession = (StoreShoppingService)market.GetStoreShoppingService(ref userService);
            Store        find = handler.GetStorebyName("X");
            MarketAnswer ans  = liorSession.AddProductToCart("X", "BOX", 6);

            Assert.AreEqual((int)StoreEnum.NoPermission, ans.Status);
        }
 public void GuestBuyItem()
 {
     try
     {
         storeServiceSession.MakeGuest();
         storeServiceSession.AddProductToCart(store, product, 3);
         orderServiceSession.GiveDetails("Someone", "Somewhere", "12345689");
         orderServiceSession.BuyItemFromImmediate(product, store, 3, 11, null);
         Assert.AreEqual(2, sysadminSession.ViewPurchaseHistoryByStore(store).ReportList.Length);
         string actual = sysadminSession.ViewPurchaseHistoryByStore(store).ReportList[0];
         Assert.AreEqual(PurchaseString("Someone"), actual);
     }
     catch (MarketException)
     {
         Assert.Fail();
     }
 }
Пример #3
0
        public void AddToCartSuccess()
        {
            StoreShoppingService liorSession = (StoreShoppingService)market.GetStoreShoppingService(ref userService);

            liorSession.MakeGuest();
            Store        find = handler.GetStorebyName("X");
            MarketAnswer ans  = liorSession.AddProductToCart("X", "BOX", 1);

            Assert.AreEqual((int)StoreEnum.Success, ans.Status);
        }
Пример #4
0
        public void AddToCartWhenQuantityisTooBig()
        {
            StoreShoppingService liorSession = (StoreShoppingService)market.GetStoreShoppingService(ref userService);

            liorSession.MakeGuest();
            Store        find = handler.GetStorebyName("X");
            MarketAnswer ans  = liorSession.AddProductToCart("X", "BOX", 999999);

            Assert.AreEqual((int)StoreEnum.QuantityIsTooBig, ans.Status);
        }
Пример #5
0
        public void AddToCartWhenProductIsNotExistsInStore()
        {
            StoreShoppingService liorSession = (StoreShoppingService)market.GetStoreShoppingService(ref userService);

            liorSession.MakeGuest();
            Store        find = handler.GetStorebyName("X");
            MarketAnswer ans  = liorSession.AddProductToCart("X", "BOBO", 6);

            Assert.AreEqual((int)StoreEnum.ProductNotFound, ans.Status);
        }
Пример #6
0
        public void AddToCartWhenStoreNotExists()
        {
            StoreShoppingService liorSession = (StoreShoppingService)market.GetStoreShoppingService(ref userService);

            liorSession.MakeGuest();
            Store find = handler.GetStorebyName("newStoreName");

            Assert.IsNull(find);
            MarketAnswer ans = liorSession.AddProductToCart("newStoreName", "ppp", 6);

            Assert.AreEqual((int)StoreEnum.StoreNotExists, ans.Status);
        }
Пример #7
0
 public void AddItemToCartTest()
 {
     try
     {
         storeServiceSession.MakeGuest();
         storeServiceSession.AddProductToCart(store1, product1, 5);
         CartItem expected = ((UserService)userServiceSession).MarketUser.Cart.SearchInCart(store1, product1, 6);
         Assert.AreEqual(5, expected.Quantity);
     }
     catch (MarketException)
     {
         Assert.Fail();
     }
 }