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

https://github.com/verifytests/verify.nsubstitute

Adds Verify support for verifying NSubstitute types.
https://github.com/verifytests/verify.nsubstitute

Last synced: 5 months ago
JSON representation

Adds Verify support for verifying NSubstitute types.

Awesome Lists containing this project

README

          

# Verify.NSubstitute

[![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-NSubstitute)](https://ci.appveyor.com/project/SimonCropp/Verify-NSubstitute)
[![NuGet Status](https://img.shields.io/nuget/v/Verify.NSubstitute.svg)](https://www.nuget.org/packages/Verify.NSubstitute/)

Adds [Verify](https://github.com/VerifyTests/Verify) support for verifying [NSubstitute](https://nsubstitute.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.NSubstitute) is a major sponsor and is proud to contribute to the development this project.

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

## NuGet

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

## Usage


```cs
[ModuleInitializer]
public static void Init() =>
VerifyNSubstitute.Initialize();
```
snippet source | anchor

Given an interface:


```cs
public interface ITarget
{
void Method(int a, int b);
}
```
snippet source | anchor

It `.ReceivedCalls()` can be verified:


```cs
[Fact]
public Task Test()
{
var target = Substitute.For();
target.Method(1, 2);
return Verify(target.ReceivedCalls());
}
```
snippet source | anchor

Will result in:


```txt
[
{
Method: ITarget.Method(int a, int b),
Arguments: [
1,
2
]
}
]
```
snippet source | anchor