Demonstrates how to run a single unit test, or sets of unit tests, when using the NUnit 3 test runner for .NET Core.
Demonstrates how you can use the .NET Core Configuration system in .NET Core unit test projects
I look at how you can use the new In-Memory database support in Entity Framwork 7 to unit test your controllers.
One of the new things I had to figure out in doing unit testing in ASP.NET 5 was how to mock the necessary infrastructure to test my controllers. In this blog post I show a few techniques you can use.
I extend the example from the previous blog post to demonstrate how you can unit test by mocking DbSet instead of using a fake DbSet.
I show how I unit test queries against my DbContext using a Fake DBSet and NBuilder.
NSubstitute is a mocking framework for .NET. One of the reasons I like NSubstitute is because you can generate the output for a mocked function call, based on the input parameters passed to the function.
Testing business logic which depends on the current date for calculation can be a bit tricky. I show you how you can mock the current date so you can write better unit tests for this code.