public void ProcessCartTestGlobal_InvalidQuantities_Fail() { var testSettings = new OrderingTestSettings("en-IN", "1111111111"); var target = new Ordering.Rules.CartIntegrity.Global.CartIntegrityRules(); var distributor = OnlineDistributorHelper.GetOnlineDistributor(testSettings.Distributor); HttpRuntime.Cache.Insert("DISTR_" + testSettings.Distributor, distributor); var cart = MyHLShoppingCartGenerator.GetBasicShoppingCart( testSettings.Distributor, testSettings.Locale, "", "", false, null, new List <DistributorShoppingCartItem> { ShoppingCartItemHelper.GetCatalogItems(1, -1, "1248", testSettings.Locale), ShoppingCartItemHelper.GetCatalogItems(1, 1, "1247", testSettings.Locale) }, OrderCategoryType.ETO); cart.ShoppingCartID = 1; var result = target.ProcessCart(cart, ShoppingCartRuleReason.CartCalculated); if (result.Count > 0 && result[0].Messages.Count > 0) { Assert.AreEqual(result[0].Messages[0], "Invalid sku quantity found. DS: 1111111111, CART: 1, SKU 1248 : quantity updated to 1."); } else { Assert.Fail("The Sku quantity -1 should be updated to 1."); } }
public void ProcessCartTestGlobal_DuplicateSKUs_Fail() { string DsId = "1111111111"; string Local = "en-IN"; var testSettings = new OrderingTestSettings(Local, DsId); var target = new Ordering.Rules.CartIntegrity.Global.CartIntegrityRules(); var distributor = DistributorOrderingProfileProvider.GetProfile(DsId, Local.Substring(3)); HttpRuntime.Cache.Insert("DISTR_" + testSettings.Distributor, distributor); var cart = MyHLShoppingCartGenerator.GetBasicShoppingCart( DsId, Local, "", "", false, null, new List <DistributorShoppingCartItem> { ShoppingCartItemHelper.GetCatalogItems(1, 1, "1248", Local), ShoppingCartItemHelper.GetCatalogItems(1, 1, "1248", Local) }, OrderCategoryType.ETO); var result = target.ProcessCart(cart, ShoppingCartRuleReason.CartCalculated); if (result.Count > 0 && result[0].Messages.Count > 0) { Assert.AreEqual(result[0].Messages[0], "Duplicate sku found. DS: 1111111111, CART: 0, SKU 1248 removed from cart."); } else { Assert.Fail("SKU 1248 is dupliacte.it should be removed from the cart"); } }