Skip to content

Releases: devlooped/moq

4.8.1

30 Dec 12:07
Compare
Choose a tag to compare

Added

  • C# 7 tuple support for DefaultValue.Empty and DefaultValue.Mock (@stakx, #563)

Changed

  • Downgraded System.Threading.Tasks.Extensions and System.ValueTuple dependencies to versions 4.3.0 as suggested by @tothdavid in order to improve Moq compatibility with .NET 4.6.1 / help prevent MissingMethodException and similar (@stakx, #571)

Fixed

  • CallBase regression with explicitly implemented interface methods (@stakx, #558)

4.8.0

30 Dec 12:09
Compare
Choose a tag to compare

Same as 4.8.0 Release Candidate 1, plus some significant speed improvements.

Changed

  • SetupAllProperties now fully supports property type recursion / loops in the object graph, thanks to deferred property initialization (@stakx, #550)

4.8.0 Release Candidate 1

30 Dec 12:08
Compare
Choose a tag to compare
Pre-release

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 or out parameters via two new overloads of Callback and Returns (@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 the ReturnsAsync extension methods, similar to Task<TResult> (@AdamDotNet, #506)
  • Special handling for ValueTask<TResult> with DefaultValue.Empty (@stakx, #529)
  • Support for custom default value generation strategies besides DefaultValue.Empty and DefaultValue.Mock:
    Implement custom providers by subclassing either DefaultValueProvider or LookupOrFallbackDefaultValueProvider,
    install them by setting Mock[Repository].DefaultValueProvider (@stakx, #533, #536)
  • Allow DefaultValue.Mock to mock Task<TMockable> and ValueTask<TMockable> (@stakx, #502)
  • Match any value for ref parameters with It.Ref<T>.IsAny (or ItExpr.Ref<T>.IsAny for protected methods) as you would with It.IsAny<T>() for regular parameters (@stakx, #537)
  • Mock.VerifyNoOtherCalls() to check whether all expected invocations have been verified -- can be used as an alternative to MockBehavior.Strict (@stakx, #539)

Changed

  • Breaking change: SetupSequence now overrides pre-existing setups like all other Setup 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)

Obsoleted

  • [Matcher] has been deprecated in favor of Match.Create (@stakx, #514)