An easy and typesafe way to use configuration values in your .NET core applications is through IOptions<T>.
This allows you to create a settings section in your appsettings.json:
And then map this to a specific class:
The only thing you need to do is to specify the section in your Startup.cs:
Now you can inject these settings in your code through IOptions<T>:
But what if you want to unit test this class? How can you create an IOptions<T> instance?
A solution exists through the Options.Create() method: