public void IfTaxesAreEnabledButPricesIncludeTaxTheBasePriceShouldBeThePrice() { var pricingMethod = new ProductPricingMethodBuilder().LoadedPricesIncludeTax().Build(); var productVariant = new ProductVariantBuilder().WithBasePrice(1.00m).Build(); pricingMethod.GetUnitPrice(productVariant, 0m, 0m).Should().Be(1.00m); }
public void IfTaxesAreDisabledTheBasePriceShouldBeThePrice() { var pricingMethod = new ProductPricingMethodBuilder().TaxesDisabled().Build(); var productVariant = new ProductVariantBuilder().WithBasePrice(1.00m).Build(); pricingMethod.GetUnitPrice(productVariant, 0m, 0m).Should().Be(1.00m); }
public void IfPricesExcludeTaxTheyShouldBeAdded() { var pricingMethod = new ProductPricingMethodBuilder().LoadedPricesExcludeTax().Build(); var productVariant = new ProductVariantBuilder().WithBasePrice(1.00m).WithTaxPercentage(20m).Build(); pricingMethod.GetUnitPrice(productVariant, 0m, 0m).Should().Be(1.20m); }
public void UnitPriceShouldBeCalculatedCorrectly(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.GetUnitPrice(cartItemData).Should().Be(Convert.ToDecimal(expected)); }