Using AutoFixture and Bogus to keep tests expressive
AutoFixture composes the test context. Bogus makes generated data easier to describe.
AutoFixture composes the test context. Bogus makes generated data easier to describe.
A unit test should show what makes its scenario special. AutoFixture can provide a valid context by default so the Arrange phase only needs to describe the difference.
Source generation can register injectable Minimal API endpoint classes and map their routes without runtime scanning or manual composition.
Constructor injection keeps Minimal API handler tests focused as endpoint dependencies grow.
Bypassing JWT validation in .NET integration tests with custom tokens and a test-only authentication setup.
Testcontainers and Respawn can make testing ASP.NET Core endpoints using Entity Framework Core easier and more reliable.
Reliably testing components using Entity Framework Core can be quite problematic. Targeting a real database comes with its own challenges. Let’s solve that!
Tailoring AutoFixture’s customizations to the need of each test can cause a lot of code to be repeated. Let’s avoid that by using generic attributes.
The WebApplicationFactory can be used to create an instance of an ASP.NET Core application hosted within the test process and execute all the tests against it. We will use it to test GRPC services.
The WebApplicationFactory can be used to create an instance of an ASP.NET Core application hosted within the test process and execute all the tests against it.
NUnit constraints can be used when verifying invocations in Moq to create powerful and clear expressions.