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.
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.
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.
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 in C# has improved dramatically with the launch of it's own IExceptionHandler middleware in .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.
The worker service project sees a major update in .NET 8 with the new IHostedLifecycle interface hooking into new background hosted service lifecycles.
Model validation for ASP.NET Core Web API now includes data annotations such as allowed and denied values as well as Base64 string validation.
The TimeProvider abstract class can be used in xUnit unit tests to mock the time and a timer using the FakeTimeProvider in .NET 8.
Learn how collection expressions and the spread operator work in C#, with examples of how to use them to simplify lists and arrays in .NET.