public async Task BindModel_ReturnsFailedResult_EvenIfSelectedBinderReturnsNull()
        {
            // Arrange
            var bindingContext = GetBindingContext(typeof(Person), binderType: typeof(NullModelBinder));

            var binder = new BinderTypeModelBinder(typeof(NullModelBinder));

            // Act
            var binderResult = await binder.BindModelResultAsync(bindingContext);

            // Assert
            Assert.NotEqual(default(ModelBindingResult), binderResult);
            Assert.False(binderResult.IsModelSet);
        }
        public async Task BindModel_CallsBindAsync_OnProvidedModelBinder()
        {
            // Arrange
            var bindingContext = GetBindingContext(typeof(Person), binderType: typeof(NotNullModelBinder));

            var model           = new Person();
            var serviceProvider = new ServiceCollection()
                                  .AddSingleton <IModelBinder, NullModelBinder>()
                                  .BuildServiceProvider();

            bindingContext.OperationBindingContext.HttpContext.RequestServices = serviceProvider;

            var binder = new BinderTypeModelBinder(typeof(NotNullModelBinder));

            // Act
            var binderResult = await binder.BindModelResultAsync(bindingContext);

            // Assert
            var p = (Person)binderResult.Model;

            Assert.Equal(model.Age, p.Age);
            Assert.Equal(model.Name, p.Name);
        }