Ejemplo n.º 1
0
        public void AddChildTest()
        {
            var target = _rootNode;
            target.AddChild(new ObservableTreeNode(new TestNode(10)));

            var added = new ObservableTreeNode(new TestNode(11));
            added.AddChild(new ObservableTreeNode(new TestNode(111)));
            added.AddChild(new ObservableTreeNode(new TestNode(112)));

            target.AddChild(added);
            target.AddChild(new ObservableTreeNode(new TestNode(12)));

            int[] expected = { 0, 10, 11, 111, 112, 12 };

            AssertLinearized(expected, _linearized, target);
        }
Ejemplo n.º 2
0
        public void AddTreeTest()
        {
            var target = _rootNode;

            target.AddChild(new ObservableTreeNode(new TestNode(12), _testNodeComparer));
            target.AddChild(new ObservableTreeNode(new TestNode(10), _testNodeComparer));

            var tree = new ObservableTreeNode(new TestNode(11), _testNodeComparer);

            tree.IsExpanded = true;
            tree.AddChild(new ObservableTreeNode(new TestNode(111), _testNodeComparer));
            tree.AddChild(new ObservableTreeNode(new TestNode(112), _testNodeComparer));

            target.AddChild(tree);

            int[] expected = { 10, 11, 111, 112, 12 };
            _linearized.ItemList.Should().Equal(expected, (a, e) => Equals(a.Model.Content, e.ToString()));
        }
Ejemplo n.º 3
0
        private ObservableTreeNode GetTestTree()
        {
            var n1  = new ObservableTreeNode(new TestNode(11), _testNodeComparer);
            var n11 = new ObservableTreeNode(new TestNode(111), _testNodeComparer);
            var n12 = new ObservableTreeNode(new TestNode(112), _testNodeComparer);

            n1.AddChild(n11);
            n1.AddChild(n12);

            var n2  = new ObservableTreeNode(new TestNode(12), _testNodeComparer);
            var n21 = new ObservableTreeNode(new TestNode(121), _testNodeComparer);
            var n22 = new ObservableTreeNode(new TestNode(122), _testNodeComparer);

            n2.AddChild(n21);
            n2.AddChild(n22);

            var n3 = new ObservableTreeNode(new TestNode(13), _testNodeComparer);

            var n311 = new ObservableTreeNode(new TestNode(1311), _testNodeComparer);
            var n312 = new ObservableTreeNode(new TestNode(1312), _testNodeComparer);
            var n31  = new ObservableTreeNode(new TestNode(131), _testNodeComparer);

            n31.AddChild(n311);
            n31.AddChild(n312);

            var n32 = new ObservableTreeNode(new TestNode(132), _testNodeComparer);

            n3.AddChild(n31);
            n3.AddChild(n32);

            var n = new ObservableTreeNode(new TestNode(1), _testNodeComparer);

            n.AddChild(n1);
            n.AddChild(n2);
            n.AddChild(n3);

            return(n);
        }
        public void AddChildInOrderTest() {
            var target = _rootNode;
            target.AddChild(new ObservableTreeNode(new TestNode(10), _testNodeComparer));

            var added = new ObservableTreeNode(new TestNode(11), _testNodeComparer);
            added.IsExpanded = true;
            added.AddChild(new ObservableTreeNode(new TestNode(111), _testNodeComparer));
            added.AddChild(new ObservableTreeNode(new TestNode(112), _testNodeComparer));

            target.AddChild(added);
            target.AddChild(new ObservableTreeNode(new TestNode(12), _testNodeComparer));

            int[] expected = { 10, 11, 111, 112, 12 };

            _linearized.ItemList.Should().Equal(expected, (a, e) => Equals(a.Model.Content, e.ToString()));
        }
        private ObservableTreeNode GetTestTree() {
            var n1 = new ObservableTreeNode(new TestNode(11), _testNodeComparer);
            var n11 = new ObservableTreeNode(new TestNode(111), _testNodeComparer);
            var n12 = new ObservableTreeNode(new TestNode(112), _testNodeComparer);
            n1.AddChild(n11);
            n1.AddChild(n12);

            var n2 = new ObservableTreeNode(new TestNode(12), _testNodeComparer);
            var n21 = new ObservableTreeNode(new TestNode(121), _testNodeComparer);
            var n22 = new ObservableTreeNode(new TestNode(122), _testNodeComparer);
            n2.AddChild(n21);
            n2.AddChild(n22);

            var n3 = new ObservableTreeNode(new TestNode(13), _testNodeComparer);

            var n311 = new ObservableTreeNode(new TestNode(1311), _testNodeComparer);
            var n312 = new ObservableTreeNode(new TestNode(1312), _testNodeComparer);
            var n31 = new ObservableTreeNode(new TestNode(131), _testNodeComparer);
            n31.AddChild(n311);
            n31.AddChild(n312);

            var n32 = new ObservableTreeNode(new TestNode(132), _testNodeComparer);
            n3.AddChild(n31);
            n3.AddChild(n32);

            var n = new ObservableTreeNode(new TestNode(1), _testNodeComparer);
            n.AddChild(n1);
            n.AddChild(n2);
            n.AddChild(n3);

            return n;
        }