All Versions
107
Latest Version
Avg Release Cycle
40 days
Latest Release
604 days ago

Changelog History
Page 1

  • v4.18.2 Changes

    August 02, 2022

    πŸ”„ Changed

    • ⚑️ Update package reference to Castle.Core (DynamicProxy) from version 5.0.0 to 5.1.0 (@stakx, #1275)
    • βœ‚ Removed dependency on System.Threading.Tasks.Extensions for netstandard2.1 and net6.0 (@tibel, #1274)

    πŸ›  Fixed

    • "Expression is not an event add" when using .Raises() with redeclared event (@howcheng, #1175)
    • 🀑 MissingMethodException when mocking interface with sealed default implementation (@pjquirk, #1209)
    • 🀑 Throws TypeLoadException on mock when a record has a base record on .NET 6 (@tgrieger-sf, #1273)
  • v4.18.1 Changes

    May 16, 2022

    πŸ›  Fixed

    • ⚑️ Regression with lazy evaluation of It.Is predicates in setup expressions after updating from 4.13.1 to 4.16.1 (@b3go, #1217)
    • Regression with SetupProperty where Moq fails to match a property accessor implementation against its definition in an interface (@Naxemar, #1248)
    • 🀑 Difference in behavior when mocking async method using .Result vs without (@cyungmann, #1253)
  • v4.18.0 Changes

    May 12, 2022

    πŸ†• New major version of DynamicProxy (you may get better performance!), so please update with care.

    πŸ”„ Changed

    • ⚑️ Update package reference to Castle.Core (DynamicProxy) from version 4.4.1 to 5.0.0 (@stakx, #1257)
    • πŸ‘€ Adjusted our target frameworks to match DynamicProxy's (see their discussion about which frameworks to target):
      • minimum .NET Framework version raised from net45 to net462
      • additional net6.0 TFM

    πŸ›  Fixed

    • Can't set up "private protected" properties (@RobSiklos, #1170)
    • Using [...] an old version of System.Net.Http which is vulnerable to "DoS", "Spoofing", "Privilege Escalation", "Authentication Bypass" and "Information Exposure" (@sidseter, #1219)
    • πŸ”§ Failure when invoking a method with by-ref parameter & mockable return type on a mock with CallBase and DefaultValue.Mock configured (@IanKemp, #1249)
  • v4.17.2 Changes

    March 06, 2022

    πŸ›  Fixed

    • 🀑 Regression: Property stubs not working on sub mock (@aaronburro, #1240)
    • πŸ”§ Failure when invoking a method with by-ref parameter & mockable return type on a mock with CallBase and DefaultValue.Mock configured (@IanKemp, #1249)
  • v4.17.1 Changes

    February 26, 2022

    βž• Added

    • 🀑 SetupSet, VerifySet methods for mock.Protected().As<>() (@tonyhallett, #1165)
    • πŸ†• New Throws method overloads that allow specifying a function with or without parameters, to provide an exception, for example .Throws(() => new InvalidOperationException()) and Setup(x => x.GetFooAsync(It.IsAny<string>()).Result).Throws((string s) => new InvalidOperationException(s)). (@adam-knights, #1191)

    πŸ”„ Changed

    • ⚑️ Update package reference to Castle.Core (DynamicProxy) from version 4.4.0 to 4.4.1 (@stakx, #1233)

    πŸ›  Fixed

    • The guard against unmatchable matchers (added in #900) was too strict; relaxed it to enable an alternative user-code shorthand _ for It.IsAny<>() (@adamfk, #1199)
    • 🀑 mock.Protected() setup methods fail when argument is of type Expression (@tonyhallett, #1189)
    • Parameter is invalid in Protected().SetupSet() ... VerifySet (@tonyhallett, #1186)
    • 🀑 Virtual properties and automocking not working for mock.Protected().As<>() (@tonyhallett, #1185)
    • 🀑 Issue mocking VB.NET class with overloaded property/indexer in base class (@myurashchyk, #1153)
    • βœ… Equivalent arrays don't test equal when returned from a method, making Verify fail when it should not (@evilc0, #1225)
    • 🀑 Property setups are ignored on mocks instantiated using Mock.Of (@stakx, #1066)
    • 🀑 SetupAllProperties causes mocks to become race-prone (@estrizhok, #1231)
  • v4.17.0 Changes

    This version was skipped due to an intermittent NuGet publishing issue.

  • v4.16.1 Changes

    February 23, 2021

    βž• Added

    • 0️⃣ CallBase can now be used with interface methods that have a default interface implementation. It will call the most specific override. (@stakx, #1130)

    πŸ”„ Changed

    • πŸ‘Œ Improved error message formatting of It.Is lambda expressions that capture local variables. (@bfriesen, #1140)

    πŸ›  Fixed

    • AmbiguousMatchException raised when interface has property indexer besides property in VB. (@mujdatdinc, #1129)
    • 0️⃣ Interface default methods are ignored (@hahn-kev, #972)
    • Callback validation too strict when setting up a task's .Result property (@stakx, #1132)
    • setup.Returns(InvocationFunc) wraps thrown exceptions in TargetInvocationException (@stakx, #1141)
  • v4.16.0 Changes

    January 16, 2021

    βž• Added

    • Ability to directly set up the .Result of tasks and value tasks, which makes setup expressions more uniform by rendering dedicated async verbs like .ReturnsAsync, .ThrowsAsync, etc. unnecessary:
       -mock.Setup(x => x.GetFooAsync()).ReturnsAsync(foo)
       +mock.Setup(x => x.GetFooAsync().Result).Returns(foo)
    

    This is useful in places where there currently aren't any such async verbs at all:

       -Mock.Of<X>(x => x.GetFooAsync() == Task.FromResult(foo))
       +Mock.Of<X>(x => x.GetFooAsync().Result == foo)
    

    This also allows recursive setups / method chaining across async calls inside a single setup expression:

       -mock.Setup(x => x.GetFooAsync()).ReturnsAsync(Mock.Of<IFoo>(f => f.Bar == bar))
       +mock.Setup(x => x.GetFooAsync().Result.Bar).Returns(bar)
    

    or, with only Mock.Of:

       -Mock.Of<X>(x => x.GetFooAsync() == Task.FromResult(Mock.Of<IFoo>(f => f.Bar == bar)))
       +Mock.Of<X>(x => x.GetFooAsync().Result.Bar == bar)
    

    This should work in all principal setup methods (Mock.Of, mock.Setup…, mock.Verify…). Support in mock.Protected() and for custom awaitable types may be added in the future. (@stakx, #1126)

    πŸ”„ Changed

    • Attempts to mark conditionals setup as verifiable are once again allowed; it turns out that forbidding it (as was done in #997 for version 4.14.0) is in fact a regression. (@stakx, #1121)

    πŸ›  Fixed

    • 🐎 Performance regression: Adding setups to a mock becomes slower with each setup (@CeesKaas, #1110)

    • 🀑 Regression: mock.Verify[All] no longer marks invocations as verified if they were matched by conditional setups. (@Lyra2108, #1114)

  • v4.15.2 Changes

    November 26, 2020

    πŸ”„ Changed

    • ⬆️ Upgraded System.Threading.Tasks.Extensions dependency to version 4.5.4 (@JeffAshton, #1108)
  • v4.15.1 Changes

    November 10, 2020

    βž• 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)