コード例 #1
0
        public void CallingSurroundSelectionWithCommentRemovesCommentTagsWhenCommentTagsExist()
        {
            int selectionStart  = 14;
            int selectionLength = 2;

            textEditor.Select(selectionStart, selectionLength);
            formattingStrategy.SurroundSelectionWithComment(textEditor);

            string expectedText =
                "<root>\r\n" +
                "\t<child></child>\r\n" +
                "</root>";

            Assert.AreEqual(expectedText, document.Text);
        }
コード例 #2
0
        public void Init()
        {
            formattingStrategy = new XmlFormattingStrategy();

            options            = new MockTextEditorOptions();
            textEditor         = new MockTextEditor();
            textEditor.Options = options;

            textDocument = new TextDocument();
            document     = new AvalonEditDocumentAdapter(textDocument, null);
            textEditor.SetDocument(document);

            textDocument.Text =
                "<root>\r\n" +
                "\t<child></child>\r\n" +
                "</root>";

            int selectionStart  = 9;
            int selectionLength = 15;

            textEditor.Select(selectionStart, selectionLength);

            formattingStrategy.SurroundSelectionWithComment(textEditor);
        }