MetallixBrother
✅ Overriding IConfigurationManager.GetSection for integration tests in .NET 8 Minimal API
Regarding reading the configuration directly, and having to manually parse string values into Uris - I'm confused as to why this is not an antipattern, but retrieving only the pertinent details and parsing it once is an antipattern.
78 replies
✅ Overriding IConfigurationManager.GetSection for integration tests in .NET 8 Minimal API
I don't believe that's strictly true - in that method, I'm adding options classes using the Option pattern. Then in
AddAzureAppConfiguration
, I'm parsing the configuration to get the relevant configuration details.78 replies
✅ Overriding IConfigurationManager.GetSection for integration tests in .NET 8 Minimal API
In my defence, I was following the guidelines provided by Microsoft: https://learn.microsoft.com/en-us/dotnet/core/extensions/options#options-validation
78 replies
✅ Overriding IConfigurationManager.GetSection for integration tests in .NET 8 Minimal API
https://github.com/ntyrrell/azure-app-config-problem
I've set up a very basic implementation as suggested. Thank you for the suggestion, I hope that this will make things clearer.
78 replies
✅ Overriding IConfigurationManager.GetSection for integration tests in .NET 8 Minimal API
I can try to create a cloneable repo, but I would need to pare it down significantly as this is software being developed for work.
I had looked at PostConfigure, but I think that it still encounters the same problems as previously mentioned.
78 replies
✅ Overriding IConfigurationManager.GetSection for integration tests in .NET 8 Minimal API
I tried that. Part of the problem is that the options class is structured.
If I set
AppConfig:Endpoint
to null
using an in memory collection, you'll hit the problem mentioned in the first bullet point (i.e. it will skip trying to do Azure App Configuration, but fail validation).
Right now there is validation on the option class, which will pass either if the instance is specified (non-null) and Endpoint is also non-null, or if there is no instance of AppConfigOptions
.78 replies