Remove CallContextServiceLocator usages in tests

This commit is contained in:
Pavel Krymets 2015-10-21 14:13:16 -07:00
parent 8623946784
commit 84bfb8da3b
2 changed files with 3 additions and 5 deletions

View File

@ -253,8 +253,7 @@ namespace Microsoft.AspNet.Mvc.Infrastructure
private static ILibraryManager GetLibraryManager() private static ILibraryManager GetLibraryManager()
{ {
return CallContextServiceLocator.Locator.ServiceProvider return PlatformServices.Default.LibraryManager;
.GetRequiredService<ILibraryManager>();
} }
} }
} }

View File

@ -91,8 +91,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
Assembly startupAssembly, Assembly startupAssembly,
Func<IServiceCollection, IServiceProvider> buildServices) Func<IServiceCollection, IServiceProvider> buildServices)
{ {
var applicationServices = CallContextServiceLocator.Locator.ServiceProvider; var libraryManager = PlatformServices.Default.LibraryManager;
var libraryManager = applicationServices.GetRequiredService<ILibraryManager>();
// When an application executes in a regular context, the application base path points to the root // 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 // directory where the application is located, for example .../samples/MvcSample.Web. However, when
@ -104,7 +103,7 @@ namespace Microsoft.AspNet.Mvc.FunctionalTests
var library = libraryManager.GetLibrary(applicationName); var library = libraryManager.GetLibrary(applicationName);
var applicationRoot = Path.GetDirectoryName(library.Path); var applicationRoot = Path.GetDirectoryName(library.Path);
var applicationEnvironment = applicationServices.GetRequiredService<IApplicationEnvironment>(); var applicationEnvironment = PlatformServices.Default.Application;
return (services) => return (services) =>
{ {