public bool AddToSearch(SearchModel search)
 {
     return
         search.Add(new CustomNodeInfo(  FunctionId, 
                                         WorkspaceModel.Name,
                                         WorkspaceModel.Category,
                                         WorkspaceModel.Description,
                                         WorkspaceModel.FileName ));
 }
Exemple #2
0
        /// <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));
        }