From afc75a82969a941197eaf7600583322f680c3c2f Mon Sep 17 00:00:00 2001 From: Doug Bunting Date: Sat, 6 Jan 2018 16:13:55 -0800 Subject: [PATCH] Move `IHttpRequestStreamReaderFactory` from `.Internal` to `.Infrastructure` - #7044 - move `IHttpResponseStreamWriterFactory` too - add breaking change records e.g. for changes to `BodyModelBinder[Provider]` constructors - these changes relate to previously-"internal" constructors and one property nits: take VS suggestions for changed files --- .../IHttpRequestStreamReaderFactory.cs | 2 +- .../IHttpResponseStreamWriterFactory.cs | 2 +- ...emoryPoolHttpRequestStreamReaderFactory.cs | 1 + ...moryPoolHttpResponseStreamWriterFactory.cs | 1 + .../Internal/MvcCoreMvcOptionsSetup.cs | 3 +- .../ModelBinding/Binders/BodyModelBinder.cs | 3 +- .../Binders/BodyModelBinderProvider.cs | 2 +- .../breakingchanges.netcore.json | 32 ++++++++++++++++++- .../Internal/JsonResultExecutor.cs | 1 + .../Infrastructure/PageResultExecutor.cs | 2 +- .../breakingchanges.netcore.json | 7 ++++ .../ViewFeatures/ViewExecutor.cs | 10 +++--- .../breakingchanges.netcore.json | 17 ++++++++++ .../ControllerBinderDelegateProviderTest.cs | 14 ++++---- .../Internal/DefaultObjectValidatorTests.cs | 1 + .../Internal/PageActionInvokerTest.cs | 20 +++++++----- .../TestHttpRequestStreamReaderFactory.cs | 2 +- .../TestHttpResponseStreamWriterFactory.cs | 2 +- 18 files changed, 91 insertions(+), 31 deletions(-) rename src/Microsoft.AspNetCore.Mvc.Core/{Internal => Infrastructure}/IHttpRequestStreamReaderFactory.cs (94%) rename src/Microsoft.AspNetCore.Mvc.Core/{Internal => Infrastructure}/IHttpResponseStreamWriterFactory.cs (94%) create mode 100644 src/Microsoft.AspNetCore.Mvc.RazorPages/breakingchanges.netcore.json create mode 100644 src/Microsoft.AspNetCore.Mvc.ViewFeatures/breakingchanges.netcore.json diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Internal/IHttpRequestStreamReaderFactory.cs b/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/IHttpRequestStreamReaderFactory.cs similarity index 94% rename from src/Microsoft.AspNetCore.Mvc.Core/Internal/IHttpRequestStreamReaderFactory.cs rename to src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/IHttpRequestStreamReaderFactory.cs index ecd0073aa8..b29db5163c 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/Internal/IHttpRequestStreamReaderFactory.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/IHttpRequestStreamReaderFactory.cs @@ -4,7 +4,7 @@ using System.IO; using System.Text; -namespace Microsoft.AspNetCore.Mvc.Internal +namespace Microsoft.AspNetCore.Mvc.Infrastructure { /// /// Creates instances for reading from . diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Internal/IHttpResponseStreamWriterFactory.cs b/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/IHttpResponseStreamWriterFactory.cs similarity index 94% rename from src/Microsoft.AspNetCore.Mvc.Core/Internal/IHttpResponseStreamWriterFactory.cs rename to src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/IHttpResponseStreamWriterFactory.cs index c76661bc63..99e2b58528 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/Internal/IHttpResponseStreamWriterFactory.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/Infrastructure/IHttpResponseStreamWriterFactory.cs @@ -4,7 +4,7 @@ using System.IO; using System.Text; -namespace Microsoft.AspNetCore.Mvc.Internal +namespace Microsoft.AspNetCore.Mvc.Infrastructure { /// /// Creates instances for writing to . diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Internal/MemoryPoolHttpRequestStreamReaderFactory.cs b/src/Microsoft.AspNetCore.Mvc.Core/Internal/MemoryPoolHttpRequestStreamReaderFactory.cs index 108956b40b..88f6f8428c 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/Internal/MemoryPoolHttpRequestStreamReaderFactory.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/Internal/MemoryPoolHttpRequestStreamReaderFactory.cs @@ -5,6 +5,7 @@ using System; using System.Buffers; using System.IO; using System.Text; +using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.WebUtilities; namespace Microsoft.AspNetCore.Mvc.Internal diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Internal/MemoryPoolHttpResponseStreamWriterFactory.cs b/src/Microsoft.AspNetCore.Mvc.Core/Internal/MemoryPoolHttpResponseStreamWriterFactory.cs index e63c471e3e..91dd31e0c7 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/Internal/MemoryPoolHttpResponseStreamWriterFactory.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/Internal/MemoryPoolHttpResponseStreamWriterFactory.cs @@ -5,6 +5,7 @@ using System; using System.Buffers; using System.IO; using System.Text; +using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.WebUtilities; namespace Microsoft.AspNetCore.Mvc.Internal diff --git a/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcCoreMvcOptionsSetup.cs b/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcCoreMvcOptionsSetup.cs index 88aa088830..e898cd6b1f 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcCoreMvcOptionsSetup.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/Internal/MvcCoreMvcOptionsSetup.cs @@ -6,6 +6,7 @@ using System.IO; using System.Threading; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Formatters; +using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.ModelBinding.Binders; using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata; @@ -97,4 +98,4 @@ namespace Microsoft.AspNetCore.Mvc.Internal options.ModelMetadataDetailsProviders.Add(new SuppressChildValidationMetadataProvider(typeof(Stream))); } } -} \ No newline at end of file +} diff --git a/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/BodyModelBinder.cs b/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/BodyModelBinder.cs index babd08ce7c..80bcedbc3a 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/BodyModelBinder.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/BodyModelBinder.cs @@ -8,6 +8,7 @@ using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Core; using Microsoft.AspNetCore.Mvc.Formatters; +using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Mvc.Internal; using Microsoft.Extensions.Logging; @@ -186,7 +187,7 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Binders private bool ShouldHandleException(IInputFormatter formatter) { var policy = _options.InputFormatterExceptionPolicy; - + // Any explicit policy on the formatters takes precedence over the global policy on MvcOptions if (formatter is IInputFormatterExceptionPolicy exceptionPolicy) { diff --git a/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/BodyModelBinderProvider.cs b/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/BodyModelBinderProvider.cs index 7bd8b2f408..c2110c793e 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/BodyModelBinderProvider.cs +++ b/src/Microsoft.AspNetCore.Mvc.Core/ModelBinding/Binders/BodyModelBinderProvider.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Mvc.Core; using Microsoft.AspNetCore.Mvc.Formatters; -using Microsoft.AspNetCore.Mvc.Internal; +using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.Extensions.Logging; namespace Microsoft.AspNetCore.Mvc.ModelBinding.Binders diff --git a/src/Microsoft.AspNetCore.Mvc.Core/breakingchanges.netcore.json b/src/Microsoft.AspNetCore.Mvc.Core/breakingchanges.netcore.json index 32960f8ced..07cf4ab0af 100644 --- a/src/Microsoft.AspNetCore.Mvc.Core/breakingchanges.netcore.json +++ b/src/Microsoft.AspNetCore.Mvc.Core/breakingchanges.netcore.json @@ -1,2 +1,32 @@ [ -] \ No newline at end of file + { + "TypeId": "public class Microsoft.AspNetCore.Mvc.ModelBinding.Binders.BodyModelBinder : Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder", + "MemberId": "public .ctor(System.Collections.Generic.IList formatters, Microsoft.AspNetCore.Mvc.Internal.IHttpRequestStreamReaderFactory readerFactory)", + "Kind": "Removal" + }, + { + "TypeId": "public class Microsoft.AspNetCore.Mvc.ModelBinding.Binders.BodyModelBinder : Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder", + "MemberId": "public .ctor(System.Collections.Generic.IList formatters, Microsoft.AspNetCore.Mvc.Internal.IHttpRequestStreamReaderFactory readerFactory, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory)", + "Kind": "Removal" + }, + { + "TypeId": "public class Microsoft.AspNetCore.Mvc.ModelBinding.Binders.BodyModelBinder : Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder", + "MemberId": "public .ctor(System.Collections.Generic.IList formatters, Microsoft.AspNetCore.Mvc.Internal.IHttpRequestStreamReaderFactory readerFactory, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, Microsoft.AspNetCore.Mvc.MvcOptions options)", + "Kind": "Removal" + }, + { + "TypeId": "public class Microsoft.AspNetCore.Mvc.ModelBinding.Binders.BodyModelBinderProvider : Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinderProvider", + "MemberId": "public .ctor(System.Collections.Generic.IList formatters, Microsoft.AspNetCore.Mvc.Internal.IHttpRequestStreamReaderFactory readerFactory)", + "Kind": "Removal" + }, + { + "TypeId": "public class Microsoft.AspNetCore.Mvc.ModelBinding.Binders.BodyModelBinderProvider : Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinderProvider", + "MemberId": "public .ctor(System.Collections.Generic.IList formatters, Microsoft.AspNetCore.Mvc.Internal.IHttpRequestStreamReaderFactory readerFactory, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory)", + "Kind": "Removal" + }, + { + "TypeId": "public class Microsoft.AspNetCore.Mvc.ModelBinding.Binders.BodyModelBinderProvider : Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinderProvider", + "MemberId": "public .ctor(System.Collections.Generic.IList formatters, Microsoft.AspNetCore.Mvc.Internal.IHttpRequestStreamReaderFactory readerFactory, Microsoft.Extensions.Logging.ILoggerFactory loggerFactory, Microsoft.AspNetCore.Mvc.MvcOptions options)", + "Kind": "Removal" + } +] diff --git a/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Internal/JsonResultExecutor.cs b/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Internal/JsonResultExecutor.cs index 130ccc465e..f7e2fc09f2 100644 --- a/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Internal/JsonResultExecutor.cs +++ b/src/Microsoft.AspNetCore.Mvc.Formatters.Json/Internal/JsonResultExecutor.cs @@ -5,6 +5,7 @@ using System; using System.Buffers; using System.Text; using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Mvc.Internal; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; diff --git a/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageResultExecutor.cs b/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageResultExecutor.cs index b8bbe7f4ec..4ebf07eab2 100644 --- a/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageResultExecutor.cs +++ b/src/Microsoft.AspNetCore.Mvc.RazorPages/Infrastructure/PageResultExecutor.cs @@ -5,7 +5,7 @@ using System; using System.Diagnostics; using System.Text.Encodings.Web; using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc.Internal; +using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Mvc.Razor; using Microsoft.AspNetCore.Mvc.ViewEngines; using Microsoft.AspNetCore.Mvc.ViewFeatures; diff --git a/src/Microsoft.AspNetCore.Mvc.RazorPages/breakingchanges.netcore.json b/src/Microsoft.AspNetCore.Mvc.RazorPages/breakingchanges.netcore.json new file mode 100644 index 0000000000..d5d7030b72 --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.RazorPages/breakingchanges.netcore.json @@ -0,0 +1,7 @@ +[ + { + "TypeId": "public class Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageResultExecutor : Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor", + "MemberId": "public .ctor(Microsoft.AspNetCore.Mvc.Internal.IHttpResponseStreamWriterFactory writerFactory, Microsoft.AspNetCore.Mvc.ViewEngines.ICompositeViewEngine compositeViewEngine, Microsoft.AspNetCore.Mvc.Razor.IRazorViewEngine razorViewEngine, Microsoft.AspNetCore.Mvc.Razor.IRazorPageActivator razorPageActivator, System.Diagnostics.DiagnosticSource diagnosticSource, System.Text.Encodings.Web.HtmlEncoder htmlEncoder)", + "Kind": "Removal" + } +] diff --git a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewExecutor.cs b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewExecutor.cs index 4ae0f2ca4a..cae30b038e 100644 --- a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewExecutor.cs +++ b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/ViewFeatures/ViewExecutor.cs @@ -4,8 +4,8 @@ using System; using System.Diagnostics; using System.IO; -using System.Text; using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Mvc.Internal; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.Rendering; @@ -217,14 +217,12 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures var response = viewContext.HttpContext.Response; - string resolvedContentType; - Encoding resolvedContentTypeEncoding; ResponseContentTypeHelper.ResolveContentTypeAndEncoding( contentType, response.ContentType, DefaultContentType, - out resolvedContentType, - out resolvedContentTypeEncoding); + out var resolvedContentType, + out var resolvedContentTypeEncoding); response.ContentType = resolvedContentType; @@ -260,4 +258,4 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures } } } -} \ No newline at end of file +} diff --git a/src/Microsoft.AspNetCore.Mvc.ViewFeatures/breakingchanges.netcore.json b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/breakingchanges.netcore.json new file mode 100644 index 0000000000..1388063181 --- /dev/null +++ b/src/Microsoft.AspNetCore.Mvc.ViewFeatures/breakingchanges.netcore.json @@ -0,0 +1,17 @@ +[ + { + "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor", + "MemberId": "protected .ctor(Microsoft.AspNetCore.Mvc.Internal.IHttpResponseStreamWriterFactory writerFactory, Microsoft.AspNetCore.Mvc.ViewEngines.ICompositeViewEngine viewEngine, System.Diagnostics.DiagnosticSource diagnosticSource)", + "Kind": "Removal" + }, + { + "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor", + "MemberId": "protected Microsoft.AspNetCore.Mvc.Internal.IHttpResponseStreamWriterFactory get_WriterFactory()", + "Kind": "Removal" + }, + { + "TypeId": "public class Microsoft.AspNetCore.Mvc.ViewFeatures.ViewExecutor", + "MemberId": "public .ctor(Microsoft.Extensions.Options.IOptions viewOptions, Microsoft.AspNetCore.Mvc.Internal.IHttpResponseStreamWriterFactory writerFactory, Microsoft.AspNetCore.Mvc.ViewEngines.ICompositeViewEngine viewEngine, Microsoft.AspNetCore.Mvc.ViewFeatures.ITempDataDictionaryFactory tempDataFactory, System.Diagnostics.DiagnosticSource diagnosticSource, Microsoft.AspNetCore.Mvc.ModelBinding.IModelMetadataProvider modelMetadataProvider)", + "Kind": "Removal" + } +] diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ControllerBinderDelegateProviderTest.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ControllerBinderDelegateProviderTest.cs index a4f90e77eb..d46fda50b5 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ControllerBinderDelegateProviderTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/ControllerBinderDelegateProviderTest.cs @@ -4,20 +4,21 @@ using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using System.Linq; using System.Reflection; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.AspNetCore.Mvc.Formatters; +using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.ModelBinding.Binders; -using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata; +using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; using Microsoft.AspNetCore.Routing; using Moq; using Xunit; -using System.Linq; namespace Microsoft.AspNetCore.Mvc.Internal { @@ -575,10 +576,8 @@ namespace Microsoft.AspNetCore.Mvc.Internal Assert.Null(controller.UntouchedProperty); } - [Theory] - [InlineData(false)] - [InlineData(true)] - public async Task BindActionArgumentsAsync_DoesNotSetNullValues_ForNonNullableProperties(bool isModelSet) + [Fact] + public async Task BindActionArgumentsAsync_DoesNotSetNullValues_ForNonNullableProperties() { // Arrange var actionDescriptor = GetActionDescriptor(); @@ -901,8 +900,7 @@ namespace Microsoft.AspNetCore.Mvc.Internal { // BindingContext.ModelName will be string.Empty here. This is a 'fallback to empty prefix' // because the value providers have no data. - object model; - if (inputPropertyValues.TryGetValue(bindingContext.FieldName, out model)) + if (inputPropertyValues.TryGetValue(bindingContext.FieldName, out var model)) { bindingContext.Result = ModelBindingResult.Success(model); } diff --git a/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultObjectValidatorTests.cs b/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultObjectValidatorTests.cs index 883a485de2..5371633029 100644 --- a/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultObjectValidatorTests.cs +++ b/test/Microsoft.AspNetCore.Mvc.Core.Test/Internal/DefaultObjectValidatorTests.cs @@ -8,6 +8,7 @@ using System.IO; using System.Linq; using System.Text; using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; diff --git a/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Internal/PageActionInvokerTest.cs b/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Internal/PageActionInvokerTest.cs index b8a53d3953..a1d066ebeb 100644 --- a/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Internal/PageActionInvokerTest.cs +++ b/test/Microsoft.AspNetCore.Mvc.RazorPages.Test/Internal/PageActionInvokerTest.cs @@ -11,6 +11,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Mvc.Internal; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.ModelBinding.Validation; @@ -25,7 +26,6 @@ using Microsoft.AspNetCore.Testing; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; -using Microsoft.Extensions.Logging.Testing; using Moq; using Xunit; @@ -102,8 +102,10 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal resourceExecutingContext.ValueProviderFactories.Add(valueProviderFactory2); }); var valueProviderFactory1 = Mock.Of(); - var valueProviderFactories = new List(); - valueProviderFactories.Add(valueProviderFactory1); + var valueProviderFactories = new List + { + valueProviderFactory1 + }; var invoker = CreateInvoker( new IFilterMetadata[] { resourceFilter.Object }, valueProviderFactories: valueProviderFactories); @@ -133,9 +135,11 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal var valueProviderFactory1 = Mock.Of(); var valueProviderFactory2 = Mock.Of(); - var valueProviderFactories = new List(); - valueProviderFactories.Add(valueProviderFactory1); - valueProviderFactories.Add(valueProviderFactory2); + var valueProviderFactories = new List + { + valueProviderFactory1, + valueProviderFactory2 + }; var invoker = CreateInvoker( new IFilterMetadata[] { resourceFilter.Object }, valueProviderFactories: valueProviderFactories); @@ -1164,13 +1168,13 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages.Internal tempDataFactory = Mock.Of(m => m.GetTempData(It.IsAny()) == Mock.Of()); } - Func pageFactory = (context, viewContext) => + object pageFactory(PageContext context, ViewContext viewContext) { var instance = (Page)Activator.CreateInstance(actionDescriptor.PageTypeInfo.AsType()); instance.PageContext = context; instance.ViewContext = viewContext; return instance; - }; + } if (handlers == null) { diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/TestHttpRequestStreamReaderFactory.cs b/test/Microsoft.AspNetCore.Mvc.TestCommon/TestHttpRequestStreamReaderFactory.cs index cd4d765ea1..639c336d46 100644 --- a/test/Microsoft.AspNetCore.Mvc.TestCommon/TestHttpRequestStreamReaderFactory.cs +++ b/test/Microsoft.AspNetCore.Mvc.TestCommon/TestHttpRequestStreamReaderFactory.cs @@ -3,7 +3,7 @@ using System.IO; using System.Text; -using Microsoft.AspNetCore.Mvc.Internal; +using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.WebUtilities; namespace Microsoft.AspNetCore.Mvc diff --git a/test/Microsoft.AspNetCore.Mvc.TestCommon/TestHttpResponseStreamWriterFactory.cs b/test/Microsoft.AspNetCore.Mvc.TestCommon/TestHttpResponseStreamWriterFactory.cs index ecc394d08c..ad63961d7e 100644 --- a/test/Microsoft.AspNetCore.Mvc.TestCommon/TestHttpResponseStreamWriterFactory.cs +++ b/test/Microsoft.AspNetCore.Mvc.TestCommon/TestHttpResponseStreamWriterFactory.cs @@ -3,7 +3,7 @@ using System.IO; using System.Text; -using Microsoft.AspNetCore.Mvc.Internal; +using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.WebUtilities; namespace Microsoft.AspNetCore.Mvc