public void PricePreTaxShouldBeCalculatedCorrectly(bool taxesEnabled, PriceLoadingMethod priceLoadingMethod,
            TaxCalculationMethod taxCalculationMethod,
            double basePrice, int quantity, double expected)
        {
            var pricingMethod =
                new ProductPricingMethodBuilder().TaxesEnabled(taxesEnabled)
                    .WithPriceLoadingMethod(priceLoadingMethod)
                    .WithTaxCalculationMethod(taxCalculationMethod).Build();
            var productVariant =
                new ProductVariantBuilder().WithBasePrice(Convert.ToDecimal(basePrice))
                    .WithTaxPercentage(TaxPercentage)
                    .Build();
            var cartItemData = new CartItemBuilder().WithItem(productVariant).WithQuantity(quantity).Build();

            pricingMethod.GetPricePreTax(cartItemData).Should().Be(Convert.ToDecimal(expected));
        }
        private void DiscountApplicationOnPricePreTaxIsCorrectForSingleRowPriced(decimal basePrice,
                                                                                 PriceLoadingMethod priceLoadingMethod, DiscountOnPrices discountOnPrices,
                                                                                 ApplyCustomerTax applyCustomerTax, double expected)
        {
            var pricingMethod =
                new ProductPricingMethodBuilder().WithPriceLoadingMethod(priceLoadingMethod)
                .CalculateTaxOnRow()
                .WithDiscountOnPrices(discountOnPrices)
                .WithCustomerTaxApplication(applyCustomerTax)
                .Build();
            var productVariant =
                new ProductVariantBuilder().WithBasePrice(basePrice)
                .WithTaxPercentage(TaxPercentage)
                .Build();
            var cartItemData = new CartItemBuilder().WithItem(productVariant).WithDiscountAmount(1).Build();

            pricingMethod.GetPricePreTax(cartItemData).Should().Be(Convert.ToDecimal(expected));
        }
Exemple #3
0
        private void DiscountApplicationOnPricePreTaxIsCorrectForIndividuallyPriced(decimal basePrice,
                                                                                    PriceLoadingMethod priceLoadingMethod, DiscountOnPrices discountOnPrices,
                                                                                    ApplyCustomerTax applyCustomerTax, double expected)
        {
            var pricingMethod =
                new ProductPricingMethodBuilder().WithPriceLoadingMethod(priceLoadingMethod)
                .CalculateTaxOnIndividualItem()
                .WithDiscountOnPrices(discountOnPrices)
                .WithCustomerTaxApplication(applyCustomerTax)
                .Build();
            var productVariant =
                new ProductVariantBuilder().WithBasePrice(basePrice)
                .WithTaxPercentage(TaxPercentage)
                .Build();
            var cartItemData = new CartItemBuilder().WithItem(productVariant).WithDiscountPercentage(10).Build();

            //check for various quantities - should be fine with individual item pricing to just multiply up
            for (int quantity = 1; quantity <= 10; quantity++)
            {
                cartItemData.Quantity = quantity;
                pricingMethod.GetPricePreTax(cartItemData).Should().Be(Convert.ToDecimal(expected * quantity));
            }
        }