Repository navigation
4.11.0 Release Candidate 1
Pre-releaseThis is a pre-release version.
It contains several minor breaking changes, and there have been extensive internal rewrites in order to fix some very long-standing bugs in relation to argument matchers in fluent setup expressions.
Changed
-
The library now targets .NET Standard 2.0 instead of .NET Standard 1.x. This has been decided based on the official cross-platform targeting guideline and the End of Life announcement for .NET Core 1.x (@stakx, #784, #785)
-
Method overload resolution may change for:
mock.Protected().Setup("VoidMethod", ...)mock.Protected().Verify("VoidMethod", ...)mock.Protected().Verify<TResult>("NonVoidMethod", ...)
due to a new overload: If the first argument is a
bool, make sure that argument gets interpreted as part ofargs, not asexactParameterMatch(see also Added section below). (@stakx & @Shereef, #751, #753) -
mock.Verify[All]now performs a more thorough error aggregation. Error messages of inner/recursive mocks are included in the error message using indentation to show the relationship between mocks. (@stakx, #762) -
mock.Verifyno longer creates setups, nor will it override existing setups, as a side-effect of using a recursive expression. (@stakx, #765) -
More accurate detection of argument matchers with
SetupSetandVerifySet, especially when used in fluent setup expressions or with indexers (@stakx, #767) -
mock.Verify(expression)error messages now contain a full listing of all invocations that occurred across all involved mocks. Setups are no longer listed, since they are completely irrelevant in the context of call verification. (@stakx, #779, #780) -
Indexers used as arguments in setup expressions are now eagerly evaluated, like all other properties already are (except when they refer to matchers) (@stakx, #794)
-
Update package reference to
Castle.Core(DynamicProxy) from version 4.3.1 to 4.4.0 (@stakx, #797)
Added
-
New method overloads:
mock.Protected().Setup("VoidMethod", exactParameterMatch, args)mock.Protected().Verify("VoidMethod", times, exactParameterMatch, args)mock.Protected().Verify<TResult>("NonVoidMethod", times, exactParameterMatch, args)
having a
bool exactParameterMatchparameter. Due to method overload resolution, it was easy to think this already existed when in fact it did not, leading to failing tests. (@Shereef & @stakx, #753, #751) -
Ability in
mock.Raiseandsetup.Raisesto raise events on sub-objects (inner mocks) (@stakx, #772)
Removed
- Pex interop (which has not been maintained for years). You might notice changes when using Visual Studio's IntelliTest feature. (@stakx, #786)
Fixed
- Setting multiple indexed object's property directly via LINQ fails (@TylerBrinkley, #314)
InvalidOperationExceptionwhen specifiying setup on mock with mock containing property of typeNullable<T>(@dav1dev, #725)Verifygets confused between the same generic and non-generic signature (@lepijohnny, #749)- Setup gets included in
Verifydespite being "unreachable" (@stakx, #703) Verifycan create setups that cause subsequentVerifyAllto fail (@stakx & @lepijohnny, #699)- Incomplete stack trace when raising an event with
mock.Raisethrows (@MutatedTomato, #738) Mock.Raiseonly raises events on root object (@hallipr, #166)- Mocking indexer captures
It.IsAny()as the value, even if given in the indexer argument (@idigra, #696) VerifySetfails on non-trivial property setup (@TimothyHayes, #430)- Use of
SetupSet'forgets' method setup (@TimothyHayes, #432) - Recursive mocks don't work with argument matching (@thalesmello, #142)
- Recursive property setup overrides previous setups (@jamesfoster, #110)
- Formatting of enumerable object for error message broke EF Core test case (@MichaelSagalovich, #741)
Verify[All]fails because of lazy (instead of eager) setup argument expression evaluation (@aeslinger, #711)ArgumentOutOfRangeExceptionwhen setup expression contains indexer access (@mosentok, #714)- Incorrect implementation of
Times.Equals(@stakx, #805)