Example #1
0
 public TrimmingModelBinderTests()
 {
     binder                = new TrimmingModelBinder();
     context               = new DefaultModelBindingContext();
     context.ModelState    = new ModelStateDictionary();
     context.ValueProvider = Substitute.For <IValueProvider>();
 }
Example #2
0
 public void SetUp()
 {
     nameValueCollection = new NameValueCollection();
     controllerContext   = new ControllerContext();
     bindingContext      = new ModelBindingContext();
     binder = new TrimmingModelBinder();
     bindingContext.ModelName = "Text";
 }
        public void SetUp()
        {
            nameValueCollection      = new NameValueCollection();
            controllerContext        = new ControllerContext();
            bindingContext           = new ModelBindingContext();
            bindingContext.ModelName = "Trimmed";
            binder = new TrimmingModelBinder();

            bindingContext.ModelMetadata = new DataAnnotationsModelMetadataProvider()
                                           .GetMetadataForProperty(null, typeof(BindersModel), bindingContext.ModelName);
        }
Example #4
0
        public TrimmingModelBinderTests()
        {
            controllerContext        = new ControllerContext();
            bindingContext           = new ModelBindingContext();
            bindingContext.ModelName = "Model.Trimmed";
            collection = new NameValueCollection();
            binder     = new TrimmingModelBinder();

            bindingContext.ModelMetadata = new DataAnnotationsModelMetadataProvider()
                                           .GetMetadataForProperty(null, typeof(BindersModel), "Trimmed");
        }
        public TrimmingModelBinderTests()
        {
            context    = new ControllerContext();
            binder     = new TrimmingModelBinder();
            binding    = new ModelBindingContext();
            collection = new NameValueCollection();

            binding.ModelName     = "StringField";
            context.Controller    = Substitute.For <ControllerBase>();
            binding.ModelMetadata = new DataAnnotationsModelMetadataProvider()
                                    .GetMetadataForProperty(null, typeof(AllTypesView), "StringField");
        }