public void RegisterBinderForType_Instance_InsertsNewProviderBehindFrontOfListProviders() { // Arrange ModelBinderProvider frontOfListProvider = new ProviderAtFront(); IExtensibleModelBinder mockBinder = new Mock <IExtensibleModelBinder>().Object; ModelBinderProviderCollection collection = new ModelBinderProviderCollection { frontOfListProvider }; // Act collection.RegisterBinderForType(typeof(int), mockBinder); // Assert Assert.Equal( new[] { typeof(ProviderAtFront), typeof(SimpleModelBinderProvider) }, collection.Select(o => o.GetType()).ToArray()); }
public void RegisterBinderForType_Instance_InsertsNewProviderBehindFrontOfListProviders() { // Arrange ModelBinderProvider frontOfListProvider = new ProviderAtFront(); IExtensibleModelBinder mockBinder = new Mock <IExtensibleModelBinder>().Object; ModelBinderProviderCollection collection = new ModelBinderProviderCollection() { frontOfListProvider }; // Act collection.RegisterBinderForType(typeof(int), mockBinder); // Assert CollectionAssert.AreEqual( new Type[] { typeof(ProviderAtFront), typeof(SimpleModelBinderProvider) }, collection.Select(o => o.GetType()).ToArray(), "New provider should be inserted after any marked 'front of list'."); }