NSubstitute
NSubstitute copied to clipboard
A friendly substitute for .NET mocking libraries.
Because netstandard2.0 is not supported by System.Threading.Tasks.Extensions v4.3.0. We need to target netstandard2.0 for use with Unity3D.
Hi. There is a feature in Mockito (java) and probably other mocking frameworks, where you can capture the arguments that were sent to a substitute function. This allows the developer...
I have a piece of code that inserts values inside a dictionary for later consumption in the assert. In this code, I have to increment a value and to have...
Hi I was in need of a feature allowing PartsOf to mock non-virtual methods implementing an interface, just the same as requested in #625. I decided to tinker a bit...
Currently `ForPartsOf` accepts a single template parameter (a class), which requires the mocked method to be virtual. Making methods of a class virtual allows derived classes to override which may...
Remove old tests that rely too heavily on mock adapter.
**Describe the bug** I've got an UnexpectedArgumentMatcherException on my DevOps environment. I don't have it on my local computer. ``` [xUnit.net 00:00:01.60] [anonymous content] [FAIL] Skipped [anonymous content] [1 ms]...
**Question** I've been struggling with a test that needs to verify calls to an out param passed to my SUT from a third party API. It reports success for any...
https://github.com/nsubstitute/NSubstitute/blob/f890efaeb7cebe01aa6304422fd2936dcfefe290/src/NSubstitute/Proxies/CastleDynamicProxy/CastleDynamicProxyFactory.cs#L167 It was changed from: ```csharp private static bool HasItems(T[]? array) { return array != null && array.Length > 0; } ``` to ```csharp private static bool HasItems(T[]? array) =>...
**Describe the bug** When reconfiguring a substitute using the `.When().Do()` pattern, the "returnThis" callback is not _replaced_, but rather _added_ as an action to be called when the substitute is...