Skip to content

Commit

Permalink
use a scope to retrieve services in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NielsPilgaard committed Sep 19, 2023
1 parent 0969bac commit a6e8cfa
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/web/Jordnaer.Server.Tests/Profile/ImageServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ public class ImageService_Should

public ImageService_Should(JordnaerWebApplicationFactory factory)
{
_blobServiceClient = factory.Services.GetRequiredService<BlobServiceClient>();
_sut = factory.Services.GetRequiredService<IImageService>();
using var scope = factory.Services.CreateScope();
_blobServiceClient = scope.ServiceProvider.GetRequiredService<BlobServiceClient>();
_sut = scope.ServiceProvider.GetRequiredService<IImageService>();
}

[Fact]
Expand Down

0 comments on commit a6e8cfa

Please sign in to comment.