diff --git a/eng/PatchConfig.props b/eng/PatchConfig.props index 301c8a5899..1b7c23f977 100644 --- a/eng/PatchConfig.props +++ b/eng/PatchConfig.props @@ -35,6 +35,7 @@ Later on, this will be checked using this condition: + @aspnet/signalr; diff --git a/src/Mvc/test/Mvc.FunctionalTests/ErrorPageTests.cs b/src/Mvc/test/Mvc.FunctionalTests/ErrorPageTests.cs index 7241fbf2eb..6db37e937d 100644 --- a/src/Mvc/test/Mvc.FunctionalTests/ErrorPageTests.cs +++ b/src/Mvc/test/Mvc.FunctionalTests/ErrorPageTests.cs @@ -1,26 +1,44 @@ // 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.Linq; using System.Net; using System.Net.Http; using System.Net.Http.Headers; using System.Text.Encodings.Web; using System.Threading.Tasks; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Testing; using Xunit; +using Xunit.Abstractions; namespace Microsoft.AspNetCore.Mvc.FunctionalTests { /// /// Functional test to verify the error reporting of Razor compilation by diagnostic middleware. /// - public class ErrorPageTests : IClassFixture> + public class ErrorPageTests : IClassFixture>, IDisposable { private static readonly string PreserveCompilationContextMessage = HtmlEncoder.Default.Encode( "One or more compilation references may be missing. " + "If you're seeing this in a published application, set 'CopyRefAssembliesToPublishDirectory' to true in your project file to ensure files in the refs directory are published."); - public ErrorPageTests(MvcTestFixture fixture) + private readonly AssemblyTestLog _assemblyTestLog; + + public ErrorPageTests( + MvcTestFixture fixture, + ITestOutputHelper testOutputHelper) { - Client = fixture.CreateDefaultClient(); + _assemblyTestLog = AssemblyTestLog.ForAssembly(GetType().Assembly); + + var loggerProvider = _assemblyTestLog.CreateLoggerFactory(testOutputHelper, GetType().Name); + + var factory = fixture.Factories.FirstOrDefault() ?? fixture.WithWebHostBuilder(b => b.UseStartup()); + Client = factory + .WithWebHostBuilder(builder => builder.ConfigureLogging(l => l.Services.AddSingleton(loggerProvider))) + .CreateDefaultClient(); } public HttpClient Client { get; } @@ -143,5 +161,10 @@ namespace Microsoft.AspNetCore.Mvc.FunctionalTests Assert.Contains(nullReferenceException, content); Assert.Contains(indexOutOfRangeException, content); } + + public void Dispose() + { + _assemblyTestLog.Dispose(); + } } } diff --git a/src/Mvc/test/Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj b/src/Mvc/test/Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj index 3778bbe548..9abe308b51 100644 --- a/src/Mvc/test/Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj +++ b/src/Mvc/test/Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj @@ -1,4 +1,4 @@ - + @@ -6,6 +6,7 @@ $(DefineConstants);GENERATE_BASELINES $(DefineConstants);__RemoveThisBitTo__GENERATE_BASELINES + Mvc.FunctionalTests false