public void AfterTaxPrice_Should_Equal_To_PreTaxPrice_When_TaxRate_Is_Zero() { const decimal preTaxPrice = 12.49m; var taxRounder = new Mock<ITaxRounder>(); var calc = new TaxCalculater(0, taxRounder.Object); decimal price = calc.CalculateTax(preTaxPrice) + preTaxPrice; Assert.AreEqual(preTaxPrice, price); }
public void CalculateIncomeTaxSuccessfully() { TaxCalculater calculater = new TaxCalculater(); var result = calculater.CalculateIncomeTax(60050); Assert.IsTrue(result == 11063.25M); result = calculater.CalculateIncomeTax(120000); Assert.IsTrue(result == 32347M); }
public void AfterTaxPrice_Should_Be_Calculated_Correctly() { const decimal preTaxPrice = 14.99m; const decimal roundedTax = 1.50m; const decimal taxRate = 0.1m; var taxRounder = new Mock<ITaxRounder>(); taxRounder.Setup(x => x.Round(preTaxPrice * taxRate)).Returns(roundedTax); var calc = new TaxCalculater((double) taxRate, taxRounder.Object); decimal price = calc.CalculateTax(preTaxPrice) + preTaxPrice; const decimal expected = preTaxPrice + roundedTax; Assert.AreEqual(expected, price); }