Skip to content

Commit 7557cb9

Browse files
committed
Merge remote-tracking branch 'origin/release/2.1' into prkrishn/merge/2.1
2 parents d76c547 + e7c5e09 commit 7557cb9

File tree

6 files changed

+48
-6
lines changed

6 files changed

+48
-6
lines changed

src/Mvc/test/Mvc.FunctionalTests/ErrorPageTests.cs

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,44 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4+
using System;
5+
using System.Linq;
46
using System.Net;
57
using System.Net.Http;
68
using System.Net.Http.Headers;
79
using System.Text.Encodings.Web;
810
using System.Threading.Tasks;
11+
using Microsoft.AspNetCore.Hosting;
12+
using Microsoft.Extensions.DependencyInjection;
13+
using Microsoft.Extensions.Logging;
14+
using Microsoft.Extensions.Logging.Testing;
915
using Xunit;
16+
using Xunit.Abstractions;
1017

1118
namespace Microsoft.AspNetCore.Mvc.FunctionalTests
1219
{
1320
/// <summary>
1421
/// Functional test to verify the error reporting of Razor compilation by diagnostic middleware.
1522
/// </summary>
16-
public class ErrorPageTests : IClassFixture<MvcTestFixture<ErrorPageMiddlewareWebSite.Startup>>
23+
public class ErrorPageTests : IClassFixture<MvcTestFixture<ErrorPageMiddlewareWebSite.Startup>>, IDisposable
1724
{
1825
private static readonly string PreserveCompilationContextMessage = HtmlEncoder.Default.Encode(
1926
"One or more compilation references may be missing. " +
2027
"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.");
21-
public ErrorPageTests(MvcTestFixture<ErrorPageMiddlewareWebSite.Startup> fixture)
28+
private readonly AssemblyTestLog _assemblyTestLog;
29+
30+
public ErrorPageTests(
31+
MvcTestFixture<ErrorPageMiddlewareWebSite.Startup> fixture,
32+
ITestOutputHelper testOutputHelper)
2233
{
23-
Client = fixture.CreateDefaultClient();
34+
_assemblyTestLog = AssemblyTestLog.ForAssembly(GetType().Assembly);
35+
36+
var loggerProvider = _assemblyTestLog.CreateLoggerFactory(testOutputHelper, GetType().Name);
37+
38+
var factory = fixture.Factories.FirstOrDefault() ?? fixture.WithWebHostBuilder(b => b.UseStartup<ErrorPageMiddlewareWebSite.Startup>());
39+
Client = factory
40+
.WithWebHostBuilder(builder => builder.ConfigureLogging(l => l.Services.AddSingleton<ILoggerFactory>(loggerProvider)))
41+
.CreateDefaultClient();
2442
}
2543

2644
public HttpClient Client { get; }
@@ -143,5 +161,10 @@ public async void AggregateException_FlattensInnerExceptions()
143161
Assert.Contains(nullReferenceException, content);
144162
Assert.Contains(indexOutOfRangeException, content);
145163
}
164+
165+
public void Dispose()
166+
{
167+
_assemblyTestLog.Dispose();
168+
}
146169
}
147170
}

src/Mvc/test/Mvc.FunctionalTests/Microsoft.AspNetCore.Mvc.FunctionalTests.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<Import Project="$(MvcTestingTargets)" Condition="'$(MvcTestingTargets)' != ''" />
33

44
<PropertyGroup>
55
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
66

77
<DefineConstants Condition="'$(GenerateBaselines)'=='true'">$(DefineConstants);GENERATE_BASELINES</DefineConstants>
88
<DefineConstants>$(DefineConstants);__RemoveThisBitTo__GENERATE_BASELINES</DefineConstants>
9+
<TestGroupName>Mvc.FunctionalTests</TestGroupName>
910
</PropertyGroup>
1011

1112
<ItemGroup>

src/Razor/Razor.Design/test/IntegrationTests/Microsoft.AspNetCore.Razor.Design.Test.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,8 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
6969
</ItemGroup>
7070
</Target>
7171

72+
<Target Name="RestoreTestProjects" BeforeTargets="Restore">
73+
<MSBuild Projects="..\testassets\RestoreTestProjects\RestoreTestProjects.csproj" Targets="Restore" />
74+
</Target>
75+
7276
</Project>

src/Razor/Razor.Design/test/testassets/ClassLibrary/ClassLibrary.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
3131
<Reference Include="Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib"/>
3232
<Reference Include="Microsoft.AspNetCore.Razor.Runtime"/>
33-
<Reference Include="Microsoft.AspNetCore.Razor.Design" ReferenceOutputAssembly="false" />
3433
</ItemGroup>
3534

3635
<ItemGroup Condition="'$(BinariesRoot)'!=''">

src/Razor/Razor.Design/test/testassets/ClassLibrary2/ClassLibrary2.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
<!-- In test scenarios $(BinariesRoot) is defined in a generated Directory.Build.props file -->
3030
<Reference Include="Microsoft.AspNetCore.Razor.Test.MvcShim.ClassLib"/>
3131
<Reference Include="Microsoft.AspNetCore.Razor.Runtime"/>
32-
<Reference Include="Microsoft.AspNetCore.Razor.Design" ReferenceOutputAssembly="false" />
3332
</ItemGroup>
3433

3534
<ItemGroup Condition="'$(BinariesRoot)'!=''">
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>netcoreapp2.2</TargetFramework>
4+
</PropertyGroup>
5+
6+
<ItemGroup>
7+
<ProjectReference Include="..\AppWithP2PReference\AppWithP2PReference.csproj" />
8+
<ProjectReference Include="..\ClassLibrary\ClassLibrary.csproj" />
9+
<ProjectReference Include="..\ClassLibrary2\ClassLibrary2.csproj" />
10+
<ProjectReference Include="..\ClassLibraryMvc21\ClassLibraryMvc21.csproj" />
11+
<ProjectReference Include="..\LargeProject\LargeProject.csproj" />
12+
<ProjectReference Include="..\SimpleMvc\SimpleMvc.csproj" />
13+
<ProjectReference Include="..\SimpleMvcFSharp\SimpleMvcFSharp.fsproj" />
14+
<ProjectReference Include="..\SimplePages\SimplePages.csproj" />
15+
</ItemGroup>
16+
</Project>

0 commit comments

Comments
 (0)