Moq v4.15.1 Release Notes

Release Date: 2020-11-10 // over 3 years ago
  • โž• Added

    • ๐Ÿ†• New method overloads for It.Is, It.IsIn, and It.IsNotIn that compare values using a custom IEqualityComparer<T> (@weitzhandler, #1064)
    • ๐Ÿ†• New properties ReturnValue and Exception on IInvocation to query recorded invocations return values or exceptions (@MaStr11, #921, #1077)
    • ๐Ÿ‘Œ Support for "nested" type matchers, i.e. type matchers that appear as part of a composite type (such as It.IsAnyType[] or Func<It.IsAnyType, bool>). Argument match expressions like It.IsAny<Func<It.IsAnyType, bool>>() should now work as expected, whereas they previously didn't. In this particular example, you should no longer need a workaround like (Func<It.IsAnyType, bool>)It.IsAny<object>() as originally suggested in #918. (@stakx, #1092)

    ๐Ÿ”„ Changed

    • ๐Ÿšš Event accessor calls (+= and -=) now get consistently recorded in Mock.Invocations. This previously wasn't the case for backwards compatibility with VerifyNoOtherCalls (which got implemented before it was possible to check them using Verify{Add,Remove}). You now need to explicitly verify expected calls to event accessors prior to VerifyNoOtherCalls. Verification of += and -= now works regardless of whether or not you set those up (which makes it consistent with how verification usually works). (@80O, @stakx, #1058, #1084)
    • ๐Ÿ“ฆ Portable PDB (debugging symbols) are now embedded in the main library instead of being published as a separate NuGet symbols package (`.snupkg) (@kzu, #1098)

    ๐Ÿ›  Fixed

    • ๐Ÿคก SetupProperty fails if property getter and setter are not both defined in mocked type (@stakx, #1017)
    • Expression tree argument not matched when it contains a captured variable – evaluate all captures to their current values when comparing two expression trees (@QTom01, #1054)
    • ๐Ÿคก Failure when parameterized Mock.Of<> is used in query comprehension from clause (@stakx, #982)