//[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);
        }
        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);
        }
        public void CharacterSelectEndOfDocument()
        {
            const string TextMessage = "char[] validChars = new char[] {'\"', '(', '<', '{', '['};\n'|";
            int          offset;
            IDocument    document = TestHelper.MakeDocument(TextMessage, out offset);

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

            selectionManager.SetSelection(selection);
            Assert.IsEmpty(selectionManager.SelectedText);
        }
        public void CursorPositionBeforeText()
        {
            const string     TextMessage      = "\rusing(WorkflowRuntime workflowRuntime = new WorkflowRuntime())";
            IDocument        document         = TestHelper.MakeDocument(TextMessage);
            int              offset           = -1;
            ISelection       selection        = new SingleWordSelection(document, offset);
            SelectionManager selectionManager = new SelectionManager(document);

            selectionManager.SetSelection(selection);

            Assert.AreEqual("using", selectionManager.SelectedText);
            TestHelper.CallAllProperties(selection);
        }
        public void CursorBeforeQuotationMark()
        {
            const string TextMessage = "\"hello there|\"";
            int          offset;
            IDocument    document = TestHelper.MakeDocument(TextMessage, out offset);

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

            selectionManager.SetSelection(selection);

            Assert.AreEqual("there", selectionManager.SelectedText);
            TestHelper.CallAllProperties(selection);
        }
        public void CursorBeforeOpeningParentisis()
        {
            const string TextMessage = "using(WorkflowRuntime workflowRuntime = new WorkflowRuntime|())";
            int          offset;
            IDocument    document = TestHelper.MakeDocument(TextMessage, out offset);

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

            selectionManager.SetSelection(selection);

            Assert.AreEqual("WorkflowRuntime", selectionManager.SelectedText);
            TestHelper.CallAllProperties(selection);
        }
        public void CursorAtEndOfWord23423()
        {
            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);

            Assert.AreEqual("Hello", selectionManager.SelectedText);
            TestHelper.CallAllProperties(selection);
        }
        public void NoSelectionOffsetEndOfDocument()
        {
            const string     TextMessage      = "using(WorkflowRuntime workflowRuntime = new WorkflowRuntime())\n\n\n";
            IDocument        document         = TestHelper.MakeDocument(TextMessage);
            int              offset           = 240;
            ISelection       selection        = new SingleWordSelection(document, offset);
            SelectionManager selectionManager = new SelectionManager(document);

            selectionManager.SetSelection(selection);

            Assert.IsTrue(selection.IsEmpty);
            Assert.IsEmpty(selectionManager.SelectedText);
            TestHelper.CallAllProperties(selection);
        }
        public void CursorAtStartOfWord()
        {
            const string TextMessage = "using(WorkflowRuntime |workflowRuntime = new WorkflowRuntime())";
            int          offset;
            IDocument    document = TestHelper.MakeDocument(TextMessage, out offset);

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

            selectionManager.SetSelection(selection);

            Assert.IsTrue(selection.ContainsOffset(18));
            Assert.AreEqual("workflowRuntime", selectionManager.SelectedText);
            TestHelper.CallAllProperties(selection);
        }
        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);
        }
        public void NullDocument()
        {
            const string     TextMessage      = null;
            IDocument        document         = TestHelper.MakeDocument(TextMessage);
            int              offset           = 21;
            ISelection       selection        = new SingleWordSelection(document, offset);
            SelectionManager selectionManager = new SelectionManager(document);

            selectionManager.SetSelection(selection);
            Assert.IsEmpty(selectionManager.SelectedText);
            TestHelper.CallAllProperties(selection);

            offset    = -2;
            selection = new SingleWordSelection(document, offset);
            selectionManager.SetSelection(selection);
            Assert.IsEmpty(selectionManager.SelectedText);
            TestHelper.CallAllProperties(selection);
        }
        public void WordCloseToDot()
        {
            const string TextMessage = "char answer = Console|.ReadKey().KeyChar;";
            int          offset;
            IDocument    document = TestHelper.MakeDocument(TextMessage, out offset);

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

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

            offset   += 1;
            selection = new SingleWordSelection(document, offset);
            selectionManager.SetSelection(selection);
            Assert.AreEqual("ReadKey", selectionManager.SelectedText);
            TestHelper.CallAllProperties(selection);
        }
        public void SelectNerestWord()
        {
            const string TextMessage = "\tIs |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);
            Assert.AreEqual("the", selectionManager.SelectedText);

            offset--;
            selection = new SingleWordSelection(document, offset);
            selectionManager.SetSelection(selection);
            Assert.AreEqual("Is", selectionManager.SelectedText);
            TestHelper.CallAllProperties(selection);
        }
        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);
        }
示例#15
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);
        }