public void Verify_Tax_Rate_Is_Correct() { var calc = new RecipeCalculator(); var chicken = new IngredientBO() { Id = 1, ProductId = 4, Quantity = 17, RecipeId = 1, UnitType = Enums.UnitTypes.None }; decimal beforeTax = calc.BeforeTaxPrice(chicken); decimal afterTax = calc.ApplySalesTax(beforeTax); var percentageDifference = Math.Round((Math.Round((afterTax - beforeTax), 2) / beforeTax), 3) * 100; Assert.IsNotNull(beforeTax); Assert.IsNotNull(afterTax); Assert.IsNotNull(percentageDifference); Assert.AreEqual(TaxRate, percentageDifference); }
public void Verify_Price_Before_Tax() { var calc = new RecipeCalculator(); var quantity = 2; var chicken = new IngredientBO() { Id = 1, ProductId = 4, Quantity = quantity, RecipeId = 1, UnitType = Enums.UnitTypes.None }; var expected = (quantity * 2.19m); decimal beforeTax = calc.BeforeTaxPrice(chicken); Assert.IsNotNull(beforeTax); Assert.AreEqual(expected, beforeTax); }