public void TestOrderEspressoWithNoCondiments()
        {
            Beverage beverage = new Espresso();
            string   test     = $"{beverage.GetDescription()} ${beverage.Cost().ToString("0.00")}";

            Assert.AreEqual(test, "Espresso $1.99");
        }
예제 #2
0
        private static void Coffee()
        {
            Beverage beverage = new Espresso();

            Console.WriteLine(beverage.GetDescription() + " $" + beverage.Cost());
            beverage = new Venti(beverage);
            Console.WriteLine(beverage.GetDescription() + " $" + beverage.Cost());

            Beverage beverage2 = new HouseBlend();

            beverage2 = new Mocha(beverage2);
            beverage2 = new Soy(beverage2);
            beverage2 = new Whip(beverage2);
            Console.WriteLine(beverage2.GetDescription() + " $" + beverage2.Cost());
            beverage2 = new Tall(beverage2);
            Console.WriteLine(beverage2.GetDescription() + " $" + beverage2.Cost());

            Beverage beverage3 = new DarkRoast();

            beverage3 = new Mocha(beverage3);
            beverage3 = new Mocha(beverage3);
            beverage3 = new Whip(beverage3);
            Console.WriteLine(beverage3.GetDescription() + " $" + beverage3.Cost());
            beverage3 = new Grande(beverage3);
            Console.WriteLine(beverage3.GetDescription() + " $" + beverage3.Cost());
        }
예제 #3
0
        static void Main(string[] args)
        {
            Beverage beverage = new Espresso();

            Console.WriteLine(beverage.GetDescription() + " $" + beverage.Cost());

            Beverage beverage2 = new DarkRoast();

            beverage2.SetSize(Beverage.Size.VENTI);
            beverage2 = new Mocha(beverage2);
            beverage2 = new Mocha(beverage2);
            beverage2 = new Whip(beverage2);

            Console.WriteLine(beverage2.GetDescription() + " $" + beverage2.Cost());

            Beverage beverage3 = new DarkRoast();

            beverage3.SetSize(Beverage.Size.GRANDE);
            beverage3 = new Soy(beverage3);
            beverage3 = new Mocha(beverage3);
            beverage3 = new Whip(beverage3);

            Console.WriteLine(beverage3.GetDescription() + " $" + beverage3.Cost());

            Console.ReadLine();
        }
예제 #4
0
        static void Main(string[] args)
        {
            var beverage = new Espresso();

            Console.WriteLine(beverage.GetDescription() + " $" + beverage.Cost());

            Beverage beverage2 = new HouseBlend();

            beverage2 = new Mocha(beverage2);
            Console.WriteLine(beverage2.GetDescription() + " $" + beverage2.Cost());
        }
예제 #5
0
        static void Main(string[] args)
        {
            Beverage espresso = new Espresso();

            System.Console.WriteLine(espresso.GetDescription() + "   -   " + espresso.Cost());

            Beverage espressoMocha = new Mocha(espresso);

            System.Console.WriteLine(espressoMocha.GetDescription() + "   -   " + espressoMocha.Cost());

            System.Console.ReadLine();
        }
예제 #6
0
        /// <summary>
        /// The Decorator Pattern attaches additional
        /// responsibilities to an object dynamically.
        /// Decorators provide a flixible alternative to
        /// subclassing for extending functionality.
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            var beverage = new Espresso();

            Console.WriteLine($"{beverage.GetDescription()} $ {beverage.Cost()}");

            Beverage beverage2 = new HouseBlend();

            beverage2 = new Soy(beverage2);
            beverage2 = new Mocha(beverage2);
            beverage2 = new Whip(beverage2);
            Console.WriteLine($"{beverage2.GetDescription()} $ {beverage2.Cost()}");
        }
예제 #7
0
        static void Main(string[] args)
        {
            Beverage beverage = new Espresso();

            Console.WriteLine(beverage.GetDescription() + " $" + beverage.Cost());

            Beverage beverage2 = new DarkRoast();

            beverage2 = new Mocha(beverage2);
            beverage2 = new Mocha(beverage2);
            beverage2 = new Whip(beverage2);
            Console.WriteLine(beverage2.GetDescription() + " $" + beverage2.Cost());

            Console.ReadKey();
        }
예제 #8
0
        static void Main(string[] args)
        {
            var firstOrder       = new MilkDecorator(new SugarDecorator(new Espresso()));
            var billOfFirstOrder = $"Price of {firstOrder.GetDescription()} is {firstOrder.GetCost()} dollars";

            var secondOrder       = new Espresso();
            var billOfSecondOrder = $"Price of {secondOrder.GetDescription()} is {secondOrder.GetCost()} dollars";

            var thirdOrder       = new SugarDecorator(new SugarDecorator(new MilkDecorator(new Espresso())));
            var billOfThirdOrder = $"Price of {thirdOrder.GetDescription()} is {thirdOrder.GetCost()} dollars";


            Console.WriteLine(billOfFirstOrder);
            Console.WriteLine(billOfSecondOrder);
            Console.WriteLine(billOfThirdOrder);
            Console.ReadKey();
        }
예제 #9
0
        public static void Main(string[] args)
        {
            Beverage beverage = new Espresso();

            Console.WriteLine(beverage.GetDescription() + " $ " + beverage.Cost());

            Beverage c1 = new DarkRoast();

            c1 = new Mocha(c1);
            c1 = new Mocha(c1);
            c1 = new Whip(c1);
            Console.WriteLine(c1.GetDescription() + " $ " + c1.Cost());

            Beverage b3 = new HouseBlend();

            b3 = new Soy(b3);
            b3 = new Mocha(b3);
            b3 = new Whip(b3);
            Console.WriteLine(b3.GetDescription() + " $ " + b3.Cost());
        }
예제 #10
0
        static void Main()
        {
            Beverage espresso = new Espresso();

            Console.WriteLine($"{espresso.GetDescription()} ${espresso.Cost()}");

            Beverage darkRoast = new DarkRoast();

            darkRoast = new Mocha(darkRoast);
            darkRoast = new Mocha(darkRoast);
            darkRoast = new Whip(darkRoast);
            Console.WriteLine($"{darkRoast.GetDescription()} ${darkRoast.Cost()}");

            Beverage houseBlend = new HouseBlend();

            houseBlend = new Soy(houseBlend);
            houseBlend = new Mocha(houseBlend);
            houseBlend = new Whip(houseBlend);
            Console.WriteLine($"{houseBlend.GetDescription()} ${houseBlend.Cost()}");
        }
예제 #11
0
        static void Main(string[] args)
        {
            Beverage beverage = new Espresso();

            Console.WriteLine(beverage.GetDescription() + " $" + beverage.Cost());

            Beverage darkRoast = new DarkRoast();

            darkRoast = new Mocha(darkRoast);
            darkRoast = new Mocha(darkRoast);
            darkRoast = new Whip(darkRoast);
            Console.WriteLine(darkRoast.GetDescription() + " $" + darkRoast.Cost());

            Beverage houseBlend = new HouseBlend();

            houseBlend = new Soya(houseBlend);
            houseBlend = new Mocha(houseBlend);
            houseBlend = new Whip(houseBlend);
            Console.WriteLine(houseBlend.GetDescription() + " $" + houseBlend.Cost());
        }
        public void should_return_espresso_when_get_espresso_description()
        {
            var espresso = new Espresso(false, false);

            Assert.Equal("Espresso", espresso.GetDescription());
        }