Exemplo n.º 1
0
        static void Main()
        {
            IWarningLight[] lights = new IWarningLight[3];
            lights[0] = new OilLevelLight();
            lights[1] = new BrakeFluidLight();
            lights[2] = new NullObjectLight(); // empty slot

            // No need to test for null...
            foreach (IWarningLight currentLight in lights)
            {
                currentLight.On();
                currentLight.Off();
            }
            Console.Read();
        }
        public void NullObjectTestCase()
        {
            var lights = new IWarningLight[3];
            lights[0] = new OilLevelLight();
            lights[1] = new BrakeFluidLight();
            lights[2] = new NullObjectLight();

            foreach (var warningLight in lights)
            {
                //no requiere validar si es o no null
                warningLight.TurnOn();
                warningLight.TurnOff();
            }

            //todo define tests
        }