public void PRECISION_Report_Printed() { var transport = PriceDependencies.GetExpense("Transport", new PercentageCost(0.03M)); var currencyFormat = new NumberFormatInfo { CurrencySymbol = "USD", CurrencyPositivePattern = 3 }; priceModifiersBuilder = new ProductModifiersBuilder() .WithDiscount(universalDiscount) .WithTax(taxPercent21) .WithExpense(transport) .WithDiscount(specialDiscountSpecificForProduct) .WithMultiplicativeCalculation() .WithCurrencyFormat(currencyFormat); var priceResult = priceCalculator.GetPriceResultForProduct(product, priceModifiersBuilder); var expected = @"Cost = 20.25 USD " + "Tax = 4.25 USD " + "Discounts = 4.24 USD " + "Transport = 0.61 USD " + "TOTAL = 20.87 USD"; var actual = priceResult.ToString().CleanseString(); Assert.Equal(expected, actual); }
public void Product_Price_With_Additional_Precision() { var transport = PriceDependencies.GetExpense("Transport", new PercentageCost(0.03M)); priceModifiersBuilder = new ProductModifiersBuilder() .WithDiscount(universalDiscount) .WithTax(taxPercent21) .WithExpense(transport) .WithDiscount(specialDiscountSpecificForProduct) .WithMultiplicativeCalculation(); var priceResult = priceCalculator.GetPriceResultForProduct(product, priceModifiersBuilder); var expectedPrice = new Money(20.87M); var actual = priceResult.Total; Assert.Equal(expectedPrice, actual); }