Exemple #1
0
 [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, " "));
 }
Exemple #2
0
 [Test] public void ParseCommentedTablesIgnored() {
     var result = new HtmlTables().Parse("leader<!--<table><tr><td>ignored</td></tr></table>-->trailer");
     Assert.AreEqual(string.Empty, Format(result, " "));
 }
Exemple #3
0
 [Test] public void ParseEmpty() {
     Tree<CellBase> result = new HtmlTables().Parse(string.Empty);
     Assert.IsTrue(result.Branches.Count == 0);
 }
Exemple #4
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);
 }
Exemple #5
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, " "));
 }
Exemple #6
0
 [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, " "));
 }
Exemple #7
0
 [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, " "));
 }
Exemple #8
0
 [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, " "));
 }
Exemple #9
0
 [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, " "));
 }