Esempio n. 1
0
            public void Url_with_controller_only_should_map_to_default_action()
            {
                RouteCollection routes = new RouteCollection();

                RouteConfig.RegisterRoutes(routes);
                routes.Url("~/product").ShouldMapTo <ProductController>(x => x.Index());
            }
Esempio n. 2
0
            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>());
            }
Esempio n. 3
0
            public void Url_with_controller_action_and_parameter_should_map_to_correct_controller()
            {
                RouteCollection routes = new RouteCollection();

                RouteConfig.RegisterRoutes(routes);
                routes.Url("~/product/details/123").ShouldMapTo <ProductController>();
            }
Esempio n. 4
0
            public void Resource_route_with_no_parameters_should_be_ignored()
            {
                RouteCollection routes = new RouteCollection();

                RouteConfig.RegisterRoutes(routes);
                routes.Url("~/abc.axd").ShouldBeIgnored();
            }
Esempio n. 5
0
            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>());
            }
Esempio n. 6
0
            public void Url_with_static_action_should_map_to_correct_controller()
            {
                RouteCollection routes = new RouteCollection();

                RouteConfig.RegisterRoutes(routes);
                routes.Url("~/search/string+to+search").ShouldMapTo <SearchController>();
            }
Esempio n. 7
0
            public void When_comparing_a_url_with_static_action_to_wrong_controller_then_throw_AssertException()
            {
                RouteCollection routes = new RouteCollection();

                RouteConfig.RegisterRoutes(routes);
                Assert.Throws <AssertException>(() => routes.Url("~/search/string+to+search").ShouldMapTo <ProductController>());
            }
Esempio n. 8
0
            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());
            }
Esempio n. 9
0
            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()));
            }
Esempio n. 10
0
            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());
            }
Esempio n. 11
0
            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)));
            }
Esempio n. 12
0
            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));
            }
Esempio n. 13
0
            public void Url_with_controller_and_action_throws_AssertException_when_action_is_wrong()
            {
                RouteCollection routes = new RouteCollection();

                RouteConfig.RegisterRoutes(routes);
                Assert.Throws <AssertException>(() => routes.Url("~/product/delete/123").ShouldMapTo <ProductController>(x => x.Details(123)));
            }
Esempio n. 14
0
            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()));
            }
Esempio n. 15
0
            public void Resource_route_with_pathinfo_should_be_ignored()
            {
                RouteCollection routes = new RouteCollection();

                RouteConfig.RegisterRoutes(routes);
                routes.Url("~/abc.axd/x/y/z").ShouldBeIgnored();
            }
Esempio n. 16
0
            public void Url_with_controller_action_and_parameter_throws_AssertException_when_action_expects_a_missing_parameter()
            {
                RouteCollection routes = new RouteCollection();

                RouteConfig.RegisterRoutes(routes);
                Assert.Throws <AssertException>(() => routes.Url("~/SearchMissingParam/abc").ShouldMapTo <SearchController>(x => x.Result("abc", 1)));
            }
Esempio n. 17
0
            public void Url_with_controller_action_and_missing_optional_parameter_should_map_correctly_to_action_with_nullable_parameter()
            {
                RouteCollection routes = new RouteCollection();

                RouteConfig.RegisterRoutes(routes);
                routes.Url("~/product/list/ASP.NET").ShouldMapTo <ProductController>(x => x.List("ASP.NET", null));
            }
Esempio n. 18
0
            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)));
            }
Esempio n. 19
0
            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)));
            }
Esempio n. 20
0
            public void Root_url_should_not_be_ignored()
            {
                RouteCollection routes = new RouteCollection();

                RouteConfig.RegisterRoutes(routes);
                Assert.Throws <AssertException>(() => routes.Url("~/").ShouldBeIgnored());
            }
Esempio n. 21
0
            public void Root_url_should_map_to_default_controller()
            {
                RouteCollection routes = new RouteCollection();

                RouteConfig.RegisterRoutes(routes);
                routes.Url("~/").ShouldMapTo <HomeController>();
            }
Esempio n. 22
0
            public void Url_with_controller_action_and_parameter_throws_AssertException_when_parameter_is_unsupported_expression()
            {
                RouteCollection routes = new RouteCollection();

                RouteConfig.RegisterRoutes(routes);
                Func <int> func = () => 123;

                Assert.Throws <AssertException>(() => routes.Url("~/product/details/123").ShouldMapTo <ProductController>(x => x.Details(func())));
            }
Esempio n. 23
0
            public void Url_with_controller_action_and_parameter_should_map_correctly_when_parameter_is_cast_operator()
            {
                RouteCollection routes = new RouteCollection();

                RouteConfig.RegisterRoutes(routes);
                long variable123 = 123;

                routes.Url("~/product/details/123").ShouldMapTo <ProductController>(x => x.Details((int)variable123));
            }
Esempio n. 24
0
 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));
 }
Esempio n. 25
0
 public void Url_with_controller_and_action_throws_AssertException_when_action_is_wrong()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     Assert.Throws<AssertException>(() => routes.Url("~/product/delete/123").ShouldMapTo<ProductController>(x => x.Details(123)));
 }
Esempio n. 26
0
 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()));
 }
Esempio n. 27
0
 public void Url_with_controller_only_should_map_to_default_action()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     routes.Url("~/product").ShouldMapTo<ProductController>(x => x.Index());
 }
Esempio n. 28
0
 public void Resource_route_with_pathinfo_should_be_ignored()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     routes.Url("~/abc.axd/x/y/z").ShouldBeIgnored();
 }
Esempio n. 29
0
 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)));
 }
Esempio n. 30
0
 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());
 }
Esempio n. 31
0
 public void Root_url_should_not_be_ignored()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     Assert.Throws<AssertException>(() => routes.Url("~/").ShouldBeIgnored());
 }
Esempio n. 32
0
 public void Url_with_controller_action_and_parameter_should_map_to_correct_controller()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     routes.Url("~/product/details/123").ShouldMapTo<ProductController>();
 }
Esempio n. 33
0
 public void Root_url_should_map_to_default_controller()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     routes.Url("~/").ShouldMapTo<HomeController>();
 }
Esempio n. 34
0
 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>());
 }
Esempio n. 35
0
 public void Url_with_static_action_should_map_to_correct_controller()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     routes.Url("~/search/string+to+search").ShouldMapTo<SearchController>();
 }
Esempio n. 36
0
 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());
 }
Esempio n. 37
0
 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>());
 }
Esempio n. 38
0
 public void When_comparing_a_url_with_static_action_to_wrong_controller_then_throw_AssertException()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     Assert.Throws<AssertException>(() => routes.Url("~/search/string+to+search").ShouldMapTo<ProductController>());
 }
Esempio n. 39
0
 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)));
 }
Esempio n. 40
0
 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()));
 }
Esempio n. 41
0
 public void Url_with_controller_action_and_parameter_throws_AssertException_when_action_expects_a_missing_parameter()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     Assert.Throws<AssertException>(() => routes.Url("~/SearchMissingParam/abc").ShouldMapTo<SearchController>(x => x.Result("abc", 1)));
 }
Esempio n. 42
0
 public void Url_with_controller_action_and_parameter_throws_AssertException_when_parameter_is_unsupported_expression()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     Func<int> func = () => 123;
     Assert.Throws<AssertException>(() => routes.Url("~/product/details/123").ShouldMapTo<ProductController>(x => x.Details(func())));
 }
Esempio n. 43
0
 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)));
 }
Esempio n. 44
0
 public void Resource_route_with_no_parameters_should_be_ignored()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     routes.Url("~/abc.axd").ShouldBeIgnored();
 }
Esempio n. 45
0
 public void Url_with_controller_action_and_parameter_should_map_correctly_to_action_with_nullable_parameter()
 {
     RouteCollection routes = new RouteCollection();
     RouteConfig.RegisterRoutes(routes);
     routes.Url("~/product/list/ASP.NET/3").ShouldMapTo<ProductController>(x => x.List("ASP.NET", 3));
 }
Esempio n. 46
0
 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));
 }