public int GetPrice(ISellableUnitPriceSource unit, bool vat, bool discounted = true, bool sale = true, bool ranged = true) { var unitDiscounted = GetOriginalPrice(unit, discounted, sale, ranged); if (vat && !unit.PricesAreIncludingVAT) { return(VatCalculator.WithVat(unitDiscounted, unit.Vat)); } if (!vat && unit.PricesAreIncludingVAT) { return(VatCalculator.WithoutVat(unitDiscounted, unit.Vat)); } return(unitDiscounted); }
public void WithoutVatFromWithVat(int amountWithVat, int amountWithoutVat) { Assert.AreEqual(amountWithoutVat, VatCalculator.WithoutVat(amountWithVat, 19)); }
public void WithoutVat() { Assert.AreEqual(84, VatCalculator.WithoutVat(100, 19)); Assert.AreEqual(85, VatCalculator.WithoutVat(101, 19)); }
public void CaclulatingBackAndForthShouldReturnSamePrice(int amount) { Assert.AreEqual(amount, VatCalculator.WithoutVat(VatCalculator.WithVat(amount, 19), 19)); Console.WriteLine(VatCalculator.WithoutVat(amount, 19)); Assert.AreEqual(amount, VatCalculator.WithVat(VatCalculator.WithoutVat(amount, 19), 19)); }
public int WithoutVat(bool pricesAreIncludingVAT, int originalTotal, decimal vat, int summedParts) { return(pricesAreIncludingVAT ? VatCalculator.WithoutVat(originalTotal, vat) : originalTotal); }