http://blogs.clariusconsulting.net/kzu

Daniel Cazzulino's Blog

Go Back to
kzu′s Latest post

Moq 3.0 RTM!!!

I’ve just released the latest version of Moq :) )))

It’s quite late on an intense week at Redmond, so I’m just going to paste the relevant portion of the changelog:


Version 3.0

    * 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

    * 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 (http://research.microsoft.com/en-us/projects/Pex/)

    * Various other minor fixes (#134, #135, #137, #138, #140, etc.)

Â

Â

As usual, get it at http://moq.me/get, browse the API at http://api.moq.me or go to the project homepage at http://moq.me.

Â

Enjoy!!!















Comments

2 Comments

  1. Hi,

    We are using Moq to create Automated Test Cases for our application. There are few queries regarding Moq:

    1. How to test a private method using Moq?
    2. How to test a class not having interface using Moq?

    Unfortunately Moq being such a strong testing framework not much help is available over net for it. Please help me to get answer of these queries.

    Thanks and Regards,
    Arjita Agrawal
    Senior Software Engineer,
    Accenture Service Ltd., India