Skip to content

Releases: nsubstitute/NSubstitute

v6.0.0 Release Candidate 1

15 Mar 09:19
531df40

Choose a tag to compare

Pre-release

NSubstitute v6.0.0 Release Candidate 1

Due to the large number of changes in this release, we wanted to start with a release candidate to ensure we've correctly captured breaking changes.

  • [NEW] ArgMatchers.Matching predicate matcher as an alternative to Is(Expression<Predicate<T>>. (.NET6 and above.)
  • [UPDATE] Improved support for custom argument matchers. Arg.Is now accepts arg matchers.
  • [UPDATE][BREAKING] Update target frameworks: .NET8, .NET Standard 2.0
  • [UPDATE][BREAKING] Remove legacy obsolete API
  • [UPDATE][BREAKING] Mark as obsolete api CompatArg with pre c# 7.0 support
  • [UPDATE][BREAKING] Nullability is enabled for public api for .NET 8+ TFMs
  • [UPDATE] Migrate documentation to docfx platform and update samples to NUnit 4
  • [NEW] Added NuGet Package README file.

Full change list

  • Update target frameworks and other infrastructure changes by @Romfos in #831
  • Remove Google Groups hyperlinks by @304NotModified in #804
  • Improve output for expected argument matchers in #806
  • Mark Substitute.For method as Pure by @Dzliera in #844
  • Move package creating from build.fsproj to github actions by @Romfos in #838
  • Added .NET 9 to test matrix by @Romfos in #848
  • Update dependencies by @Saibamen in #843
  • Migrate documentation to docfx by @Romfos in #850
  • Added test for issue #716 by @rbeurskens in #846
  • feat: add dependabot for this project for minor and patch updates for nuget packages and github actions by @wmundev in #792
  • #853 Fix matching with multiple generic arguments of the same type by @rholek in #858
  • Ability to mock protected methods with and without return value by @Jason31569 in #845
  • Enable nullability for public api by @Romfos in #856
  • Bugfix/async event handlers return instantly by @jmartschinke in #808
  • Fix matching generic calls with AnyType when the generic argument is also a generic argument in return type, out or ref parameter by @JMolenkamp in #862
  • Feature: allow interception of any generic method call when using Arg.AnyType by @JMolenkamp in #855
  • Params arg unit test by @Jason31569 in #874
  • Added exception extensions for ValueTask without return type (rebase) in #873
  • Migrate to slnx by @Romfos in #882
  • Migrate documentation validation from build.fsproj to Roslyn code generator by @Romfos in #883
  • Fix doc links (#884) in #886
  • Add PackageReadmeFile. by @peymanr34 in #888
  • Make public api and tests the same for all TFMs by @Romfos in #885
  • Migrate documentation samples to NUnit4 by @Romfos in #889
  • Run unit tests in Microsoft.Testing.Platform mode by @Romfos in #896
  • Bump actions/checkout from 4 to 5 by @dependabot[bot] in #902
  • Fix typo in return value documentation by @ericmutta in #903
  • Bump actions/setup-dotnet from 4 to 5 by @dependabot[bot] in #907
  • Fix typo in received calls documentation by @ericmutta in #904
  • Simplify github actions to use less jobs by @Romfos in #911
  • Bump actions/upload-artifact from 4 to 5 by @dependabot[bot] in #916
  • Bump NUnit3TestAdapter from 5.0.0 to 5.2.0 by @dependabot[bot] in #922
  • Bump BenchmarkDotNet from 0.15.2 to 0.15.5 by @dependabot[bot] in #921
  • Add .NET 10 to test matrix by @Romfos in #913
  • Bump Microsoft.Extensions.Logging.Abstractions from 9.0.0 to 10.0.0 by @dependabot[bot] in #926
  • Bump actions/checkout from 5 to 6 by @dependabot[bot] in #928
  • Bump Microsoft.CodeAnalysis.CSharp from 4.14.0 to 5.0.0 by @dependabot[bot] in #929
  • Bump BenchmarkDotNet from 0.15.5 to 0.15.6 by @dependabot[bot] in #924
  • Bump BenchmarkDotNet from 0.15.6 to 0.15.8 by @dependabot[bot] in #930
  • Bump NUnit3TestAdapter from 5.2.0 to 6.0.0 by @dependabot[bot] in #931
  • Fix XML docs for WhenCalled.Throws by @kerego in #934
  • Bump NUnit3TestAdapter from 5.2.0 to 6.0.0 by @dependabot[bot] in #937
  • Bump Microsoft.Extensions.Logging.Abstractions from 10.0.0 to 10.0.1 by @dependabot[bot] in #936
  • Bump actions/upload-artifact from 5 to 6 by @dependabot[bot] in #935
  • Bump NUnit3TestAdapter from 6.0.0 to 6.0.1 by @dependabot[bot] in #939
  • Fixed bug that would cause a struct to not match and throw a runtime error. by @Notallthatevil in #895
  • Remove TestingPlatformDotnetTestSupport for test projects by @Romfos in #938
  • Improve changelog by @304NotModified in #940
  • Bump NUnit3TestAdapter from 6.0.1 to 6.1.0 by @dependabot[bot] in #941
  • Bump Microsoft.Extensions.Logging.Abstractions from 10.0.1 to 10.0.2 by @dependabot[bot] in #942
  • Custom arg matcher support in #912
  • Bump Microsoft.Extensions.Logging.Abstractions from 10.0.2 to 10.0.3 by @dependabot[bot] in #944
  • Bump NUnit from 4.4.0 to 4.5.0 by @dependabot[bot] in #946
  • Bump actions/upload-artifact from 6 to 7 by @dependabot[bot] in #949
  • Added test for DefaultInterfacesImplementation by @304NotModified in #950
  • Bump NUnit from 4.5.0 to 4.5.1 by @dependabot[bot] in #951

New Contributors

Thank you to our first time contributors!

Thanks also to @304NotModified and @Romfos for their continued support and contributions to this release.

Full Changelog: v5.3.0...v6.0.0-rc.1

v5.3.0

28 Oct 09:04
45e00e3

Choose a tag to compare

  • [NEW] Introduced Substitute.ForTypeForwardingTo to create substitutes that forward interceptable calls to a concrete class. This provides an easy way of implementing a test spy over an existing type. Designed and implemented by @marcoregueira in #700 from a proposal by @wsaeed. Thanks to all who contributed to discussions of this feature.
  • [NEW] Support Raise.EventWith default constructor (#788) by @mihnea-radulescu in #813
  • [NEW] Implement When(...).Throws to avoid confusion with Throw method (#803) by @mihnea-radulescu in #818
  • [FIX] Arg.Any<Arg.AnyType>() does not match arguments passed by reference (#787) by @mihnea-radulescu in #811
  • [FIX] Support matching arguments whose type is generic, when their concrete type is not known (#786) by @mihnea-radulescu in #814
  • [FIX] Release build workflow (#797)
  • [DOC] Add Throws for exceptions to the docs by @304NotModified in #795
  • [DOC] Remove Visual Studio for Mac from readme by @Romfos in #807
  • [TECH] Migrate from NUnit 3 to NUnit 4 by @Romfos in #783
  • [TECH] Update build project to .net 8 by @Romfos in #776
  • [TECH] Code style: use C# 12 collection literals by @Romfos in #810
  • [TECH] Use c# 12 primary constructors by @Romfos in #812
  • [TECH] Added csharp_style_prefer_primary_constructors into editorconfig by @Romfos in #819

Thanks to first-time contributors @mihnea-radulescu and @marcoregueira! Thanks also @304NotModified and @Romfos for their continued support and contributions to this release.

Full Changelog: v5.2.0...v5.3.0

v5.2.0

20 Apr 07:11
19b38fd

Choose a tag to compare

⚠️ Note: there is no build currently available for this version due to an issue switching over to a new automated release build. We'll have a new release shortly once we sort this.

Summary of main changes:

  • [UPDATE] Upgrade website build to jekyll 3.9.0 and add link to edit website pages (#767, #769; thanks to @brad)
  • [UPDATE] Build improvements:
  • [NEW] Support for Sourcelink and Deterministic Build. Thanks @304NotModified! (#737)

Many thanks to @alexandrnikitin, @Romfos, @brad, and @304NotModified for their contributions!
Thanks a lot to all code contributors, reviewers, and people who have raised and/or commented on issues.

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/

As always, please raise an issue on GitHub if you have any problems.

Changelog: https://github.com/nsubstitute/NSubstitute/blob/v5.2.0/CHANGELOG.md
Breaking changes: None.

Project links:

Change list

New Contributors

  • @brad made their first contribution in #768

Full Changelog: v5.1.0...v5.2.0

v5.1.0

11 Sep 08:27
c3d4c38

Choose a tag to compare

We've released NSubstitute v5.1.0!

Changes:

  • [DOC] Add clickable headings. Thanks @jheinath! (#729)
  • [UPDATE] Update Castle.Core to 5.1.1-* to support C# 9 covariants. Thanks @siblount to tracking this down. (#730)
  • [UPDATE] Improved support for testing ILogger. Thanks to @zlangner for this contribution, and also thanks to @Saibamen for reviewing this PR. (#732)
  • [NEW] Add Arg.AnyType for matching calls with generic parameters. Thanks @icalvo for implementing and documenting this! (#634, #715, #733).

Thanks a lot to all code contributors, reviewers, and people who have raised and/or commented on issues.

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/

As always, please raise an issue on GitHub if you have any problems.

Changelog: https://github.com/nsubstitute/NSubstitute/blob/v5.1.0/CHANGELOG.md
Breaking changes: NSubstitute Analyzers may produce false positives in some cases for Arg.AnyType. Follow nsubstitute/NSubstitute.Analyzers#212 for progress on this. These warnings can be suppressed if required.

Project links:

v5.0.0

12 Feb 08:48

Choose a tag to compare

Hi all,

We've released NSubstitute v5.0.0. This release updates our target frameworks to the ones recommended by Microsoft: .NET 6+, .NET Framework 4.6.2+, .NET Standard 2.0+. Thanks to @Romfos for this change (#710), and @alexandrnikitin for the review and merge. Thanks also to @tillw for some clarifications to our docs on internal members (#706).

See full release notes here: https://github.com/nsubstitute/NSubstitute/releases/tag/v5.0.0

Thanks a lot to all code contributors, reviewers, and people who have raised and/or commented on issues.

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/

As always, please raise an issue on GitHub if you have any problems.

Changelog: https://github.com/nsubstitute/NSubstitute/blob/v5.0.0/CHANGELOG.md
Breaking changes:

  • Dropped support for older platforms. Minimum versions now .NET 6+, .NET Framework 4.6.2+, .NET Standard 2.0+

Project links:

What's Changed

New Contributors

Full Changelog: v4.4.0...v5.0.0

v4.4.0

17 Jul 03:51
fed59f6

Choose a tag to compare

Hi all,

We've released NSubstitute v4.4.0. This adds support for Castle Core v5, thanks to @Havunen (#690, #673), as well as fixing an issue checking for constructor args on null object, courtesy of @phongphanq, and @appel1 (#683, #685). Thanks also to @Mandroide for the code review. @Socolin has also added .ThrowsAsync() that will correctly mock exceptions on async methods (#609, #663).

Thanks a lot to all code contributors, reviewers, and people who have raised and/or commented on issues.

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/

As always, please raise an issue on GitHub if you have any problems.

Changelog: https://github.com/nsubstitute/NSubstitute/blob/v4.4.0/CHANGELOG.md
Breaking changes: There should be no breaking changes with this release.
Project links:

What's Changed

  • Add .ThrowsAsync() that will correctly mock exception on async methods by @Socolin in #663
  • Updated NSubstitute to v5 for modern TFMs by @Havunen in #690
  • CastleDynamicProxyFactory_HasItem_true_when_array_is_null by @phongphanq in #683
  • Add support for ReturnsNull calls for nullable value types by @Stedoss in #692

New Contributors

Full Changelog: v4.3.0...v4.4.0

v4.3.0

24 Jan 13:28
992f2d8

Choose a tag to compare

Hi everyone,

We've just released NSubstitute v4.3.0. This introduces support for .NET 5 (#636) and .NET 6 (#674). 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/

As always, please raise an issue on GitHub or email the group if you have any problems.

Changelog: https://github.com/nsubstitute/NSubstitute/blob/v4.3.0/CHANGELOG.md

Breaking changes: There should be no breaking changes with this release.

Project links:

What's Changed

  • Handle protected and internal property setters by @zvirja in #627
  • Fix typo in help. Changed "was" to "way". by @DarqueWarrior in #628
  • Add .NET 5 target and arrange nullability attributes by @zvirja in #636
  • Slightly refactor code to make it look fresh by @zvirja in #639
  • Update Castle.Core min from 4.4.0 to 4.4.1 by @dtchepak in #640
  • doc: Update property received checking to make use of Discards by @rugk in #651
  • Ignore "null handlers" when a substituted event is raised by @x789 in #667
  • Add argument matching tests to demonstrate matching of value and reference types by @suzicurran in #671
  • Added .Net6 target framework by @Havunen in #674
  • Prep for 4.3.0 release by @dtchepak in #678

New Contributors

Full Changelog: v4.2.2...v4.3.0

v4.2.2

13 Jun 06:01

Choose a tag to compare

Hi everyone,

We've just released NSubstitute 4.2.2. This patch release fixes a thread-safety issue with auto-value providers (#600, #601). Thanks to Alex Povar (@zvirja) for these changes.

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/

As always, please raise an issue on GitHub or email the group if you have any problems.

Changelog: https://github.com/nsubstitute/NSubstitute/blob/v4.2.2/CHANGELOG.md

Breaking changes: There should be no breaking changes with this release.

Project links: