コード例 #1
0
        //[Test]
        public void ExtendSelection2()
        {
            const string     TextMessage = "using(workflowRuntime)\n\n\n\tstring name = \"Darth Vader|\"";
            int              offset;
            IDocument        document         = TestHelper.MakeDocument(TextMessage, out offset);
            ISelection       selection        = new SingleWordSelection(document, offset);
            SelectionManager selectionManager = new SelectionManager(document);

            selectionManager.SetSelection(selection.StartPosition, selection.EndPosition);
            Assert.AreEqual("Vader", selectionManager.SelectedText);

            selection = new ExtendBlockSelection(document, selection);
            selectionManager.SetSelection(selection.StartPosition, selection.EndPosition);
            Assert.AreEqual("\"Darth Vader\"", selectionManager.SelectedText);
            TestHelper.CallAllProperties(selection);

            selection = new ExtendBlockSelection(document, selection);
            selectionManager.SetSelection(selection.StartPosition, selection.EndPosition);
            Assert.AreEqual("\tstring name = \"Darth Vader\"", selectionManager.SelectedText);
            TestHelper.CallAllProperties(selection);

            selection = new ExtendBlockSelection(document, selection);
            selectionManager.SetSelection(selection.StartPosition, selection.EndPosition);
            Assert.AreEqual("\tstring name = \"Darth Vader\"", selectionManager.SelectedText);
            TestHelper.CallAllProperties(selection);
        }
コード例 #2
0
        public void Whawhoooiii2342()
        {
            const string TextMessage =
                "\n{\nConsole.WriteLine();\n\tConsole.WriteLine(\"Get back to w|ork!\");\n\tConsole.WriteLine();\n}\n";
            int       offset;
            IDocument document = TestHelper.MakeDocument(TextMessage, out offset);

            ISelection       selection        = new SingleWordSelection(document, offset);
            SelectionManager selectionManager = new SelectionManager(document);

            selectionManager.SetSelection(selection.StartPosition, selection.EndPosition);
            Assert.AreEqual("work!", selectionManager.SelectedText);

            selection = new ExtendBlockSelection(document, selection);
            selectionManager.SetSelection(selection.StartPosition, selection.EndPosition);
            Assert.AreEqual("\"Get back to work!\"", selectionManager.SelectedText);

            selection = new ExtendBlockSelection(document, selection);
            selectionManager.SetSelection(selection.StartPosition, selection.EndPosition);
            Assert.AreEqual("(\"Get back to work!\")", selectionManager.SelectedText);

            selection = new ExtendBlockSelection(document, selection);
            selectionManager.SetSelection(selection.StartPosition, selection.EndPosition);
            Assert.AreEqual("\tConsole.WriteLine(\"Get back to work!\");\n", selectionManager.SelectedText);

            selection = new ExtendBlockSelection(document, selection);
            selectionManager.SetSelection(selection.StartPosition, selection.EndPosition);
            Assert.AreEqual("Console.WriteLine();\n\tConsole.WriteLine(\"Get back to work!\");\n\tConsole.WriteLine();\n", selectionManager.SelectedText);
        }
コード例 #3
0
        public void ExtendSelectionStartOfDocument()
        {
            const string     TextMessage = "|Console.WriteLine(\"Is the bug fixed?\");";
            int              offset;
            IDocument        document         = TestHelper.MakeDocument(TextMessage, out offset);
            ISelection       selection        = new SingleWordSelection(document, offset);
            SelectionManager selectionManager = new SelectionManager(document);

            selectionManager.SetSelection(selection.StartPosition, selection.EndPosition);
            Assert.AreEqual("Console", selectionManager.SelectedText);

            selection = new ExtendBlockSelection(document, selection);
            selectionManager.SetSelection(selection.StartPosition, selection.EndPosition);
            Assert.AreEqual("Console.WriteLine(\"", selectionManager.SelectedText);
            TestHelper.CallAllProperties(selection);
        }
コード例 #4
0
        public void ExtendBlockToCurrentLine()
        {
            const string TextMessage = "\n\n\tstring doobii = \"Aha a |unit test\";\t\n\n\n";
            int          offset;
            IDocument    document = TestHelper.MakeDocument(TextMessage, out offset);

            ISelection       selection        = new SingleWordSelection(document, offset);
            SelectionManager selectionManager = new SelectionManager(document);

            selectionManager.SetSelection(selection.StartPosition, selection.EndPosition);
            Assert.AreEqual("unit", selectionManager.SelectedText);

            selection = new ExtendBlockSelection(document, selection);
            TestHelper.CallAllProperties(selection);
            selectionManager.SetSelection(selection.StartPosition, selection.EndPosition);
            Assert.AreEqual("\"Aha a unit test\"", selectionManager.SelectedText);

            selection = new ExtendBlockSelection(document, selection);
            selectionManager.SetSelection(selection.StartPosition, selection.EndPosition);
            Assert.AreEqual("\tstring doobii = \"Aha a unit test\";\t\n", selectionManager.SelectedText);
        }
コード例 #5
0
        public void Decrease_text_select_with_qoutes_to_only_word()
        {
            // Arrange
            const string     textMessage = "\"|Hello World!\"";
            int              offset;
            IDocument        document         = TestHelper.MakeDocument(textMessage, out offset);
            ISelection       selection        = new SingleWordSelection(document, offset);
            SelectionManager selectionManager = new SelectionManager(document);

            selectionManager.SetSelection(selection.StartPosition, selection.EndPosition);

            selection = new ExtendBlockSelection(document, selection);
            selectionManager.SetSelection(selection.StartPosition, selection.EndPosition);
            Assert.AreEqual("\"Hello World!\"", selectionManager.SelectedText);

            // Act
            selection = new DecreaseSelection(document, selection);
            selectionManager.SetSelection(selection);

            // Arrange
            Assert.AreEqual("Hello World!", selectionManager.SelectedText);
        }