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); }
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); }
// -> Indicators private void SetIndicatorLight(IndicatorLight light) { _light = light; RaisePropertyChanged("IsRedLightOn"); RaisePropertyChanged("IsGreenLightOn"); RaisePropertyChanged("IsYellowLightOn"); }
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); }
private void InitResult16BitsLights() { _resultLights16 = new IndicatorLight[16]; for (var i = 0; i < 16; i++) { _resultLights16[i] = new IndicatorLight(); } }
private void Init8BitsLights() { _8BitsResultLights = new IndicatorLight[8]; for (var i = 0; i < 8; i++) { _8BitsResultLights[i] = new IndicatorLight(); } }
private void Init16BitsLights() { _16BitsResultLights = new IndicatorLight[16]; for (var i = 0; i < 16; i++) { _16BitsResultLights[i] = new IndicatorLight(); } }
private void InitResult8BitsLights() { _resultLights8 = new IndicatorLight[8]; for (var i = 0; i < 8; i++) { _resultLights8[i] = new IndicatorLight(); } }
public void InvertorNotConnectToPower() { IndicatorLight light = new IndicatorLight(); Invertor invertor = new Invertor(); invertor.Output.ConnectTo(light.Input); Assert.IsTrue(light.Lighting); }
public void InvertRelayNotConnectToPower() { IndicatorLight light = new IndicatorLight(); Relay relay = new Relay(invert: true); relay.Output.ConnectTo(light.Input); Assert.IsTrue(light.Lighting); }
// CONSTRUCTOR public UserSection() { _insulatorManager = InsulatorSetDataManager.Instance; _alternativeInputMode = false; _isIntegrityReportShown = false; _light = IndicatorLight.None; IntegrityReport = new ObservableCollection <string>(); Spans = new ObservableCollection <UserSpan>(); CreateBasicSection(); }
private void AssertCarryEquals(IndicatorLight carryLight, Int32 bits, String binaryResult) { Boolean carry = false; if (binaryResult.Length > bits) { carry = (binaryResult[0] == '1' ? true : false); } Assert.AreEqual(carryLight.Lighting, carry); }
public FlipFlopTest() { _powerSet = new PowerSupplier(); _powerClear = new PowerSupplier(); _light = new IndicatorLight(); _flipFlop = new FlipFlop(); _flipFlop.Set.ConnectTo(_powerSet.Output); _flipFlop.Clear.ConnectTo(_powerClear.Output); _flipFlop.Output.ConnectTo(_light.Input); }
public HalfAdderTest() { _halfAdder = new HalfAdder(); _power1 = new PowerSupplier(); _power2 = new PowerSupplier(); _lightSum = new IndicatorLight(); _lightCarry = new IndicatorLight(); _halfAdder.Number1In.ConnectTo(_power1.Output); _halfAdder.Number2In.ConnectTo(_power2.Output); _halfAdder.Sum.ConnectTo(_lightSum.Input); _halfAdder.CarryOut.ConnectTo(_lightCarry.Input); }
public DTypeFlipFlopTest() { _powerDataLevelTriggered = new PowerSupplier(); _powerClockLevelTriggered = new PowerSupplier(); _lightQLevelTriggered = new IndicatorLight(); _lightQBarLevelTriggered = new IndicatorLight(); _DTypeFlipFlopLevelTriggered = new DTypeFlipFlopLevelTriggered(); _DTypeFlipFlopLevelTriggered.Data.ConnectTo(_powerDataLevelTriggered.Output); _DTypeFlipFlopLevelTriggered.Clock.ConnectTo(_powerClockLevelTriggered.Output); _DTypeFlipFlopLevelTriggered.Q.ConnectTo(_lightQLevelTriggered.Input); _DTypeFlipFlopLevelTriggered.QBar.ConnectTo(_lightQBarLevelTriggered.Input); }
public RSFlipFlopTest() { _powerSet = new PowerSupplier(); _powerReset = new PowerSupplier(); _lightSet = new IndicatorLight(); _lightReset = new IndicatorLight(); _RS = new RSFlipFlop(); _RS.Set.ConnectTo(_powerSet.Output); _RS.Reset.ConnectTo(_powerReset.Output); _RS.Q.ConnectTo(_lightSet.Input); _RS.QBar.ConnectTo(_lightReset.Input); }
private void Init16Bits() { _16BitsNumber1Switches = new Switches(16); _16BitsNumber2Switches = new Switches(16); Init16BitsLights(); _turnSub16Bits = new PowerSupplier(); _overflowUnderflowLight16Bits = new IndicatorLight(); _16BitsAdderSuber = new AdderSubtractor <Adder16Bits, Complementor16Bits>(); _16BitsAdderSuber.Number1Inputs.Connect(_16BitsNumber1Switches.Outputs); _16BitsAdderSuber.Number2Inputs.Connect(_16BitsNumber2Switches.Outputs); _16BitsAdderSuber.TurnSubstract.ConnectTo(_turnSub16Bits.Output); _16BitsAdderSuber.ResultOutputs.Connect(_16BitsResultLights.Select(l => l.Input as InputEndpoint)); _16BitsAdderSuber.OverflowUnderflow.ConnectTo(_overflowUnderflowLight16Bits.Input); }
private void Init16BitsTest() { _16BitsNumber1Switches = new Switches(16); _16BitsNumber2Switches = new Switches(16); Init16BitsLights(); _carryInPowerFor16Bits = new PowerSupplier(); _carryOutLightFor16Bits = new IndicatorLight(); _16BitsAdder = new Adder16Bits(); _16BitsAdder.Number1Inputs.Connect(_16BitsNumber1Switches.Outputs); _16BitsAdder.Number2Inputs.Connect(_16BitsNumber2Switches.Outputs); _16BitsAdder.CarryInput.ConnectTo(_carryInPowerFor16Bits.Output); _16BitsAdder.SumOutputs.Connect(_16BitsSumLights.Select(l => l.Input as InputEndpoint)); _16BitsAdder.CarryOutput.ConnectTo(_carryOutLightFor16Bits.Input); }
public Decoder2To4Test() { _power1 = new PowerSupplier(); _power2 = new PowerSupplier(); _light11 = new IndicatorLight(); _light10 = new IndicatorLight(); _light01 = new IndicatorLight(); _light00 = new IndicatorLight(); _decoder = new Decoder2To4(); _decoder.Input1.ConnectTo(_power1.Output); _decoder.Input2.ConnectTo(_power2.Output); _decoder.Output11.ConnectTo(_light11.Input); _decoder.Output10.ConnectTo(_light10.Input); _decoder.Output01.ConnectTo(_light01.Input); _decoder.Output00.ConnectTo(_light00.Input); }
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); }
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 ClearBackToBasicSection() { int index = Spans.Count - 1; UserSpan span; if (Spans.Count > 2) { do { span = Spans.Last(); span.PropertyChanged -= OnUserSpanPropertyChanged; Spans.Remove(span); index--; } while (index > 1); } foreach (UserSpan remainingSpan in Spans) { remainingSpan.Clear(); } OrderingSection(); _light = IndicatorLight.None; }
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); }