diff --git a/src/Microsoft.AspNetCore.Mvc.Core/ApplicationModels/ApplicationModelConventionCollection.cs b/src/Microsoft.AspNetCore.Mvc.Core/ApplicationModels/ApplicationModelConventionCollection.cs
deleted file mode 100644
index e0ee53c2ce..0000000000
--- a/src/Microsoft.AspNetCore.Mvc.Core/ApplicationModels/ApplicationModelConventionCollection.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-
-namespace Microsoft.AspNetCore.Mvc.ApplicationModels
-{
- ///
- /// Represents a collection of application model conventions.
- ///
- public class ApplicationModelConventionCollection : Collection
- {
- ///
- /// Initializes a new instance of the class that is empty.
- ///
- public ApplicationModelConventionCollection()
- {
- }
-
- ///
- /// Initializes a new instance of the class
- /// as a wrapper for the specified list.
- ///
- /// The list that is wrapped by the new collection.
- public ApplicationModelConventionCollection(IList applicationModelConventions)
- : base(applicationModelConventions)
- {
- }
-
- ///
- /// Removes all application model conventions of the specified type.
- ///
- /// The type to remove.
- public void RemoveType() where TApplicationModelConvention : IApplicationModelConvention
- {
- RemoveType(typeof(TApplicationModelConvention));
- }
-
- ///
- /// Removes all application model conventions of the specified type.
- ///
- /// The type to remove.
- public void RemoveType(Type applicationModelConventionType)
- {
- for (var i = Count - 1; i >= 0; i--)
- {
- var applicationModelConvention = this[i];
- if (applicationModelConvention.GetType() == applicationModelConventionType)
- {
- RemoveAt(i);
- }
- }
- }
- }
-}
diff --git a/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/ApplicationModelConventionExtensions.cs b/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/ApplicationModelConventionExtensions.cs
index ef3c606973..4ed7ba369f 100644
--- a/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/ApplicationModelConventionExtensions.cs
+++ b/src/Microsoft.AspNetCore.Mvc.Core/DependencyInjection/ApplicationModelConventionExtensions.cs
@@ -12,6 +12,48 @@ namespace Microsoft.Extensions.DependencyInjection
///
public static class ApplicationModelConventionExtensions
{
+ ///
+ /// Removes all application model conventions of the specified type.
+ ///
+ /// The list of s.
+ /// The type to remove.
+ public static void RemoveType(this IList list) where TApplicationModelConvention : IApplicationModelConvention
+ {
+ if (list == null)
+ {
+ throw new ArgumentNullException(nameof(list));
+ }
+
+ RemoveType(list, typeof(TApplicationModelConvention));
+ }
+
+ ///
+ /// Removes all application model conventions of the specified type.
+ ///
+ /// The list of s.
+ /// The type to remove.
+ public static void RemoveType(this IList list, Type type)
+ {
+ if (list == null)
+ {
+ throw new ArgumentNullException(nameof(list));
+ }
+
+ if (type == null)
+ {
+ throw new ArgumentNullException(nameof(type));
+ }
+
+ for (var i = list.Count - 1; i >= 0; i--)
+ {
+ var applicationModelConvention = list[i];
+ if (applicationModelConvention.GetType() == type)
+ {
+ list.RemoveAt(i);
+ }
+ }
+ }
+
///
/// Adds a to all the controllers in the application.
///
diff --git a/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Metadata/MetadataDetailsProviderCollection.cs b/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Metadata/MetadataDetailsProviderCollection.cs
deleted file mode 100644
index 4eba80f496..0000000000
--- a/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Metadata/MetadataDetailsProviderCollection.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-
-namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
-{
- ///
- /// Represents a collection of metadata details providers.
- ///
- public class MetadataDetailsProviderCollection : Collection
- {
- ///
- /// Initializes a new instance of the class that is empty.
- ///
- public MetadataDetailsProviderCollection()
- {
- }
-
- ///
- /// Initializes a new instance of the class
- /// as a wrapper for the specified list.
- ///
- /// The list that is wrapped by the new collection.
- public MetadataDetailsProviderCollection(IList metadataDetailsProviders)
- : base(metadataDetailsProviders)
- {
- }
-
- ///
- /// Removes all metadata details providers of the specified type.
- ///
- /// The type to remove.
- public void RemoveType() where TMetadataDetailsProvider : IMetadataDetailsProvider
- {
- RemoveType(typeof(TMetadataDetailsProvider));
- }
-
- ///
- /// Removes all metadata details providers of the specified type.
- ///
- /// The type to remove.
- public void RemoveType(Type metadataDetailsProviderType)
- {
- for (var i = Count - 1; i >= 0; i--)
- {
- var metadataDetailsProvider = this[i];
- if (metadataDetailsProvider.GetType() == metadataDetailsProviderType)
- {
- RemoveAt(i);
- }
- }
- }
- }
-}
diff --git a/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Metadata/MetadataDetailsProviderExtensions.cs b/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Metadata/MetadataDetailsProviderExtensions.cs
new file mode 100644
index 0000000000..dbb474956e
--- /dev/null
+++ b/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Metadata/MetadataDetailsProviderExtensions.cs
@@ -0,0 +1,56 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using System.Collections.Generic;
+
+namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
+{
+ ///
+ /// Extension methods for .
+ ///
+ public static class MetadataDetailsProviderExtensions
+ {
+ ///
+ /// Removes all metadata details providers of the specified type.
+ ///
+ /// The list of s.
+ /// The type to remove.
+ public static void RemoveType(this IList list) where TMetadataDetailsProvider : IMetadataDetailsProvider
+ {
+ if (list == null)
+ {
+ throw new ArgumentNullException(nameof(list));
+ }
+
+ RemoveType(list, typeof(TMetadataDetailsProvider));
+ }
+
+ ///
+ /// Removes all metadata details providers of the specified type.
+ ///
+ /// The list of s.
+ /// The type to remove.
+ public static void RemoveType(this IList list, Type type)
+ {
+ if (list == null)
+ {
+ throw new ArgumentNullException(nameof(list));
+ }
+
+ if (type == null)
+ {
+ throw new ArgumentNullException(nameof(type));
+ }
+
+ for (var i = list.Count - 1; i >= 0; i--)
+ {
+ var metadataDetailsProvider = list[i];
+ if (metadataDetailsProvider.GetType() == type)
+ {
+ list.RemoveAt(i);
+ }
+ }
+ }
+ }
+}
diff --git a/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ModelBinderProviderCollection.cs b/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ModelBinderProviderCollection.cs
deleted file mode 100644
index 0bfccb3e10..0000000000
--- a/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ModelBinderProviderCollection.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-
-namespace Microsoft.AspNetCore.Mvc.ModelBinding
-{
- ///
- /// Represents a collection of model binder providers.
- ///
- public class ModelBinderProviderCollection : Collection
- {
- ///
- /// Initializes a new instance of the class that is empty.
- ///
- public ModelBinderProviderCollection()
- {
- }
-
- ///
- /// Initializes a new instance of the class
- /// as a wrapper for the specified list.
- ///
- /// The list that is wrapped by the new collection.
- public ModelBinderProviderCollection(IList modelBinderProviders)
- : base(modelBinderProviders)
- {
- }
-
- ///
- /// Removes all model binder providers of the specified type.
- ///
- /// The type to remove.
- public void RemoveType() where TModelBinderProvider : IModelBinderProvider
- {
- RemoveType(typeof(TModelBinderProvider));
- }
-
- ///
- /// Removes all model binder providers of the specified type.
- ///
- /// The type to remove.
- public void RemoveType(Type modelBinderProviderType)
- {
- for (var i = Count - 1; i >= 0; i--)
- {
- var modelBinderProvider = this[i];
- if (modelBinderProvider.GetType() == modelBinderProviderType)
- {
- RemoveAt(i);
- }
- }
- }
- }
-}
diff --git a/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ModelBinderProviderExtensions.cs b/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ModelBinderProviderExtensions.cs
new file mode 100644
index 0000000000..791959a06a
--- /dev/null
+++ b/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ModelBinderProviderExtensions.cs
@@ -0,0 +1,56 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using System.Collections.Generic;
+
+namespace Microsoft.AspNetCore.Mvc.ModelBinding
+{
+ ///
+ /// Extension methods for .
+ ///
+ public static class ModelBinderProviderExtensions
+ {
+ ///
+ /// Removes all model binder providers of the specified type.
+ ///
+ /// The list of s.
+ /// The type to remove.
+ public static void RemoveType(this IList list) where TModelBinderProvider : IModelBinderProvider
+ {
+ if (list == null)
+ {
+ throw new ArgumentNullException(nameof(list));
+ }
+
+ RemoveType(list, typeof(TModelBinderProvider));
+ }
+
+ ///
+ /// Removes all model binder providers of the specified type.
+ ///
+ /// The list of s.
+ /// The type to remove.
+ public static void RemoveType(this IList list, Type type)
+ {
+ if (list == null)
+ {
+ throw new ArgumentNullException(nameof(list));
+ }
+
+ if (type == null)
+ {
+ throw new ArgumentNullException(nameof(type));
+ }
+
+ for (var i = list.Count - 1; i >= 0; i--)
+ {
+ var modelBinderProvider = list[i];
+ if (modelBinderProvider.GetType() == type)
+ {
+ list.RemoveAt(i);
+ }
+ }
+ }
+ }
+}
diff --git a/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ModelValidatorProviderCollection.cs b/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ModelValidatorProviderCollection.cs
deleted file mode 100644
index 58e9213ca2..0000000000
--- a/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ModelValidatorProviderCollection.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-
-namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
-{
- ///
- /// Represents a collection of model validator providers.
- ///
- public class ModelValidatorProviderCollection : Collection
- {
- ///
- /// Initializes a new instance of the class that is empty.
- ///
- public ModelValidatorProviderCollection()
- {
- }
-
- ///
- /// Initializes a new instance of the class
- /// as a wrapper for the specified list.
- ///
- /// The list that is wrapped by the new collection.
- public ModelValidatorProviderCollection(IList modelValidatorProviders)
- : base(modelValidatorProviders)
- {
- }
-
- ///
- /// Removes all model validator providers of the specified type.
- ///
- /// The type to remove.
- public void RemoveType() where TModelValidatorProvider : IModelValidatorProvider
- {
- RemoveType(typeof(TModelValidatorProvider));
- }
-
- ///
- /// Removes all model validator providers of the specified type.
- ///
- /// The type to remove.
- public void RemoveType(Type modelValidatorProviderType)
- {
- for (var i = Count - 1; i >= 0; i--)
- {
- var modelValidatorProvider = this[i];
- if (modelValidatorProvider.GetType() == modelValidatorProviderType)
- {
- RemoveAt(i);
- }
- }
- }
- }
-}
diff --git a/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ModelValidatorProviderExtensions.cs b/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ModelValidatorProviderExtensions.cs
new file mode 100644
index 0000000000..3fbb512290
--- /dev/null
+++ b/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Validation/ModelValidatorProviderExtensions.cs
@@ -0,0 +1,56 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using System.Collections.Generic;
+
+namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
+{
+ ///
+ /// Extension methods for .
+ ///
+ public static class ModelValidatorProviderExtensions
+ {
+ ///
+ /// Removes all model validator providers of the specified type.
+ ///
+ /// This list of s.
+ /// The type to remove.
+ public static void RemoveType(this IList list) where TModelValidatorProvider : IModelValidatorProvider
+ {
+ if (list == null)
+ {
+ throw new ArgumentNullException(nameof(list));
+ }
+
+ RemoveType(list, typeof(TModelValidatorProvider));
+ }
+
+ ///
+ /// Removes all model validator providers of the specified type.
+ ///
+ /// This list of s.
+ /// The type to remove.
+ public static void RemoveType(this IList list, Type type)
+ {
+ if (list == null)
+ {
+ throw new ArgumentNullException(nameof(list));
+ }
+
+ if (type == null)
+ {
+ throw new ArgumentNullException(nameof(type));
+ }
+
+ for (var i = list.Count - 1; i >= 0; i--)
+ {
+ var modelValidatorProvider = list[i];
+ if (modelValidatorProvider.GetType() == type)
+ {
+ list.RemoveAt(i);
+ }
+ }
+ }
+ }
+}
diff --git a/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ValueProviderFactoryCollection.cs b/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ValueProviderFactoryCollection.cs
deleted file mode 100644
index e85fbd0f09..0000000000
--- a/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ValueProviderFactoryCollection.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-
-namespace Microsoft.AspNetCore.Mvc.ModelBinding
-{
- ///
- /// Represents a collection of value provider factories.
- ///
- public class ValueProviderFactoryCollection : Collection
- {
- ///
- /// Initializes a new instance of the class that is empty.
- ///
- public ValueProviderFactoryCollection()
- {
- }
-
- ///
- /// Initializes a new instance of the class
- /// as a wrapper for the specified list.
- ///
- /// The list that is wrapped by the new collection.
- public ValueProviderFactoryCollection(IList valueProviderFactories)
- : base(valueProviderFactories)
- {
- }
-
- ///
- /// Removes all value provider factories of the specified type.
- ///
- /// The type to remove.
- public void RemoveType() where TValueProviderFactory : IValueProviderFactory
- {
- RemoveType(typeof(TValueProviderFactory));
- }
-
- ///
- /// Removes all value provider factories of the specified type.
- ///
- /// The type to remove.
- public void RemoveType(Type valueProviderFactoryType)
- {
- for (var i = Count - 1; i >= 0; i--)
- {
- var valueProviderFactory = this[i];
- if (valueProviderFactory.GetType() == valueProviderFactoryType)
- {
- RemoveAt(i);
- }
- }
- }
- }
-}
diff --git a/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ValueProviderFactoryExtensions.cs b/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ValueProviderFactoryExtensions.cs
new file mode 100644
index 0000000000..40041c9427
--- /dev/null
+++ b/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/ValueProviderFactoryExtensions.cs
@@ -0,0 +1,56 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using System.Collections.Generic;
+
+namespace Microsoft.AspNetCore.Mvc.ModelBinding
+{
+ ///
+ /// Extension methods for .
+ ///
+ public static class ValueProviderFactoryExtensions
+ {
+ ///
+ /// Removes all value provider factories of the specified type.
+ ///
+ /// The list of .
+ /// The type to remove.
+ public static void RemoveType(this IList list) where TValueProviderFactory : IValueProviderFactory
+ {
+ if (list == null)
+ {
+ throw new ArgumentNullException(nameof(list));
+ }
+
+ RemoveType(list, typeof(TValueProviderFactory));
+ }
+
+ ///
+ /// Removes all value provider factories of the specified type.
+ ///
+ /// The list of .
+ /// The type to remove.
+ public static void RemoveType(this IList list, Type type)
+ {
+ if (list == null)
+ {
+ throw new ArgumentNullException(nameof(list));
+ }
+
+ if (type == null)
+ {
+ throw new ArgumentNullException(nameof(type));
+ }
+
+ for (var i = list.Count - 1; i >= 0; i--)
+ {
+ var valueProviderFactory = list[i];
+ if (valueProviderFactory.GetType() == type)
+ {
+ list.RemoveAt(i);
+ }
+ }
+ }
+ }
+}
diff --git a/src/Microsoft.AspNetCore.Mvc.Core/MvcOptions.cs b/src/Microsoft.AspNetCore.Mvc.Core/MvcOptions.cs
index 24de911424..2eec2a0d53 100644
--- a/src/Microsoft.AspNetCore.Mvc.Core/MvcOptions.cs
+++ b/src/Microsoft.AspNetCore.Mvc.Core/MvcOptions.cs
@@ -22,16 +22,16 @@ namespace Microsoft.AspNetCore.Mvc
public MvcOptions()
{
CacheProfiles = new Dictionary(StringComparer.OrdinalIgnoreCase);
- Conventions = new ApplicationModelConventionCollection();
+ Conventions = new List();
Filters = new FilterCollection();
FormatterMappings = new FormatterMappings();
InputFormatters = new FormatterCollection();
OutputFormatters = new FormatterCollection();
- ModelBinderProviders = new ModelBinderProviderCollection();
+ ModelBinderProviders = new List();
ModelBindingMessageProvider = new DefaultModelBindingMessageProvider();
- ModelMetadataDetailsProviders = new MetadataDetailsProviderCollection();
- ModelValidatorProviders = new ModelValidatorProviderCollection();
- ValueProviderFactories = new ValueProviderFactoryCollection();
+ ModelMetadataDetailsProviders = new List();
+ ModelValidatorProviders = new List();
+ ValueProviderFactories = new List();
}
///
@@ -56,7 +56,7 @@ namespace Microsoft.AspNetCore.Mvc
/// Gets a list of instances that will be applied to
/// the when discovering actions.
///
- public ApplicationModelConventionCollection Conventions { get; }
+ public IList Conventions { get; }
///
/// Gets a collection of which are used to construct filters that
@@ -100,7 +100,7 @@ namespace Microsoft.AspNetCore.Mvc
///
/// Gets a list of s used by this application.
///
- public ModelBinderProviderCollection ModelBinderProviders { get; }
+ public IList ModelBinderProviders { get; }
///
/// Gets the default . Changes here are copied to the
@@ -122,12 +122,12 @@ namespace Microsoft.AspNetCore.Mvc
///
///
///
- public MetadataDetailsProviderCollection ModelMetadataDetailsProviders { get; }
+ public IList ModelMetadataDetailsProviders { get; }
///
/// Gets a list of s used by this application.
///
- public ModelValidatorProviderCollection ModelValidatorProviders { get; }
+ public IList ModelValidatorProviders { get; }
///
/// Gets a list of s that are used by this application.
@@ -150,7 +150,7 @@ namespace Microsoft.AspNetCore.Mvc
///
/// Gets a list of used by this application.
///
- public ValueProviderFactoryCollection ValueProviderFactories { get; }
+ public IList ValueProviderFactories { get; }
///
/// Gets or sets the SSL port that is used by this application when
diff --git a/src/Microsoft.AspNetCore.Mvc.Core/breakingchanges.netcore.json b/src/Microsoft.AspNetCore.Mvc.Core/breakingchanges.netcore.json
index 99e51f7379..0eab874ed3 100644
--- a/src/Microsoft.AspNetCore.Mvc.Core/breakingchanges.netcore.json
+++ b/src/Microsoft.AspNetCore.Mvc.Core/breakingchanges.netcore.json
@@ -145,30 +145,5 @@
"TypeId": "public class Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.DefaultModelMetadata : Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata",
"MemberId": "public override Microsoft.AspNetCore.Mvc.ModelBinding.Metadata.IModelBindingMessageProvider get_ModelBindingMessageProvider()",
"Kind": "Removal"
- },
- {
- "TypeId": "public class Microsoft.AspNetCore.Mvc.MvcOptions",
- "MemberId": "public System.Collections.Generic.IList get_Conventions()",
- "Kind": "Removal"
- },
- {
- "TypeId": "public class Microsoft.AspNetCore.Mvc.MvcOptions",
- "MemberId": "public System.Collections.Generic.IList get_ModelBinderProviders()",
- "Kind": "Removal"
- },
- {
- "TypeId": "public class Microsoft.AspNetCore.Mvc.MvcOptions",
- "MemberId": "public System.Collections.Generic.IList get_ValueProviderFactories()",
- "Kind": "Removal"
- },
- {
- "TypeId": "public class Microsoft.AspNetCore.Mvc.MvcOptions",
- "MemberId": "public System.Collections.Generic.IList get_ModelMetadataDetailsProviders()",
- "Kind": "Removal"
- },
- {
- "TypeId": "public class Microsoft.AspNetCore.Mvc.MvcOptions",
- "MemberId": "public System.Collections.Generic.IList get_ModelValidatorProviders()",
- "Kind": "Removal"
}
]
diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModel/ApplicationModelConventionCollectionTests.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModel/ApplicationModelConventionCollectionTests.cs
deleted file mode 100644
index 3202e01e30..0000000000
--- a/test/Microsoft.AspNetCore.Mvc.Core.Test/ApplicationModel/ApplicationModelConventionCollectionTests.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (c) .NET Foundation. All rights reserved.
-// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
-using System;
-using System.Threading.Tasks;
-using Xunit;
-
-namespace Microsoft.AspNetCore.Mvc.ApplicationModels
-{
- public class ApplicationModelConventionCollectionTests
- {
- [Fact]
- public void RemoveType_RemovesAllOfType()
- {
- // Arrange
- var collection = new ApplicationModelConventionCollection
- {
- new FooApplicationModelConvention(),
- new BarApplicationModelConvention(),
- new FooApplicationModelConvention()
- };
-
- // Act
- collection.RemoveType(typeof(FooApplicationModelConvention));
-
- // Assert
- var convention = Assert.Single(collection);
- Assert.IsType(convention);
- }
-
- [Fact]
- public void GenericRemoveType_RemovesAllOfType()
- {
- // Arrange
- var collection = new ApplicationModelConventionCollection
- {
- new FooApplicationModelConvention(),
- new BarApplicationModelConvention(),
- new FooApplicationModelConvention()
- };
-
- // Act
- collection.RemoveType();
-
- // Assert
- var convention = Assert.Single(collection);
- Assert.IsType(convention);
- }
-
- private class FooApplicationModelConvention : IApplicationModelConvention
- {
- public void Apply(ApplicationModel application)
- {
- throw new NotImplementedException();
- }
- }
-
- private class BarApplicationModelConvention : IApplicationModelConvention
- {
- public void Apply(ApplicationModel application)
- {
- throw new NotImplementedException();
- }
- }
- }
-}
diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/ApplicationModelConventionExtensionsTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/ApplicationModelConventionExtensionsTest.cs
index b9b42e2e27..e635763920 100644
--- a/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/ApplicationModelConventionExtensionsTest.cs
+++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/DependencyInjection/ApplicationModelConventionExtensionsTest.cs
@@ -1,11 +1,11 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using System;
using System.Collections.Generic;
using System.Reflection;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ApplicationModels;
-using Microsoft.Extensions.Internal;
using Xunit;
namespace Microsoft.Extensions.DependencyInjection
@@ -89,6 +89,60 @@ namespace Microsoft.Extensions.DependencyInjection
}
}
+ [Fact]
+ public void RemoveType_RemovesAllOfType()
+ {
+ // Arrange
+ var list = new List
+ {
+ new FooApplicationModelConvention(),
+ new BarApplicationModelConvention(),
+ new FooApplicationModelConvention()
+ };
+
+ // Act
+ list.RemoveType(typeof(FooApplicationModelConvention));
+
+ // Assert
+ var convention = Assert.Single(list);
+ Assert.IsType(convention);
+ }
+
+ [Fact]
+ public void GenericRemoveType_RemovesAllOfType()
+ {
+ // Arrange
+ var list = new List
+ {
+ new FooApplicationModelConvention(),
+ new BarApplicationModelConvention(),
+ new FooApplicationModelConvention()
+ };
+
+ // Act
+ list.RemoveType();
+
+ // Assert
+ var convention = Assert.Single(list);
+ Assert.IsType(convention);
+ }
+
+ private class FooApplicationModelConvention : IApplicationModelConvention
+ {
+ public void Apply(ApplicationModel application)
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ private class BarApplicationModelConvention : IApplicationModelConvention
+ {
+ public void Apply(ApplicationModel application)
+ {
+ throw new NotImplementedException();
+ }
+ }
+
private class HelloController
{
public string GetHello()
diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Metadata/MetadataDetailsProviderCollectionTests.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Metadata/MetadataDetailsProviderExtensionsTest.cs
similarity index 73%
rename from test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Metadata/MetadataDetailsProviderCollectionTests.cs
rename to test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Metadata/MetadataDetailsProviderExtensionsTest.cs
index 0db4306979..5a5254d004 100644
--- a/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Metadata/MetadataDetailsProviderCollectionTests.cs
+++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Metadata/MetadataDetailsProviderExtensionsTest.cs
@@ -1,18 +1,18 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-using System;
+using System.Collections.Generic;
using Xunit;
namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
{
- public class MetadataDetailsProviderCollectionTests
+ public class MetadataDetailsProviderExtensionsTest
{
[Fact]
public void RemoveType_RemovesAllOfType()
{
// Arrange
- var collection = new MetadataDetailsProviderCollection
+ var list = new List
{
new FooMetadataDetailsProvider(),
new BarMetadataDetailsProvider(),
@@ -20,10 +20,10 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
};
// Act
- collection.RemoveType(typeof(FooMetadataDetailsProvider));
+ list.RemoveType(typeof(FooMetadataDetailsProvider));
// Assert
- var provider = Assert.Single(collection);
+ var provider = Assert.Single(list);
Assert.IsType(provider);
}
@@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
public void GenericRemoveType_RemovesAllOfType()
{
// Arrange
- var collection = new MetadataDetailsProviderCollection
+ var list = new List
{
new FooMetadataDetailsProvider(),
new BarMetadataDetailsProvider(),
@@ -39,10 +39,10 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Metadata
};
// Act
- collection.RemoveType();
+ list.RemoveType();
// Assert
- var provider = Assert.Single(collection);
+ var provider = Assert.Single(list);
Assert.IsType(provider);
}
diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ModelBinderProviderCollectionTests.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ModelBinderProviderExtensionsTest.cs
similarity index 78%
rename from test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ModelBinderProviderCollectionTests.cs
rename to test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ModelBinderProviderExtensionsTest.cs
index 4cc5b138bf..24f8310a41 100644
--- a/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ModelBinderProviderCollectionTests.cs
+++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ModelBinderProviderExtensionsTest.cs
@@ -2,17 +2,18 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
+using System.Collections.Generic;
using Xunit;
namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
- public class ModelBinderProviderCollectionTests
+ public class ModelBinderProviderExtensionsTest
{
[Fact]
public void RemoveType_RemovesAllOfType()
{
// Arrange
- var collection = new ModelBinderProviderCollection
+ var list = new List
{
new FooModelBinderProvider(),
new BarModelBinderProvider(),
@@ -20,10 +21,10 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
};
// Act
- collection.RemoveType(typeof(FooModelBinderProvider));
+ list.RemoveType(typeof(FooModelBinderProvider));
// Assert
- var provider = Assert.Single(collection);
+ var provider = Assert.Single(list);
Assert.IsType(provider);
}
@@ -31,7 +32,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
public void GenericRemoveType_RemovesAllOfType()
{
// Arrange
- var collection = new ModelBinderProviderCollection
+ var list = new List
{
new FooModelBinderProvider(),
new BarModelBinderProvider(),
@@ -39,10 +40,10 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
};
// Act
- collection.RemoveType();
+ list.RemoveType();
// Assert
- var provider = Assert.Single(collection);
+ var provider = Assert.Single(list);
Assert.IsType(provider);
}
diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/ModelValidatorProviderCollectionTests.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/ModelValidatorProviderExtensionsTest.cs
similarity index 78%
rename from test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/ModelValidatorProviderCollectionTests.cs
rename to test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/ModelValidatorProviderExtensionsTest.cs
index 9f4f1c1d79..69a067ad5d 100644
--- a/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/ModelValidatorProviderCollectionTests.cs
+++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/Validation/ModelValidatorProviderExtensionsTest.cs
@@ -2,17 +2,18 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
+using System.Collections.Generic;
using Xunit;
namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
{
- public class ModelValidatorProviderCollectionTests
+ public class ModelValidatorProviderExtensionsTest
{
[Fact]
public void RemoveType_RemovesAllOfType()
{
// Arrange
- var collection = new ModelValidatorProviderCollection
+ var list = new List
{
new FooModelValidatorProvider(),
new BarModelValidatorProvider(),
@@ -20,10 +21,10 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
};
// Act
- collection.RemoveType(typeof(FooModelValidatorProvider));
+ list.RemoveType(typeof(FooModelValidatorProvider));
// Assert
- var provider = Assert.Single(collection);
+ var provider = Assert.Single(list);
Assert.IsType(provider);
}
@@ -31,7 +32,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
public void GenericRemoveType_RemovesAllOfType()
{
// Arrange
- var collection = new ModelValidatorProviderCollection
+ var list = new List
{
new FooModelValidatorProvider(),
new BarModelValidatorProvider(),
@@ -39,10 +40,10 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
};
// Act
- collection.RemoveType();
+ list.RemoveType();
// Assert
- var provider = Assert.Single(collection);
+ var provider = Assert.Single(list);
Assert.IsType(provider);
}
diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ValueProviderFactoryCollectionTests.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ValueProviderFactoryExtensionsTest.cs
similarity index 79%
rename from test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ValueProviderFactoryCollectionTests.cs
rename to test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ValueProviderFactoryExtensionsTest.cs
index f516d3778b..d55b1317e2 100644
--- a/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ValueProviderFactoryCollectionTests.cs
+++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/ModelBinding/ValueProviderFactoryExtensionsTest.cs
@@ -2,18 +2,19 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
+using System.Collections.Generic;
using System.Threading.Tasks;
using Xunit;
namespace Microsoft.AspNetCore.Mvc.ModelBinding
{
- public class ValueProviderFactoryCollectionTests
+ public class ValueProviderFactoryExtensionsTest
{
[Fact]
public void RemoveType_RemovesAllOfType()
{
// Arrange
- var collection = new ValueProviderFactoryCollection
+ var list = new List
{
new FooValueProviderFactory(),
new BarValueProviderFactory(),
@@ -21,10 +22,10 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
};
// Act
- collection.RemoveType(typeof(FooValueProviderFactory));
+ list.RemoveType(typeof(FooValueProviderFactory));
// Assert
- var factory = Assert.Single(collection);
+ var factory = Assert.Single(list);
Assert.IsType(factory);
}
@@ -32,7 +33,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
public void GenericRemoveType_RemovesAllOfType()
{
// Arrange
- var collection = new ValueProviderFactoryCollection
+ var list = new List
{
new FooValueProviderFactory(),
new BarValueProviderFactory(),
@@ -40,10 +41,10 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding
};
// Act
- collection.RemoveType();
+ list.RemoveType();
// Assert
- var factory = Assert.Single(collection);
+ var factory = Assert.Single(list);
Assert.IsType(factory);
}