An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

# Verify.FakeItEasy

[![Discussions](https://img.shields.io/badge/Verify-Discussions-yellow?svg=true&label=)](https://github.com/orgs/VerifyTests/discussions)
[![Build status](https://img.shields.io/appveyor/build/SimonCropp/Verify-FakeItEasy)](https://ci.appveyor.com/project/SimonCropp/Verify-FakeItEasy)
[![NuGet Status](https://img.shields.io/nuget/v/Verify.FakeItEasy.svg)](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.

[![Entity Framework Extensions](https://raw.githubusercontent.com/VerifyTests/Verify.FakeItEasy/refs/heads/main/docs/zzz.png)](https://entityframework-extensions.net/?utm_source=simoncropp&utm_medium=Verify.FakeItEasy)

### Developed using JetBrains IDEs

[![JetBrains logo.](https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.svg)](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