public void ReturnTrueTest2() { FileStructureTree testTreeOne = new FileStructureTree(); testTreeOne.Root = new Node("folder1"); testTreeOne.Root.LeftChild = new Node("folder2"); testTreeOne.Root.RightChild = new Node("folder3"); testTreeOne.Root.LeftChild.LeftChild = new Node("folder4"); testTreeOne.Root.LeftChild.RightChild = new Node("folder5"); testTreeOne.Root.RightChild.LeftChild = new Node("folder6"); testTreeOne.Root.RightChild.RightChild = new Node("folder7"); FileStructureTree testTreeTwo = new FileStructureTree(); testTreeTwo.Root = new Node("folder python"); testTreeTwo.Root.LeftChild = new Node("folder CShapr"); testTreeTwo.Root.RightChild = new Node("Javascript"); testTreeTwo.Root.LeftChild.LeftChild = new Node("Visual Basic"); testTreeTwo.Root.LeftChild.RightChild = new Node("C++"); testTreeTwo.Root.RightChild.LeftChild = new Node("Ruby"); testTreeTwo.Root.RightChild.RightChild = new Node("Ruby"); CompareTwoTrees compareTwoTrees = new CompareTwoTrees(); Assert.True(compareTwoTrees.LeafsInTwoTrees(testTreeOne, testTreeTwo)); }
public static void TestTwoTreesForFalse() { FileStructureTree treeOne = new FileStructureTree(); treeOne.Root = new Node("folder1"); treeOne.Root.LeftChild = new Node("folder2"); treeOne.Root.RightChild = new Node("folder3"); treeOne.Root.LeftChild.LeftChild = new Node("folder4"); treeOne.Root.LeftChild.RightChild = new Node("folder5"); treeOne.Root.RightChild.LeftChild = new Node("folder6"); treeOne.Root.RightChild.RightChild = new Node("folder7"); FileStructureTree treeTwo = new FileStructureTree(); treeTwo.Root = new Node("folder 11"); treeTwo.Root.LeftChild = new Node("folder 12"); treeTwo.Root.RightChild = new Node("folder 13"); treeTwo.Root.LeftChild.LeftChild = new Node("folder 14"); treeTwo.Root.LeftChild.RightChild = new Node("folder 15"); treeTwo.Root.RightChild.RightChild = new Node("folder 16"); CompareTwoTrees compareTwoTrees = new CompareTwoTrees(); Console.WriteLine(""); Console.WriteLine($"Tree One has 4 leafs. Tree Two has 3 leafs."); Console.WriteLine($"Therefore will return: {compareTwoTrees.LeafsInTwoTrees(treeOne, treeTwo)}"); }
public void ReturnFalseTest1() { FileStructureTree testTreeOne = new FileStructureTree(); testTreeOne.Root = new Node("folder1"); testTreeOne.Root.LeftChild = new Node("folder2"); testTreeOne.Root.RightChild = new Node("folder3"); FileStructureTree testTreeTwo = new FileStructureTree(); testTreeTwo.Root = new Node("folder python"); testTreeTwo.Root.LeftChild = new Node("folder CShapr"); testTreeTwo.Root.RightChild = new Node("Javascript"); testTreeTwo.Root.RightChild.RightChild = new Node("C#"); testTreeTwo.Root.RightChild.LeftChild = new Node("C#"); CompareTwoTrees compareTwoTrees = new CompareTwoTrees(); Assert.False(compareTwoTrees.LeafsInTwoTrees(testTreeOne, testTreeTwo)); }