.NET tutorials

How to use Moq for mocking objects with xUnit and .NET

How to use Moq for mocking objects with xUnit and .NET

Learn how to use Moq for mocking objects like classes and interfaces in an xUnit test project when writing unit tests for .NET and C# projects.
How to use xUnit to run unit testing in .NET and C#

How to use xUnit to run unit testing in .NET and C#

xUnit beginners tutorial on how to run unit testing in C# and .NET using the Fact and Theory attributes, as well as focusing on different Assert methods.
How to create ASP.NET Core Web API CRUD methods

How to create ASP.NET Core Web API CRUD methods

We create an ASP.NET Core Web API project and show CRUD examples using GET, POST, PUT & DELETE methods with routing as well as how to test in Postman.
How to create and add custom middleware in ASP.NET Core

How to create and add custom middleware in ASP.NET Core

Find out how to create custom middleware using C# and add it to a .NET app by adding HTTP response headers to an ASP.NET Core Web API request.
Exception handling has its own middleware in .NET 8

Exception handling has its own middleware in .NET 8

Exception handling in C# has improved dramatically with the launch of it's own IExceptionHandler middleware in .NET 8 .
Validating appsettings becomes much faster with .NET 8

Validating appsettings becomes much faster with .NET 8

.NET 8 allows for a faster way to validate the option values in appsettings.json in an ASP.NET Core Web API using data annotations.
Hosted service has a major update to its lifecycle events

Hosted service has a major update to its lifecycle events

The worker service project sees a major update in .NET 8 with the new IHostedLifecycle interface hooking into new background hosted service lifecycles.
Data annotations has some awesome additions in .NET 8

Data annotations has some awesome additions in .NET 8

Model validation for ASP.NET Core Web API now includes data annotations such as allowed and denied values as well as Base64 string validation.
TimeProvider makes it easier to mock time in .NET 8

TimeProvider makes it easier to mock time in .NET 8

The TimeProvider abstract class can be used in xUnit unit tests to mock the time and a timer using the FakeTimeProvider in .NET 8.
Collection expressions brings the spread operator to C# 12

Collection expressions brings the spread operator to C# 12

Collection expressions (also known as collection literals) brings the spread operator to C# allowing for collection types to be joined together.