Exemple #1
0
        public void BindModel_NullValue_ReturnsNull()
        {
            binding.ValueProvider = new NameValueCollectionValueProvider(collection, null);

            Assert.Null(binder.BindModel(context, binding));
        }
Exemple #2
0
            public void Default()
            {
                DateTime input = new DateTime(1964, 2, 12, 0, 0, 0, 0);

                var modelBindingContext = new ModelBindingContext {
                    ModelName     = "form.Date",
                    ValueProvider = new FormCollection {
                        { "Form.Date", input.ToString() }
                    }
                };

                DateTime?result = dateTimeModelBinder.BindModel(null, modelBindingContext) as DateTime?;

                Assert.IsTrue(result.HasValue);
                Assert.AreEqual(input, result.Value);
            }