Created
January 28, 2022 00:41
-
-
Save tonysneed/4e0f736ce28b7b3fe7ff93fb53fcce4f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private WebApplicationFactory<Program> GetWebApplicationFactory() => | |
new WebApplicationFactory<Program>() | |
.WithWebHostBuilder(builder => | |
{ | |
IConfigurationSection? configSection = null; | |
builder.ConfigureAppConfiguration((context, config) => | |
{ | |
config.AddJsonFile(Path.Combine(Directory.GetCurrentDirectory(), AppSettingsFile)); | |
configSection = context.Configuration.GetSection(nameof(WeatherDatabaseSettings)); | |
}); | |
builder.ConfigureTestServices(services => | |
services.Configure<WeatherDatabaseSettings>(configSection)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment