public void Create_ForDictionaryType_ReturnsBinder(Type modelType) { // Arrange var provider = new DictionaryModelBinderProvider(); var context = new TestModelBinderProviderContext(modelType); context.OnCreatingBinder(m => { if (m.ModelType == typeof(KeyValuePair<string, int>) || m.ModelType == typeof(int) || m.ModelType == typeof(string)) { return Mock.Of<IModelBinder>(); } else { Assert.False(true, "Not the right model type"); return null; } }); // Act var result = provider.GetBinder(context); // Assert Assert.IsType<DictionaryModelBinder<string, int>>(result); }
public void Create_ForNonDictionaryType_ReturnsNull(Type modelType) { // Arrange var provider = new DictionaryModelBinderProvider(); var context = new TestModelBinderProviderContext(modelType); // Act var result = provider.GetBinder(context); // Assert Assert.Null(result); }
public void Create_ForNonDictionaryType_ReturnsNull(Type modelType) { // Arrange var provider = new DictionaryModelBinderProvider(); var context = new TestModelBinderProviderContext(modelType); // Act var result = provider.GetBinder(context); // Assert Assert.Null(result); }