[ANN] NSubstitute 4.0.0 released

Skip to first unread message

David Tchepak

Jan 30, 2019, 5:09:34 AM1/30/19
to nsubs...@googlegroups.com
Hi everyone,

We've just released NSubstitute 4.0.0, after trials of the 4.0.0 Release Candidate 1 (RC1) did not show any major issues. There have been no code changes between RC1 and the final 4.0.0 release. I've included the summary of changes from the RC1 announcement below as a reminder of what's changed since 3.1.0.


This release has a significant number of new features, fixes and improvements, so please see the changelog for full details! I'll cover a few highlights here.

* New support for matching `out` and `ref` arguments with argument matchers

* `CallBase()` for enabling base method calls for existing substitutes. This provides another way of having partial mocking from NSubstitute.

* A new `Configure()` method which can be used to tell NSubstitute that we are configuring the next call, so it will not run any callbacks or call base methods of the substitute while that call is being configured.

* Improved performance

* Improved debugging, errors and error messages

* Improved documentation

There are a few potentially breaking changes for this release. Please see the link below for the full list. The main one is that argument matching for `out` and `ref` requires C# 7 features, so if you are stuck on an earlier compiler you will have to use one of the workarounds described in the Breaking Changes document. Please post to the list if you have any troubles migrating projects to 4.0 and I'm happy to provide suggestions to make the process easier. (See http://nsubstitute.github.io/help/compat-args/ for some options). Other breaking changes mainly relate to detecting problematic NSubstitute usage patterns, which will now throw as soon as they are detectable rather than leaking into other tests to cause problems. Those breaking changes generally indicate legitimate problems with that test that should be fixed (i.e. it's a good breaking change, not something completely inconvenient!)

This release has been largely driven and developed by core team member Alex Povar (@zvirja). Thanks Alex! Thanks also to @tpodolak for the huge amount of work that has gone in to the NSubstitute.Analyzers project. Thanks also to Alexandr Nikitin, @firelizzard18, @jsbed, Chris Maddock, Jim Aho, and Mathias Lorenzen for their contributions to this release!

As always, please raise an issue on GitHub (https://github.com/nsubstitute/NSubstitute/issues) or email the group if you have any problems.


Breaking Changes:

Project links:

Reply all
Reply to author
0 new messages