Перейти к файлу
dependabot[bot] 49750168bd
Bump Microsoft.NET.Test.Sdk from 17.11.1 to 17.12.0 in /src (#241)
2024-11-20 10:25:22 +00:00
.github
src Bump Microsoft.NET.Test.Sdk from 17.11.1 to 17.12.0 in /src (#241) 2024-11-20 10:25:22 +00:00
.gitignore
license.txt
readme.md

readme.md

Verify.NSubstitute

Discussions Build status NuGet Status

Adds Verify support for verifying NSubstitute types.

See Milestones for release notes.

NuGet package

https://nuget.org/packages/Verify.NSubstitute/

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