[Test] public void ParseContentWithoutTables() { // This is somewhat redundant with ParseNoTables, but I added // it to make sure I understand the behavior of Format() var result = new HtmlTables().Parse("<p>Hello world!</p>"); Assert.AreEqual(string.Empty, Format(result, " ")); }
[Test] public void ParseCommentedTablesIgnored() { var result = new HtmlTables().Parse("leader<!--<table><tr><td>ignored</td></tr></table>-->trailer"); Assert.AreEqual(string.Empty, Format(result, " ")); }
[Test] public void ParseEmpty() { Tree<CellBase> result = new HtmlTables().Parse(string.Empty); Assert.IsTrue(result.Branches.Count == 0); }
[Test] public void ParseNoTables() { Tree<CellBase> result = new HtmlTables().Parse("set the table"); Assert.IsTrue(result.Branches.Count == 0); result = new HtmlTables().Parse("set the <table"); Assert.IsTrue(result.Branches.Count == 0); }
public void ParseCommentSeveralCommentBlocks() { var result = new HtmlTables().Parse("<!--first--><p>other content</p><!--<table><tr><td>first</td></tr></table>-->"); Assert.AreEqual(string.Empty, Format(result, " ")); }
[Test] public void ParseCommentInsideTable() { var result = new HtmlTables().Parse("<table><tr><td>first</td></tr><!--<tr><td>first</td></tr>--></table>"); Assert.AreEqual(" <table> <tr> <td> first</td></tr> <!--<tr><td>first</td></tr>--></table>", Format(result, " ")); }
[Test] public void ParseCommentUnclosed() { var result = new HtmlTables().Parse("<table><tr><td>leader</td></tr></table><!--<table><tr><td>ignored</td></tr></table><table><tr><td>trailer</td></tr></table>"); Assert.AreEqual(" <table> <tr> <td> leader</td></tr></table> <!--<table><tr><td>ignored</td></tr></table><table><tr><td>trailer</td></tr></table>", Format(result, " ")); }
[Test] public void ParseCommentTarnishedTableElement() { var result = new HtmlTables().Parse("<!--table><tr><td>ignored</td></tr></table--><table><tr><td>trailer</td></tr></table>"); Assert.AreEqual(" <!--table><tr><td>ignored</td></tr></table--> <table> <tr> <td> trailer</td></tr></table>", Format(result, " ")); }
[Test] public void ParseCommentedTableAsLeader() { var result = new HtmlTables().Parse("<!--<table><tr><td>ignored</td></tr></table>--><table><tr><td>foo</td></tr></table>"); Assert.AreEqual(" <!--<table><tr><td>ignored</td></tr></table>--> <table> <tr> <td> foo</td></tr></table>", Format(result, " ")); }