public void FindInterceptionTest() { //| x1 x2 y1 | //|--+--[ ]--[OSR]--+--[/]----( )--| //| | y1 x3 | | //| +--[ ]---[ ]---+ | // Rung TestRung = new Rung(); var Y1 = new Coil(); Y1.Name = "1"; var X1 = new Contact(); X1.Name = "1"; var X2 = new Contact(); X2.Name = "2"; X2.IsInverted = true; var X3 = new Contact(); X3.Name = "2"; X3.IsInverted = true; var Y1C = new Contact(); Y1C.Name = "1"; Y1C.Type = Contact.ContactType.OutputPin; TestRung.Add(Y1); TestRung.InsertBefore(X2, Y1); TestRung.Add(X1); TestRung.InsertUnder(Y1C, X1); TestRung.InsertAfter(new OSR(), X1); TestRung.InsertAfter(X3, Y1C); Tuple <Node, Node> temp; temp = TestRung.FindInterception(Y1C, X3); Assert.IsNull(temp); temp = TestRung.FindInterception(Y1C, X2); Assert.IsNull(temp); temp = TestRung.FindInterception(Y1C, Y1); Assert.IsNull(temp); temp = TestRung.FindInterception(Y1C, X1); Assert.AreEqual(temp.Item1, X1.LeftLide); Assert.AreEqual(temp.Item2, X3.RightLide); temp = TestRung.FindInterception(X3, X1); Assert.AreEqual(temp.Item1, X1.LeftLide); Assert.AreEqual(temp.Item2, X3.RightLide); }