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);
        }
示例#2
0
 public void WithVatFromWithoutVat(int amountWithoutVat, int amountWithVat)
 {
     Assert.AreEqual(amountWithVat, VatCalculator.WithVat(amountWithoutVat, 19));
 }
示例#3
0
 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 WithVat(bool pricesAreIncludingVAT, int originalTotal, decimal vat, int summedParts)
 {
     return(pricesAreIncludingVAT ? originalTotal : VatCalculator.WithVat(originalTotal, vat));
 }