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.
- Host: GitHub
- URL: https://github.com/verifytests/verify.nsubstitute
- Owner: VerifyTests
- License: mit
- Created: 2022-01-11T10:32:00.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-30T10:46:25.000Z (about 2 years ago)
- Last Synced: 2024-05-01T09:37:55.711Z (about 2 years ago)
- Language: C#
- Homepage:
- Size: 245 KB
- Stars: 0
- 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.NSubstitute
[](https://github.com/orgs/VerifyTests/discussions)
[](https://ci.appveyor.com/project/SimonCropp/Verify-NSubstitute)
[](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.
[](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