Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Context ctx = new Context(new IAmOn());

            ctx.pressedOff();
            ctx.pressedOn();
            ctx.pressedOff();
            ctx.pressedOff();
            ctx.pressedOn();
            ctx.pressedOn();
            ctx.pressedFix();
            ctx.pressedFix();
            ctx.pressedOff();
            ctx.pressedOn();
            ctx.pressedFix();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Context ctx = new Context(new IAmOn());

            // Turning off
            ctx.pressedOff();
            // Turning on
            ctx.pressedOn();
            // Broken
            ctx.pressedOn();
            // Still broken
            ctx.pressedOn();
            // Still broken
            ctx.pressedOff();
            // Fix
            ctx.pressedFix();
            // Already off
            ctx.pressedOff();
        }