Updating test TFMs for custom test discovery
This commit is contained in:
parent
8bde9b7e72
commit
a9644a5bf3
|
|
@ -16,7 +16,7 @@
|
||||||
},
|
},
|
||||||
"imports": "portable-net451+win8"
|
"imports": "portable-net451+win8"
|
||||||
},
|
},
|
||||||
"dnx451": {
|
"net451": {
|
||||||
"frameworkAssemblies": {
|
"frameworkAssemblies": {
|
||||||
"System.Runtime": "",
|
"System.Runtime": "",
|
||||||
"System.Threading.Tasks": ""
|
"System.Threading.Tasks": ""
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
},
|
},
|
||||||
"imports": "portable-net451+win8"
|
"imports": "portable-net451+win8"
|
||||||
},
|
},
|
||||||
"dnx451": {
|
"net451": {
|
||||||
"frameworkAssemblies": {
|
"frameworkAssemblies": {
|
||||||
"System.Runtime": "",
|
"System.Runtime": "",
|
||||||
"System.Threading.Tasks": ""
|
"System.Threading.Tasks": ""
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ namespace Microsoft.AspNetCore.Diagnostics.FunctionalTests
|
||||||
using (new CultureReplacer())
|
using (new CultureReplacer())
|
||||||
{
|
{
|
||||||
var builder = new WebHostBuilder()
|
var builder = new WebHostBuilder()
|
||||||
.ConfigureServices(InitializeServices)
|
|
||||||
.UseStartup(typeof(TStartup));
|
.UseStartup(typeof(TStartup));
|
||||||
|
|
||||||
_server = new TestServer(builder);
|
_server = new TestServer(builder);
|
||||||
|
|
@ -43,31 +42,5 @@ namespace Microsoft.AspNetCore.Diagnostics.FunctionalTests
|
||||||
Client.Dispose();
|
Client.Dispose();
|
||||||
_server.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<IApplicationEnvironment>(
|
|
||||||
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<IAssemblyProvider>(assemblyProvider);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
"RuntimeInfoPageSample": "1.0.0",
|
"RuntimeInfoPageSample": "1.0.0",
|
||||||
"StatusCodePagesSample": "1.0.0",
|
"StatusCodePagesSample": "1.0.0",
|
||||||
"WelcomePageSample": "1.0.0",
|
"WelcomePageSample": "1.0.0",
|
||||||
"xunit.runner.aspnet": "2.0.0-aspnet-*"
|
"xunit": "2.1.0"
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"wwwroot",
|
"wwwroot",
|
||||||
|
|
@ -28,8 +28,13 @@
|
||||||
"dotnet-test-xunit": "1.0.0-dev-*"
|
"dotnet-test-xunit": "1.0.0-dev-*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dnx451": {}
|
"dnx451": {
|
||||||
|
"dependencies": {
|
||||||
|
"xunit.runner.console": "2.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
"testRunner": "xunit",
|
||||||
"publishExclude": [
|
"publishExclude": [
|
||||||
"**.user",
|
"**.user",
|
||||||
"**.vspscc"
|
"**.vspscc"
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
},
|
},
|
||||||
"imports": "portable-net451+win8"
|
"imports": "portable-net451+win8"
|
||||||
},
|
},
|
||||||
"dnx451": {
|
"net451": {
|
||||||
"frameworkAssemblies": {
|
"frameworkAssemblies": {
|
||||||
"System.Runtime": "",
|
"System.Runtime": "",
|
||||||
"System.Threading.Tasks": ""
|
"System.Threading.Tasks": ""
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
},
|
},
|
||||||
"imports": "portable-net451+win8"
|
"imports": "portable-net451+win8"
|
||||||
},
|
},
|
||||||
"dnx451": {
|
"net451": {
|
||||||
"frameworkAssemblies": {
|
"frameworkAssemblies": {
|
||||||
"System.Runtime": "",
|
"System.Runtime": "",
|
||||||
"System.Threading.Tasks": ""
|
"System.Threading.Tasks": ""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue