Exemple #1
0
 public void TestHTMLSimpleNoOpen()
 {
     HTML.Document d = HTML.Document.Parse("wibble");
     HTML.Element  p = d.HTML.Follow("body.p");
     Assert.AreEqual(1, p.Contents.Count);
     HTML.Cdata cdata = p.Contents[0] as HTML.Cdata;
     Assert.AreEqual("wibble", cdata.Content);
 }
Exemple #2
0
 public void TestHTMLTwoPara()
 {
     HTML.Document d = HTML.Document.Parse("<p>first</p> <p>second</p>");
     Assert.AreEqual(2, d.HTML.Follow("body").Contents.Count);
     HTML.Element p1 = d.HTML.Follow("body.p");
     Assert.AreEqual(1, p1.Contents.Count);
     HTML.Cdata cdata1 = p1.Contents[0] as HTML.Cdata;
     Assert.AreEqual("first", cdata1.Content);
     HTML.Element p2     = (HTML.Element)d.HTML.Follow("body").Contents[1];
     HTML.Cdata   cdata2 = p2.Contents[0] as HTML.Cdata;
     Assert.AreEqual("second", cdata2.Content);
 }
Exemple #3
0
 public void TestHTMLInline()
 {
     HTML.Document d = HTML.Document.Parse("<p>one <i>two</i> three</p>");
     HTML.Element  p = d.HTML.Follow("body.p");
     Assert.AreEqual(3, p.Contents.Count);
     HTML.Cdata cdata1 = p.Contents[0] as HTML.Cdata;
     Assert.AreEqual("one ", cdata1.Content);
     HTML.Element italic = p.Contents[1] as HTML.Element;
     Assert.AreEqual("i", italic.Name);
     Assert.AreEqual(1, italic.Contents.Count);
     HTML.Cdata cdata2 = italic.Contents[0] as HTML.Cdata;
     Assert.AreEqual("two", cdata2.Content);
     HTML.Cdata cdata3 = p.Contents[2] as HTML.Cdata;
     Assert.AreEqual(" three", cdata3.Content);
 }
Exemple #4
0
 public void TestHTMLSimple()
 {
     HTML.Document d = HTML.Document.Parse("<p>wibble</p>");
     Assert.AreEqual("html", d.HTML.Name);
     Assert.AreEqual(2, d.HTML.Contents.Count);
     HTML.Element body = d.HTML.Contents[1] as HTML.Element;
     Assert.IsNotNull(body);
     Assert.AreEqual("body", body.Name);
     Assert.AreEqual(1, body.Contents.Count);
     HTML.Element p = body.Contents[0] as HTML.Element;
     Assert.AreEqual("p", p.Name);
     Assert.AreEqual(1, p.Contents.Count);
     HTML.Cdata cdata = p.Contents[0] as HTML.Cdata;
     Assert.AreEqual("wibble", cdata.Content);
 }