public void PowerWireLight()
        {
            PowerSupplier  power = new PowerSupplier();
            Wire           wire  = new Wire();
            IndicatorLight light = new IndicatorLight();

            wire.Connect(power.Output, light.Input);

            Assert.IsFalse(light.Lighting);

            power.On();
            Assert.IsTrue(light.Lighting);
            power.On();
            Assert.IsTrue(light.Lighting);
            power.Off();
            Assert.IsFalse(light.Lighting);
            power.Off();
            Assert.IsFalse(light.Lighting);
            power.Toggle();
            Assert.IsTrue(light.Lighting);
            power.Toggle();
            Assert.IsFalse(light.Lighting);
            power.Toggle();
            Assert.IsTrue(light.Lighting);
            power.Toggle();
            Assert.IsFalse(light.Lighting);

            power.On();
            Assert.IsTrue(light.Lighting);
            light.Input.DisconnectEndpoint();
            Assert.IsFalse(light.Lighting);
            power.On();
            Assert.IsFalse(light.Lighting);
        }
        public void NOR()
        {
            PowerSupplier  power1  = new PowerSupplier();
            PowerSupplier  power2  = new PowerSupplier();
            NORGate        norGate = new NORGate();
            IndicatorLight light   = new IndicatorLight();

            norGate.Output.ConnectTo(light.Input);
            Assert.IsTrue(light.Lighting);

            norGate.Input1.ConnectTo(power1.Output);
            norGate.Input2.ConnectTo(power2.Output);
            Assert.IsTrue(light.Lighting);

            power1.On();
            power2.Off();
            Assert.IsFalse(light.Lighting);
            power1.Off();
            power2.On();
            Assert.IsFalse(light.Lighting);
            power1.On();
            power2.On();
            Assert.IsFalse(light.Lighting);
            power1.Off();
            power2.Off();
            Assert.IsTrue(light.Lighting);
        }
Exemple #3
0
        public void InvertRelayWithContactInput()
        {
            PowerSupplier  power1 = new PowerSupplier();
            PowerSupplier  power2 = new PowerSupplier();
            IndicatorLight light  = new IndicatorLight();
            Relay          relay  = new Relay(invert: true);

            relay.Input.ConnectTo(power1.Output);
            relay.InputOfContact.ConnectTo(power2.Output);
            relay.Output.ConnectTo(light.Input);

            Assert.IsFalse(light.Lighting);
            power1.On();
            power2.Off();
            Assert.IsFalse(light.Lighting);
            power1.On();
            power2.On();
            Assert.IsFalse(light.Lighting);
            power1.Off();
            power2.On();
            Assert.IsTrue(light.Lighting);
            power1.Off();
            power2.Off();
            Assert.IsFalse(light.Lighting);
        }
Exemple #4
0
 public void TestInit()
 {
     _switches8.Clear();
     _switches16.Clear();
     _invertPwr.Off();
     _invertPwr16.Off();
 }
 public void TestInit()
 {
     _8BitsNumber1Switches.Clear();
     _8BitsNumber2Switches.Clear();
     _turnSub8Bits.Off();
     _16BitsNumber1Switches.Clear();
     _16BitsNumber2Switches.Clear();
     _turnSub16Bits.Off();
 }
Exemple #6
0
 public void TestInit()
 {
     _8BitsNumber1Switches.Clear();
     _8BitsNumber2Switches.Clear();
     _16BitsNumber1Switches.Clear();
     _16BitsNumber2Switches.Clear();
     _carryInPowerFor8Bits.Off();
     _carryInPowerFor16Bits.Off();
 }
Exemple #7
0
        public void InvertRelay()
        {
            PowerSupplier  power = new PowerSupplier();
            IndicatorLight light = new IndicatorLight();
            Relay          relay = new Relay(invert: true);

            relay.Input.ConnectTo(power.Output);
            relay.Output.ConnectTo(light.Input);

            power.On();
            Assert.IsFalse(light.Lighting);
            power.Off();
            Assert.IsTrue(light.Lighting);
            power.Toggle();
            Assert.IsFalse(light.Lighting);
            power.Toggle();
            Assert.IsTrue(light.Lighting);
        }
Exemple #8
0
        public void DefaultInvertor()
        {
            PowerSupplier  power    = new PowerSupplier();
            IndicatorLight light    = new IndicatorLight();
            Invertor       invertor = new Invertor();

            invertor.Input.ConnectTo(power.Output);
            invertor.Output.ConnectTo(light.Input);

            power.On();
            Assert.IsFalse(light.Lighting);
            power.Off();
            Assert.IsTrue(light.Lighting);
            power.Toggle();
            Assert.IsFalse(light.Lighting);
            power.Toggle();
            Assert.IsTrue(light.Lighting);
        }
 public void TestInit()
 {
     _power1.Off();
     _power2.Off();
 }
Exemple #10
0
 public void TestInit()
 {
     _powerDataLevelTriggered.Off();
     _powerClockLevelTriggered.Off();
 }
Exemple #11
0
 public void TestInit()
 {
     _powerSet.Off();
     _powerReset.Off();
 }
 public void TestInit()
 {
     _oscillator10Hz.Output.DisconnectEndpoint();
     _startPower.Off();
     _count = 0;
 }
 public void TestInit()
 {
     _powerSet.Off();
     _powerClear.Off();
 }
        public void MultiOR()
        {
            PowerSupplier power1   = new PowerSupplier();
            PowerSupplier power2   = new PowerSupplier();
            PowerSupplier power3   = new PowerSupplier();
            PowerSupplier power4   = new PowerSupplier();
            PowerSupplier power5   = new PowerSupplier();
            MultiORGate   mtORGate = new MultiORGate(5);

            mtORGate.ConnectInputsWith(power1.Output, power2.Output, power3.Output, power4.Output, power5.Output);
            IndicatorLight light = new IndicatorLight();

            mtORGate.Output.ConnectTo(light.Input);
            Assert.IsFalse(light.Lighting);

            power1.On();
            power2.Off();
            power3.Off();
            power4.Off();
            power5.Off();
            Assert.IsTrue(light.Lighting);
            power1.On();
            power2.On();
            power3.Off();
            power4.Off();
            power5.Off();
            Assert.IsTrue(light.Lighting);
            power1.On();
            power2.On();
            power3.On();
            power4.Off();
            power5.Off();
            Assert.IsTrue(light.Lighting);
            power1.On();
            power2.On();
            power3.On();
            power4.On();
            power5.Off();
            Assert.IsTrue(light.Lighting);
            power1.On();
            power2.On();
            power3.On();
            power4.On();
            power5.On();
            Assert.IsTrue(light.Lighting);
            power1.Off();
            power2.On();
            power3.Off();
            power4.Off();
            power5.Off();
            Assert.IsTrue(light.Lighting);
            power1.Off();
            power2.On();
            power3.On();
            power4.Off();
            power5.Off();
            Assert.IsTrue(light.Lighting);
            power1.Off();
            power2.On();
            power3.On();
            power4.On();
            power5.Off();
            Assert.IsTrue(light.Lighting);
            power1.Off();
            power2.On();
            power3.On();
            power4.On();
            power5.On();
            Assert.IsTrue(light.Lighting);
            power1.Off();
            power2.Off();
            power3.On();
            power4.Off();
            power5.Off();
            Assert.IsTrue(light.Lighting);
            power1.Off();
            power2.Off();
            power3.On();
            power4.On();
            power5.Off();
            Assert.IsTrue(light.Lighting);
            power1.Off();
            power2.Off();
            power3.On();
            power4.On();
            power5.On();
            Assert.IsTrue(light.Lighting);
            power1.Off();
            power2.Off();
            power3.Off();
            power4.On();
            power5.Off();
            Assert.IsTrue(light.Lighting);
            power1.Off();
            power2.Off();
            power3.Off();
            power4.On();
            power5.On();
            Assert.IsTrue(light.Lighting);
            power1.Off();
            power2.Off();
            power3.Off();
            power4.Off();
            power5.On();
            Assert.IsTrue(light.Lighting);
            power1.Off();
            power2.Off();
            power3.Off();
            power4.Off();
            power5.Off();
            Assert.IsFalse(light.Lighting);
        }