Search code examples
.netmockingrhino-mocksstubmoles

Mocking / stubbing non-virtual methods in .NET


What .NET mocking or stubbing frameworks exist that can stub non-virtual (or even static) methods like Microsoft Moles? It would be nice to have something like RhinoMocks AssertWasCalled.


Solution

  • In fact, there is one more : Justmock
    I've tried those 3 frameworks and I chose Moles. It's true that it only stub things and it's your job to change them into mocks, but finally it's not too hard (even if I found that the tutorial was not enough clear).

    There are already topics on what framework to choose, like here.

    If you really want pre-programmed verifications on your calls, spend money for Justmock or Typemock (more expensive but still the leader).