Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fluffynuts/nsubstitute.verifyall
Provides the .VerifyAll() extension method for reference types, similar to Moq's
https://github.com/fluffynuts/nsubstitute.verifyall
Last synced: 5 days ago
JSON representation
Provides the .VerifyAll() extension method for reference types, similar to Moq's
- Host: GitHub
- URL: https://github.com/fluffynuts/nsubstitute.verifyall
- Owner: fluffynuts
- License: bsd-3-clause
- Created: 2024-01-04T15:21:29.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-04-18T07:55:05.000Z (9 months ago)
- Last Synced: 2024-11-17T05:53:38.489Z (about 2 months ago)
- Language: C#
- Homepage:
- Size: 104 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
NSubstitute.VerifyAll
---Aim: to provide the convenient `.VerifyAll()` method from Moq on NSubstitute
proxies so that:- it's easier to move from Moq to NSubstitute
- it's more convenient to verify a bunch of calls which have been set upNot supported, and may never be, unless there's demand:
- `.Verifiable()`
- `.Verify()`
These methods are used to verify only a portion of the mocked
service - if you're setting up a bunch of mocks and only testing
one or two, it's not much effort to verify those calls later. However,
if you're setting up a bunch of calls or migrating code, being able to
leave `.VerifyAll()` in place is quite convenient.Usage
---1. install
2. add `using NSubstitute.VerifyAll` to the affected file(s)
3. use `.VerifyAll()` as you would with Moq (see below)Convenience
---One of the very convenient bits of Moq is the `.VerifyAll()` extension,
which reduces noise in a test where you're going to set up a substitute/mock
service with one or more mocked methods, and then verify that those methods
have been called as expected:```csharp
var service = new Mock();
service.Setup(x => x.Add(3, 4))
.Returns(7);
var consumer = new Consumer(service.Object);
// ... some time later:
thing.VerifyAll();
```compared with NSubstitute's:
```csharp
var service = Substitute.For();
service
```