public void RemoteControlTest()
        {
            RemoteControl remoteControl = new RemoteControl();

            Light kitchenLight = new Light("Kitchen light");
            Light livingRoomLight = new Light("Living room light");
            Stereo livingRoomStereo = new Stereo("Living room stereo");

            LightOnCommand kitchenLightOnCommand = new LightOnCommand(kitchenLight);
            LightOffCommand kitchenLightOffCommand = new LightOffCommand(kitchenLight);
            LightOnCommand livingRoomLightOnCommand = new LightOnCommand(livingRoomLight);
            LightOffCommand livingRoomLightOffCommand = new LightOffCommand(livingRoomLight);
            StereoOnWithCDCommand stereoOnWithCdCommand = new StereoOnWithCDCommand(livingRoomStereo);
            StereoOffCommand stereoOffCommand = new StereoOffCommand(livingRoomStereo);

            remoteControl.SetCommand(0, kitchenLightOnCommand, kitchenLightOffCommand);
            remoteControl.SetCommand(1, livingRoomLightOnCommand, livingRoomLightOffCommand);
            remoteControl.SetCommand(2, stereoOnWithCdCommand, stereoOffCommand);

            Assert.AreEqual("Kitchen light is On", remoteControl.OnButtonWasPushed(0));
        }
        static void Main(string[] args)
        {
            RemoteControl remoteControl = new RemoteControl();

            Light kitchenLight = new Light("Kitchen light");
            Light livingRoomLight = new Light("Living room light");
            Stereo livingRoomStereo = new Stereo("Living room stereo");
            CeilingFan ceilingFan = new CeilingFan();

            LightOnCommand kitchenLightOnCommand = new LightOnCommand(kitchenLight);
            LightOffCommand kitchenLightOffCommand = new LightOffCommand(kitchenLight);
            LightOnCommand livingRoomLightOnCommand = new LightOnCommand(livingRoomLight);
            LightOffCommand livingRoomLightOffCommand = new LightOffCommand(livingRoomLight);
            StereoOnWithCDCommand stereoOnWithCdCommand = new StereoOnWithCDCommand(livingRoomStereo);
            StereoOffCommand stereoOffCommand = new StereoOffCommand(livingRoomStereo);

            CeilingFanHighCommand ceilingFanHighCommand = new CeilingFanHighCommand(ceilingFan);
            CeilingFanMediumCommand ceilingFanMediumCommand = new CeilingFanMediumCommand(ceilingFan);
            CeilingFanOffCommand ceilingFanOffCommand = new CeilingFanOffCommand(ceilingFan);

            remoteControl.SetCommand(0, kitchenLightOnCommand, kitchenLightOffCommand);
            remoteControl.SetCommand(1, livingRoomLightOnCommand, livingRoomLightOffCommand);
            remoteControl.SetCommand(2, stereoOnWithCdCommand, stereoOffCommand);

            Console.WriteLine(remoteControl.ToString());

            Console.WriteLine(remoteControl.OnButtonWasPushed(0));
            Console.WriteLine(remoteControl.OffButtonWasPushed(0));
            Console.WriteLine(remoteControl.OnButtonWasPushed(1));
            Console.WriteLine(remoteControl.OffButtonWasPushed(1));
            Console.WriteLine(remoteControl.OnButtonWasPushed(2));
            Console.WriteLine(remoteControl.OffButtonWasPushed(2));

            RemoteControlWithUndo remoteControlWithUndo = new RemoteControlWithUndo();

            remoteControlWithUndo.SetCommand(0, kitchenLightOnCommand, kitchenLightOffCommand);
            remoteControlWithUndo.SetCommand(1, ceilingFanHighCommand, ceilingFanOffCommand);
            remoteControlWithUndo.SetCommand(2, ceilingFanMediumCommand, ceilingFanOffCommand);

            Console.WriteLine();
            Console.WriteLine(remoteControlWithUndo.ToString());

            Console.WriteLine(remoteControlWithUndo.OnButtonWasPushed(0));
            Console.WriteLine(remoteControlWithUndo.OffButtonWasPushed(0));
            Console.WriteLine(remoteControlWithUndo.UndoButtonWasPushed());

            Console.WriteLine(remoteControlWithUndo.OffButtonWasPushed(0));

            Console.WriteLine();
            Console.WriteLine(remoteControlWithUndo.ToString());

            Console.WriteLine(remoteControlWithUndo.UndoButtonWasPushed());
            Console.WriteLine("CEILING FAN");
            Console.WriteLine();

            Console.WriteLine(remoteControlWithUndo.OnButtonWasPushed(1));
            Console.WriteLine(remoteControlWithUndo.OffButtonWasPushed(1));
            Console.WriteLine(remoteControlWithUndo.ToString());
            Console.WriteLine(remoteControlWithUndo.UndoButtonWasPushed());

            Console.WriteLine(remoteControlWithUndo.OnButtonWasPushed(2));
            Console.WriteLine(remoteControlWithUndo.ToString());
            Console.WriteLine(remoteControlWithUndo.UndoButtonWasPushed());

            Console.WriteLine("\r\n-----------PARTY------------\r\n");

            RemoteControlWithUndo partyRemoteControl = new RemoteControlWithUndo();

            Light partyLight = new Light("Party room");
            Stereo partyStereo = new Stereo("Party room");
            CeilingFan partyCeilingFan = new CeilingFan();

            LightOnCommand lightOn = new LightOnCommand(partyLight);
            LightOffCommand lightOff = new LightOffCommand(partyLight);
            StereoOnWithCDCommand stereoOnWithCd = new StereoOnWithCDCommand(partyStereo);
            StereoOffCommand stereoOff = new StereoOffCommand(partyStereo);
            CeilingFanHighCommand ceilingFanHigh = new CeilingFanHighCommand(partyCeilingFan);
            CeilingFanOffCommand ceilingFanOff = new CeilingFanOffCommand(partyCeilingFan);

            ICommand[] partyOn = {lightOff, stereoOnWithCd, ceilingFanHigh};
            ICommand[] partyOff = {lightOn, stereoOff, ceilingFanOff};

            partyRemoteControl.SetCommand(0, new MacroCommand(partyOn), new MacroCommand(partyOff));

            Console.WriteLine(partyRemoteControl.OnButtonWasPushed(0));
            Console.WriteLine();

            Console.WriteLine(partyRemoteControl.OffButtonWasPushed(0));
            Console.WriteLine();

            Console.WriteLine(partyRemoteControl.UndoButtonWasPushed());
            Console.ReadLine();
        }
 public StereoOffCommand(Stereo stereo)
 {
     this.stereo = stereo;
 }