public void It_should_call_constraints() { engine.Fakes.UrlParser.Paths["/hello"] = PathData.None(new FooPage(), "hello"); bool wasCalled = false; route = new ContentSubRoute<ContentItem>("x", engine, "{hello}", null, new { hello = new DelegateConstraint((v) => wasCalled = true) }); route.GetRouteData(new FakeHttpContext("/hello")); wasCalled.Should().Be(true); }
public void It_should_route_paths_matching_IRouteConstraint() { engine.Fakes.UrlParser.Paths["/world"] = PathData.None(new FooPage(), "world"); route = new ContentSubRoute<ContentItem>("x", engine, "{hello}", null, new { hello = new DelegateConstraint((v) => v == "world") }); var data = route.GetRouteData(new FakeHttpContext("/world")); data.Values["hello"].Should().Be("world"); }