static void Main(string[] args)
        {
            var tea = new Tea();

            tea.PrepareRecipe();

            var coffeeHook = new CoffeeWithHook();

            Console.WriteLine("\nMaking coffee...");
            coffeeHook.PrepareRecipe();

            var ducks = new Duck[]
            {
                new Duck("Daffy", 8),
                new Duck("Dewey", 2),
                new Duck("Howard", 7),
                new Duck("Louie", 2),
                new Duck("Donald", 10),
                new Duck("Huey", 2),
            };

            Console.WriteLine("Before sorting:");
            Display(ducks);

            Array.Sort(ducks);

            Console.WriteLine("\nAfter sorting:");
            Display(ducks);

            Console.ReadKey();
        }
Exemplo n.º 2
0
        public static void Template()
        {
            var tea    = new Tea();
            var coffee = new Coffee();

            tea.PrepareRecipe();
            coffee.PrepareRecipe();
        }
        static void Main(string[] args)
        {
            Tea    tea    = new Tea();
            Coffee coffee = new Coffee();

            tea.PrepareRecipe();
            coffee.PrepareRecipe();
        }
 public void TestTea()
 {
     teaResult.Append("Boiling water\n");
     teaResult.Append("Steeping the tea\n");
     teaResult.Append("Pouring into cup\n");
     teaResult.Append("Adding lemon\n");
     Assert.AreEqual(teaResult.ToString(), tea.PrepareRecipe());
 }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            Tea    tea    = new Tea();
            Coffee coffee = new Coffee();

            Console.WriteLine("Making tea...");
            tea.PrepareRecipe();
            Console.WriteLine("Making coffee...");
            coffee.PrepareRecipe();
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            Tea    tea    = new Tea();
            Coffee coffee = new Coffee();

            tea.PrepareRecipe();

            // coffee
            coffee.PrepareRecipe();
            Console.ReadKey();
        }
Exemplo n.º 7
0
        public static void TestTemplateMethodPattern()
        {
            Console.Clear();
            Tea myTea = new Tea();

            Console.WriteLine(myTea.PrepareRecipe());

            Coffee myCoffee = new Coffee();

            Console.WriteLine(myCoffee.PrepareRecipe());
        }
Exemplo n.º 8
0
    static void Main()
    {
        Tea    tea    = new Tea();
        Coffee coffee = new Coffee();

        System.Console.WriteLine("\nMaking tea...");
        tea.PrepareRecipe();

        System.Console.WriteLine("\nMaking coffee...");
        coffee.PrepareRecipe();
    }
        public void PrepareRecipe()
        {
            var tea = new Tea();

            tea.PrepareRecipe();

            Assert.IsTrue(this.sw.ToString().Contains(BeverageMessages.BoilWater));
            Assert.IsTrue(this.sw.ToString().Contains(BeverageMessages.SteepTeaBag));
            Assert.IsTrue(this.sw.ToString().Contains(BeverageMessages.PourInCup));
            Assert.IsTrue(this.sw.ToString().Contains(BeverageMessages.AddLemon));
        }
        public static void Start()
        {
            Console.WriteLine("Start making tea...");

            CaffeineBeverage myTea = new Tea();
            myTea.PrepareRecipe();

            Console.WriteLine("Start making coffee...");

            CaffeineBeverage myCoffee = new Coffee();
            myCoffee.PrepareRecipe();
        }
Exemplo n.º 11
0
        public static void Main(string[] args)
        {
            CaffeineBeverage caffeinatedBeverage;

            caffeinatedBeverage = new Coffee();
            caffeinatedBeverage.PrepareRecipe();

            Console.WriteLine();

            caffeinatedBeverage = new Tea();
            caffeinatedBeverage.PrepareRecipe();
        }
Exemplo n.º 12
0
        static void Template()
        {
            Console.WriteLine("Prepare tea");
            Tea tea = new Tea();

            tea.PrepareRecipe();
            Console.WriteLine();
            Console.WriteLine("Prepare coffee");
            Coffee coffee = new Coffee();

            coffee.PrepareRecipe();
        }
Exemplo n.º 13
0
        static void MakeTea()
        {
            var tea = new Tea();

            tea.PrepareRecipe();

            Console.WriteLine("***************");

            var coffe = new Coffee();

            coffe.PrepareRecipe();
        }
        static void Main(string[] args)
        {
            var coffee = new Coffee();
            var tea    = new Tea();

            Console.WriteLine("Making Tea...");
            tea.PrepareRecipe();

            Console.WriteLine("\nMaking Coffee...");
            coffee.PrepareRecipe();

            Console.ReadLine();
        }
Exemplo n.º 15
0
        static void Main(string[] args)
        {
            var coffee = new Coffee();
            var tea    = new Tea();

            System.Console.WriteLine("\nLet's make some coffee!");
            coffee.PrepareRecipe();

            System.Console.WriteLine("\nAnd some tea!");
            tea.PrepareRecipe();

            Console.ReadKey();
        }
Exemplo n.º 16
0
        public static void Main()
        {
            HotDrink tea = new Tea();

            Console.WriteLine(PrintMessages.PrepareDrink, nameof(Tea));
            tea.PrepareRecipe();

            Console.WriteLine();

            HotDrink coffee = new Coffee();

            Console.WriteLine(PrintMessages.PrepareDrink, nameof(Coffee));
            coffee.PrepareRecipe();
        }
Exemplo n.º 17
0
        public void MethodAbstraction()
        {
            CaffeineBeverage tea    = new Tea();
            CaffeineBeverage coffee = new Coffee();
            CaffeineBeverage coffeeWithHook_WantsCondiments      = new CoffeeWithHook();
            CaffeineBeverage coffeeWithHook_DoesntWantCondiments = new CoffeeWithHook();

            (coffeeWithHook_WantsCondiments as CoffeeWithHook).CustomerRequestedCondiments      = true;
            (coffeeWithHook_DoesntWantCondiments as CoffeeWithHook).CustomerRequestedCondiments = false;

            tea.PrepareRecipe();
            coffee.PrepareRecipe();
            coffeeWithHook_WantsCondiments.PrepareRecipe();
            coffeeWithHook_DoesntWantCondiments.PrepareRecipe();

            Assert.AreNotEqual(tea.Status, coffee.Status);
            Assert.AreEqual(coffeeWithHook_WantsCondiments.Status, coffee.Status);
            Assert.AreNotEqual(coffeeWithHook_DoesntWantCondiments.Status, coffeeWithHook_WantsCondiments.Status);
        }
        public void TemplateMethodTest()
        {
            Tea    tea    = new Tea();
            Coffee coffee = new Coffee();

            Console.WriteLine("${Environment.NewLine}Making tea...");
            tea.PrepareRecipe();

            Console.WriteLine($"{Environment.NewLine}Making coffee...");
            coffee.PrepareRecipe();

            TeaWithHook    teaHook    = new TeaWithHook();
            CoffeeWithHook coffeeHook = new CoffeeWithHook();

            Console.WriteLine($"{Environment.NewLine}Making tea...");
            teaHook.PrepareRecipe();

            Console.WriteLine($"{Environment.NewLine}Making coffee...");
            coffeeHook.PrepareRecipe();
        }
Exemplo n.º 19
0
        static void Main(string[] args)
        {
            Console.WriteLine("\n--- Tea ---");
            var tea = new Tea();

            tea.PrepareRecipe();

            Console.WriteLine("\n--- Coffee ---");
            var coffee = new Coffee();

            coffee.PrepareRecipe();

            Console.WriteLine("\n--- Tea (with hook)---");
            var teaWithHook = new TeaWithHook();

            teaWithHook.PrepareRecipe();

            Console.WriteLine("\n--- Coffee (with hook) ---");
            var coffeeWithHook = new CoffeeWithHook();

            coffeeWithHook.PrepareRecipe();
        }
        private static void Main()
        {
            var myTea = new Tea();

            myTea.PrepareRecipe();
        }
Exemplo n.º 21
0
        static void Main(string[] args)
        {
            Tea MyTea = new Tea();

            MyTea.PrepareRecipe();
        }