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(); } }
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); }
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); }
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); }
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); }
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(); } }