https://github.com/verifytests/verify.fakeiteasy
Adds Verify support for verifying FakeItEasy types.
https://github.com/verifytests/verify.fakeiteasy
Last synced: 3 months ago
JSON representation
Adds Verify support for verifying FakeItEasy types.
- Host: GitHub
- URL: https://github.com/verifytests/verify.fakeiteasy
- Owner: VerifyTests
- License: mit
- Created: 2022-04-28T11:25:31.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-30T11:43:02.000Z (about 2 years ago)
- Last Synced: 2024-05-01T09:37:52.796Z (about 2 years ago)
- Language: C#
- Homepage:
- Size: 267 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Funding: .github/FUNDING.yml
- License: license.txt
Awesome Lists containing this project
README
#
Verify.FakeItEasy
[](https://github.com/orgs/VerifyTests/discussions)
[](https://ci.appveyor.com/project/SimonCropp/Verify-FakeItEasy)
[](https://www.nuget.org/packages/Verify.FakeItEasy/)
Adds [Verify](https://github.com/VerifyTests/Verify) support for verifying [FakeItEasy](https://fakeiteasy.github.io/) types.
**See [Milestones](../../milestones?state=closed) for release notes.**
## Sponsors
### Entity Framework Extensions
[Entity Framework Extensions](https://entityframework-extensions.net/?utm_source=simoncropp&utm_medium=Verify.FakeItEasy) is a major sponsor and is proud to contribute to the development this project.
[](https://entityframework-extensions.net/?utm_source=simoncropp&utm_medium=Verify.FakeItEasy)
### Developed using JetBrains IDEs
[](https://jb.gg/OpenSourceSupport)
## NuGet
* https://nuget.org/packages/Verify.FakeItEasy
## Usage
```cs
[ModuleInitializer]
public static void Init() =>
VerifyFakeItEasy.Initialize();
```
snippet source | anchor
Given an interface:
```cs
public interface ITarget
{
void Method(int a, int b);
}
```
snippet source | anchor
Its `.GetCalls()` can be verified:
```cs
[Fact]
public Task ReceivedCalls()
{
var target = A.Fake();
target.Method(1, 2);
var calls = Fake.GetCalls(target);
return Verify(calls);
}
```
snippet source | anchor
Will result in:
```txt
[
{
Method: ITarget.Method(int a, int b),
Arguments: [
1,
2
]
}
]
```
snippet source | anchor
A instance of `FakeManager` can also be verified.
```cs
[Fact]
public Task FakeManager()
{
var target = A.Fake();
target.Method(1, 2);
var fakeManager = Fake.GetFakeManager(target);
return Verify(fakeManager);
}
```
snippet source | anchor