You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Refactoring of the unit tests to use Moq library from NuGet packages (fixes#23).
* Changes the PosInfoMoq1000 rule to check only VerifyAll() method call (#fixes#22).
* Add the PosInfoMoq1002 rule (fixes#22).
* Improving the PosInfoMoq2005 rules unit tests to check when no explicit constructors.
* Improves the PosInfoMoq1002 rules to check the Verifiable() expression setup method depending of the expressions (#22).
* Add unit test to check that custom Setup() method is not impacted by the analyzer (fixes#12).
Copy file name to clipboardExpand all lines: README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,9 +26,9 @@ Design rules used to make your unit tests more strongly strict.
26
26
27
27
| Rule | Description |
28
28
| - | - |
29
-
|[PosInfoMoq1000: `Verify()` and `VerifyAll()` methods should be called when instantiate a `Mock<T>` instances](docs/Design/PosInfoMoq1000.md)| When instantiating a `Mock<T>` in the *Arrange* phase of an unit test,`Verify()` or`VerifyAll()` method should be called in the *Assert* phase to check the setup methods has been called. |
29
+
|[PosInfoMoq1000: `VerifyAll()` methods should be called when instantiate a `Mock<T>` instances](docs/Design/PosInfoMoq1000.md)| When instantiating a `Mock<T>` in the *Arrange* phase of an unit test, `VerifyAll()` method should be called in the *Assert* phase to check the setup methods has been called. |
30
30
|[PosInfoMoq1001: The `Mock<T>` instance behavior should be defined to Strict mode](docs/Design/PosInfoMoq1001.md)| When instantiating a `Mock<T>` instance, the `MockBehavior` of the `Mock` instance should be defined to `Strict`. |
31
-
31
+
|[PosInfoMoq1002: `Verify()` methods should be called when `Verifiable()` has been setup](docs/Design/PosInfoMoq1002.md)| When a mocked member has been setup with the `Verifiable()` method, the `Verify()` method must be called at the end of the unit test. |
smtpService.Verify(); // The Verify() will check that the mocked ISmtpService.SendMail() has been called (because marked with the ".Verifiable()" method).
36
+
}
37
+
```
38
+
39
+
## How to fix violations
40
+
41
+
To fix a violation of this rule, call the `Verify()` in the *Assert* phase
42
+
on the `Mock<T>` instances, if some mocked members has been marked as `Verifiable()` in the *Arrange* phase.
43
+
44
+
## When to suppress warnings
45
+
46
+
Do not suppress a warning from this rule. Normally `Verifiable()` setup members must be call in the unit tests execution.
0 commit comments