public void TestExtractCell(string text, string expectedText, int expectedRowSpan, int expectedColSpan, bool expectedIsHeader) { IHtmlCell cell = HtmlTableParser.ExtractCell(text); if (cell.InnerText != expectedText) { throw new Exception(string.Format("The found InnerText {0} is differente from the excepted one {1} for {2}", cell.InnerText, expectedText, text)); } if (cell.IsHeader != expectedIsHeader) { throw new Exception(string.Format("The found IsHeader {0} is differente from the excepted one {1} for {2}", cell.IsHeader, expectedIsHeader, text)); } if (cell.RowSpan != expectedRowSpan) { throw new Exception(string.Format("The found RowSpan {0} is differente from the excepted one {1} for {2}", cell.RowSpan, expectedRowSpan, text)); } if (cell.ColSpan != expectedColSpan) { throw new Exception(string.Format("The found ColSpan {0} is differente from the excepted one {1} for {2}", cell.ColSpan, expectedColSpan, text)); } }
public void TestInvalidCell() { Assert.Throws <HtmlTableParserNoTagEndException>(() => HtmlTableParser.ExtractCell("<td"), "Should throw HtmlTableParserNoTagEndException"); }