示例#1
0
        public void CanAddCategory()
        {
            var model = new SearchViewModel();
            var root = model.AddRootCategory("Peter");
            var leafCat = new BrowserInternalElement("Boyer", root);
            root.Items.Add(leafCat);

            Assert.Contains(leafCat, root.Items );
            Assert.Contains( root, model.BrowserRootCategories );
        }
示例#2
0
        public void CanRunRemoveCategoryIfCategoryDoesntExist()
        {
            var model = new SearchViewModel();
            var root = model.AddRootCategory("Peter");
            var leaf = new BrowserInternalElement("Boyer", root);
            root.AddChild(leaf);

            Assert.Contains(leaf, root.Items);
            Assert.Contains(root, model.BrowserRootCategories);

            model.RemoveCategory("Peter.Rabbit");
            Assert.True(model.BrowserRootCategories.Contains(root));
            Assert.True(root.Items.Contains(leaf));
        }
示例#3
0
        public void CanRemoveCategoryWithDelimiters()
        {
            var model = new SearchViewModel();
            var root = model.AddRootCategory("Peter");
            var leaf = new BrowserInternalElement("Boyer", root);
            root.AddChild(leaf);

            Assert.Contains(leaf, root.Items);
            Assert.Contains(root, model.BrowserRootCategories);

            model.RemoveCategory("Peter.Boyer");
            Assert.True( model.BrowserRootCategories.Contains(root) );
            Assert.False( root.Items.Contains(leaf) );
        }