//-------------------------------------------------------------------- private void _AssertCountingVisitor(DataStructures.Node Node, DataStructures.VisitationType VisitType, int ExpectedCount) { //Console.WriteLine( "Testing VisitNodes( " + VisitType.ToString() + " )." ); DataStructures.Node.CountingVisitor visitor = new DataStructures.Node.CountingVisitor(); Node.VisitNodes(visitor, VisitType); Assert.AreEqual(ExpectedCount, visitor.Count, "Visitor count mismatch after VisitNodes( " + VisitType.ToString() + " )."); }
public void Test_20_Clone() { DataStructures.Node root = new DataStructures.Node(); NodeTestData.AddTestChildren(root); DataStructures.Node.CloningVisitor visitor = new DataStructures.Node.CloningVisitor(root); root.VisitNodes(visitor, DataStructures.VisitationType.DecendentsDepthFirst); NodeTestData.AssertTestChildren(visitor.TargetRoot); return; }