Moq 3.0 Released
Moq's popularity has grown as mocking has become mainstream in .NET, in part because Moq is designed for developers who are new to mocking or may be writing their own custom mock objects. Moq does not use the classic record/reply idiom and instead lets testers set behavioral expectations, often through lambda expressions, and intercepts mock object calls by utilizing Castle DynamicProxy.
Moq 3.0 represents a major new release, with the following notable changes:
- Silverlight Support A separate binary is available that is fully compatible with Silverlight.
- New simplified event raising syntax Example: mock.Raise(foo => foo.MyEvent += null, new MyArgs(...));
- Support for custom event signatures (not compatible with EventHandler) Example: mock.Raise(foo => foo.MyEvent += null, arg1, arg2, arg3);
- Improved property setter behavior Example: mock.VerifySet(foo => foo.Value = "foo");
- Additional sample application code ASP.NET MVC application also updated to work with latest version
- Better integration with Pex Previously, Pex would spend effort analyzing the Moq library code, trying to understand the internals of Moq framework. In 3.0 release, Pex attributes have used to shut down the Pex monitoring for certain areas of Moq which aren't relevant to the code under test.
How Can We Use Our Creative Power and Technological Opportunity to Address the Challenges of the 21st Century?
Gyorgyi Galik Feb 26, 2015