本文整理匯總了C#中Body.AddAttribute方法的典型用法代碼示例。如果您正苦於以下問題:C# Body.AddAttribute方法的具體用法?C# Body.AddAttribute怎麽用?C# Body.AddAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Body
的用法示例。
在下文中一共展示了Body.AddAttribute方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: AddTWoAttributes_ToString_TagWithAttributes
public void AddTWoAttributes_ToString_TagWithAttributes()
{
Body b = new Body();
b.AddAttribute("first", "val1");
b.AddAttribute("second", "val2");
string html = b.ToString();
string expected = "<body first=\"val1\" second=\"val2\"></body>";
Assert.AreEqual(expected, html);
}
示例2: AddAttribute_ToString_TagWithAttribute
public void AddAttribute_ToString_TagWithAttribute()
{
Body b = new Body();
b.AddAttribute("attname", "val");
string html = b.ToString();
string expected = "<body attname=\"val\"></body>";
Assert.AreEqual(expected, html);
}
示例3: AddClassAddAttribute_ToString_TagWithClassesAndAttributes
public void AddClassAddAttribute_ToString_TagWithClassesAndAttributes()
{
Body b = new Body();
b.AddClass("one");
b.AddAttribute("first", "val1");
string html = b.ToString();
string expected = "<body class=\"one\" first=\"val1\"></body>";
Assert.AreEqual(expected, html);
}