From 5c79dc250697ce5fd7fc5c532eae0adc2ca2a444 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Pilgaard=20Gr=C3=B8ndahl?= Date: Sat, 2 Sep 2023 22:50:02 +0200 Subject: [PATCH] remove IHostedService from servicecollection in tests, so they don't fail to stop --- .../Jordnaer.Server.Tests/JordnaerWebApplicationFactory.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/web/Jordnaer.Server.Tests/JordnaerWebApplicationFactory.cs b/tests/web/Jordnaer.Server.Tests/JordnaerWebApplicationFactory.cs index 7096e7d2..c7bf793e 100644 --- a/tests/web/Jordnaer.Server.Tests/JordnaerWebApplicationFactory.cs +++ b/tests/web/Jordnaer.Server.Tests/JordnaerWebApplicationFactory.cs @@ -1,10 +1,16 @@ using Jordnaer.Server.Database; +using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc.Testing; +using Microsoft.Extensions.DependencyInjection.Extensions; +using Microsoft.Extensions.Hosting; namespace Jordnaer.Server.Tests; public class JordnaerWebApplicationFactory : WebApplicationFactory { + protected override void ConfigureWebHost(IWebHostBuilder builder) => + builder.ConfigureServices(services => services.RemoveAll()); + public JordnaerWebApplicationFactory() { Environment.SetEnvironmentVariable($"ConnectionStrings_{nameof(JordnaerDbContext)}",