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


C# RouteCollection.Url方法代码示例

本文整理汇总了C#中RouteCollection.Url方法的典型用法代码示例。如果您正苦于以下问题:C# RouteCollection.Url方法的具体用法?C# RouteCollection.Url怎么用?C# RouteCollection.Url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RouteCollection的用法示例。


在下文中一共展示了RouteCollection.Url方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Url_with_no_matching_route_throws_AssertException

 public void Url_with_no_matching_route_throws_AssertException()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     Assert.Throws<AssertException>(() => routes.Url("~/product/details/123/456").ShouldMapTo<ProductController>(x => x.Details(123)));
 }
开发者ID:glombard,项目名称:WebTestHelper,代码行数:6,代码来源:RouteConfigTests.cs

示例2: Resource_route_with_pathinfo_should_be_ignored

 public void Resource_route_with_pathinfo_should_be_ignored()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     routes.Url("~/abc.axd/x/y/z").ShouldBeIgnored();
 }
开发者ID:glombard,项目名称:WebTestHelper,代码行数:6,代码来源:RouteConfigTests.cs

示例3: Url_with_controller_action_and_parameter_should_map_correctly_when_parameter_is_method_call

 public void Url_with_controller_action_and_parameter_should_map_correctly_when_parameter_is_method_call()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     routes.Url("~/product/details/123").ShouldMapTo<ProductController>(x => x.Details(MethodReturnsInt(123)));
 }
开发者ID:glombard,项目名称:WebTestHelper,代码行数:6,代码来源:RouteConfigTests.cs

示例4: Url_with_no_action_in_route_throws_AssertException

 public void Url_with_no_action_in_route_throws_AssertException()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     Assert.Throws<AssertException>(() => routes.Url("~/HomeNoAction").ShouldMapTo<HomeController>(x => x.Index()));
 }
开发者ID:glombard,项目名称:WebTestHelper,代码行数:6,代码来源:RouteConfigTests.cs

示例5: Url_with_no_controller_in_route_throws_AssertException

 public void Url_with_no_controller_in_route_throws_AssertException()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     Assert.Throws<AssertException>(() => routes.Url("~/NoController/index").ShouldMapTo<HomeController>());
 }
开发者ID:glombard,项目名称:WebTestHelper,代码行数:6,代码来源:RouteConfigTests.cs

示例6: RouteCollection

 public void When_comparing_a_url_with_controller_action_and_parameter_to_wrong_controller_then_throw_AssertException()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     Assert.Throws<AssertException>(() => routes.Url("~/product/details/123").ShouldMapTo<SearchController>());
 }
开发者ID:glombard,项目名称:WebTestHelper,代码行数:6,代码来源:RouteConfigTests.cs

示例7: Url_with_controller_action_and_two_parameters_should_map_to_correct_controller_and_action

 public void Url_with_controller_action_and_two_parameters_should_map_to_correct_controller_and_action()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     routes.Url("~/search/ASP.NET/2").ShouldMapTo<SearchController>(x => x.Result("ASP.NET", 2));
 }
开发者ID:glombard,项目名称:WebTestHelper,代码行数:6,代码来源:RouteConfigTests.cs

示例8: Root_url_should_map_to_default_controller

 public void Root_url_should_map_to_default_controller()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     routes.Url("~/").ShouldMapTo<HomeController>();
 }
开发者ID:glombard,项目名称:WebTestHelper,代码行数:6,代码来源:RouteConfigTests.cs

示例9: Url_with_controller_action_and_parameter_throws_AssertException_when_null_parameter_is_expected

 public void Url_with_controller_action_and_parameter_throws_AssertException_when_null_parameter_is_expected()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     Assert.Throws<AssertException>(() => routes.Url("~/product/list/ASP.NET/1").ShouldMapTo<ProductController>(x => x.List("ASP.NET", null)));
 }
开发者ID:glombard,项目名称:WebTestHelper,代码行数:6,代码来源:RouteConfigTests.cs

示例10: Resource_route_with_no_parameters_should_be_ignored

 public void Resource_route_with_no_parameters_should_be_ignored()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     routes.Url("~/abc.axd").ShouldBeIgnored();
 }
开发者ID:glombard,项目名称:WebTestHelper,代码行数:6,代码来源:RouteConfigTests.cs

示例11: Url_with_controller_action_and_parameter_should_map_correctly_when_parameter_is_variable

 public void Url_with_controller_action_and_parameter_should_map_correctly_when_parameter_is_variable()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     int variable123 = 123;
     routes.Url("~/product/details/123").ShouldMapTo<ProductController>(x => x.Details(variable123));
 }
开发者ID:glombard,项目名称:WebTestHelper,代码行数:7,代码来源:RouteConfigTests.cs

示例12: Root_url_should_not_be_ignored

 public void Root_url_should_not_be_ignored()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     Assert.Throws<AssertException>(() => routes.Url("~/").ShouldBeIgnored());
 }
开发者ID:glombard,项目名称:WebTestHelper,代码行数:6,代码来源:RouteConfigTests.cs

示例13: Url_with_controller_and_action_and_unexpected_parameter_throws_AssertException

 public void Url_with_controller_and_action_and_unexpected_parameter_throws_AssertException()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     Assert.Throws<AssertException>(() => routes.Url("~/product/index/123").ShouldMapTo<ProductController>(x => x.Index()));
 }
开发者ID:glombard,项目名称:WebTestHelper,代码行数:6,代码来源:RouteConfigTests.cs

示例14: Url_with_controller_action_and_parameter_should_not_be_ignored

 public void Url_with_controller_action_and_parameter_should_not_be_ignored()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     Assert.Throws<AssertException>(() => routes.Url("~/product/details/123").ShouldBeIgnored());
 }
开发者ID:glombard,项目名称:WebTestHelper,代码行数:6,代码来源:RouteConfigTests.cs

示例15: Url_with_controller_and_action_only_should_map_correctly

 public void Url_with_controller_and_action_only_should_map_correctly()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     routes.Url("~/product/index").ShouldMapTo<ProductController>(x => x.Index());
 }
开发者ID:glombard,项目名称:WebTestHelper,代码行数:6,代码来源:RouteConfigTests.cs


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