<commit_before>using Docu.Documentation.Comments;
using Docu.Parsing.Comments;
using NUnit.Framework;
using System.Linq;
using StructureMap;

namespace Docu.Tests.Parsing
{
    [TestFixture]
    public class CommentParserTests
    {
        private CommentParser parser;
        private IContainer container;

        [TestFixtureSetUp]
        public void SetupContainer()
        {
            container = ContainerBootstrapper.BootstrapStructureMap();
        }

        [SetUp]
        public void CreateParser()
        {
            parser = container.GetInstance<CommentParser>();
        }

        [Test]
        public void ShouldParseSimple()
        {
            var blocks = parser.ParseNode("<x>Hello world!</x>".ToNode());

            blocks.Count.ShouldEqual(1);
            blocks[0].ShouldBeOfType<InlineText>();
            ((InlineText)blocks[0]).Text.ShouldEqual("Hello world!");
        }

        [Test]
        public void ShouldParseSimpleTrimLeadingWhitespace()
        {
            var blocks = parser.ParseNode("<x>  Hello world!</x>".ToNode());

            blocks.Count.ShouldEqual(1);
            blocks[0].ShouldBeOfType<InlineText>();
            ((InlineText)blocks[0]).Text.ShouldEqual("Hello world!");
        }

        [Test]
        public void ShouldParseSimpleTrimLeadingWhitespaceNewlines()
        {
            var blocks = parser.ParseNode(@"
            <x>
                Hello world!
            </x>".ToNode());

            blocks.Count.ShouldEqual(1);
            blocks[0].ShouldBeOfType<InlineText>();
            ((InlineText)blocks[0]).Text.ShouldEqual("Hello world!");
        }

        [Test]
        public void ShouldParseCodeInline()
        {
            var blocks = parser.ParseNode("<x><c>code</c></x>".ToNode());

            blocks.Count.ShouldEqual(1);
            blocks[0].ShouldBeOfType<InlineCode>();
            ((InlineCode)blocks[0]).Text.ShouldEqual("code");
        }

        [Test, Category("TeamCityIgnore")]
        public void ShouldParseCodeMultiline()
        {
            var blocks = parser.ParseNode(@"
<x>
    <code>
        Some multiline
        code
    </code>
</x>        ".ToNode());

            blocks.Count.ShouldEqual(1);
            blocks[0].ShouldBeOfType<InlineCode>();
            ((InlineCode)blocks[0]).Text.ShouldEqual("Some multiline\r\ncode");
        }

        [Test]
        public void ShouldParseSeeForNamespace()
        {
            var blocks = parser.ParseNode("<x><see cref=\"N:Example\" /></x>".ToNode());

            blocks.Count.ShouldEqual(1);
            blocks[0].ShouldBeOfType<See>();
            ((See)blocks[0]).Reference.IsResolved.ShouldBeFalse();
            ((See)blocks[0]).Reference.Name.ShouldEqual("Example");
        }

        [Test]
        public void ShouldParseSeeForType()
        {<commit_msg>Attempting to restore troublesome test on TeamCity<commit_after>using Docu.Documentation.Comments;
using Docu.Parsing.Comments;
using NUnit.Framework;
using System.Linq;
using StructureMap;

namespace Docu.Tests.Parsing
{
    [TestFixture]
    public class CommentParserTests
    {
        private CommentParser parser;
        private IContainer container;

        [TestFixtureSetUp]
        public void SetupContainer()
        {
            container = ContainerBootstrapper.BootstrapStructureMap();
        }

        [SetUp]
        public void CreateParser()
        {
            parser = container.GetInstance<CommentParser>();
        }

        [Test]
        public void ShouldParseSimple()
        {
            var blocks = parser.ParseNode("<x>Hello world!</x>".ToNode());

            blocks.Count.ShouldEqual(1);
            blocks[0].ShouldBeOfType<InlineText>();
            ((InlineText)blocks[0]).Text.ShouldEqual("Hello world!");
        }

        [Test]
        public void ShouldParseSimpleTrimLeadingWhitespace()
        {
            var blocks = parser.ParseNode("<x>  Hello world!</x>".ToNode());

            blocks.Count.ShouldEqual(1);
            blocks[0].ShouldBeOfType<InlineText>();
            ((InlineText)blocks[0]).Text.ShouldEqual("Hello world!");
        }

        [Test]
        public void ShouldParseSimpleTrimLeadingWhitespaceNewlines()
        {
            var blocks = parser.ParseNode(@"
            <x>
                Hello world!
            </x>".ToNode());

            blocks.Count.ShouldEqual(1);
            blocks[0].ShouldBeOfType<InlineText>();
            ((InlineText)blocks[0]).Text.ShouldEqual("Hello world!");
        }

        [Test]
        public void ShouldParseCodeInline()
        {
            var blocks = parser.ParseNode("<x><c>code</c></x>".ToNode());

            blocks.Count.ShouldEqual(1);
            blocks[0].ShouldBeOfType<InlineCode>();
            ((InlineCode)blocks[0]).Text.ShouldEqual("code");
        }

        [Test]
        public void ShouldParseCodeMultiline()
        {
            var blocks = parser.ParseNode(@"
<x>
    <code>
        Some multiline
        code
    </code>
</x>        ".ToNode());

            blocks.Count.ShouldEqual(1);
            blocks[0].ShouldBeOfType<InlineCode>();
            ((InlineCode)blocks[0]).Text.ShouldEqual("Some multiline\r\ncode");
        }

        [Test]
        public void ShouldParseSeeForNamespace()
        {
            var blocks = parser.ParseNode("<x><see cref=\"N:Example\" /></x>".ToNode());

            blocks.Count.ShouldEqual(1);
            blocks[0].ShouldBeOfType<See>();
            ((See)blocks[0]).Reference.IsResolved.ShouldBeFalse();
            ((See)blocks[0]).Reference.Name.ShouldEqual("Example");
        }

        [Test]
        public void ShouldParseSeeForType()
        {
{'fraction_non_alphanumeric': 0.13252589081972968, 'fraction_numerical': 0.00667017728629103, 'mean_word_length': 2.0340788072417464, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2357584', 'n_tokens_mistral': 1565, 'n_tokens_neox': 1542, 'n_words': 247}