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(); }
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"); }
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"); }
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"); }
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"); }
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"); }
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); }