Releases: PosInformatique/PosInformatique.Moq.Analyzers
Releases · PosInformatique/PosInformatique.Moq.Analyzers
v2.0.1
Improvements/Fixes
- Fix the PosInfoMoq2005 which raised an error with constructor that contains array parameters (fixes #55).
v2.0.0
New rules
- PosInfoMoq1010: Use
+= nullsyntax when raising events withRaise()/RaiseAsync()(fixes #52). - PosInfoMoq2001: Add the support of the
SetupSequence()methods. (fixes #33). - PosInfoMoq2017:
Mock<T>.Raise()/RaiseAsync()must use parameters matching the event signature (fixes #51). - PosInfoMoq2018: The first parameter of
Raise()/RaiseAsync()must be an event (fixes #51). - PosInfoMoq2019:
RaiseAsync()must be used only for events with async handlers (returningTask) (fixes #51).
This is a major improvement to detect the bug of Moq related to the devlooped/moq#1568 issue (and the related PR devlooped/moq#1571 proposed fix which is still not approved).
New fixers
- PosInfoMoq1000: The fixer add a call for missing VerifyAll() at the end of the unit tests. (fixes #53).
v1.13.0
New rules
- PosInfoMoq1007: The
Verify()method must specify theTimesargument (fixes #37). - PosInfoMoq1008: The
Mock.Verify()andMock.VerifyAll()methods must specify at least one mock (fixes #46). - PosInfoMoq1009: Avoid using
Verifiable()method (fixes #48).
Improvements/Fixes
- When using
It.IsAny<T>()orIt.Is<T>()with inherited class, the PosInfoMoq1006 was raised (fixes #47).
v1.12.0
New rules
- PosInfoMoq1006: The
It.IsAny<T>()orIt.Is<T>()arguments must match the parameters of the mocked method. (fixes #44).
v1.11.0
New rules
- PosInfoMoq1005: Defines the generic argument of the
SetupSet()method with the type of the mocked property (fixes #42). - PosInfoMoq2014: The delegate in the argument of the
Returns()method must return a value with same type of the mocked method (fixes #35). - PosInfoMoq2015: The
Protected().Setup()method must match the return type of the mocked method. - PosInfoMoq2016:
Mock<T>constructor with factory lambda expression can be used only with classes (fixes #40).
Improvements/Fixes
- PosInfoMoq2001: Check that property setup with the
SetupSet()method are overridable (fixes #42). - Fix the PosInfoMoq1001 rule for the
Mock<T>instantiation with the lambda expression to create mock instances (fixes #39). - Fix the PosInfoMoq2004 rule for the
Mock<T>instantiation with the lambda expression to create mock instances (fixes #39). - Fix the PosInfoMoq1001 fixer when using the
Mock.Of<T>as argument in the constructor call (fixes #41).
v1.10.0
New rules:
- PosInfoMoq2012: The delegate in the argument of the
Returns()method must return a value with same type of the mocked method. - PosInfoMoq2013: The delegate in the argument of the
Returns()/ReturnsAsync()method must have the same parameter types of the mocked method/property.
v1.9.3
Improvements/Fixes
- Fix the PosInfoMoq2006 which raised an error when setup a property/method in inherited classes (fixes #31).
v1.9.2
Improvements/Fixes
- Fix the PosInfoMoq1003 to raise warnings when using InSequence() method (fixes #29).
- Fix the PosInfoMoq2003 to raise errors when using InSequence() method (fixes #29).
v1.9.1
New rules:
- PosInfoMoq2009:
Mock.Of<T>method must be used only to mock non-sealed class. - PosInfoMoq2010:
Mock.Of<T>method must be used only with types that contains parameterless contructor. - PosInfoMoq2011: Constructor of the mocked class must be accessible.
Improvements/Fixes
- Updates the PosInfoMoq1001 rule to check
Strictbehavior usage for theMock.Of<T>()method (fixes #27).
v1.8.0
New rules:
- PosInfoMoq1003: The
Callback()method should be used to check the parameters when mocking a method withIt.IsAny<T>()arguments. (fixes #21). - PosInfoMoq1004: The
Callback()parameter should not be ignored if it has been setup as anIt.IsAny<T>()argument. (fixes #21).