Exemplo n.º 1
0
        public void Should_fail_to_bind_parameter()
        {
            var action          = ActionMethod.From <PropertyBinderHandler>(x => x.Action(null));
            var parameter       = action.MethodDescriptor.Parameters.First();
            var actionParameter = new ActionParameter(action, parameter);
            var model           = new PropertyBinderHandler.Model();

            actionParameter.Should().Throw <InvalidOperationException>(
                x => x.BindProperty(model, "fark"));
        }
Exemplo n.º 2
0
        public void Should_fail_to_bind_property_to_arguments()
        {
            var action   = ActionMethod.From <ArgumentHandler>(x => x.Action(null, null));
            var property = action.MethodDescriptor.Parameters
                           .First(x => x.Name == "model").ParameterType.Properties.First();
            var actionParameter = new ActionParameter(action, property);
            var arguments       = new object[2];

            actionParameter.Should().Throw <InvalidOperationException>(
                x => x.BindArgument(arguments, "fark"));
        }