Here are the steps to use Microsoft.Extensions.Configuration in your .NET Core unit tests:
- Include the .NET Core Configuration NuGet package: https://www.nuget.org/packages/Microsoft.Extensions.Configuration.Json/
- Copy the appsettings.json to your test project.
- Don’t forget to set the ‘Copy to output directory’ to ‘Copy always’
- Add the following code to build up your configuration: