Use HostBuilder.UseUmbraco in same order for tests and running web app

This commit is contained in:
Paul Johnson
2020-12-17 12:18:28 +00:00
parent 79aa2e1cc2
commit a883df9d88
5 changed files with 29 additions and 23 deletions

View File

@@ -19,7 +19,6 @@ using Umbraco.Core.DependencyInjection;
using Umbraco.Web.Common.Controllers;
using Microsoft.Extensions.Hosting;
using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
using Umbraco.Web.BackOffice.Controllers;
namespace Umbraco.Tests.Integration.TestServerTest
@@ -35,7 +34,7 @@ namespace Umbraco.Tests.Integration.TestServerTest
InMemoryConfiguration["Umbraco:CMS:Hosting:Debug"] = "true";
// create new WebApplicationFactory specifying 'this' as the IStartup instance
var factory = new UmbracoWebApplicationFactory<UmbracoTestServerTestBase>(CreateHostBuilder);
var factory = new UmbracoWebApplicationFactory<UmbracoTestServerTestBase>(CreateHostBuilder, BeforeHostStart);
// additional host configuration for web server integration tests
Factory = factory.WithWebHostBuilder(builder =>
@@ -71,15 +70,11 @@ namespace Umbraco.Tests.Integration.TestServerTest
// call startup
builder.Configure(app =>
{
Services = app.ApplicationServices;
UseTestDatabase(app.ApplicationServices);
Configure(app);
});
}).UseEnvironment(Environments.Development);
builder.UseUmbraco(); // Ensures CoreRuntime.StartAsync is called, must be after ConfigureWebHost
return builder;
}