ReplaceAll() public method

public ReplaceAll ( ) : void
return void
示例#1
0
        public void ReplaceAllInCurrentWindow()
        {
            using (OpenTestProject(true))
            {
                Assert.IsFalse(InvokeMainMenuItem("Edit", "Replace"));

                FindProjectNode("Project", "FileA").DoubleClick();

                var editorPanel = FindDockPanel("FileA");
                var editor      = editorPanel.Children[0].Children[0];

                Assert.IsTrue(InvokeMainMenuItem("Edit", "Replace"));

                var findWindow = new FindWindow(MainWindow.Children["Find and Replace", ControlType.Window]);

                Assert.AreEqual(LookInType.CurrentDocument, findWindow.LookInType);

                findWindow.FindWhat              = "A";
                findWindow.ReplaceWith           = "B";
                findWindow.MatchCase             = true;
                findWindow.MatchWholeWord        = false;
                findWindow.UseRegularExpressions = false;
                findWindow.LookInFileTypes       = null;

                findWindow.ReplaceAll();

                MessageBox.Show("Hi");

                Assert.AreEqual(
                    @"Ba
Bb
Bc
",
                    editor.Value.Value
                    );

                findWindow.Window.Window.Close();

                editorPanel.Window.Close();

                CloseProject();
            }
        }
示例#2
0
        public void ReplaceAllInCurrentWindow()
        {
            using (OpenTestProject(true))
            {
                Assert.IsFalse(InvokeMainMenuItem("Edit", "Replace"));

                FindProjectNode("Project", "FileA").DoubleClick();

                var editorPanel = FindDockPanel("FileA");
                var editor = editorPanel.Children[0].Children[0];

                Assert.IsTrue(InvokeMainMenuItem("Edit", "Replace"));

                var findWindow = new FindWindow(MainWindow.Children["Find and Replace", ControlType.Window]);

                Assert.AreEqual(LookInType.CurrentDocument, findWindow.LookInType);

                findWindow.FindWhat = "A";
                findWindow.ReplaceWith = "B";
                findWindow.MatchCase = true;
                findWindow.MatchWholeWord = false;
                findWindow.UseRegularExpressions = false;
                findWindow.LookInFileTypes = null;

                findWindow.ReplaceAll();

                MessageBox.Show("Hi");

                Assert.AreEqual(
            @"Ba
            Bb
            Bc
            ",
                    editor.Value.Value
                );

                findWindow.Window.Window.Close();

                editorPanel.Window.Close();

                CloseProject();
            }
        }