Skip to content

Commit

Permalink
remove IHostedService from servicecollection in tests, so they don't …
Browse files Browse the repository at this point in the history
…fail to stop
  • Loading branch information
NielsPilgaard committed Sep 2, 2023
1 parent 6278de9 commit 5c79dc2
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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<Program>
{
protected override void ConfigureWebHost(IWebHostBuilder builder) =>
builder.ConfigureServices(services => services.RemoveAll<IHostedService>());

public JordnaerWebApplicationFactory()
{
Environment.SetEnvironmentVariable($"ConnectionStrings_{nameof(JordnaerDbContext)}",
Expand Down

0 comments on commit 5c79dc2

Please sign in to comment.