Ejemplo n.º 1
0
        public static void TestMediator()
        {
            Console.WriteLine("----------------------Mediator----------------------");
            AlarmSystem system = new AlarmSystem();

            AlarmClock    clock         = new AlarmClock(system);
            CoffeeMachine coffeeMachine = new CoffeeMachine(system);
            Heater        heater        = new Heater(system);
            Stereo        stereo        = new Stereo(system);

            system.SetAlarmClock(clock);
            system.SetCoffeeMachine(coffeeMachine);
            system.SetHeater(heater);
            system.SetStereo(stereo);

            clock.AlarmOn();
            Console.WriteLine("---------------------------------------------------\n");
        }