Merge remote-tracking branch 'origin/release/2.1' into prkrishn/merge/2.1
This commit is contained in:
commit
7557cb916b
|
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Functional test to verify the error reporting of Razor compilation by diagnostic middleware.
|
||||
/// </summary>
|
||||
public class ErrorPageTests : IClassFixture<MvcTestFixture<ErrorPageMiddlewareWebSite.Startup>>
|
||||
public class ErrorPageTests : IClassFixture<MvcTestFixture<ErrorPageMiddlewareWebSite.Startup>>, 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<ErrorPageMiddlewareWebSite.Startup> fixture)
|
||||
private readonly AssemblyTestLog _assemblyTestLog;
|
||||
|
||||
public ErrorPageTests(
|
||||
MvcTestFixture<ErrorPageMiddlewareWebSite.Startup> 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<ErrorPageMiddlewareWebSite.Startup>());
|
||||
Client = factory
|
||||
.WithWebHostBuilder(builder => builder.ConfigureLogging(l => l.Services.AddSingleton<ILoggerFactory>(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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="$(MvcTestingTargets)" Condition="'$(MvcTestingTargets)' != ''" />
|
||||
|
||||
<PropertyGroup>
|
||||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
<DefineConstants Condition="'$(GenerateBaselines)'=='true'">$(DefineConstants);GENERATE_BASELINES</DefineConstants>
|
||||
<DefineConstants>$(DefineConstants);__RemoveThisBitTo__GENERATE_BASELINES</DefineConstants>
|
||||
<TestGroupName>Mvc.FunctionalTests</TestGroupName>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -69,4 +69,8 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
|
|||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="RestoreTestProjects" BeforeTargets="Restore">
|
||||
<MSBuild Projects="..\testassets\RestoreTestProjects\RestoreTestProjects.csproj" Targets="Restore" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@
|
|||
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
|
||||
<Reference Include="Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib"/>
|
||||
<Reference Include="Microsoft.AspNetCore.Razor.Runtime"/>
|
||||
<Reference Include="Microsoft.AspNetCore.Razor.Design" ReferenceOutputAssembly="false" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
|
||||
<Reference Include="Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib"/>
|
||||
<Reference Include="Microsoft.AspNetCore.Razor.Runtime"/>
|
||||
<Reference Include="Microsoft.AspNetCore.Razor.Design" ReferenceOutputAssembly="false" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(BinariesRoot)'!=''">
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\AppWithP2PReference\AppWithP2PReference.csproj" />
|
||||
<ProjectReference Include="..\ClassLibrary\ClassLibrary.csproj" />
|
||||
<ProjectReference Include="..\ClassLibrary2\ClassLibrary2.csproj" />
|
||||
<ProjectReference Include="..\ClassLibraryMvc21\ClassLibraryMvc21.csproj" />
|
||||
<ProjectReference Include="..\LargeProject\LargeProject.csproj" />
|
||||
<ProjectReference Include="..\SimpleMvc\SimpleMvc.csproj" />
|
||||
<ProjectReference Include="..\SimpleMvcFSharp\SimpleMvcFSharp.fsproj" />
|
||||
<ProjectReference Include="..\SimplePages\SimplePages.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Loading…
Reference in New Issue