Merge pull request #9585 from rustybox/netcore/task/front-end-routing

Netcore: Dispose host on test teardown.
This commit is contained in:
Shannon Deminick
2020-12-22 09:41:51 +11:00
committed by GitHub
2 changed files with 1 additions and 9 deletions

View File

@@ -86,6 +86,7 @@ namespace Umbraco.Tests.Integration.Testing
// Ensure CoreRuntime stopped (now it's a HostedService)
IHost host = Services.GetRequiredService<IHost>();
host.StopAsync().GetAwaiter().GetResult();
host.Dispose();
}
[TearDown]

View File

@@ -45,15 +45,6 @@ namespace Umbraco.Tests.Integration.Umbraco.Infrastructure.Services
eventBinder.Start();
}
public override void TearDown()
{
// Ensure this is dipsosed
// TODO: How come MSDI doesn't automatically dispose all of these at the end of each test?
// How can we automatically dispose of all IDisposables at the end of the tests as if it were an aspnet app?
Services.GetRequiredService<PublishedSnapshotServiceEventHandler>().Dispose();
base.TearDown();
}
private void AssertJsonStartsWith(int id, string expected)
{
var json = GetJson(id).Replace('"', '\'');