Revert "[Fixes #7587] No easy way to change ASPNETCORE_ENVIRONMENT"
This reverts commit 22510e1377.
This commit is contained in:
parent
86a036cf76
commit
4984dd2cdd
|
|
@ -243,22 +243,13 @@ namespace Microsoft.AspNetCore.Mvc.Testing
|
||||||
/// array as arguments.
|
/// array as arguments.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <returns>A <see cref="IWebHostBuilder"/> instance.</returns>
|
/// <returns>A <see cref="IWebHostBuilder"/> instance.</returns>
|
||||||
protected virtual IWebHostBuilder CreateWebHostBuilder()
|
protected virtual IWebHostBuilder CreateWebHostBuilder() =>
|
||||||
{
|
WebHostBuilderFactory.CreateFromTypesAssemblyEntryPoint<TEntryPoint>(Array.Empty<string>()) ??
|
||||||
var builder = WebHostBuilderFactory.CreateFromTypesAssemblyEntryPoint<TEntryPoint>(Array.Empty<string>());
|
throw new InvalidOperationException(Resources.FormatMissingCreateWebHostBuilderMethod(
|
||||||
if (builder == null)
|
nameof(IWebHostBuilder),
|
||||||
{
|
typeof(TEntryPoint).Assembly.EntryPoint.DeclaringType.FullName,
|
||||||
throw new InvalidOperationException(Resources.FormatMissingCreateWebHostBuilderMethod(
|
typeof(WebApplicationFactory<TEntryPoint>).Name,
|
||||||
nameof(IWebHostBuilder),
|
nameof(CreateWebHostBuilder)));
|
||||||
typeof(TEntryPoint).Assembly.EntryPoint.DeclaringType.FullName,
|
|
||||||
typeof(WebApplicationFactory<TEntryPoint>).Name,
|
|
||||||
nameof(CreateWebHostBuilder)));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return builder.UseEnvironment("Development");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the <see cref="TestServer"/> with the bootstrapped application in <paramref name="builder"/>.
|
/// Creates the <see cref="TestServer"/> with the bootstrapped application in <paramref name="builder"/>.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue