From a9644a5bf385f49b990187bec7c69c30ec664777 Mon Sep 17 00:00:00 2001 From: John Luo Date: Fri, 19 Feb 2016 16:51:04 -0800 Subject: [PATCH] Updating test TFMs for custom test discovery --- .../project.json | 4 +-- .../project.json | 4 +-- .../TestFixture.cs | 27 ------------------- .../project.json | 11 +++++--- .../project.json | 4 +-- .../project.json | 4 +-- 6 files changed, 16 insertions(+), 38 deletions(-) diff --git a/test/Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.FunctionalTests/project.json b/test/Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.FunctionalTests/project.json index a0f3fba47c..ffe1abed65 100644 --- a/test/Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.FunctionalTests/project.json +++ b/test/Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.FunctionalTests/project.json @@ -16,7 +16,7 @@ }, "imports": "portable-net451+win8" }, - "dnx451": { + "net451": { "frameworkAssemblies": { "System.Runtime": "", "System.Threading.Tasks": "" @@ -29,4 +29,4 @@ "compilationOptions": { "warningsAsErrors": true } -} \ No newline at end of file +} diff --git a/test/Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.Tests/project.json b/test/Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.Tests/project.json index 53270435a8..eb6ccd8caa 100644 --- a/test/Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.Tests/project.json +++ b/test/Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.Tests/project.json @@ -22,7 +22,7 @@ }, "imports": "portable-net451+win8" }, - "dnx451": { + "net451": { "frameworkAssemblies": { "System.Runtime": "", "System.Threading.Tasks": "" @@ -33,4 +33,4 @@ } } } -} \ No newline at end of file +} diff --git a/test/Microsoft.AspNetCore.Diagnostics.FunctionalTests/TestFixture.cs b/test/Microsoft.AspNetCore.Diagnostics.FunctionalTests/TestFixture.cs index 6d83e32faf..d074bd517f 100644 --- a/test/Microsoft.AspNetCore.Diagnostics.FunctionalTests/TestFixture.cs +++ b/test/Microsoft.AspNetCore.Diagnostics.FunctionalTests/TestFixture.cs @@ -26,7 +26,6 @@ namespace Microsoft.AspNetCore.Diagnostics.FunctionalTests using (new CultureReplacer()) { var builder = new WebHostBuilder() - .ConfigureServices(InitializeServices) .UseStartup(typeof(TStartup)); _server = new TestServer(builder); @@ -43,31 +42,5 @@ namespace Microsoft.AspNetCore.Diagnostics.FunctionalTests Client.Dispose(); _server.Dispose(); } - - protected virtual void InitializeServices(IServiceCollection services) - { - var libraryManager = DnxPlatformServices.Default.LibraryManager; - - // When an application executes in a regular context, the application base path points to the root - // directory where the application is located, for example .../samples/MvcSample.Web. However, when - // executing an application as part of a test, the ApplicationBasePath of the IApplicationEnvironment - // points to the root folder of the test project. - // To compensate, we need to calculate the correct project path and override the application - // environment value so that components like the view engine work properly in the context of the test. - var startupAssembly = typeof(TStartup).GetTypeInfo().Assembly; - var applicationName = startupAssembly.GetName().Name; - var library = libraryManager.GetLibrary(applicationName); - var applicationRoot = Path.GetDirectoryName(library.Path); - - var applicationEnvironment = PlatformServices.Default.Application; - - services.AddSingleton( - new TestApplicationEnvironment(applicationEnvironment, applicationName, applicationRoot)); - - // Inject a custom assembly provider. Overrides AddMvc() because that uses TryAdd(). - var assemblyProvider = new StaticAssemblyProvider(); - assemblyProvider.CandidateAssemblies.Add(startupAssembly); - services.AddSingleton(assemblyProvider); - } } } diff --git a/test/Microsoft.AspNetCore.Diagnostics.FunctionalTests/project.json b/test/Microsoft.AspNetCore.Diagnostics.FunctionalTests/project.json index 6688a3d243..ebcb91da6c 100644 --- a/test/Microsoft.AspNetCore.Diagnostics.FunctionalTests/project.json +++ b/test/Microsoft.AspNetCore.Diagnostics.FunctionalTests/project.json @@ -14,7 +14,7 @@ "RuntimeInfoPageSample": "1.0.0", "StatusCodePagesSample": "1.0.0", "WelcomePageSample": "1.0.0", - "xunit.runner.aspnet": "2.0.0-aspnet-*" + "xunit": "2.1.0" }, "exclude": [ "wwwroot", @@ -28,11 +28,16 @@ "dotnet-test-xunit": "1.0.0-dev-*" } }, - "dnx451": {} + "dnx451": { + "dependencies": { + "xunit.runner.console": "2.1.0" + } + } }, + "testRunner": "xunit", "publishExclude": [ "**.user", "**.vspscc" ], "version": "1.0.0-*" -} \ No newline at end of file +} diff --git a/test/Microsoft.AspNetCore.Diagnostics.Tests/project.json b/test/Microsoft.AspNetCore.Diagnostics.Tests/project.json index 2629bb42a1..938d14e4fa 100644 --- a/test/Microsoft.AspNetCore.Diagnostics.Tests/project.json +++ b/test/Microsoft.AspNetCore.Diagnostics.Tests/project.json @@ -21,7 +21,7 @@ }, "imports": "portable-net451+win8" }, - "dnx451": { + "net451": { "frameworkAssemblies": { "System.Runtime": "", "System.Threading.Tasks": "" @@ -39,4 +39,4 @@ "resource": [ "Resources/**" ] -} \ No newline at end of file +} diff --git a/test/Microsoft.AspNetCore.MiddlewareAnalysis.Tests/project.json b/test/Microsoft.AspNetCore.MiddlewareAnalysis.Tests/project.json index 58cdc213c5..9dce63c8a3 100644 --- a/test/Microsoft.AspNetCore.MiddlewareAnalysis.Tests/project.json +++ b/test/Microsoft.AspNetCore.MiddlewareAnalysis.Tests/project.json @@ -19,7 +19,7 @@ }, "imports": "portable-net451+win8" }, - "dnx451": { + "net451": { "frameworkAssemblies": { "System.Runtime": "", "System.Threading.Tasks": "" @@ -30,4 +30,4 @@ } }, "testRunner": "xunit" -} \ No newline at end of file +}