예제 #1
0
        [Test] public void CategoriesInWorkspace()
        {
            IResource category1 = CategoryManager.CreateCategory("Category1", Core.CategoryManager.RootCategory);
            IResource category2 = CategoryManager.CreateCategory("Category2", category1);
            IResource category3 = CategoryManager.CreateCategory("Category3", Core.CategoryManager.RootCategory);
            IResource category4 = CategoryManager.CreateCategory("Category4", category3);

            _workspaceManager.AddResourceToWorkspaceRecursive(_workspace, category1);
            _workspaceManager.AddResourceToWorkspace(_workspace, category3);

            _treePane.RootResource = Core.ResourceTreeManager.ResourceTreeRoot;
            _treePane.Populate();
            _treePane.SetActiveWorkspace(_workspace);
            Assert.AreEqual(1, _treePane.ResourceTree.JetListView.Nodes.Count);
            JetListViewNode categoriesNode = _treePane.ResourceTree.JetListView.Nodes [0];

            Assert.AreEqual("Categories", categoriesNode.Data.ToString());

            categoriesNode.Expanded = true;
            Assert.AreEqual(2, categoriesNode.Nodes.Count);

            JetListViewNode cat1Node = categoriesNode.Nodes [0];

            Assert.AreEqual("Category1", cat1Node.Data.ToString());
            cat1Node.Expanded = true;
            Assert.AreEqual(1, cat1Node.Nodes.Count);

            JetListViewNode cat3Node = categoriesNode.Nodes [1];

            Assert.AreEqual("Category3", cat3Node.Data.ToString());
            cat3Node.Expanded = true;
            Assert.IsFalse(cat3Node.Nodes [0].FiltersAccept);
        }