Skip to content

Commit

Permalink
Fixed DI tests to validate scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
skuill committed Feb 2, 2024
1 parent 0dcd9fa commit afb7b1e
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ public void IocContainer_GetService_LyricsScraperClient_DefaultNotNull()
// Act
serviceCollection.AddLyricScraperClientService(configuration);

var serviceProvider = serviceCollection.BuildServiceProvider();
var serviceProvider = serviceCollection.BuildServiceProvider(
new ServiceProviderOptions
{
ValidateOnBuild = true,
ValidateScopes = true
}).CreateScope().ServiceProvider;
var service = serviceProvider.GetService<ILyricsScraperClient>();
var searchResult = service.SearchLyric(new ArtistAndSongSearchRequest(null, null));

Expand Down Expand Up @@ -71,7 +76,12 @@ public void IocContainer_GetService_LyricsScraperClient_FullSetup()
// Act
serviceCollection.AddLyricScraperClientService(configuration);

var serviceProvider = serviceCollection.BuildServiceProvider();
var serviceProvider = serviceCollection.BuildServiceProvider(
new ServiceProviderOptions
{
ValidateOnBuild = true,
ValidateScopes = true
}).CreateScope().ServiceProvider;
var service = serviceProvider.GetService<ILyricsScraperClient>();

// Assert
Expand Down

0 comments on commit afb7b1e

Please sign in to comment.