예제 #1
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);
        }
예제 #2
0
        public void FindNode_ShouldReturnCorrectNodeSimple()
        {
            // arrange
            NodeTree <bool> root = new NodeTree <bool>(Guid.NewGuid(), true);

            root.SpawnChild(Guid.NewGuid(), true);
            root.SpawnChild(Guid.NewGuid(), false);
            Guid targetGuid = Guid.NewGuid();
            var  targetNode = root.SpawnChild(Guid.NewGuid(), true).SpawnChild(Guid.NewGuid(), false).SpawnChild(targetGuid, false);;

            // act
            var result = root.FindNode(root, targetGuid);

            // assert
            Assert.AreEqual(targetNode, result);
        }