Beispiel #1
0
        public void CanPurchase_With_Brazil_DS_ZeroVolume()
        {
            var             testSettings = new OrderingTestSettings("es-AR", "WEBTESTBR");
            var             ruleEngine   = new Ordering.Rules.PurchasingPermissions.es_AR.PurchasingPermissionRules();
            MembershipUser  user         = Membership.GetUser(testSettings.Distributor);
            GenericIdentity identity     = new GenericIdentity(user.UserName);
            RolePrincipal   principal    = new RolePrincipal(identity);

            System.Threading.Thread.CurrentPrincipal = principal;
            HttpContext.Current.User = principal;
            var cart = MyHLShoppingCartGenerator.GetBasicShoppingCart(
                testSettings.Distributor, testSettings.Locale, "", "", false, null, new List <DistributorShoppingCartItem>
            {
                ShoppingCartItemHelper.GetCatalogItems(1, 5, "5451", testSettings.Locale)
            }, OrderCategoryType.ETO);

            cart.ShoppingCartID = 1;
            var result = ruleEngine.ProcessCart(cart, ShoppingCartRuleReason.CartItemsBeingAdded);

            if (result.Count > 0 && result[0].Messages.Count == 0)
            {
                Assert.AreEqual(0,
                                result[0].Messages.Count);
            }
            else
            {
                Assert.Fail("May be the volume poient of sku 5451 is not 0.");
            }
        }
Beispiel #2
0
        public void CanPurchase_ARWithValidTinCodes_True()
        {
            // Used constants.
            const string Distributor = "09550499";

            System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("es-AR");

            // Rules engine.
            var ruleEngine = new Ordering.Rules.PurchasingPermissions.es_AR.PurchasingPermissionRules();

            // Getting an online distributor.
            var ods = OnlineDistributorHelper.GetOnlineDistributor(
                Distributor,
                "AR",
                new List <string>
            {
                "ARTX",
                "CUIT"
            });
            MembershipUser  user      = Membership.GetUser(Distributor);
            GenericIdentity identity  = new GenericIdentity(user.UserName);
            RolePrincipal   principal = new RolePrincipal(identity);

            System.Threading.Thread.CurrentPrincipal = principal;
            HttpContext.Current.User = principal;
            // Getting a result.
            var result = ruleEngine.CanPurchase(Distributor, "SG");

            // Asserts.
            Assert.AreEqual(result, true, "Local distributor with ARTX and CUIT tin codes should be able to purchase in Argentina");
        }