public void TestCreateTreeWithIntegerRoot() { ITree <int> tree = new Tree.Tree <int>(5); Assert.AreEqual(5, tree.Root.Value); Assert.IsNotNull(tree.Root); }
public void TestCreateTreeWithRootByReference() { ITreeNode <int> node = new TreeNode <int>(5); ITree <int> tree = new Tree.Tree <int>(node); Assert.AreSame(node, tree.Root); }
public void TestCreateTreeWithChildrenNodes() { var nodes = new List <ITreeNode <int> >(); for (int i = 0; i < 10; i++) { nodes.Add(new TreeNode <int>(i * 5)); } ITree <int> tree = new Tree.Tree <int>(0); tree.Root.Children = nodes; Assert.AreEqual(10, tree.Root.Children.Count()); }
public void TestCheckTreeChildrenNodeValues() { var nodes = new List <ITreeNode <int> >(); for (int i = 0; i < 10; i++) { nodes.Add(new TreeNode <int>(i * 5)); } ITree <int> tree = new Tree.Tree <int>(0); tree.Root.Children = nodes; Assert.AreEqual(0, tree.Root.Children.First().Value); // first Assert.AreEqual(5, tree.Root.Children.Skip(1).First().Value); // second }
public void TestCreateTreeWithEmptyRoot() { ITree <int> tree = new Tree.Tree <int>(); Assert.IsNull(tree.Root); }