コード例 #1
0
 protected override void Context()
 {
     base.Context();
     _nodeToAdd = new TestNode("toto", "toto");
     _childNode = new TestNode("tutu", "tutu");
     _nodeToAdd.AddChildren(_childNode);
 }
コード例 #2
0
 protected override void Context()
 {
     base.Context();
     _parentNode             = new TestNode("Parent");
     _childNode1             = new TestNode("Child1");
     _childNode2             = new TestNode("Child2");
     _childWithChildrenNode1 = new TestNode("ChildWithChildren1");
     _childNode3             = new TestNode("Child3");
     _parentNode.AddChildren(_childNode1, _childNode2, _childWithChildrenNode1);
     _childWithChildrenNode1.AddChildren(_childNode3);
     sut.AddNode(_parentNode);
 }
コード例 #3
0
        private static void AddTreeNode(ITreeNode node, IList <ITreeNode> nodes)
        {
            var children = nodes.Where(x => x.Parent == node).ToList();

            node.AddChildren(children);
            RemoveAssignedChildren(node, nodes);

            for (var i = 0; i < children.Count; i++)
            {
                AddTreeNode(children[i], nodes);
                if (nodes.Count == 0)
                {
                    break;
                }
            }
        }