Extensions for .NET SDK
- Description
- Installing
- Extensions list
- For apps
- For integration tests
- For unit tests
- Other
- Debugging
- Dev notes
Description
This repo contains extensions to help build .NET applications, as well as extensions for unit and integration tests. It supports applications targeting .NET 6.0 or higher.
Installing
This repo provides two NuGet packages:
NuGet |
Version |
Downloads |
dotnet-sdk-extensions |
|
|
dotnet-sdk-extensions-testing |
|
|
Installation is performed via NuGet and you can do it using the following commands:
dotnet add package dotnet-sdk-extensions
dotnet add package dotnet-sdk-extensions-testing
Extensions list
The extensions available are split into two groups:
- Extensions to use on app code.
- Extensions to use when doing integration and unit tests.
For more information about each extension check its docs. You can find the link to each extension's documentation below.
For apps
- Using
T
options classes instead of IOptions
- Extending Polly
- Circuit breaker checker policy
- Add a timeout policy to an HttpClient
- Add a retry policy to an HttpClient
- Add a circuit breaker policy to an HttpClient
- Add a fallback policy to an HttpClient
- Add a set of resilience policies to an HttpClient
- Extending the policy options validation
For integration tests
- Providing test appsettings files to the test server
- Override configuration values on the test server
- Disable logs when doing integration tests
- Mocking HttpClient's responses in-process
- Mocking HttpClient's responses out-of-process
- Integration tests for HostedServices (Background Services)
For unit tests
- Mocking HttpClient's responses for unit testing
Other
- Notes on WebApplicationFactory regarding asp.net integration tests
Debugging
The NuGet packages published include symbols generated with sourcelink.
For more information on how to debug the NuGet packages code from your application see:
- Exploring .NET Core's SourceLink - Stepping into the Source Code of NuGet packages you don't own
- How to Configure Visual Studio to Use SourceLink to Step into NuGet Package Source.
- Source Link - microsoft docs
Dev notes
For notes aimed at developers working on this repo or just trying to understand it go here. It will show you how to build and run the solution among other things.