public void Totals_Are_Using_Correct_Adjustment_Rates()
        {
            var calc = new RecipeCalculator();
            var receiptItems = calc.CreateRecipeReceipt(CreateRecipeTwo());
            var receiptTotals = calc.TotalCost(receiptItems);

            decimal beforeTax = receiptItems.FirstOrDefault(chicken => chicken.ProductId == 4).BeforeTaxTotal;
            decimal afterTax = calc.ApplySalesTax(beforeTax);
            var taxPercentageDifference = Math.Round((Math.Round((afterTax - beforeTax), 2) / beforeTax), 3) * 100;
            decimal beforeDiscount = receiptItems.FirstOrDefault(garlic => garlic.ProductId == 1).BeforeTaxTotal;
            decimal afterDiscount = calc.ApplyWellnessDiscount(beforeDiscount);
            var discountPercentageDifference = ((beforeDiscount - afterDiscount) / beforeDiscount) * 100;

            Assert.IsNotNull(receiptItems);
            Assert.IsNotNull(receiptTotals);
            Assert.AreNotEqual(0, receiptItems.Count);
            Assert.IsNotNull(discountPercentageDifference);
            Assert.AreEqual(WelnessDiscountRate, discountPercentageDifference);
            Assert.IsNotNull(taxPercentageDifference);
            Assert.AreEqual(TaxRate, taxPercentageDifference);

            //View receipt results in the Output pane.
            PrintReceiptToOutput(calc.CreateRecipeReceipt(CreateRecipeOne()), calc.TotalCost(calc.CreateRecipeReceipt(CreateRecipeOne())));
            PrintReceiptToOutput(calc.CreateRecipeReceipt(CreateRecipeTwo()), calc.TotalCost(calc.CreateRecipeReceipt(CreateRecipeTwo())));
            PrintReceiptToOutput(calc.CreateRecipeReceipt(CreateRecipeThree()), calc.TotalCost(calc.CreateRecipeReceipt(CreateRecipeThree())));
        }
        public void Retrieve_AdjustmentRate_Settings()
        {
            var calc = new RecipeCalculator();

            var salesTax = calc.AppSettings.SalesTax;

            Assert.IsNotNull(salesTax);
            Assert.AreEqual(TaxRate, salesTax);
        }
        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);
        }
        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);
        }