NMock2 and the year 2009

A short list of features that you can expect of NMock2 (.NET mocking framework) in one of the next releases:

  • mocking of classes
  • nonstrict mocks
  • detectation of swallowed exceptions
  • NMock2 ReSharper plugin for code completion
  • state full mocks

http://sourceforge.net/projects/nmock2

mocking of classes

NNock2 will be able to mock virtual and abstract methods and properties of classes. Either with strict, transparent or nonstrict behaviour.

  • strict: unexpected calls on mock will result in an UnexpectedInvocationException
  • transparent: unexpected calls will be relayed to the mocked class
  • nonstrict: unexpected calls are allowed and a default value is returned for out and return values.
  • NMock2 uses Castle Project’s DynamicProxies to accomplish this.

nonstrict mocks – stubs

Calls to nonstrict mocks will not result in UnexpectedInvocationExceptions. NMock2 will also return default values for return and out values.

detection of swallowed expectation exceptions

If the tested code swallows exceptions then NMock2 will rethrow exceptions concerning expectations (unexpected calls, illegal expectation definitions)

NMock2 ReSharper plugin for code completion

The NMock2 ReSharper plugin will help you write expectation definitions. The intelli-sense provider will show you for example all members on a mock after you have written Expect.Once.On(aMock). and will auto-complete the Method(…) part of the expectation.

state full mocks

A state machine can be assigned to a mock. The state machine defines how the mock reacts to calls depending of its current state.

This will ease up unit testing of classes with state full dependencies.

Happy mocking!

About the author

Urs Enzler

Add comment

By Urs Enzler

Recent Posts