Rhino Mocks mocking framework

Welcome to the my introduction course to the Rhino Mocks framework. In this series I will show you how you can use the Rhino Mocks mocking framework effectively. Let me start with the basics and explain what mock objects are.

Mock objects are object which pretend to be other objects, they are effectively mimicking other those objects. The purpose of mock objects is to allow you to test the interactions between components, this is very useful when you test code that doesn’t lend itself easily to state based testing.

You can set expected method calls on mocks, which are verified that they are executed in the predetermined order. You can configure argument matching, constraints and provide a custom implementation for the mock’s function and properties.

A mocking framework provides you with a set of classes which help you to build mocks, set expectations and interaction ordering. In this series I will use the Rhino Mocks [1] framework developed by Oren Eini aka Ayende Rahien [2].

Before you start
I made a couple of assumptions about you. I assumed that you:

  • Are familiar with C# and the .NET framework 2.0.
  • Know the NUnit [3] framework.

I hope you like the articles. If you have any questions, comments or suggestions please let me know. Enjoy reading, Bert Willems.

Parts

Sources

[1] Rhino Mocks
[2] Ayende Rahien
[3] NUnit
Be Sociable, Share!