NSubstitute icon indicating copy to clipboard operation
NSubstitute copied to clipboard

A friendly substitute for .NET mocking libraries.

Results 185 NSubstitute issues
Sort by recently updated
recently updated
newest added

**Question** How to translate this keeping the behavior unchanged? https://dotnetfiddle.net/7iB6Wu ```csharp public static void Main() { var valuesAsStringArray1 = new[] { "123", "5" }; var valuesAsStringArray2 = new[] { "123",...

**Question** Hello, I am trying to find a way to automatically generate mocks for a specific service in NSubstitute. Let's supose we have this code sample below ```csharp public class...

In almost any .NET project I need to have a substitute for `ILoggerFactory` and its probably most used method `CreateLogger()`. It returns `ILogger`, which is in turn: ``` public interface...

**Describe the bug** When using the Returns extension method with a Task that may contain a nullable value, the method is ambiguous. The same happens for non primitive nullable types....

bug

**Describe the bug** I'm trying to mock my GRPC calls as I did before in Moq. But NSubstitute is throwing an exception. I used the following code to mock it:...

bug

**Describe the bug** A When/Do substitution that throws an exception also says the call was never received. **To Reproduce** [DotNetFiddle](https://dotnetfiddle.net/DVOxIV) ``` using System; using System.Threading.Tasks; using FluentValidation; using NSubstitute; using...

Hi all! Trying to mock an extension method that uses the the Prism Library DialogService with a callback action: The NSub I attempted looked like this: ```csharp _subDialogService.When(x => x.ShowDialog(Arg.Is,...

**Describe the bug** If a mocked interface has a method with an interpolated string handler an exception is thrown if the method is called. **To Reproduce** ```csharp using System.Runtime.CompilerServices; var...

bug

ServiceBusSender substitute is not working.. I have a scenario where i send messages to servicebusender and check the received calls. here is the code: ``` **public ServiceBusSender serviceBusSender; serviceBusSender =...