/// <summary> /// Helper method for custom node adding and removing /// </summary> public static void AssertAddAndRemoveCustomNode(SearchModel searchModel, string nodeName, string catName, string descr = "Bla", string path = "Bla") { var dummyInfo = new CustomNodeInfo(Guid.NewGuid(), nodeName, catName, descr, path); searchModel.Add(dummyInfo); var res = searchModel.Search(nodeName).ToList(); Assert.AreNotEqual(0, res.Count()); Assert.AreEqual(res[0].Name, nodeName); Assert.IsTrue(searchModel.ContainsCategory(catName)); searchModel.RemoveNodeAndEmptyParentCategory(nodeName); res = searchModel.Search(nodeName).ToList(); Assert.AreEqual(0, res.Count()); Assert.IsFalse(searchModel.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); }