.NET tutorials

xUnit Assert basics: True/False, Equal, Same, Matches and more

xUnit Assert basics: True/False, Equal, Same, Matches and more

Learn xUnit basic assert methods such as boolean, ranges and string validations to write clear, reliable, and maintainable unit tests.
How to use InlineData, MemberData and ClassData in xUnit

How to use InlineData, MemberData and ClassData in xUnit

Master the Theory attributes InlineData, MemberData, and ClassData in xUnit so you can create your own parameterised unit tests.
How to add unit testing to Minimal APIs routes using xUnit

How to add unit testing to Minimal APIs routes using xUnit

Learn how to unit test minimal API endpoint handlers using xUnit by moving the routes and the endpoint handlers to their own separate classes.
Add API key authentication to an Minimal API endpoint

Add API key authentication to an Minimal API endpoint

Learn how to add API key authentication to a minimal API endpoint by using a saved key in the config and how you can add a fallback policy to protect all routes.
Minimal API filters: Run code before the endpoint handler

Minimal API filters: Run code before the endpoint handler

Learn how to add multiple endpoint filters to your minimal API routes so you can run code before and after your endpoint handler.
TypedResults or Results for Minimal API responses?

TypedResults or Results for Minimal API responses?

Learn whether you should use TypedResults or Results when returning a minimal API response and the different response types you can use.
How to use parameter binding for routes in Minimal APIs

How to use parameter binding for routes in Minimal APIs

Learn how to use parameter binding in minimal API routes with wildcards and constraints as well as using them in an endpoint handler alongside special types.
How to use routing in Minimal APIs with one line of code

How to use routing in Minimal APIs with one line of code

Learn how to create Minimal API routes with one line of code, add endpoints to OpenAPI documentation and how you can group similar routes together.
Common errors to avoid in ASP.NET Core dependency injection

Common errors to avoid in ASP.NET Core dependency injection

Looking at how you can avoid common errors in ASP.NET Core dependency injection like not registering a service and circular dependency.
How to write xUnit tests for dependency injection services

How to write xUnit tests for dependency injection services

Learn how to write xUnit tests for a class that injects services that uses ASP.NET Core dependency injection using mock and real instances.