コード例 #1
0
        public void GetDescendantsBreadthFirst()
        {
            DummySceneNode nodeA = new DummySceneNode();
            DummySceneNode nodeB = new DummySceneNode();
            DummySceneNode nodeC = new DummySceneNode();
            DummySceneNode nodeD = new DummySceneNode();

            nodeA.Children.Add(nodeB);
            nodeA.Children.Add(nodeC);
            nodeB.Children.Add(nodeD);

            var descendants = nodeA.GetDescendants(false).ToArray();

            Assert.AreEqual(3, descendants.Length);
            Assert.AreSame(nodeB, descendants[0]);
            Assert.AreSame(nodeC, descendants[1]);
            Assert.AreSame(nodeD, descendants[2]);
        }
コード例 #2
0
        public void GetDescendantsOfLeaf()
        {
            DummySceneNode nodeA = new DummySceneNode();

            Assert.AreEqual(0, nodeA.GetDescendants().Count());
        }