public void SurroundingParagraphsAreUnchanged() { var htmlDocument = new HtmlDocument(); htmlDocument.LoadHtml(PARAGRAPH + FAKE_LIST_ITEM + FAKE_LIST_ITEM + FAKE_LIST_ITEM + PARAGRAPH); var formatter = new FakeListFormatter(); formatter.FormatHtml(htmlDocument); Assert.AreEqual(PARAGRAPH + "<ul>" + LIST_ITEM + LIST_ITEM + LIST_ITEM + "</ul>" + PARAGRAPH, htmlDocument.DocumentNode.OuterHtml); }
public void TwoConsecutiveListItemsAreAList() { var htmlDocument = new HtmlDocument(); htmlDocument.LoadHtml(HTML_BEFORE + FAKE_LIST_ITEM + FAKE_LIST_ITEM + HTML_AFTER); var formatter = new FakeListFormatter(); formatter.FormatHtml(htmlDocument); Assert.AreEqual(HTML_BEFORE + "<ul>" + LIST_ITEM + LIST_ITEM + "</ul>" + HTML_AFTER, htmlDocument.DocumentNode.OuterHtml); }
public void TwoSeparateListItemsAreNotAList() { var htmlDocument = new HtmlDocument(); htmlDocument.LoadHtml(HTML_BEFORE + FAKE_LIST_ITEM + PARAGRAPH + FAKE_LIST_ITEM + HTML_AFTER); var formatter = new FakeListFormatter(); formatter.FormatHtml(htmlDocument); Assert.AreEqual(HTML_BEFORE + FAKE_LIST_ITEM + PARAGRAPH + FAKE_LIST_ITEM + HTML_AFTER, htmlDocument.DocumentNode.OuterHtml); }
public void NoListNoChange() { var htmlDocument = new HtmlDocument(); htmlDocument.LoadHtml(HTML_BEFORE + PARAGRAPH + PARAGRAPH + PARAGRAPH + HTML_AFTER); var formatter = new FakeListFormatter(); formatter.FormatHtml(htmlDocument); Assert.AreEqual(HTML_BEFORE + PARAGRAPH + PARAGRAPH + PARAGRAPH + HTML_AFTER, htmlDocument.DocumentNode.OuterHtml); }
public void SingleParagraphListSplitByBrIsTransformed() { var htmlDocument = new HtmlDocument(); htmlDocument.LoadHtml("<p>- example list item<br />" + Environment.NewLine + "- example list item<br />" + Environment.NewLine + "- example list item</p>"); var formatter = new FakeListFormatter(); formatter.FormatHtml(htmlDocument); Assert.AreEqual("<ul>" + LIST_ITEM + LIST_ITEM + LIST_ITEM + "</ul>", htmlDocument.DocumentNode.OuterHtml); }
public void MultipleListsAreTransformed() { var htmlDocument = new HtmlDocument(); htmlDocument.LoadHtml(PARAGRAPH + FAKE_LIST_ITEM + FAKE_LIST_ITEM + FAKE_LIST_ITEM + PARAGRAPH + FAKE_LIST_ITEM + FAKE_LIST_ITEM + FAKE_LIST_ITEM + PARAGRAPH); var formatter = new FakeListFormatter(); formatter.FormatHtml(htmlDocument); Assert.AreEqual(PARAGRAPH + "<ul>" + LIST_ITEM + LIST_ITEM + LIST_ITEM + "</ul>" + PARAGRAPH + "<ul>" + LIST_ITEM + LIST_ITEM + LIST_ITEM + "</ul>" + PARAGRAPH, htmlDocument.DocumentNode.OuterHtml); }