示例#1
0
        public void ReplaceTest()
        {
            vm               = new FindReplaceDialogViewModel(ed);
            vm.UseRegex      = true;
            vm.TextToFind    = "sam[^\\s]*";
            vm.TextToReplace = "hello";
            vm.FindText();
            vm.ReplaceText();

            Assert.AreEqual("This is some hello text\non 3 different lines\nwith more samples",
                            ed.Text,
                            "Replacement Text");
        }
示例#2
0
        public void ReplaceTest()
        {
            // need to ceatea a new editor for replaces tests as they change the text
            var localEditor = new MockEditor("This is some sample text\non 3 different lines\nwith more samples");
            var vm          = new FindReplaceDialogViewModel(mockEventAggregator)
            {
                Editor        = localEditor,
                UseRegex      = true,
                UseWildcards  = false,
                CaseSensitive = false,
                TextToFind    = "sam[^\\s]*",
                TextToReplace = "hello"
            };

            vm.FindText();
            vm.ReplaceText();

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