Adds Verify support for verifying FakeItEasy types.
Перейти к файлу
dependabot[bot] b341ed6ff8
Bump Polyfill from 7.4.1 to 7.5.0 in /src (#274)
2024-11-20 10:04:32 +00:00
.github refs or cleanup 2024-03-03 10:49:06 +11:00
src Bump Polyfill from 7.4.1 to 7.5.0 in /src (#274) 2024-11-20 10:04:32 +00:00
.gitignore . 2022-04-29 20:27:20 +10:00
license.txt . 2022-04-29 20:27:20 +10:00
readme.md Update readme.md 2024-08-15 21:50:30 +10:00

readme.md

Verify.FakeItEasy

Discussions Build status NuGet Status

Adds Verify support for verifying FakeItEasy types.

See Milestones for release notes.

NuGet package

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

Usage

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

snippet source | anchor

Given an interface:

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

snippet source | anchor

Its .GetCalls() can be verified:

[Fact]
public Task ReceivedCalls()
{
    var target = A.Fake<ITarget>();
    target.Method(1, 2);
    var calls = Fake.GetCalls(target);
    return Verify(calls);
}

snippet source | anchor

Will result in:

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

snippet source | anchor

A instance of FakeManager can also be verified.

[Fact]
public Task FakeManager()
{
    var target = A.Fake<ITarget>();
    target.Method(1, 2);
    var fakeManager = Fake.GetFakeManager(target);
    return Verify(fakeManager);
}

snippet source | anchor