private void CheckGate(IFlowGate gate, bool[] results) { this.CheckGate(gate, false, false, results[0]); this.CheckGate(gate, false, true, results[1]); this.CheckGate(gate, true, false, results[2]); this.CheckGate(gate, true, true, results[3]); }
private void CheckGate(IFlowGate gate, bool x, bool y, bool q) { bool wasFired = false; Action<bool> action = (signal) => { Assert.AreEqual(q, signal); wasFired=true; }; gate.Out += action; gate.A(x); gate.B(y); gate.Out -= action; Assert.IsTrue(wasFired,"No fired!"); }