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()); }
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()); }
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()); }
public void HasNormalAttributesWithSameName() { var tag = new Tag("div") { {"id", "foo"}, {"id", "bar"} }; Assert.AreEqual("bar", tag["id"]); }
public void HasListAttributesWithSameName() { var tag = new Tag("div") { {"class", "foo"}, {"class", "bar"} }; Assert.AreEqual("foo bar", tag["class"]); }
public void UsesDictionary() { var attributes = new Dictionary<string, string>{ {"id", "foo"}, {"class", "bar"} }; var tag = new Tag("div") { attributes }; Assert.AreEqual("foo", tag["id"]); Assert.AreEqual("bar", tag["class"]); }
public void UsesAnonymousTypeWithCasing() { var tag = new Tag("div") { new { Id = "foo", Class = "bar" } }; Assert.AreEqual("foo", tag["id"]); Assert.AreEqual("bar", tag["class"]); }
public void UsesAnonymousType() { var tag = new Tag("div") { new { id = "foo" } }; Assert.AreEqual("foo", tag["id"]); }
public void IsEmpty() { var tag = new Tag("div"); Assert.IsNull(tag[0]); Assert.AreEqual("<div></div>", tag.ToString()); }
public void HasText() { var tag = new Tag("p") { "Hello World" }; Assert.IsInstanceOfType<Tag>(tag[0]); Assert.AreEqual("<p>Hello World</p>", tag.ToString()); }