Porting #712 to release
This commit is contained in:
parent
e3f4f23b5a
commit
68092dbb97
|
|
@ -254,7 +254,7 @@ namespace Microsoft.AspNetCore.Hosting
|
|||
{
|
||||
if (_startup != null)
|
||||
{
|
||||
return _startup.ConfigureDelegate.Target.GetType().GetTypeInfo().Assembly.GetName().Name;
|
||||
return _startup.ConfigureDelegate.GetMethodInfo().DeclaringType.GetTypeInfo().Assembly.GetName().Name;
|
||||
}
|
||||
if (_startupType != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting.Fakes;
|
||||
using Microsoft.AspNetCore.Hosting.Internal;
|
||||
using Microsoft.AspNetCore.Hosting.Server;
|
||||
|
|
@ -477,6 +478,33 @@ namespace Microsoft.AspNetCore.Hosting
|
|||
Assert.Equal(PlatformServices.Default.Application.ApplicationBasePath, appEnv.ApplicationBasePath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Configure_SupportsNonStaticMethodDelegate()
|
||||
{
|
||||
var host = new WebHostBuilder()
|
||||
.UseServer(new TestServer())
|
||||
.Configure(app => { })
|
||||
.Build();
|
||||
|
||||
var hostingEnv = host.Services.GetService<IHostingEnvironment>();
|
||||
Assert.Equal("Microsoft.AspNetCore.Hosting.Tests", hostingEnv.ApplicationName);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Configure_SupportsStaticMethodDelegate()
|
||||
{
|
||||
var host = new WebHostBuilder()
|
||||
.UseServer(new TestServer())
|
||||
.Configure(StaticConfigureMethod)
|
||||
.Build();
|
||||
|
||||
var hostingEnv = host.Services.GetService<IHostingEnvironment>();
|
||||
Assert.Equal("Microsoft.AspNetCore.Hosting.Tests", hostingEnv.ApplicationName);
|
||||
}
|
||||
|
||||
private static void StaticConfigureMethod(IApplicationBuilder app)
|
||||
{ }
|
||||
|
||||
private IWebHostBuilder CreateWebHostBuilder()
|
||||
{
|
||||
var vals = new Dictionary<string, string>
|
||||
|
|
|
|||
Loading…
Reference in New Issue