NSubstitute
NSubstitute copied to clipboard
A friendly substitute for .NET mocking libraries.
- Add IDescribeSpecification to allow custom arg matchers to provide custom output for "expected to receive" entries. - Fallback to ToString when IDescribeSpecification not implemented. - Update code comment docs...
When implementing a custom argument matcher, it would be nice that the output of what is expected would be the same of the default matchers (or is customizable): Example: `sut.Received().MyMethod(Arg.Is(p...
**Describe the bug** This is of course a bug in the user code, as we should use `Throw` instead of `Throws`. But the exception is at least not clear And...
Should we consider replacing Google Groups (https://groups.google.com/g/nsubstitute) with GitHub discussions? (for example: https://github.com/xunit/xunit/discussions) Because: - I found a link to the Google Groups on the docs https://nsubstitute.github.io/help/return-for-all/ - but it...
Fixes https://github.com/nsubstitute/NSubstitute/issues/801 Oops it was in the readme. I missed it Draft as we maybe should replace them with GitHub discussions hyperlinks
**Question** Hello everyone. I'm having trouble in verifying a call to a method accepting a single argument, whose type is a generic interface (say, `IMyArgument`). At compile time, I don't...
The package itself asked me to raise this issue with the following code: ``` NSubstitute.Exceptions.SubstituteInternalException Please report this exception at https://github.com/nsubstitute/NSubstitute/issues: CallCollection.Delete - collection doesn't contain the call at NSubstitute.Core.CallCollection.Delete(ICall...
I fall into a category of people that has transitioned to using NSubstitute after discovering security concerns in Moq, which are detailed thoroughly in this article: https://medium.com/@michalsitek/critical-security-vulnerability-in-moq-4-20-0-ffd24739cc49. So far, there...
**Is your feature request related to a problem? Please describe.** Currently if we want to test raising an event that has custom events args (rather than just using [EventArgs](https://learn.microsoft.com/en-us/dotnet/api/system.eventargs?view=net-8.0)), the...
**Describe the bug** `Arg.Any()` does not match arguments passed by reference **To Reproduce** ```csharp IMyService service = Substitute.For(); MyArgument arg = new(); service.MyMethod(ref arg); // The following line throws. service.Received().MyMethod(ref...