Example #1
0
 public void FindWildcard()
 {
     vm = new FindReplaceDialogViewModel(ed);
     vm.UseWildcards = true;
     vm.TextToFind = "sam*";
     vm.FindText();
     Assert.AreEqual(13, ed.SelectionStart, "Selection Start");
     Assert.AreEqual(11, ed.SelectionLength, "Selection Length");
 }
Example #2
0
 public void FindCaseInsensitive()
 {
     vm = new FindReplaceDialogViewModel(ed);
     vm.TextToFind = "SAMPLE";
     vm.CaseSensitive = false;
     vm.FindText();
     Assert.AreEqual(13, ed.SelectionStart);
     Assert.AreEqual(6, ed.SelectionLength);
 }
Example #3
0
        public void FindRegEx()
        {
            vm = new FindReplaceDialogViewModel(ed);
            vm.UseRegex = true;
            vm.TextToFind = "sam[^\\s]*";
            vm.FindText();
            Assert.AreEqual(13, ed.SelectionStart, "Selection Start");
            Assert.AreEqual(6, ed.SelectionLength, "Selection Length");

            vm.TextToFind = "\\s.?iff[^\\s]*";
            vm.FindText();
            Assert.AreEqual(29, ed.SelectionStart, "Selection Start");
            Assert.AreEqual(10, ed.SelectionLength, "Selection Length");
            Assert.AreEqual(" different", ed.Selection);
        }
Example #4
0
        public void FindCaseSensitive()
        {
            vm = new FindReplaceDialogViewModel(ed);
            vm.TextToFind = "SAMPLE";
            vm.CaseSensitive = true;
            vm.FindText();
            Assert.AreEqual(0, ed.SelectionStart, "Selection Start");
            Assert.AreEqual(0, ed.SelectionLength, "Selection Length");

            vm.TextToFind = "sample";
            vm.CaseSensitive = true;
            vm.FindText();
            Assert.AreEqual(13, ed.SelectionStart, "Selection Start");
            Assert.AreEqual(6, ed.SelectionLength, "Selection Length");
        }
Example #5
0
        public void ReplaceAllTest()
        {
            vm = new FindReplaceDialogViewModel(ed);
            vm.UseRegex = true;
            vm.TextToFind = "sam[^\\s]*";
            vm.TextToReplace = "hello";
            //vm.Find();
            vm.ReplaceAllText();

            Assert.AreEqual("This is some hello text\non 3 different lines\nwith more hello",
                ed.Text,
                "Replacement Text");
        }