Beispiel #1
0
        public void Should_bind_parameter_to_arguments()
        {
            var action    = ActionMethod.From <ArgumentHandler>(x => x.Action(null, null));
            var parameter = action.MethodDescriptor.Parameters
                            .First(x => x.Name == "value");
            var actionParameter = new ActionParameter(action, parameter);
            var arguments       = new object[2];

            actionParameter.BindArgument(arguments, "fark");

            arguments.ShouldOnlyContain(null, "fark");
        }
Beispiel #2
0
        public void Should_bind_new_parameter_property_to_arguments()
        {
            var action    = ActionMethod.From <ArgumentHandler>(x => x.Action(null, null));
            var parameter = action.MethodDescriptor.Parameters
                            .First(x => x.Name == "model");
            var property        = parameter.ParameterType.Properties.First();
            var actionParameter = new ActionParameter(action, parameter, property);
            var arguments       = new object[2];

            actionParameter.BindArgument(arguments, "fark");

            var model = arguments[0] as ArgumentHandler.Model;

            model.ShouldNotBeNull();
            model.Value.ShouldEqual("fark");

            arguments[1].ShouldBeNull();
        }