Example #1
0
        public void Ctor_NullTarget_DoesNotThrow()
        {
            var method = GetMethodWithNoArgs();
            var pa     = ParameterizedActionFactory.CreateAction(method);

            Should.NotThrow(() => new ParameterizedActionTarget(null, method, pa));
        }
Example #2
0
        public void Ctor_NullMethod_Throws()
        {
            var method = GetMethodWithNoArgs();
            var pa     = ParameterizedActionFactory.CreateAction(method);

            Should.Throw <ArgumentNullException> (() => new ParameterizedActionTarget("foobar", null, pa));
        }
Example #3
0
        private void AddHandlerForParameterizedAction(RouteHandler routes, HttpMethodAttribute att, MethodInfo info)
        {
            ParameterizedAction       action = ParameterizedActionFactory.CreateAction(info);
            ParameterizedActionTarget target = new ParameterizedActionTarget(this, info, action);

            AddImplicitRouteHandler(target, att.Patterns, att.Methods);
        }
Example #4
0
        private void AddDefaultHandlerForParameterizedAction(RouteHandler routes, MethodInfo info)
        {
            ParameterizedAction       action = ParameterizedActionFactory.CreateAction(info);
            ParameterizedActionTarget target = new ParameterizedActionTarget(this, info, action);

            AddImplicitRouteHandler(target, new string [] { "/" + info.Name }, HttpMethods.RouteMethods);
        }
Example #5
0
        public void Invoke_StaticMethodNoParams_IsInvoked()
        {
            var method = GetMethod("SomeStaticActionNoParams");
            var pa     = ParameterizedActionFactory.CreateAction(method);

            pa(this, new object [] { new ManosAppStub(), new ManosContextStub() });

            Assert.IsTrue(action_invoked_properly);
        }
Example #6
0
        public void Invoke_NonStaticMethodSingleBoolParam_IsInvoked()
        {
            var method = GetMethod("SomeActionBoolParam");
            var pa     = ParameterizedActionFactory.CreateAction(method);

            pa(this, new object [] { new ManosAppStub(), new ManosContextStub(), true });

            Assert.IsTrue(action_invoked_properly);
        }
Example #7
0
        public void Invoke_StaticMethodTwoStringsShouldMatch_MatchingStringsMatch()
        {
            var method = GetMethod("SomeStaticActionTwoStringsShouldMatch");
            var pa     = ParameterizedActionFactory.CreateAction(method);

            pa(this, new object [] { new ManosAppStub(), new ManosContextStub(), "foo", "foo" });

            Assert.IsTrue(action_invoked_properly);
        }