示例#1
0
        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));
            }
        }
示例#2
0
 public void TestInvalidCell()
 {
     Assert.Throws <HtmlTableParserNoTagEndException>(() => HtmlTableParser.ExtractCell("<td"), "Should throw HtmlTableParserNoTagEndException");
 }