Tutorial about mocking with Rhino Mocks and Moq

I was asked to write a tutorial about mocking with Rhino Mocks on DotNetSlackers.


When using TDD to develop an application it is essential that the system under test (SUT) can be tested in isolation. That is, only the class that I am currently developing is “real” and all other parts are simulated or faked. If my SUT needs to collaborate with other components those other components are mocked during the test. We can either manually implement such mock objects or use a mocking framework for this task. There exist several well known mocking frameworks for the .NET platform. In this article I’ll give a short introduction in the two most used OSS mocking frameworks. The first is Rhino Mocks which was developed by Oren Eini, aka Ayende and the other one is Moq developed by Daniel Cazzulino.


The first part of this tutorial is now online and can be seen here.

About Gabriel Schenker

Gabriel N. Schenker started his career as a physicist. Following his passion and interest in stars and the universe he chose to write his Ph.D. thesis in astrophysics. Soon after this he dedicated all his time to his second passion, writing and architecting software. Gabriel has since been working for over 25 years as a consultant, software architect, trainer, and mentor mainly on the .NET platform. He is currently working as senior software architect at Alien Vault in Austin, Texas. Gabriel is passionate about software development and tries to make the life of developers easier by providing guidelines and frameworks to reduce friction in the software development process. Gabriel is married and father of four children and during his spare time likes hiking in the mountains, cooking and reading.
This entry was posted in Mock, mocking framework, tutorial. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • Thanks for this tutorial! I send it around to everybody in the office (well the devs)


  • Thanks for tutorial, 1 exemple is more than 1000 words

  • an excellent tutorial, and one that’ll help anyone looking for mocking frameworks. if you want to toss in Typemock Isolator into the mix, let me know at avik at typemock dot com, and I’ll set you up with a license.

    By the way, your bio page (http://www.lostechies.com/members/gnschenker/default.aspx) is a bit garbled :)