Ejemplo n.º 1
0
        public void ForMarkdownWithNoBlocks_ReturnsNoBlocks()
        {
            var reader = new StringReader(@"# Markdown
Contains no blocks.
");
            var blocks = new MarkdownXmlBlockExtractor().Extract(reader);

            Assert.That(blocks, Is.Empty);
        }
Ejemplo n.º 2
0
        public void ForMarkdownWithUntypedNonXmlBlock_ReturnsNoBlocks()
        {
            var reader = new StringReader(@"# Markdown
```
This is some text in a block.
```
");
            var blocks = new MarkdownXmlBlockExtractor().Extract(reader);

            Assert.That(blocks, Is.Empty);
        }
Ejemplo n.º 3
0
        public void ForMarkdownWithXmlTypedNonXmlBlock_ReturnsOneEmptyBlock()
        {
            var reader = new StringReader(@"# Markdown
```xml
This is some text in a block which claims to be XML.
```
");
            var blocks = new MarkdownXmlBlockExtractor().Extract(reader);

            Assert.That(blocks, Has.Count.EqualTo(1));
            Assert.That(blocks.Single().GetElements(), Is.Empty);
        }
Ejemplo n.º 4
0
        public void ForMarkdownWithXmlTypedBlock_ContainingXmlElements_ReturnsOneBlockContainingElements()
        {
            var reader = new StringReader(@"# Markdown
```xml
<a></a>
<b></b>
```
");
            var blocks = new MarkdownXmlBlockExtractor().Extract(reader);

            Assert.That(blocks, Has.Count.EqualTo(1));
            Assert.That(blocks.Single().GetElements(), Has.Count.EqualTo(2));
        }
Ejemplo n.º 5
0
        public void ForMarkdownWithXmlTypedInvalidXmlBlock_ReturnsOneUnparseableBlock()
        {
            var reader = new StringReader(@"# Markdown
```xml
This is some text which is not valid inner XML <_<,
in a block which claims to be XML.
```
");
            var blocks = new MarkdownXmlBlockExtractor().Extract(reader);

            Assert.That(blocks, Has.Count.EqualTo(1));
            Assert.Catch <XmlException>(() => blocks.Single().GetElements());
        }