NSubstitute
NSubstitute copied to clipboard
A friendly substitute for .NET mocking libraries.
I'm loving the work done under #401 to make the syntax for `ref`/`out` parameters much better, i.e. we can now say: ```C# var lookup = Substitute.For(); lookup.TryLookup("hello", out Arg.Any()) .Returns(true);...
When trying to upgrade to NSubstitute 3.1.0 I am seeing failures for tests which register NSubstitute mocks with Castle.Windor a la... container.Register() etc. These tests pass just fine with NSubstitute...
**Describe the bug** Example shown [in this post](https://www.elasticmint.com/blog/2018/04/16/fixing-intermittent-test-failures/) suggests arg matchers not being cleared correctly for `DidNotReceiveWithAnyArgs` (and potentially with `ReceivedWithAnyArgs`). **To Reproduce** I have not not been able to...
Is there currently a way to access the original method/property name inside `ReturnsForAll`? I know there is a `CallInfo` parameter you can access to get any arguments, but that doesn't...
I'd like to be able to do something like `DelegateCalls` in this example: ```cs var items = new List { /* ... */ }; var list = Substitute.For(); list.DelegateCalls(instance: items);...
Sometimes it's not possible to specify arguments directly in a call. Instead I have to be able to retrieve them for assertions. I currently do that by using ``` var...
Shouldn't [Query.cs line 14](https://github.com/nsubstitute/NSubstitute/blob/f7fc2727ac2f35cbf2a69458fe710087a8c5a565/src/NSubstitute/Core/Query.cs#L14) read: ```csharp var allMatchingCallsOnTarget = target.ReceivedCalls().Where(callSpecification.CreateCopyThatMatchesAnyArguments().IsSatisfiedBy); ``` Rather than ```csharp var allMatchingCallsOnTarget = target.ReceivedCalls().Where(callSpecification.IsSatisfiedBy); ``` I'm trying to test a sequence. I have a bug, but...
Setting a Returns() within a Returns() leads to global LastCallRouter being incorrect. May need to look at using a stack for LastCallRouter so we can handle this. Example of bug:...
Right now, there doesn't seem to be support for complex callbacks with `AndDoes` like there is with `When...Do`. This leads to some redundant code if you want to configure specific...
Scenario here: https://gist.github.com/b759fa100814bd04eb11 Could create with a Name or allow overriding ToString(). Perhaps provide default id# for substitutes.