Пример #1
0
 public void FlowProblem1()
 {
     RapidFindReplaceControlViewModel finder = new RapidFindReplaceControlViewModel();
     bool hit=false;
     FlowDocument content = LoadFlowDocument("FlowDocument1.xaml");
     System.Collections.Generic.List<Run> runs = new System.Collections.Generic.List<Run>(5);
     FindRuns(content.Blocks, runs);
     finder.FindTextIn(runs, delegate(Run run, int index, int length)
         {
             hit = true;
         },   new Query("urna jimmy"));
     
     Assert.IsTrue(hit);
 }
Пример #2
0
        public void FlowProblem1_AsFlowDocument_WithRegistry()
        {
            RapidFindReplaceControlViewModel finder = new RapidFindReplaceControlViewModel();
            bool hit = false;
            FlowDocument content = LoadFlowDocument("FlowDocument1.xaml");
            finder.FindTextIn(FindHandlerRegistry.CreateIRunReaderHandlerFor(content), delegate(Run run, int index, int length)
            {
                hit = true;
            }, new Query("urna jimmy"));

            Assert.IsTrue(hit);
        }
Пример #3
0
        public void Flow_3()
        {
            RapidFindReplaceControlViewModel finder = new RapidFindReplaceControlViewModel();
           // finder.FindOptions.IgnoreWhitespaceCharacters = true;
            bool hit = false;
            FlowDocument content = LoadFlowDocument("FlowDocument3.xaml");
            finder.FindTextIn(FindHandlerRegistry.CreateIRunReaderHandlerFor(content), delegate(Run run, int index, int length)
            {
                hit = true;
            }, new Query("a b c"));

            Assert.IsTrue(hit);
        }
Пример #4
0
        public void FlowProblem_Jimmy_SecondColumn_no2()
        {
            RapidFindReplaceControlViewModel finder = new RapidFindReplaceControlViewModel();
            FlowDocument content = LoadFlowDocument("FlowDocument4.xaml");
            int hitCount = 0;
            finder.FindTextIn(new FlowDocumentRunReader(content), delegate(Run run, int index, int length)
            {
                hitCount++;
            }, new Query("jimmy"));

            Assert.AreEqual(2, hitCount);
        }