Releases: devlooped/moq
Releases · devlooped/moq
4.8.1
Added
Changed
- Downgraded
System.Threading.Tasks.Extensions
andSystem.ValueTuple
dependencies to versions 4.3.0 as suggested by @tothdavid in order to improve Moq compatibility with .NET 4.6.1 / help preventMissingMethodException
and 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
void
methods (@alexbestul, #463) - Support for sequential setups (
SetupSequence
) of protected members (@stakx, #493) - Support for callbacks for methods having
ref
orout
parameters via two new overloads ofCallback
andReturns
(@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 theReturnsAsync
extension methods, similar toTask<TResult>
(@AdamDotNet, #506) - Special handling for
ValueTask<TResult>
withDefaultValue.Empty
(@stakx, #529) - Support for custom default value generation strategies besides
DefaultValue.Empty
andDefaultValue.Mock
:
Implement custom providers by subclassing eitherDefaultValueProvider
orLookupOrFallbackDefaultValueProvider
,
install them by settingMock[Repository].DefaultValueProvider
(@stakx, #533, #536) - Allow
DefaultValue.Mock
to mockTask<TMockable>
andValueTask<TMockable>
(@stakx, #502) - Match any value for
ref
parameters withIt.Ref<T>.IsAny
(orItExpr.Ref<T>.IsAny
for 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:
SetupSequence
now overrides pre-existing setups like all otherSetup
methods 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
Returns
are 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.0
to 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
SetupSequence
are 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
Setup
throws when an attempt is made to set one up (@stakx, #497) - Let
SetupAllProperties
skip inaccessible methods (@stakx, #499) - Prevent Moq from relying on a mock's implementation of
IEnumerable<T>
(@stakx, #510) - Verification leaked internal
MockVerificationException
type; remove it (@stakx, #511) - Custom matcher properties not printed correctly in error messages (@stakx, #517)
- Infinite loop when invoking delegate in
Mock.Of
setup expression (@stakx, #528)