public void CanRemoveElementCustomNodeByNameWithSingleCategory() { var model = new SearchViewModel(); model.Add("Peter", "Greens", "A description", System.Guid.NewGuid()); model.SearchAndUpdateResultsSync("Peter"); Assert.AreEqual(1, model.SearchResults.Count); model.Remove("Peter"); model.SearchAndUpdateResultsSync("Peter"); Assert.AreEqual(0, model.SearchResults.Count); }
/// <summary> /// Load Custom Nodes from the default directory - the "definitions" /// directory where the executing assembly is located.. /// </summary> /// <param name="bench">The logger is needed in order to tell how long it took.</param> public static void LoadCustomNodes(DynamoView bench, CustomNodeLoader customNodeLoader, SearchViewModel searchViewModel) { // custom node loader var sw = new Stopwatch(); sw.Start(); customNodeLoader.UpdateSearchPath(); var nn = customNodeLoader.GetNodeNameCategoryAndGuidList(); // add nodes to search foreach (var pair in nn) { searchViewModel.Add(pair.Item1, pair.Item2, pair.Item3); } sw.Stop(); DynamoCommands.WriteToLogCmd.Execute(string.Format("{0} ellapsed for loading definitions.", sw.Elapsed)); // update search view searchViewModel.SearchAndUpdateResultsSync(searchViewModel.SearchText); }
public void CanTryToRemoveElementFromSearchWithNonexistentName() { var model = new SearchViewModel(); model.Remove("NonExistentName"); model.SearchAndUpdateResultsSync("NonExistentName"); Assert.AreEqual(0, model.SearchResults.Count); }