本文整理汇总了C#中Url.Evaluate方法的典型用法代码示例。如果您正苦于以下问题:C# Url.Evaluate方法的具体用法?C# Url.Evaluate怎么用?C# Url.Evaluate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Url
的用法示例。
在下文中一共展示了Url.Evaluate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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"));
}
示例2: CheckUrlWithTildeRequiredNoAppName
public void CheckUrlWithTildeRequiredNoAppName()
{
var url = new Url { Value = new MockAttribute(new Constant("~/info")) };
var model = new TagModel(this, new MockSessionState(), null, new MockResponse { ApplicationPath = "/" });
// CHANGE DOCUMENTATIE
Assert.That(url.Evaluate(model), Is.EqualTo("/info"));
}
示例3: CheckUrlWithTildeRequired
public void CheckUrlWithTildeRequired()
{
var url = new Url {Value = new MockAttribute(new Constant("~/info"))};
var model = new TagModel(this, new MockSessionState(), null, new MockResponse { ApplicationPath = "/SharpTiles" });
Assert.That(url.Evaluate(model), Is.EqualTo("/SharpTiles/info"));
}
示例4: TestRenderingOfUrl
public void TestRenderingOfUrl()
{
var url = new Url();
url.Value = new MockAttribute(new Constant("www.sharptiles.org"));
Assert.That(url.Evaluate(new TagModel(this)), Is.EqualTo("www.sharptiles.org"));
}
示例5: 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"));
}
示例6: 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"));
}