public void WriteBlock_WritesBlock(FlexiCardsBlock dummyFlexiCardsBlock, string expectedResult) { // Arrange var dummyStringWriter = new StringWriter(); var dummyHtmlRenderer = new HtmlRenderer(dummyStringWriter); ExposedFlexiCardsBlockRenderer testSubject = CreateExposedFlexiCardsBlockRenderer(); // Act testSubject.ExposedWriteBlock(dummyHtmlRenderer, dummyFlexiCardsBlock); string result = dummyStringWriter.ToString(); // Assert Assert.Equal(expectedResult, result, ignoreLineEndingDifferences: true); }
public void WriteBlock_OnlyWritesChildrenIfEnableHtmlForBlockIsFalse() { // Arrange // Dummy title part const string dummyTitle = "dummyTitle"; var dummyTitleContainerInline = new ContainerInline(); dummyTitleContainerInline.AppendChild(new LiteralInline(dummyTitle)); var dummyTitlePartBlock = new PlainLeafBlock(null); dummyTitlePartBlock.Inline = dummyTitleContainerInline; // Dummy content part const string dummyContent = "dummyContent"; var dummyContentContainerInline = new ContainerInline(); dummyContentContainerInline.AppendChild(new LiteralInline(dummyContent)); var dummyContentParagraphBlock = new ParagraphBlock() { Inline = dummyContentContainerInline }; var dummyContentPartBlock = new PlainContainerBlock(null); dummyContentPartBlock.Add(dummyContentParagraphBlock); // Dummy footnote part const string dummyFootnote = "dummyFootnote"; var dummyFootnoteContainerInline = new ContainerInline(); dummyFootnoteContainerInline.AppendChild(new LiteralInline(dummyFootnote)); var dummyFootnotePartBlock = new PlainLeafBlock(null); dummyFootnotePartBlock.Inline = dummyFootnoteContainerInline; FlexiCardsBlock dummyFlexiCardsBlock = CreateFlexiCardsBlock(children: new List <FlexiCardBlock> { CreateFlexiCardBlock(titlePart: dummyTitlePartBlock, contentPart: dummyContentPartBlock, footnotePart: dummyFootnotePartBlock) }); var dummyStringWriter = new StringWriter(); var dummyHtmlRenderer = new HtmlRenderer(dummyStringWriter) { EnableHtmlForBlock = false }; ExposedFlexiCardsBlockRenderer testSubject = CreateExposedFlexiCardsBlockRenderer(); // Act testSubject.ExposedWriteBlock(dummyHtmlRenderer, dummyFlexiCardsBlock); string result = dummyStringWriter.ToString(); // Assert Assert.Equal($"{dummyTitle}\n{dummyContent}\n{dummyFootnote}\n", result, ignoreLineEndingDifferences: true); }