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 ); }
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)); }
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) ); }