public void TestStoppingVisitor() { VisitableLinkedList <int> l = GetTestCustomLinkedList(); ComparableFindingVisitor <int> visitor = new ComparableFindingVisitor <int>(6); l.Accept(visitor); Assert.AreEqual(visitor.Found, true); visitor = new ComparableFindingVisitor <int>(99); l.Accept(visitor); Assert.AreEqual(visitor.Found, false); }
public void TestVisitor() { VisitableLinkedList <int> l = GetTestCustomLinkedList(); SumVisitor visitor = new SumVisitor(); l.Accept(visitor); Assert.AreEqual(visitor.Sum, 0 + 3 + 6 + 9 + 12); }
public void TestNullVisitor() { VisitableLinkedList <int> l = new VisitableLinkedList <int>(); l.Accept(null); }