Пример #1
0
        static void Main(string[] args)
        {
            // ---------- DECORATOR ----------

            //Beverage beverage = new Espresso();
            //Console.WriteLine(beverage.getDescription() + " $" + beverage.Cost());


            //Beverage beverage2 = new Decaf();
            //beverage2 = new AlmondMilk(beverage2);
            //beverage2 = new RegularMilk(beverage2);

            //Console.WriteLine(beverage2.getDescription() + " $" + beverage2.Cost());


            // ------- PROXY -------

            //Console.WriteLine("\n\nPassing an employee with Barista Role to CafeBeaurocaryProxy");
            //Employee barista = new Employee("Sophie", Role.Barista);
            //CafeBeaurocracyProxy cafeOperationsProxy1 = new CafeBeaurocracyProxy(barista);
            //cafeOperationsProxy1.SignContracts();
            //cafeOperationsProxy1.HandleTaxes();

            //Console.WriteLine("\n\nPassing an employee with Manager Role to CafeBeaurocaryProxy");
            //Employee manager = new Employee("Laura", Role.Manager);
            //CafeBeaurocracyProxy cafeOperationsProxy2 = new CafeBeaurocracyProxy(manager);
            //cafeOperationsProxy2.SignContracts();
            //cafeOperationsProxy2.HandleTaxes();


            /// --------- FACADE ---------

            CoffeeMachine      coffeeMachine = new CoffeeMachine();
            CoffeMachineFacade facade        = new CoffeMachineFacade(coffeeMachine);

            Employee.MakeCoffe(facade);
        }
Пример #2
0
        static void Main(string[] args)
        {
            IConnector connector = new ConnectorProxy(new string[] { "google.com", "linkedin.com", "youtube.com", "facebook.com" });

            connector.Connect("geeksforgeeks.com");

            connector.Reload();

            connector.Connect("google.com");
            connector.Connect("linkedin.com");
            connector.Reload();

            CoffeMachineFacade coffeeMachine = new CoffeMachineFacade();

            coffeeMachine.Americano();

            coffeeMachine.Frappe();

            coffeeMachine.HotChocolate();

            coffeeMachine.SelfCleare();

            coffeeMachine.HotChocolate();
        }
Пример #3
0
 public static void MakeCoffe(CoffeMachineFacade facade)
 {
     facade.MakeCoffee();
 }