Exemplo n.º 1
0
        public void Can_get_names_from_a_HttpRouteCollection()
        {
            var routes = new HttpRouteCollection();

            routes.MapHttpRoute("foo.show", "foo/{id}");
            routes.MapHttpRoute("foo.one.two", "foo/{one}/{two}");
            routes.MapHttpRoute("bar.show", "bar/{id}", defaults: new { id = RouteParameter.Optional });
            routes.MapHttpRoute("bar.one.two", "bar/{one}/{two}",
                defaults: new { one = RouteParameter.Optional, two = RouteParameter.Optional });
            routes.MapHttpRoute("constraint", "constraints/{id:int}", null, new { id = @"\d+" });

            var names = routes.GetNames();
            Assert.True(names.Count == 5);
        }
Exemplo n.º 2
0
        public void Can_get_names_from_a_HttpRouteCollection()
        {
            var routes = new HttpRouteCollection();

            routes.MapHttpRoute("foo.show", "foo/{id}");
            routes.MapHttpRoute("foo.one.two", "foo/{one}/{two}");
            routes.MapHttpRoute("bar.show", "bar/{id}", defaults: new { id = RouteParameter.Optional });
            routes.MapHttpRoute("bar.one.two", "bar/{one}/{two}",
                                defaults: new { one = RouteParameter.Optional, two = RouteParameter.Optional });
            routes.MapHttpRoute("constraint", "constraints/{id:int}", null, new { id = @"\d+" });

            var names = routes.GetNames();

            Assert.True(names.Count == 5);
        }