public void BindWithModelBinding_IModelBinder() { HttpParameterDescriptor param = CreateParameterDescriptor(); var binder = new CustomModelBinder(); ModelBinderParameterBinding binding = (ModelBinderParameterBinding)param.BindWithModelBinding(binder); Assert.NotNull(binding); Assert.Equal(binder, binding.Binder); }
public void BindWithModelBinding_IModelBinder() { HttpParameterDescriptor param = CreateParameterDescriptor(); var binder = new CustomModelBinder(); ModelBinderParameterBinding binding = (ModelBinderParameterBinding) param.BindWithModelBinding(binder); Assert.NotNull(binding); Assert.Equal(binder, binding.Binder); }
public void BindWithModelBinding_ValueProviderFactory_IEnumerable() { HttpParameterDescriptor param = CreateParameterDescriptor(); var binder = new CustomModelBinder(); ModelBinderParameterBinding binding = (ModelBinderParameterBinding) param.BindWithModelBinding(binder, new List<ValueProviderFactory>() { new CustomValueProviderFactory1(), new CustomValueProviderFactory2() }); Assert.NotNull(binding); Assert.Equal(binder, binding.Binder); ValueProviderFactory[] vpfs = binding.ValueProviderFactories.ToArray(); Assert.Equal(2, vpfs.Length); Assert.IsType<CustomValueProviderFactory1>(vpfs[0]); Assert.IsType<CustomValueProviderFactory2>(vpfs[1]); }
public void BindWithModelBinding_ValueProviderFactory_IEnumerable() { HttpParameterDescriptor param = CreateParameterDescriptor(); var binder = new CustomModelBinder(); ModelBinderParameterBinding binding = (ModelBinderParameterBinding)param.BindWithModelBinding(binder, new List <ValueProviderFactory>() { new CustomValueProviderFactory1(), new CustomValueProviderFactory2() }); Assert.NotNull(binding); Assert.Equal(binder, binding.Binder); ValueProviderFactory[] vpfs = binding.ValueProviderFactories.ToArray(); Assert.Equal(2, vpfs.Length); Assert.IsType <CustomValueProviderFactory1>(vpfs[0]); Assert.IsType <CustomValueProviderFactory2>(vpfs[1]); }