public void ModelBinders_RemoveTypesOf_RemovesDescriptorsOfIModelBinder() { // Arrange var modelBinders = new MvcOptions().ModelBinders; modelBinders.Add(new ByteArrayModelBinder()); modelBinders.Add(Mock.Of<IModelBinder>()); modelBinders.Add(typeof(ByteArrayModelBinder)); modelBinders.Add(Mock.Of<IModelBinder>()); // Act modelBinders.RemoveTypesOf<ByteArrayModelBinder>(); // Assert Assert.DoesNotContain(modelBinders, descriptor => descriptor.OptionType == typeof(ByteArrayModelBinder)); }
public void ValueProviderFactories_RemoveTypesOf_RemovesDescriptorsOfIValueProviderFactory() { // Arrange var factories = new MvcOptions().ValueProviderFactories; factories.Add(new FormValueProviderFactory()); factories.Add(Mock.Of<IValueProviderFactory>()); factories.Add(typeof(FormValueProviderFactory)); factories.Add(Mock.Of<IValueProviderFactory>()); // Act factories.RemoveTypesOf<FormValueProviderFactory>(); // Assert Assert.DoesNotContain(factories, descriptor => descriptor.OptionType == typeof(FormValueProviderFactory)); }
public void ModelBinders_RemoveTypesOf_RemovesDescriptorsOfIModelBinder() { // Arrange var modelBinders = new MvcOptions().ModelBinders; modelBinders.Add(new ByteArrayModelBinder()); modelBinders.Add(Mock.Of <IModelBinder>()); modelBinders.Add(typeof(ByteArrayModelBinder)); modelBinders.Add(Mock.Of <IModelBinder>()); // Act modelBinders.RemoveTypesOf <ByteArrayModelBinder>(); // Assert Assert.DoesNotContain(modelBinders, descriptor => descriptor.OptionType == typeof(ByteArrayModelBinder)); }
public void ValueProviderFactories_RemoveTypesOf_RemovesDescriptorsOfIValueProviderFactory() { // Arrange var factories = new MvcOptions().ValueProviderFactories; factories.Add(new FormValueProviderFactory()); factories.Add(Mock.Of <IValueProviderFactory>()); factories.Add(typeof(FormValueProviderFactory)); factories.Add(Mock.Of <IValueProviderFactory>()); // Act factories.RemoveTypesOf <FormValueProviderFactory>(); // Assert Assert.DoesNotContain(factories, descriptor => descriptor.OptionType == typeof(FormValueProviderFactory)); }