Пример #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);
        }
Пример #2
0
        public void GreatestDepth_SimpleShouldFindDepth()
        {
            // arrange
            NodeTree <string> root = new NodeTree <string>(Guid.NewGuid(), "test");

            root.SpawnChild(Guid.NewGuid(), "test2");
            root.SpawnChild(Guid.NewGuid(), "test3");
            root.SpawnChild(Guid.NewGuid(), "test4").SpawnChild(Guid.NewGuid(), "test5").SpawnChild(Guid.NewGuid(), "test6");

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

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