Friday, November 12, 2004

Mutant NMock

A while ago I found I wanted NMock to allow me to specify what a mock object should return without setting up an expectation. SetResult lets you do this, but I wanted the return value to change depending on the parameters. So I hacked the source code a bit and came up with this.

The new syntax is

DynamicMock mock = new DynamicMock(typeof("Banana"));

mock.Return("MethodName",returnValue,param1, param2 ... );

Feel free to try it out. No warrenty is provided.

No comments:

GitHub Projects