Verify.NSubstitute

April 9, 2026 ยท View on GitHub

Discussions Build status NuGet Status

Adds Verify support for verifying NSubstitute types.

See Milestones for release notes.

Sponsors

Entity Framework Extensions

Entity Framework Extensions is a major sponsor and is proud to contribute to the development this project.

Entity Framework Extensions

Developed using JetBrains IDEs

JetBrains logo.

NuGet

Usage

[ModuleInitializer]
public static void Init() =>
    VerifyNSubstitute.Initialize();

snippet source | anchor

Given an interface:

public interface ITarget
{
    void Method(int a, int b);
}

snippet source | anchor

It .ReceivedCalls() can be verified:

[Fact]
public Task Test()
{
    var target = Substitute.For<ITarget>();
    target.Method(1, 2);
    return Verify(target.ReceivedCalls());
}

snippet source | anchor

Will result in:

[
  {
    Method: ITarget.Method(int a, int b),
    Arguments: [
      1,
      2
    ]
  }
]

snippet source | anchor