本文整理汇总了C#中Url.AddNestedTag方法的典型用法代码示例。如果您正苦于以下问题:C# Url.AddNestedTag方法的具体用法?C# Url.AddNestedTag怎么用?C# Url.AddNestedTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Url
的用法示例。
在下文中一共展示了Url.AddNestedTag方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestRenderingOfParamsUrlWithTwoParams
public void TestRenderingOfParamsUrlWithTwoParams()
{
var url = new Url();
url.Value = new MockAttribute(new Constant("www.sharptiles.org"));
var param1 = new Param();
param1.Name = new MockAttribute(new Constant("p1"));
param1.Body = new MockAttribute(new Constant("v1"));
var param2 = new Param();
param2.Name = new MockAttribute(new Constant("p2"));
param2.Body = new MockAttribute(new Constant("v2"));
url.AddNestedTag(param1);
url.AddNestedTag(param2);
Assert.That(url.Evaluate(new TagModel(this)), Is.EqualTo("www.sharptiles.org?p1=v1&p2=v2"));
}
示例2: TestRenderingOfParamsUrlInVariable
public void TestRenderingOfParamsUrlInVariable()
{
var url = new Url();
url.Value = new MockAttribute(new Constant("www.sharptiles.org"));
var param1 = new Param();
param1.Name = new MockAttribute(new Constant("p1"));
param1.Body = new MockAttribute(new Constant("v1"));
var param2 = new Param();
param2.Name = new MockAttribute(new Constant("p2"));
param2.Body = new MockAttribute(new Constant("v2"));
url.AddNestedTag(param1);
url.AddNestedTag(param2);
url.Var = new MockAttribute(new Constant("target"));
var model = new TagModel(this);
Assert.That(url.Evaluate(model), Is.EqualTo(String.Empty));
Assert.That(model.Page["target"], Is.EqualTo("www.sharptiles.org?p1=v1&p2=v2"));
}
示例3: TestRenderingOfParamsUrlInVariableInDifferentScope
public void TestRenderingOfParamsUrlInVariableInDifferentScope()
{
var url = new Url();
url.Value = new MockAttribute(new Constant("www.sharptiles.org"));
var param1 = new Param();
param1.Name = new MockAttribute(new Constant("p1"));
param1.Body = new MockAttribute(new Constant("v1"));
url.AddNestedTag(param1);
url.Var = new MockAttribute(new Constant("target"));
url.Scope = new MockAttribute(new Constant("Session"));
var model = new TagModel(this, new MockSessionState());
Assert.That(url.Evaluate(model), Is.EqualTo(String.Empty));
Assert.That(model.Session["target"], Is.EqualTo("www.sharptiles.org?p1=v1"));
}