Skip to content

Coding Practice

How to Migrate from Moq to NSubstitute

I was a happy user of the Moq library for the last 12 years. I liked the simplicity of Moq and how it allowed me to write tests first and then incrementally build the functionality.

Unfortunately, the creator of Moq is currently doing his best to kill the project. As he declared, either his spyware SponsorLink strong-arms enough individual developers into sponsoring him, or he will quit developing Moq. This leaves us in a lose-lose situation and for me it is time to move my private projects to another mocking library.

I played with a few alternatives and finally settled with NSubstitute. It covers all my use cases and offers an even simpler syntax than what I know from Moq.

10 Unpleasant Surprises When Migrating From .Net 4.8 to .Net 6

While our migration from .Net 4.8 to .Net 6 worked better than expected, we found a lot of annoying incompatibilities that took us hours to figure out. In this post I collect the 10 most frustrating differences to give you an overview on what to expect when you upgrade your applications to .Net 6.

This is part 2 of the mini-series on the .Net 6 migration:

  1. The Challenging Endeavour of a .Net 6 Migration
  2. 10 Unpleasant Surprises When Migrating From .Net 4.8 to .Net 6
  3. .Net 6 in Production: Same Same, but Different

The Challenging Endeavour of a .Net 6 Migration

For our most important application, the migration from .Net 4.8 to .Net 6 was an adventure. Now that it successfully runs in production, I take the opportunity to share our experience with the migration of our biggest application and the obstacles we run into.

This is part 1 of the mini-series on the .Net 6 migration:

  1. The Challenging Endeavour of a .Net 6 Migration
  2. 10 Unpleasant Surprises When Migrating From .Net 4.8 to .Net 6
  3. .Net 6 in Production: Same Same, but Different

Great Help & Little Effort: Project Templates for Visual Studio

If I run into tasks that I must repeat countless times, I try to automate them as much as possible. Since we always add the same dependencies to our test projects, we thought it would be a great idea to create a project template that has all the necessary settings already in place. Let us figure out how little effort it takes to create our own project templates for dotnet, Visual Studio and Rider.

Code Coverage made Easy: A Step-by-Step Guide for .NET 6

For .Net 4.8 it was enough to install Visual Studio Enterprise Edition on the build server and check the box for code coverage in the Testing task of Azure DevOps. The build agent then collected the coverage data and published it as part of your builds. Unfortunately, for .Net 6 this no longer works, and we need to go through a lot more steps.

There are a handful projects for code coverage that support .Net "core", but not every project is still under active development. Be careful when you select a coverage tool and make sure that there is still some activity going on.