Moq v2.6 Release Notes
-
- ๐คก 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 theDefaultValue
behavior too, so you can stub entire hierarchies :). - โ Added support for mocking methods with
out
andref
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")
andVerifySet(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 typeT
- ๐ 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
- ๐คก Implemented Issue #55: We now provide a