A pre-packaged set of routes/actions that can be registered in the constructor of a ManoApp-derived class.
Inheritance: IManosModule
Beispiel #1
0
 private RouteHandler AddImplicitRouteHandler(ManosModule module, string [] patterns, HttpMethod [] methods)
 {
     module.Routes.IsImplicit = true;
     module.Routes.Patterns   = patterns;
     module.Routes.Methods    = methods;
     Routes.Children.Add(module.Routes);
     return(module.Routes);
 }
Beispiel #2
0
        public void TestAddRouteNull()
        {
            ManosModule m = new ManosModule ();

            Should.Throw<ArgumentNullException> (() => m.Route (new ManosModule (), null, null));
            Should.Throw<ArgumentNullException> (() => m.Route (new ManosAction (FakeAction), null, null));
            Should.Throw<ArgumentNullException> (() => m.Route (null, new ManosAction (FakeAction)));
            Should.Throw<ArgumentNullException> (() => m.Route (null, new ManosModule ()));
        }
Beispiel #3
0
        private RouteHandler AddRouteHandler(ManosModule module, string [] patterns, HttpMethod [] methods)
        {
            if (module == null)
            {
                throw new ArgumentNullException("module");
            }
            if (patterns == null)
            {
                throw new ArgumentNullException("patterns");
            }
            if (methods == null)
            {
                throw new ArgumentNullException("methods");
            }

            module.Routes.Patterns = patterns;
            module.Routes.Methods  = methods;
            Routes.Children.Add(module.Routes);
            return(module.Routes);
        }
Beispiel #4
0
 public RouteHandler Trace(ManosModule module, params string [] patterns)
 {
     return(AddRouteHandler(module, patterns, HttpMethods.TraceMethods));
 }
Beispiel #5
0
        //

        public RouteHandler Trace(string pattern, ManosModule module)
        {
            return(AddRouteHandler(module, new string [] { pattern }, HttpMethods.TraceMethods));
        }
Beispiel #6
0
 public RouteHandler Options(ManosModule module, params string [] patterns)
 {
     return(AddRouteHandler(module, patterns, HttpMethods.OptionsMethods));
 }
Beispiel #7
0
        //

        public RouteHandler Options(string pattern, ManosModule module)
        {
            return(AddRouteHandler(module, new string [] { pattern }, HttpMethods.OptionsMethods));
        }
Beispiel #8
0
 public RouteHandler Get(string pattern, ManosModule module)
 {
     return AddRouteHandler (module, new string [] { pattern }, HttpMethods.GetMethods);
 }
Beispiel #9
0
 public RouteHandler Delete(ManosModule module, params string [] patterns)
 {
     return AddRouteHandler (module, patterns, HttpMethods.DeleteMethods);
 }
Beispiel #10
0
        private RouteHandler AddRouteHandler(ManosModule module, string [] patterns, string [] methods)
        {
            if (module == null)
                throw new ArgumentNullException ("module");
            if (patterns == null)
                throw new ArgumentNullException ("patterns");
            if (methods == null)
                throw new ArgumentNullException ("methods");

            module.Routes.Patterns = patterns;
            module.Routes.Methods = methods;
            Routes.Children.Add (module.Routes);
            return module.Routes;
        }
Beispiel #11
0
 private RouteHandler AddImplicitRouteHandler(ManosModule module, string [] patterns, string [] methods)
 {
     module.Routes.IsImplicit = true;
     module.Routes.Patterns = patterns;
     module.Routes.Methods = methods;
     Routes.Children.Add (module.Routes);
     return module.Routes;
 }
Beispiel #12
0
 public RouteHandler Post(ManosModule module, params string [] patterns)
 {
     return AddRouteHandler (module, patterns, HttpMethods.PostMethods);
 }
Beispiel #13
0
 public RouteHandler Options(ManosModule module, params string [] patterns)
 {
     return AddRouteHandler (module, patterns, HttpMethods.OptionsMethods);
 }
Beispiel #14
0
 //
 public RouteHandler Options(string pattern, ManosModule module)
 {
     return AddRouteHandler (module, new string [] { pattern }, HttpMethods.OptionsMethods);
 }