Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

Commit

Permalink
Added some unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
khellang committed Aug 20, 2017
1 parent 4f2e3b8 commit e519f74
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/Microsoft.AspNetCore.Hosting.Tests/WebHostBuilderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,33 @@ public void DefaultApplicationNameWithUseStartupOfT()
}
}

[Fact]
public void CustomApplicationName()
{
using (var host = new WebHostBuilder()
.UseServer(new TestServer())
.UseApplicationName("Test Application")
.UseStartup<StartupNoServices>()
.Build())
{
var hostingEnv = host.Services.GetService<IHostingEnvironment>();
Assert.Equal("Test Application", hostingEnv.ApplicationName);
}
}

[Fact]
public void DefaultApplicationNameWithInjectedIStartup()
{
using (var host = new WebHostBuilder()
.UseServer(new TestServer())
.ConfigureServices(s => s.AddSingleton<IStartup, StartupNoServices>())
.Build())
{
var hostingEnv = host.Services.GetService<IHostingEnvironment>();
Assert.Equal(Assembly.GetEntryAssembly().GetName().Name, hostingEnv.ApplicationName);
}
}

[Fact]
public void DefaultApplicationNameWithUseStartupOfType()
{
Expand Down

0 comments on commit e519f74

Please sign in to comment.