Exemplo n.º 1
0
        public void It_should_give_null_for_empty_path_when_no_defaults()
        {
            route = new ContentSubRoute<ContentItem>("x", engine, "{hello}/{hej}", null, null);

            var values = route.GetRouteValues("");

            values.Should().BeNull();
        }
Exemplo n.º 2
0
        public void It_should_give_default_for_second_segment()
        {
            route = new ContentSubRoute<ContentItem>("x", engine, "{hello}/{hej}", new { hej = "världen" }, null);

            var values = route.GetRouteValues("sverige");

            values.Count.Should().Be(3);
            values["controller"].Should().Be("Foo");
            values["hello"].Should().Be("sverige");
            values["hej"].Should().Be("världen");
        }
Exemplo n.º 3
0
 public void It_should_allow_custom_controller()
 {
     route = new ContentSubRoute<ContentItem>("x", engine, "{hello}", new { controller= "Bar", hello = "world" }, null);
     var values = route.GetRouteValues("");
     values["controller"].Should().Be("Bar");
 }
Exemplo n.º 4
0
        public void It_should_support_catch_all_token()
        {
            route = new ContentSubRoute<ContentItem>("x", engine, "{hej*}", null, null);

            var values = route.GetRouteValues("hela/världen");

            values.Count.Should().Be(2);
            values["hej"].Should().Be("hela/världen");
        }
Exemplo n.º 5
0
        public void It_should_prefer_passed_path_before_using_default()
        {
            route = new ContentSubRoute<ContentItem>("x", engine, "{hello}/{hej}", new { hej = "världen" }, null);

            var values = route.GetRouteValues("sverige/wow");

            values.Count.Should().Be(3);
            values["hello"].Should().Be("sverige");
            values["hej"].Should().Be("wow");
        }
Exemplo n.º 6
0
        public void It_should_match_static_segments()
        {
            route = new ContentSubRoute<ContentItem>("x", engine, "hello/{hej}", null, null);

            var values = route.GetRouteValues("hello/världen");

            values.Count.Should().Be(2);
            values["hej"].Should().Be("världen");
        }
Exemplo n.º 7
0
        public void It_should_ignore_case()
        {
            route = new ContentSubRoute<ContentItem>("x", engine, "hello/{hej}", null, null);

            var values = route.GetRouteValues("HELLO/världen");

            values.Count.Should().Be(2);
        }