Blog Posts for: Unit Testing

Running a specific test with .NET Core and NUnit
24 November 2016

Demonstrates how to run a single unit test, or sets of unit tests, when using the NUnit 3 test runner for .NET Core.

Using Configuration files in .NET Core Unit Test Projects
24 November 2016

Demonstrates how you can use the .NET Core Configuration system in .NET Core unit test projects

Unit testing ASP.NET 5 Controllers with Entity Framework 7 In-Memory Database
24 November 2015

I look at how you can use the new In-Memory database support in Entity Framwork 7 to unit test your controllers.

Unit testing controllers in ASP.NET 5 (MVC 6)
13 October 2015

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.

Unit Testing with NBuilder and NSubstitute using either a FakeDBSet or a mock DbSet
11 August 2015

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.

Unit Testing with FakeDBSet and NBuilder
04 August 2015

I show how I unit test queries against my DbContext using a Fake DBSet and NBuilder.

Reasons I like NSubstitute: Generate output based on input parameters
21 July 2015

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.

Unit testing with Dates
07 April 2015

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.