예제 #1
0
 public void NullOrEmptyChildElementsAsArgsToAppendMethodAreNotAppended()
 {
     Element body = new Element("body");
     Element[] nullarray = null;
     Assert.AreEqual("<body></body>", body.Append(nullarray).ToString());
     Assert.AreEqual(0, body.Children.Count);
     Element[] emptyarray = new Element[0] { };
     Assert.AreEqual(0, body.Children.Count);
 }
예제 #2
0
 public void VerifyInsert()
 {
     Element table = new Element("table");
     Element thead = new Element("thead");
     Element tr = new Element("tr");
     for (int i = 0; i < 3; i++)
     {
         tr.Insert(new Element("th").Update("Blah"));
     }
     table.Append(thead.Append(tr));
     string actual = table.ToString();
     string expected = "<table><thead><tr><th>Blah</th><th>Blah</th><th>Blah</th></tr></thead></table>";
     Assert.AreEqual(expected, actual);
 }
예제 #3
0
 public void NullElementsAreNotAppendedAndDoNotThrowExceptions()
 {
     Element body = new Element("body");
     Element iamnull = null;
     Element form = new Element("form");
     body.Append(iamnull, form);
     Assert.AreEqual(1, body.Children.Count);
     Assert.AreEqual("<body><form></form></body>", body.ToString());
 }