public void VerifyInsertDefaultsToIndexZero() { Element select = new Element("select"); select.Insert(new Element("option").Update("Item 1")); select.Insert(new Element("option").Update("Item 2")); Assert.AreEqual("<select><option>Item 2</option><option>Item 1</option></select>", select.ToString()); }
public void VerifyNullElementsAreSkippedDuringInsert() { Element nullelement = null; Element select = new Element("select"); select.Insert(new Element("option").Update("Item 1"), nullelement); Assert.AreEqual(1, select.Children.Count); Assert.AreEqual("<select><option>Item 1</option></select>", select.ToString()); }
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); }