Ejemplo n.º 1
0
        public void SkipWordBorder3()
        {
            var strategy = SearchStrategyFactory.Create("// find", false, true, SearchMode.Normal);
            var text     = new StringTextSource("            // findtest");
            var results  = strategy.FindAll(text, 0, text.TextLength).ToArray();

            Assert.IsEmpty(results, "No results should be found!");
        }
Ejemplo n.º 2
0
        public void SkipWordBorder2()
        {
            var strategy = SearchStrategyFactory.Create("AllTests", false, true, SearchMode.Normal);
            var text     = "name=\"FindAllTests ";
            var results  = strategy.FindAll(text, 0, text.Length, new SearchContext()).ToArray();

            Assert.IsEmpty(results, "No results should be found!");
        }
Ejemplo n.º 3
0
        public void ResultAtEnd()
        {
            var strategy = SearchStrategyFactory.Create("me", false, true, SearchMode.Normal);
            var text     = new StringTextSource("result           // find me");
            var results  = strategy.FindAll(text, 0, text.TextLength).ToArray();

            Assert.AreEqual(1, results.Length, "One result should be found!");
            Assert.AreEqual("result           // find ".Length, results[0].Offset);
            Assert.AreEqual("me".Length, results[0].Length);
        }
Ejemplo n.º 4
0
        public void SimpleTest()
        {
            var strategy = SearchStrategyFactory.Create("AllTests", false, false, SearchMode.Normal);
            var text     = new StringTextSource("name=\"FindAllTests ");
            var results  = strategy.FindAll(text, 0, text.TextLength).ToArray();

            Assert.AreEqual(1, results.Length, "One result should be found!");
            Assert.AreEqual("name=\"Find".Length, results[0].Offset);
            Assert.AreEqual("AllTests".Length, results[0].Length);
        }
Ejemplo n.º 5
0
        public void ResultAtStart()
        {
            var strategy = SearchStrategyFactory.Create("result", false, true, SearchMode.Normal);
            var text     = "result           // find me";
            var results  = strategy.FindAll(text, 0, text.Length, new SearchContext()).ToArray();

            Assert.AreEqual(1, results.Length, "One result should be found!");
            Assert.AreEqual(0, results[0].Offset);
            Assert.AreEqual("result".Length, results[0].Length);
        }
Ejemplo n.º 6
0
 void UpdateSearch()
 {
     // only reset as long as there are results
     // if no results are found, the "no matches found" message should not flicker.
     // if results are found by the next run, the message will be hidden inside DoSearch ...
     if (renderer.CurrentResults.Any())
     {
         messageView.IsOpen = false;
     }
     strategy = SearchStrategyFactory.Create(SearchPattern ?? "", !MatchCase, WholeWords, UseRegex ? SearchMode.RegEx : SearchMode.Normal);
     DoSearch(true);
 }
Ejemplo n.º 7
0
        void UpdateSearch()
        {
            // only reset as long as there are results
            // if no results are found, the "no matches found" message should not flicker.
            // if results are found by the next run, the message will be hidden inside DoSearch ...
            if (renderer.CurrentResults.Any())
            {
                messageView.IsOpen = false;
            }

            strategy = SearchStrategyFactory.Create(SearchPattern ?? "", !MatchCase, WholeWords, GetSearchMode());
            OnSearchOptionsChanged(new SearchOptionsChangedEventArgs(SearchPattern, MatchCase, UseWildCards, UseRegex, WholeWords));
            DoSearch(true);
        }