예제 #1
0
        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);
        }
예제 #2
0
        /// <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);
        }
예제 #3
0
        public void CanTryToRemoveElementFromSearchWithNonexistentName()
        {
            var model = new SearchViewModel();
            model.Remove("NonExistentName");

            model.SearchAndUpdateResultsSync("NonExistentName");
            Assert.AreEqual(0, model.SearchResults.Count);
        }