private void RunCountAndAssertionsForCounterVisitorTest(NodeCounterVisitorBase <int> visitor, int expectedCount) { IChildSetIntegerTree mockTree = GenerateMockTree(); Assert.Zero(visitor.Count, "GIVEN: Expected node count to be zero before starting the operation"); mockTree.Accept(visitor); Assert.AreEqual(expectedCount, visitor.Count, "Expected the visitor count to be equal to the # of nodes in the tree"); }
private void RunIntegerAccumulatorAndAssertCorrectResult(IIntegerAccumulationVisitor visitor, int expectedBefore, int expectedAfter) { IChildSetIntegerTree mockTree = GenerateMockTree(); Assert.AreEqual(expectedBefore, visitor.Result, "GIVEN: Result before visitation is incorrect"); visitor.Visit(mockTree); Assert.AreEqual(expectedAfter, visitor.Result, "Visitor's result is not as expected after visitation"); }