Exemple #1
0
        public void GreatestDepth_ShouldFindDepthRandom(int depth)
        {
            // arrange
            NodeTree <int> root = new NodeTree <int>(Guid.NewGuid(), 6);

            root.GenrateTree(depth, root, 2324);

            // act
            var actual = root.GreatestDepth(root);

            // assert
            Assert.AreEqual(depth, actual);
        }
Exemple #2
0
        public void FindNode_ShouldReturnCorrectNodeRandom(int depth)
        {
            // arrange
            NodeTree <object> root = new NodeTree <object>(Guid.NewGuid(), new { testInt = 108, text = "test" });

            root.GenrateTree(depth, root, new { text = "test2" });
            NodeTree <object> randomNode = root.SelectRandomNode(root);

            // act
            var actual = root.FindNode(root, randomNode.GetNodeID());

            // assert
            Assert.AreEqual(randomNode, actual);
        }