public void ShouldGetCost() { //Arrange var drinks = new List <IDrink>() { new MilkDecorator(new SugarDecorator(new Tea())), new SugarDecorator(new IceTea()), new ChocolateDecorator(new MilkDecorator(new SugarDecorator((new Expresso())))) }; //Act /* Values to check * Hot Tea with Milk and Sugar * Ice Tea with Sugar * Expresso with Chocolate and Milk and Sugar * */ double actualCost = AcuCafeLibrary.GetCost(CafeFactory.CreateDrink("Expresso with Chocolate and Milk and Sugar")); //Assert /* Values to check * Hot Tea with Milk and Sugar - 2 * Ice Tea with Sugar - 2 * Expresso with Chocolate and Milk and Sugar - 2.75 * */ Assert.Equal(2.75, actualCost); }
public static void Main(string[] args) { OpenApplication(); string input = Console.ReadLine(); //Check Valid Input bool isInputValid = CheckIfInputIsValid(input); if (isInputValid == true) { IDrink drink = CafeFactory.CreateDrink(ConfigurationManager.AppSettings[input]); if (drink != null) { AcuCafeLibrary.OrderDrink(drink); Console.WriteLine($"The cost of your drink is {AcuCafeLibrary.GetCost(drink)}"); } else { Console.WriteLine("Drink unavailable"); } } else { Console.WriteLine("Invalid Input\n"); } }
public void ShouldSupportCondiments() { //Arrange var drinks = new List <IDrink>() { new MilkDecorator(new SugarDecorator(new Tea())), new SugarDecorator(new IceTea()), new ChocolateDecorator(new MilkDecorator(new SugarDecorator((new Expresso())))) }; //Act /* Values to check * Hot Tea with Milk and Sugar * Ice Tea with Sugar * Expresso with Chocolate and Milk and Sugar * */ IDrink actual = AcuCafeLibrary.OrderDrink(CafeFactory.CreateDrink("Expresso with Chocolate and Milk and Sugar")); //Asert Assert.Equal(drinks[2].Description, actual.Description); }