示例#1
0
 public void HasAttribute()
 {
     var tag = new Tag("div")
     {
         {"id", "foo"}
     };
     Assert.AreEqual("foo", tag["id"]);
     Assert.IsNull(tag[0]);
     Assert.AreEqual("<div id=\"foo\"></div>", tag.ToString());
 }
示例#2
0
 public void HasChild()
 {
     var tag = new Tag("div")
     {
         new Tag("p")
         {
             "Hello World"
         }
     };
     Assert.IsInstanceOfType<Tag>(tag[0]);
     Assert.AreEqual("<div><p>Hello World</p></div>", tag.ToString());
 }
示例#3
0
 public void HasAttributeAndChild()
 {
     var tag = new Tag("div")
     {
         {"id", "foo"},
         new Tag("p")
         {
             "Hello World"
         }
     };
     Assert.AreEqual("foo", tag["id"]);
     Assert.AreEqual("<div id=\"foo\"><p>Hello World</p></div>", tag.ToString());
 }
示例#4
0
 public void IsEmpty()
 {
     var tag = new Tag("div");
     Assert.IsNull(tag[0]);
     Assert.AreEqual("<div></div>", tag.ToString());
 }
示例#5
0
 public void HasText()
 {
     var tag = new Tag("p")
     {
         "Hello World"
     };
     Assert.IsInstanceOfType<Tag>(tag[0]);
     Assert.AreEqual("<p>Hello World</p>", tag.ToString());
 }