Esempio n. 1
0
        public void IncludesFilteredItems()
        {
            HierarchyTreeViewItemCollection collection;
            HierarchyTreeViewItem           root1;
            HierarchyTreeViewItem           root2;
            HierarchyTreeViewItem           child1;
            HierarchyTreeViewItem           child2;
            HierarchyTreeViewItem           grandchild1;
            HierarchyTreeViewItem           grandchild2;


            grandchild1 = Factory.CreateTreeViewItem(name: "x");
            grandchild2 = Factory.CreateTreeViewItem(name: "a");
            child1      = Factory.CreateTreeViewItem(name: "x", children: new[] { grandchild1 });
            child2      = Factory.CreateTreeViewItem(name: "x", children: new[] { grandchild2 });
            root1       = Factory.CreateTreeViewItem(name: "x", children: new[] { child1 });
            root2       = Factory.CreateTreeViewItem(name: "a", children: new[] { child2 });

            collection = new HierarchyTreeViewItemCollection(new[] { root1, root2 });

            collection.Filter(new RegexTextFilter("x"));

            Assert.Equal(
                new[] {
                root1,
                child1,
                grandchild1,
                root2,
                child2,
                grandchild2
            },
                collection.GetFullHierarchy()
                );
        }
Esempio n. 2
0
        public void ReturnsAllItemsAndAllDescendants()
        {
            HierarchyTreeViewItemCollection collection;
            HierarchyTreeViewItem           root1;
            HierarchyTreeViewItem           root2;
            HierarchyTreeViewItem           child1;
            HierarchyTreeViewItem           child2;
            HierarchyTreeViewItem           grandchild1;
            HierarchyTreeViewItem           grandchild2;


            grandchild1 = Factory.CreateTreeViewItem();
            grandchild2 = Factory.CreateTreeViewItem();
            child1      = Factory.CreateTreeViewItem(children: new[] { grandchild1 });
            child2      = Factory.CreateTreeViewItem(children: new[] { grandchild2 });
            root1       = Factory.CreateTreeViewItem(children: new[] { child1 });
            root2       = Factory.CreateTreeViewItem(children: new[] { child2 });

            collection = new HierarchyTreeViewItemCollection(new[] { root1, root2 });

            Assert.Equal(
                new[] {
                root1,
                child1,
                grandchild1,
                root2,
                child2,
                grandchild2
            },
                collection.GetFullHierarchy()
                );
        }