public void WriteStandard_RendersStandardFlexiSectionBlock(FlexiSectionBlock dummyFlexiSectionBlock,
                                                                   FlexiSectionHeadingBlock dummyFlexiSectionHeadingBlock,
                                                                   string expectedResult)
        {
            // Arrange
            dummyFlexiSectionBlock.Add(dummyFlexiSectionHeadingBlock);
            var dummyStringWriter = new StringWriter();
            var dummyHtmlRenderer = new HtmlRenderer(dummyStringWriter); // Note that markdig changes dummyStringWriter.NewLine to '\n'
            FlexiSectionBlockRenderer testSubject = CreateFlexiSectionBlockRenderer();

            // Act
            testSubject.Write(dummyHtmlRenderer, dummyFlexiSectionBlock);
            string result = dummyStringWriter.ToString();

            // Assert
            Assert.Equal(expectedResult, result, ignoreLineEndingDifferences: true);
        }
        public void WriteClassic_RendersClassicFlexiSectionBlock()
        {
            // Arrange
            const int    dummyLevel                  = 6;
            const string dummyHeadingText            = "dummyHeadingText";
            var          dummyHeadingContainerInline = new ContainerInline();

            dummyHeadingContainerInline.AppendChild(new LiteralInline(dummyHeadingText));
            FlexiSectionHeadingBlock dummyFlexiSectionHeadingBlock = CreateFlexiSectionHeadingBlock();

            dummyFlexiSectionHeadingBlock.Inline = dummyHeadingContainerInline;
            const string dummyChildText            = "dummyChildText";
            var          dummyChildContainerInline = new ContainerInline();

            dummyChildContainerInline.AppendChild(new LiteralInline(dummyChildText));
            var dummyChildBlock = new ParagraphBlock()
            {
                Inline = dummyChildContainerInline
            };
            var dummyStringWriter = new StringWriter();
            var dummyHtmlRenderer = new HtmlRenderer(dummyStringWriter);
            FlexiSectionBlockRenderer testSubject       = CreateFlexiSectionBlockRenderer();
            FlexiSectionBlock         flexiSectionBlock = CreateFlexiSectionBlock(level: dummyLevel);

            flexiSectionBlock.Add(dummyFlexiSectionHeadingBlock);
            flexiSectionBlock.Add(dummyChildBlock);

            // Act
            testSubject.WriteClassic(dummyHtmlRenderer, flexiSectionBlock);

            // Assert
            string result = dummyStringWriter.ToString();

            Assert.Equal($@"<h{dummyLevel}>{dummyHeadingText}</h{dummyLevel}>
<p>{dummyChildText}</p>
",
                         result,
                         ignoreLineEndingDifferences: true);
        }
        public void WriteStandard_RendersChildren()
        {
            // Arrange
            const string dummyChildContent         = "dummyChildText";
            var          dummyChildContainerInline = new ContainerInline();

            dummyChildContainerInline.AppendChild(new LiteralInline(dummyChildContent));
            var dummyChildBlock = new ParagraphBlock()
            {
                Inline = dummyChildContainerInline
            };
            FlexiSectionBlock dummyFlexiSectionBlock = CreateFlexiSectionBlock(level: 2); // Level must be specified or we'll get an out of range exception

            dummyFlexiSectionBlock.Add(CreateFlexiSectionHeadingBlock());
            dummyFlexiSectionBlock.Add(dummyChildBlock);
            var dummyStringWriter = new StringWriter();
            var dummyHtmlRenderer = new HtmlRenderer(dummyStringWriter); // Note that markdig changes dummyStringWriter.NewLine to '\n'
            FlexiSectionBlockRenderer testSubject = CreateFlexiSectionBlockRenderer();

            // Act
            testSubject.Write(dummyHtmlRenderer, dummyFlexiSectionBlock);
            string result = dummyStringWriter.ToString();

            // Assert
            Assert.Equal($@"<section class="" _level_2 _no-link-icon"">
<header class=""__header"">
<h2 class=""__heading""></h2>
<button class=""__link-button"" aria-label=""Copy link"">
</button>
</header>
<p>{dummyChildContent}</p>
</section>
",
                         result,
                         ignoreLineEndingDifferences: true);
        }