当前位置: 首页>>代码示例>>C#>>正文


C# Url.Evaluate方法代码示例

本文整理汇总了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"));
        }
开发者ID:rslijp,项目名称:sharptiles,代码行数:22,代码来源:UrlTest.cs

示例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"));
 }
开发者ID:rslijp,项目名称:sharptiles,代码行数:7,代码来源:UrlTest.cs

示例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"));
 }
开发者ID:rslijp,项目名称:sharptiles,代码行数:6,代码来源:UrlTest.cs

示例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"));
 }
开发者ID:rslijp,项目名称:sharptiles,代码行数:6,代码来源:UrlTest.cs

示例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"));
        }
开发者ID:rslijp,项目名称:sharptiles,代码行数:17,代码来源:UrlTest.cs

示例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"));
        }
开发者ID:rslijp,项目名称:sharptiles,代码行数:18,代码来源:UrlTest.cs


注:本文中的Url.Evaluate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。