public void CalculateTax_WithValidInput_ReturnsExpectedValue() { IDeliveryTaxCalculator deliveryTaxCalculator = new DeliveryTaxCalculator(); var deliveryTax = deliveryTaxCalculator.CalculateTax(200); Assert.AreEqual(205, deliveryTax); }
public void GetCalculatedTax_WithValidInput_ReturnsExpectedType() { IDeliveryTaxCalculator deliveryTaxCalculator = new DeliveryTaxCalculator(); DeliveryTaxCalculationContext deliveryTaxContext = new DeliveryTaxCalculationContext(deliveryTaxCalculator); var deliveryTax = deliveryTaxContext.GetCalculatedTax(200); Assert.IsInstanceOf(typeof(double), deliveryTax); }
public double BuildMealForUser(List <FoodMenuModel> selectedMealItems) { Console.WriteLine("______________________________"); Console.WriteLine("You selected those items:"); Console.WriteLine("______________________________"); MealBuilder mealBuilder = new MealBuilder(); mealBuilder.PrepareMeal(selectedMealItems); mealBuilder.meal.ShowItems(); var foodCost = mealBuilder.meal.ComputePrice(); var delivery = new DeliveryTaxCalculator(); var taxCalculationContext = new DeliveryTaxCalculationContext(delivery); Console.WriteLine($"Delivery fee: {delivery.deliveryTax} dollars"); var taxAmount = taxCalculationContext.GetCalculatedTax(foodCost); Console.WriteLine($"Total cost: {taxAmount}"); return(taxAmount); }