skip to the main content area of this page
Patterns and Practices

 

Moq 2.5 Released - Free Mocking Library for .NET Using C# 3.0 Features


Moq v2.5 was released. Moq is a mocking framework for the .NET that takes advantages of the C# 3.0 Syntax, and in particular, Lambda Expressions.

Moq version 2.5 has several improvements:

  • 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, 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!)

You can learn more about Moq here.

 

Related Posts:

 


Tags: Moq