/// <summary> /// Helper method for custom node adding and removing /// </summary> public void AssertAddAndRemoveCustomNode(SearchViewModel search, string nodeName, string catName, string descr = "Bla", string path = "Bla") { var dummyInfo = new CustomNodeInfo(Guid.NewGuid(), nodeName, catName, descr, path); search.Add(dummyInfo); search.SearchAndUpdateResultsSync(nodeName); Assert.AreNotEqual(0, search.SearchResults.Count); Assert.AreEqual(search.SearchResults[0].Name, nodeName); Assert.IsTrue(search.ContainsCategory(catName)); search.RemoveNodeAndEmptyParentCategory(nodeName); search.SearchAndUpdateResultsSync(nodeName); Assert.AreEqual(0, search.SearchResults.Count); Assert.IsFalse(search.ContainsCategory(catName)); }
public void GetCategoryByNameWithValidInput() { const string catName = "Category.Child"; _search.AddCategory(catName); Assert.IsTrue(_search.ContainsCategory(catName)); Assert.AreEqual(1, _search.BrowserRootCategories.Count(x => x.Name == "Category")); var nestedCat = _search.GetCategoryByName("Category.Child"); Assert.NotNull(nestedCat); }