public void GetBinder_InvalidValueProviderResult_ReturnsNull() { // Arrange ExtensibleModelBindingContext bindingContext = GetBindingContext(); bindingContext.ValueProvider = new SimpleValueProvider() { { "theModelName", "not an integer" } }; TypeMatchModelBinderProvider provider = new TypeMatchModelBinderProvider(); // Act IExtensibleModelBinder binder = provider.GetBinder(null, bindingContext); // Assert Assert.IsNull(binder); }
public void BindModel_ValidValueProviderResult_ReturnsBinder() { // Arrange ExtensibleModelBindingContext bindingContext = GetBindingContext(); bindingContext.ValueProvider = new SimpleValueProvider() { { "theModelName", 42 } }; TypeMatchModelBinderProvider provider = new TypeMatchModelBinderProvider(); // Act IExtensibleModelBinder binder = provider.GetBinder(null, bindingContext); // Assert Assert.IsInstanceOfType(binder, typeof(TypeMatchModelBinder)); }
public void BindModel_ValidValueProviderResult_ReturnsBinder() { // Arrange ExtensibleModelBindingContext bindingContext = GetBindingContext(); bindingContext.ValueProvider = new SimpleValueProvider { { "theModelName", 42 } }; TypeMatchModelBinderProvider provider = new TypeMatchModelBinderProvider(); // Act IExtensibleModelBinder binder = provider.GetBinder(null, bindingContext); // Assert Assert.IsType <TypeMatchModelBinder>(binder); }
public void GetBinder_InvalidValueProviderResult_ReturnsNull() { // Arrange ExtensibleModelBindingContext bindingContext = GetBindingContext(); bindingContext.ValueProvider = new SimpleValueProvider { { "theModelName", "not an integer" } }; TypeMatchModelBinderProvider provider = new TypeMatchModelBinderProvider(); // Act IExtensibleModelBinder binder = provider.GetBinder(null, bindingContext); // Assert Assert.Null(binder); }