diff --git a/Docs/pages/04-verify-interactions.md b/Docs/pages/04-verify-interactions.md index 2de582b8..96aa1e0c 100644 --- a/Docs/pages/04-verify-interactions.md +++ b/Docs/pages/04-verify-interactions.md @@ -113,12 +113,25 @@ If the order is incorrect or a call is missing, a `MockVerificationException` wi ## Check for unexpected interactions -You can check if all interactions with the mock have been verified using `ThatAllInteractionsAreVerified`: +1. **ThatAllInteractionsAreVerified**: + You can check if all interactions with the mock have been verified using `ThatAllInteractionsAreVerified`: -```csharp -// Returns true if all interactions have been verified before -bool allVerified = sut.VerifyMock.ThatAllInteractionsAreVerified(); -``` + ```csharp + // Returns true if all interactions have been verified before + bool allVerified = sut.VerifyMock.ThatAllInteractionsAreVerified(); + ``` + + This is useful for ensuring that your test covers all interactions and that no unexpected calls were made. + If any interaction was not verified, this method returns `false`. + + +2. **ThatAllSetupsAreUsed**: + You can check if all registered setups on the mock have been used using `ThatAllSetupsAreUsed`: + + ```csharp + // Returns true if all setups have been used + bool allUsed = sut.VerifyMock.ThatAllSetupsAreUsed(); + ``` -This is useful for ensuring that your test covers all interactions and that no unexpected calls were made. -If any interaction was not verified, this method returns `false`. + This is useful for ensuring that your test setup and test execution match. + If any setup was not used, this method returns `false`. diff --git a/README.md b/README.md index df38c97c..511011df 100644 --- a/README.md +++ b/README.md @@ -196,7 +196,8 @@ Mockolate provides flexible parameter matching for method setups and verificatio - `It.Is(value)`: Matches a specific value. - `It.IsNull()`: Matches null. - `It.IsTrue()`/`It.IsFalse()`: Matches boolean true/false. -- `It.IsInRange(min, max)`: Matches a number within the given range. You can append `.Exclusive()` to exclude the minimum and maximum value. +- `It.IsInRange(min, max)`: Matches a number within the given range. You can append `.Exclusive()` to exclude the + minimum and maximum value. - `It.IsOut(…)`/`It.IsRef(…)`: Matches and sets out/ref parameters, supports value setting and predicates. @@ -437,12 +438,25 @@ If the order is incorrect or a call is missing, a `MockVerificationException` wi ### Check for unexpected interactions -You can check if all interactions with the mock have been verified using `ThatAllInteractionsAreVerified`: +1. **ThatAllInteractionsAreVerified**: + You can check if all interactions with the mock have been verified using `ThatAllInteractionsAreVerified`: -```csharp -// Returns true if all interactions have been verified before -bool allVerified = sut.VerifyMock.ThatAllInteractionsAreVerified(); -``` + ```csharp + // Returns true if all interactions have been verified before + bool allVerified = sut.VerifyMock.ThatAllInteractionsAreVerified(); + ``` + + This is useful for ensuring that your test covers all interactions and that no unexpected calls were made. + If any interaction was not verified, this method returns `false`. + + +2. **ThatAllSetupsAreUsed**: + You can check if all registered setups on the mock have been used using `ThatAllSetupsAreUsed`: + + ```csharp + // Returns true if all setups have been used + bool allUsed = sut.VerifyMock.ThatAllSetupsAreUsed(); + ``` -This is useful for ensuring that your test covers all interactions and that no unexpected calls were made. -If any interaction was not verified, this method returns `false`. + This is useful for ensuring that your test setup and test execution match. + If any setup was not used, this method returns `false`.