SimpleMock
March 22nd, 2007
I recently had occasion to demonstrate how to write a very lightweight mocking framework. The result was SimpleMock. SimpleMock does four things:
- Reports failure when no expectations are set
- Reports failure when expectations are not met
- Reports failure when unexpected calls are found
- Succeeds when all expectations are met
- Allows you specify if expectations are positionally sensitive or not
SimpleMock will not do the following:
- Set return values for functions
- Mock parameters
- Or any of the other really cool things that PascalMock1.1 will do
Tests are included in the archive. These will show you how to use it.
Download the code here: SimpleMock.zip
Updated to added behavior #5 above. I recently had a reason to not care in what order method expectations are called.
Recent Comments