Example #1
0
        public void Initialize()
        {
            // Initialize mock document
            _document = new TextDocumentMock();
            _document.Selection = new TextSelectionMock();

            // Initialize mock range
            _range = new TextRangeMock();
            _range.CharacterFormat = new TextCharacterFormatMock();
            _document.TextRange = _range;

            _highlighter = new MarkdownTestHighlighter(_document);
        }
Example #2
0
        public void TestDefaultFormatting()
        {
            // Test this method on markdown itself, as it is stubbed in MarkdownTestHighlighter
            _highlighter = new Markdown(_document);

            // Make some text that doesn't require formatting bold/italic
            _range.Text = "This is some text that should not get highlighted.";
            _range.CharacterFormat.Bold = FormatEffect.On;
            _range.CharacterFormat.Italic = FormatEffect.On;

            _highlighter.Highlight();

            // Highlighting should've been removed
            Assert.AreEqual(FormatEffect.Off, _range.CharacterFormat.Italic);
            Assert.AreEqual(FormatEffect.Off, _range.CharacterFormat.Bold);
        }