public void default_should_include_namespace_class_and_method_for_all_http_methods() { var route = RegexUrlPolicy.Create().CreateRoute <GetHandler>(x => x.Execute()); route.AllowedHttpMethods.ShouldBeEmpty(); route.Pattern.ShouldEqual("web/handlers/gethandler/execute"); }
public void should_ignore_entire_class_name() { var route = RegexUrlPolicy.Create(x => x.IgnoreClassName()) .CreateRoute <GetHandler>(x => x.Execute()); route.Pattern.ShouldEqual("web/handlers/execute"); }
public void should_ignore_type_namespace() { var route = RegexUrlPolicy.Create(x => x.IgnoreNamespace <IgnoreIncludeTests>()) .CreateRoute <GetHandler>(x => x.Execute()); route.Pattern.ShouldEqual("web/handlers/gethandler/execute"); }
public void should_ignore_multiple_custom_regex_method_names() { var route = RegexUrlPolicy.Create(x => x.IgnoreMethodNames("^.*?e", "u.*$")) .CreateRoute <GetHandler>(x => x.Execute()); route.Pattern.ShouldEqual("web/handlers/gethandler/c"); }
public void should_ignore_custom_namespace() { var route = RegexUrlPolicy.Create(x => x.IgnoreNamespaces("Web.Handlers")) .CreateRoute <GetHandler>(x => x.Execute()); route.Pattern.ShouldEqual("gethandler/execute"); }
public void should_ignore_multiple_custom_regex_namespaces() { var route = RegexUrlPolicy.Create(x => x.IgnoreNamespaces("H.*?d", "ers")) .CreateRoute <GetHandler>(x => x.Execute()); route.Pattern.ShouldEqual("web/l/gethandler/execute"); }
public void should_ignore_custom_method_name() { var route = RegexUrlPolicy.Create(x => x.IgnoreMethodNames("cute")) .CreateRoute <GetHandler>(x => x.Execute()); route.Pattern.ShouldEqual("web/handlers/gethandler/exe"); }
public void should_ignore_current_assembly_namespace_of_generic_type() { var route = RegexUrlPolicy.Create(x => x.IgnoreAssemblyNamespace <IgnoreIncludeTests>()) .CreateRoute <GetHandler>(x => x.Execute()); route.Pattern.ShouldEqual("web/handlers/gethandler/execute"); }
public void should_ignore_multiple_custom_regex_class_names() { var route = RegexUrlPolicy.Create(x => x.IgnoreClassNames("H.*?d", "l.*$")) .CreateRoute <GetHandler>(x => x.Execute()); route.Pattern.ShouldEqual("web/handlers/get/execute"); }
public void should_constrain_to_get_by_method_name() { var route = RegexUrlPolicy.Create(x => x.ConstrainMethodToGet("Execute")) .CreateRoute <GetHandler>(x => x.Execute()); route.AllowedHttpMethods.Count.ShouldEqual(1); route.AllowedHttpMethods.ShouldContain("GET"); }
public void should_constrain_to_post_by_class_name_ending_with() { var route = RegexUrlPolicy.Create(x => x.ConstrainClassToPostEndingWith("PostHandler")) .CreateRoute <UserPostHandler>(x => x.Execute()); route.AllowedHttpMethods.Count.ShouldEqual(1); route.AllowedHttpMethods.ShouldContain("POST"); }
public void should_constrain_to_update_by_class_name() { var route = RegexUrlPolicy.Create(x => x.ConstrainClassToUpdate("Update")) .CreateRoute <UpdateHandler>(x => x.ExecuteUpdate()); route.AllowedHttpMethods.Count.ShouldEqual(1); route.AllowedHttpMethods.ShouldContain("UPDATE"); }
public void should_constrain_to_put_by_class_name() { var route = RegexUrlPolicy.Create(x => x.ConstrainClassToPut("Put")) .CreateRoute <PutHandler>(x => x.ExecutePut()); route.AllowedHttpMethods.Count.ShouldEqual(1); route.AllowedHttpMethods.ShouldContain("PUT"); }
public void should_constrain_to_delete_by_namespace() { var route = RegexUrlPolicy.Create(x => x.ConstrainNamespaceToDelete("Web")) .CreateRoute <GetHandler>(x => x.Execute()); route.AllowedHttpMethods.Count.ShouldEqual(1); route.AllowedHttpMethods.ShouldContain("DELETE"); }
public void should_constrain_to_delete_by_method_name_starting_with() { var route = RegexUrlPolicy.Create(x => x.ConstrainMethodToDelete("Delete")) .CreateRoute <DeleteHandler>(x => x.ExecuteDelete()); route.AllowedHttpMethods.Count.ShouldEqual(1); route.AllowedHttpMethods.ShouldContain("DELETE"); }
public void should_constrain_to_post_by_method_name_starting_with() { var route = RegexUrlPolicy.Create(x => x.ConstrainMethodToPost("Execute")) .CreateRoute <PostHandler>(x => x.Execute()); route.AllowedHttpMethods.Count.ShouldEqual(1); route.AllowedHttpMethods.ShouldContain("POST"); }
public void should_constrain_to_get_by_class_name_starting_with() { var route = RegexUrlPolicy.Create(x => x.ConstrainClassToGetStartingWith("Get")) .CreateRoute <GetUserHandler>(x => x.Execute()); route.AllowedHttpMethods.Count.ShouldEqual(1); route.AllowedHttpMethods.ShouldContain("GET"); }
public void should_constrain_to_delete_by_class_name_ending_with() { var route = RegexUrlPolicy.Create(x => x.ConstrainClassToDeleteEndingWith("DeleteHandler")) .CreateRoute <UserDeleteHandler>(x => x.Execute()); route.AllowedHttpMethods.Count.ShouldEqual(1); route.AllowedHttpMethods.ShouldContain("DELETE"); }
public Conventions() { Actions .FindBy(x => x .IncludeTypeNamesSuffixed("Handler") .IncludeMethodsPrefixed("Execute") .Applies.ToAssemblyContainingType(GetType())); Routes .OverrideFolders() .UrlPolicy(RegexUrlPolicy.Create( x => x.IgnoreAssemblyNamespace(GetType()) .IgnoreClassName() .IgnoreMethodNames("Execute") .ConstrainClassToGetEndingWith("GetHandler") .ConstrainClassToPostEndingWith("PostHandler") .ConstrainClassToPutEndingWith("PutHandler") .ConstrainClassToDeleteEndingWith("DeleteHandler") .ConstrainClassToUpdateEndingWith("UpdateHandler"))); Import <FubuBender>(x => x .Bindings(y => y.BindCookies().BindFiles()) .Configure(y => y.UseJsonCamelCaseNaming())); }
public void should_include_url_parameters() { RegexUrlPolicy.Create().CreateRoute <GetByIdAndNameHandler>(x => x.Execute_Id_Name(null)) .Pattern.ShouldEqual("web/handlers/getbyidandnamehandler/execute/{Id}/{Name}"); }
public void should_include_namespace_url_parameters() { RegexUrlPolicy.Create().CreateRoute <WidgetGetHandler>(x => x.Execute_Id(null)) .Pattern.ShouldEqual("web/handlers/{Name}/widgetgethandler/execute/{Id}"); }