- 👍 [NEW] Add .NET 5 (#636) and .NET 6 (#674) support. Thanks to @zvirja and @Havunen!
📦 If you haven't already done so, please make sure you add the NSubstitute.Analyzers package wherever you reference NSubstitute: https://nsubstitute.github.io/help/nsubstitute-analysers/
💥 Breaking changes: There should be no breaking changes with this release.
- [FIX] It might be impossible to assign
outarguments using type-compatible value. (#577, @zvirja)
- 🔧 [FIX] Configured result is returned in the
Received.InOrdercheck causing tests to fail sometimes. (#569, @zvirja)
- [FIX] It might be impossible to assign
- [FIX] Raise events for delegates taking single array argument of reference element type. (#560, @zvirja)
Quantity.Within(min, max)to assert a call was received within a range of times. This is available in the
- 🔧 [FIX] Re-throw captured NSubstitute exceptions when configuring async methods. (#533, @zvirja)
- 🐎 [UPDATE] Various performance improvements. (#536, #542, #547, @zvirja)
- ⚡️ [UPDATE] Use Castle.Proxy library to generate delegate proxies. (#537, @zvirja)
- [FIX] Do not fail on nested generic type formatting. (#515, @zvirja)
- [FIX] Fix event handling for code created by non-ECMA compliant compilers. (#500, #525, @zvirja)
- ⚡️ [UPDATE] Thanks to Julian Verdurmen (@304NotModified) for updating our website and links to HTTPS! All links to the NSub website should now go through https://nsubstitute.github.io, 🌐 and other web links in the project also go through to HTTPS where supported.
- 📚 [UPDATE] Documentation updates (#516 thanks to Michael Freidgeim @MNF; #530, #531 thanks to @304NotModified; #540, #549)
Thanks to core team member Alex Povar (@zvirja) for putting a huge amount of work into 🚀 defining and implementing features, fixes and refactoring for this release! Also thanks to @tpodolak for the new NSubstitute.Analyzers project! Finally, thanks to everyone who submitted PRs, raised or commented on issues, or took the time to help answer questions on StackOverflow.
Major new features and improvements
- [NEW] NSubstitute.Analyzers project. 🔧 Uses Roslyn to detect potential problems with NSubstitute configurations, such as trying to substitute for non-virtual members. Whenever you add NSubstitute to your C# or VB project, 📦 don't forget to also add the corresponding NSubstitute.Analyzers package! Thanks to @tpodolak for starting and running this project!
CallBasefor enabling base method calls for specific methods. (#449, @zvirja)
- [NEW][BREAKING] Arg matchers (
Arg.Isetc) can now be used for
outarguments. 👀 See [BreakingChanges.md](BreakingChanges.md) if you are still using pre-C#7. (#404, @zvirja)
- 🔧 [NEW]
NSubstitute.Extensions.ConfigurationExtensionsto 🔧 ensure NSubstitute handles the next call as a configuration/specification. (#350, @zvirja)
- 🐎 [UPDATE] Performance improvements. (@zvirja)
- Delegate proxy generation improvements (#362)
- Minimise allocations and LINQ use on hot code paths (#390)
- Optimise array allocation (#395)
- ⚡️ [UPDATE][BREAKING] Calls made with one or more argument matchers (
Arg.Any) 🔧 will no longer return previously configured results. NSubstitute will assume the call is 🔧 being configured and avoid running logic configured via previous
Returns()calls. 👀 This helps fix some problems with overlapping configurations. See #345 and [BreakingChanges.md](BreakingChanges.md) for more information. (@zvirja)
🆕 New and improved debugging, errors and error messages
- 🔧 [NEW] Raise
CouldNotConfigureBaseMethodExceptionwhen trying to configure a call to call a base method that does not exist. (#429, @zvirja)
- [NEW] Raise
RedundantArgumentMatcherExceptionif extra arg matchers are detected. This is ✅ a huge help for immediately identifying misconfigured tests. (@zvirja)
- ⚡️ [UPDATE] Improved
AmbiguousArgumentsExceptionbehaviour and errors. (#403 and others; @zvirja)
- [NEW] Improve debugging experience with proxy ids. (#39, @zvirja)
- ⚡️ [UPDATE] Improved display of
MatchArgsto help with debugging. (@zvirja)
- ✅ [NEW][BREAKING] Detection of unused argument matchers. This helps to identify errors in tests due to incorrectly used argument matchers. (#361, #89, #279; @zvirja)
And lots, lots more!
Including (but not limited to):
- 👍 [NEW] Support for netstandard-2.0. (#447, @zvirja)
- [FIX] Improved handling of virtual calls in constructors. (#423, @zvirja)
- 🔧 [NEW] Added a set of
When()overloads to configure async methods without compilation warnings. (#468, @zvirja)
- 🛠 [FIX] Fixed potential for
ArgumentNullExceptionon finalizer thread. (#382, @zvirja)
- ⚡️ [UPDATE] Now using Castle.Core 4.3.1+. We :heart: you Castle.Core! (Thanks for the PR Alexandr Nikitin!)
- [NEW] Expose
NSubstitute.ReceivedExtensionsnamespace. Thanks to @firelizzard18 for this suggestion.
- ⚡️ [UPDATE] Made substitute setup and verification more robust in the concurrent environments. (#462, @zvirja)
- ⚡️ [UPDATE] Removed NSubstitute.Core.Extensions.Zip (no longer require NET35 support). (#336)
- 📚 [FIX] Restored XML documentation. (#345)
- [NEW] Made global NSubstitute customization more easier. (#448, @zvirja)
- 📚 [UPDATE] Documentation updates and fixes. Thanks to @jsbed, Chris Maddock, Jim Aho (#369), and Mathias Lorenzen.
- ⚡️ [UPDATE] Updated builds thanks to Alexandr Nikitin.
- 🔨 [UPDATE] Significant refactoring thanks to Alex Povar. (#448 and many, many other PRs)
v4.0.0-rc1November 19, 2018
- 📦 [FIX] Reduced packages required when referencing from NET45 and NET46. (#331)
- ⚡️ [UPDATE] Reintroduced support for NET45. (#329)
- 👍 [NEW] Support for auto-substituting
ValueTask<T>results. Thanks to @KrzysztofBranicki for this change. (#325)
- 🚀 [FIX] Signing 3.x release to prevent problems with other packages that work with different versions of NSubstitute. Thanks Alex Povar for raising this. (#324)
- ⚡️ [UPDATE] Readme and other docs converted to markdown (.md) rather than plain text. Thanks to Stefan Kert for this PR.
- ⚠ [FIX] Fixed warning about System.ComponentModel.TypeConverter 4.0.1 (#311). Thanks to Stefan Kert for this PR.
- ⚡️ [UPDATE] [BREAKING] Migrated to new csproj format, targeting .NET Standard 1.3. ⬇️ Dropped support for older .NET platforms (pre-.NET46). Uses NuGet for dependencies rather than shipping them ilmerged. Thanks to Alexandr Nikitin for this work. Also thanks to @StefanKert and @robertcoltheart for review feedback.
- ⚡️ [UPDATE] Stopped shipping ZIP distribution, now exclusively using NuGet. (#319)
- 📚 [UPDATE] Stopped shipping documentation with the NuGet package. This information is available in the source repository. (#319)