예제 #1
0
파일: Search.cs 프로젝트: l2obin/Dynamo
        /// <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));
        }
예제 #2
0
파일: Search.cs 프로젝트: l2obin/Dynamo
        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);
        }