Releases: devlooped/moq
Releases · devlooped/moq
4.8.1
Added
Changed
- Downgraded
System.Threading.Tasks.ExtensionsandSystem.ValueTupledependencies to versions 4.3.0 as suggested by @tothdavid in order to improve Moq compatibility with .NET 4.6.1 / help preventMissingMethodExceptionand similar (@stakx, #571)
Fixed
4.8.0
4.8.0 Release Candidate 1
This is a pre-release version.
Added
- Support for sequential setup of
voidmethods (@alexbestul, #463) - Support for sequential setups (
SetupSequence) of protected members (@stakx, #493) - Support for callbacks for methods having
reforoutparameters via two new overloads ofCallbackandReturns(@stakx, #468) - Improved support for setting up and verifying protected members (including generic methods and methods having by-ref parameters) via the new duck-typing
mock.Protected().As<TAnalog>()interface (@stakx, #495, #501) - Support for
ValueTask<TResult>when using theReturnsAsyncextension methods, similar toTask<TResult>(@AdamDotNet, #506) - Special handling for
ValueTask<TResult>withDefaultValue.Empty(@stakx, #529) - Support for custom default value generation strategies besides
DefaultValue.EmptyandDefaultValue.Mock:
Implement custom providers by subclassing eitherDefaultValueProviderorLookupOrFallbackDefaultValueProvider,
install them by settingMock[Repository].DefaultValueProvider(@stakx, #533, #536) - Allow
DefaultValue.Mockto mockTask<TMockable>andValueTask<TMockable>(@stakx, #502) - Match any value for
refparameters withIt.Ref<T>.IsAny(orItExpr.Ref<T>.IsAnyfor protected methods) as you would withIt.IsAny<T>()for regular parameters (@stakx, #537) Mock.VerifyNoOtherCalls()to check whether all expected invocations have been verified -- can be used as an alternative toMockBehavior.Strict(@stakx, #539)
Changed
- Breaking change:
SetupSequencenow overrides pre-existing setups like all otherSetupmethods do. This means that exhausted sequences no longer fall back to previous setups to produce a "default" action or return value. (@stakx, #476) - Delegates passed to
Returnsare validated a little more strictly than before (return type and parameter count must match with method being set up) (@stakx, #520) - Change assembly versioning scheme to
major.minor.0.0to help prevent assembly version conflicts and to reduce the need for binding redirects (@stakx, #554)
Fixed
- Update a method's invocation count correctly, even when it is set up to throw an exception (@stakx, #473)
- Sequences set up with
SetupSequenceare now thread-safe (@stakx, #476) - Record calls to methods that are named like event accessors (
add_X,remove_X) so they can be verified (@stakx, #488) - Improve recognition logic for sealed methods so that
Setupthrows when an attempt is made to set one up (@stakx, #497) - Let
SetupAllPropertiesskip inaccessible methods (@stakx, #499) - Prevent Moq from relying on a mock's implementation of
IEnumerable<T>(@stakx, #510) - Verification leaked internal
MockVerificationExceptiontype; remove it (@stakx, #511) - Custom matcher properties not printed correctly in error messages (@stakx, #517)
- Infinite loop when invoking delegate in
Mock.Ofsetup expression (@stakx, #528)