All Versions
Latest Version
Avg Release Cycle
40 days
Latest Release
425 days ago

Changelog History
Page 10

  • v4.1.1309.800 Changes

    September 08, 2013

    ๐Ÿš€ This version was released twice under different version numbers.

    โž• Added

    • ๐Ÿ†• New It.IsNotNull<T> matcher (@Pjanssen, #40)
    • โž• Add covariant IMock<out T> interface to Mock<T> (@tkellogg, #44)

    ๐Ÿ”„ Changed

    • ๐Ÿš€ Rename Changelog.txt to and inject the latter into the NuGet metadata (@Moq, #52)

    ๐Ÿ›  Fixed

    • ๐Ÿ›  Fix "collection modified" exception thrown as result of more methods being called on a mock while verifying method calls (@yonahw, #36)
    • ๐Ÿ›  Fix NullReferenceException when subscribing to an event (@bittailor, #39)
    • ๐Ÿ›  Fix thread safety issue (IndexOutOfRangeException) on setup (@stoo101, #51)
  • v4.1.1309.1617 Changes

    September 16, 2013

    ๐Ÿš€ This version was released twice under different version numbers.

    ๐Ÿ›  Fixed

    • ๐Ÿ›  Fix regression bug surrounding Mock.As<TInterface>(): Prevent early initialization of mock from checking for delegate mocks. (@kzu, #54)
  • v4.1.1308.2316 Changes

    ๐Ÿ“‡ Minor change only (change title in NuGet package metadata)

  • v4.1.1308.2120 Changes

    โž• Added

    • โž• Add capability for mocking delegates (event handlers) (@quetzalcoatl, #4)
    • ๐Ÿ‘ Allow CallBase for specific method / property (@srudin, #8)
    • ๐Ÿ†• New matchers It.IsIn and It.IsNotIn (@rdingwall, #27)
    • โž• Add .gitignore file (@yorah, #10 / @FellicePollano, #30)
    • โž• Add new Verify method overload group that accepts a Times instance (@ChrisMissal, #34)

    ๐Ÿ”„ Changed

    • โšก๏ธ Update Castle.Core assemblies from version to 3.2.0, fetch Castle.Core via NuGet (@yorah, #11 / @kzu)
    • Corrected Verify method behavior for generic methods calls (@Suremaker, #25)
    • Split up Interceptor.Intercept into a set of 8 strategies, introduce InterceptionAction(@FellicePollano, #31)

    ๐Ÿ›  Fixed

    • ๐Ÿ›  Fix SetupSequentialContext to increment counter also after Throws (@lukas-ais, #7)
    • ๐Ÿคก Make Mock.Of work on properties with non-public setters (@yorah, #9, #19)
    • โž• Adding (and removing) handlers for events declared on interfaces when CallBase = true (@IharBury, #13)
    • ๐Ÿคก Distinguish between verification exception and mock crash (@quetzalcoatl, #16)
    • ๐Ÿ‘Œ Improve thread safety of Interceptor class (@FelicePollano, #29)

    Note: Release notes in the above format are not available for ealier versions of Moq. The above ๐Ÿ”„ changelog entries have been reconstructed from the Git commit history. What follows below are the ๐Ÿš€ original release notes, for which maintenance stopped around Moq version 4.5. They are nevertheless included below as they go back further in time.

  • v4.1 Changes

    • โž• Added covariant IMock<out T> interface to Mock<T>
    • โž• Added It.IsNotNull<T>
    • ๐Ÿ›  Fix: 'NullReferenceException when subscribing to an event'
    • โž• Added overloads to Verify to accept Times as a Method Group
    • ๐Ÿ”‹ Feature request: It.IsIn(..), It.IsNotIn(...)
    • Corrected Verify method behavior for generic methods calls
    • ๐Ÿคก Differentiate verification error from mock crash
    • ๐Ÿ›  Fix: Adding (and removing) handlers for events declared on interfaces works when CallBase = true.
    • โšก๏ธ Update to latest Castle
    • ๐Ÿ›  Fix: Mock.Of (Functional Syntax) doesn't work on properties with non-public setters
    • ๐Ÿ›  Fix: Allow to use CallBase instead of Returns
    • ๐Ÿ›  Fix: Solved Multi-threading issue - IndexOutOfRangeException
    • ๐Ÿคก Capability of mocking delegates (event handlers)
  • v4.0 Changes

    • ๐Ÿคก Linq to Mocks: Mock.Of<T>(x => x.Id == 23 && x.Title == "Rocks!")
    • ๐Ÿ›  Fixed issues:
      • 87 BadImageFormatException when using a mock with a Visual Studio generated Accessor object
      • 166 Unable to use a delegate to mock a function that takes 5 or more parameters.
      • 168 Call count failure message never says which is the actual invocation count
      • 175 theMock.Object failing on VS2010 Beta 1
      • 177 Generic constraint on interface method causes BadImageFormatException when getting Object.
      • 183 Display what invocations were recieved when the expected one hasn't been met
      • 186 Methods that are not virtual gives non-sense-exception message
      • 188 More Callback Overloads
      • 199 Simplify SetupAllProperties implementation to simply iterate and call SetupProperty
      • 200 Fluent mock does not honor parent mock CallBase setting.
      • 202 Mock.Protected().Expect() deprecated with no work-around
      • 204 Allow default return values to be specified (per-mock)
      • 205 Error calling SetupAllProperties for Mock<IDataErrorInfo>
      • 206 Linq-to-Mocks Never Returns on Implicit Boolean Property
      • 207 NullReferenceException thrown when using Mocks.CreateQuery with implicit boolean expression
      • 208 Can't setup a mock for method that accept lambda expression as argument.
      • 211 SetupAllProperties should return the Mock<T> instead of void.
      • 223 When a method is defined to make the setup an asserts mock fails
      • 226 Can't raise events on mocked Interop interfaces
      • 229 CallBase is not working for virtual events
      • 238 Moq fails to mock events defined in F#
      • 239 Use Func instead of Predicate
      • 250 4.0 Beta 2 regression - cannot mock MethodInfo when targetting .NET 4
      • 251 When a generic interface also implements a non-generic version, Verify does not work in some cases
      • 254 Unable to create mock of EnvDTE.DTE
      • 261 Can not use protected setter in public property
      • 267 Generic argument as dependency for method Setup overrides all previous method setups for a given method
      • 273 Attempting to create a mock thrown a Type Load exception. The message refers to an inaccessible interface.
      • 276 .Net 3.5 no more supported
  • v3.0 Changes

    • ๐Ÿ‘ Silverlight support! Finally integrated Jason's Silverlight contribution! Issue #73
    • ๐Ÿคก Brand-new simplified event raising syntax (#130): mock.Raise(foo => foo.MyEvent += null, new MyArgs(...));
    • ๐Ÿ‘Œ Support for custom event signatures (not compatible with EventHandler): mock.Raise(foo => foo.MyEvent += null, arg1, arg2, arg3);
    • ๐Ÿคก Substantially improved property setter behavior: mock.VerifySet(foo => foo.Value = "foo"); (also available for SetupSet
    • Renamed Expect* with Setup*
    • Vastly simplified custom argument matchers: public int IsOdd() { return Match<int>.Create(v => i % 2 == 0); }
    • โž• Added support for verifying how many times a member was invoked: mock.Verify(foo => foo.Do(), Times.Never());
    • โž• Added simple sample app named StoreSample
    • ๐Ÿšš Moved Stub functionality to the core API (SetupProperty and SetupAllProperties)
    • ๐Ÿ›  Fixed sample ASP.NET MVC app to work with latest version
    • ๐Ÿ‘ Allow custom matchers to be created with a substantially simpler API
    • ๐Ÿ›  Fixed issue #145 which prevented discrimination of setups by generic method argument types
    • ๐Ÿ›  Fixed issue #141 which prevented ref arguments matching value types (i.e. a Guid)
    • ๐Ÿ‘ Implemented improvement #131: Add support for It.IsAny and custom argument matchers for SetupSet/VerifySet
    • ๐Ÿ‘ Implemented improvement #124 to render better error messages
    • Applied patch from David Kirkland for improvement #125 to improve matching of enumerable parameters
    • Implemented improvement #122 to provide custom errors for Verify
    • 0๏ธโƒฃ Implemented improvement #121 to provide null as default value for Nullable<T>
    • ๐Ÿ›  Fixed issue #112 which fixes passing a null argument to a mock constructor
    • ๐Ÿ‘ Implemented improvement #111 to better support params arguments
    • ๐Ÿ›  Fixed bug #105 about improperly overwriting setups for property getter and setter
    • Applied patch from Ihar.Bury for issue #99 related to protected expectations
    • ๐Ÿ›  Fixed issue #97 on not being able to use SetupSet/VerifySet if property did not have a getter
    • ๐Ÿ‘ Better integration with Pex (
    • ๐Ÿ›  Various other minor fixes (#134, #135, #137, #138, #140, etc.)
  • v2.6 Changes

    • ๐Ÿคก Implemented Issue #55: We now provide a mock.DefaultValue = [DefaultValue.Empty | DefaultValue.Mock] which will provide the current behavior (default) or mocks for mockeable return types for loose mock invocations without expectations.
    • โž• Added support for stubbing properties from moq-contrib: now you can do mock.Stub(m => m.Value) and add stub behavior to the property. mock.StubAll() is also provided. This integrates with the DefaultValue behavior too, so you can stub entire hierarchies :).
    • โž• Added support for mocking methods with out and ref parameters (Issue #50)
    • ๐Ÿคก Applied patch contributed by slava for Issue #72: add support to limit numbor of calls on mocked method (we now have mock.Expect(...).AtMost(5))
    • ๐Ÿ‘ Implemented Issue #94: Easier setter verification: Now we support ExpectSet(m = m.Value, "foo") and VerifySet(m = m.Value, 5) (Thanks ASP.NET MVC Team!)
    • ๐Ÿคก Implemented issue #96: Automatically chain mocks when setting expectations. It's now possible to specify expectations for an entire hierarchy of objects just starting from the root mock. THIS IS REALLY COOL!!!
    • ๐Ÿ›  Fixed Issue #89: Expects() does not always return last expectation
    • Implemented Issue 91: Expect a method/property to never be called (added Never() method to an expectation. Can be used on methods, property getters and setters)
    • ๐Ÿ›  Fixed Issue 86: IsAny<T> should check if the value is actually of type T
    • ๐Ÿ›  Fixed Issue 88: Cannot mock protected internal virtual methods using Moq.Protected
    • ๐Ÿ›  Fixed Issue 90: Removing event handlers from mocked objects
    • โšก๏ธ Updated demo and added one more test for the dynamic addition of interfaces
  • v2.5 Changes

    • โž• Added support for mocking protected members
    • โž• Added new way of extending argument matchers which is now very straightforward
    • โž• Added support for mocking events
    • โž• Added support for firing events from expectations
    • โœ‚ Removed usage of MBROs which caused inconsistencies in mocking features
    • โž• Added ExpectGet and ExpectSet to better support properties, and provide better intellisense.
    • โž• Added verification with expressions, which better supports Arrange-Act-Assert testing model (can do Verify(m => m.Do(...)))
    • โž• Added Throws<TException>
    • โž• Added mock.CallBase property to specify whether the virtual members base implementation should be called
    • โž• Added support for implementing and setting expectations and verifying additional interfaces in the mock, via the new mock.As<TInterface>() method (thanks Fernando Simonazzi!)
    • ๐Ÿ‘Œ Improved argument type matching for Is/IsAny (thanks Jeremy.Skinner!)
  • v2.0 Changes

    • ๐Ÿ”จ Refactored fluent API on mocks. This may cause some existing tests to fail, but the fix is trivial (just reorder the calls to Callback, Returns and Verifiable)
    • โž• Added support for retrieving a Mock<T> from a T instance created by a mock.
    • โž• Added support for retrieving the invocation arguments from a Callback or Returns.
    • Implemented AtMostOnce() constraint
    • โž• Added support for creating MBROs with protected constructors
    • ๐Ÿคก Loose mocks now return default empty arrays and IEnumerables instead of nulls