Environment Setup – Rhino Mocks Tutorial

Rhino Mocks is very easy to setup. There is only one single DLL “Rhino.Mocks.DLL” needs to be included.

There are two options to include Rhino Mocks in your solution.

  1. Direct download from hibernatingrhinos site.
  2. Use NuGet to download DLL.

Setup solution using Direct download

We can directly download “Rhino.Mocks.DLL” from https://www.hibernatingrhinos.com/oss/rhino-mocks

Click on the “Download” link in the left Navigation. This will download the latest version in zip format.

Extract the zip. Extracted folder contains four files.

  1. acknowledgements.txt
  2. license.txt
  3. Rhino.Mocks.dll
  4. Rhino.Mocks.xml

Open Visual Studio. Create a console application and right click on the Add Reference button.

Visual Studio Add Reference

Click on the Browse button. Choose the downloaded folder and Add the “Rhino.Mocks.dll” file.

Visual Studio Browse Add Reference Rhino Mocks

In the Program.cs file write namespace “Rhino.Mocks” and build the solution.

using System;
using Rhino.Mocks;

namespace ConsoleApplication2
    class Program
        static void Main(string[] args)

If the build is successful, that means Rhino Mocks is successfully added in your project.

Setup Rhino Mocks Solution using NuGet

NuGet is an easy way to add your project’s dependencies. Below are the steps for adding Rhino Mocks using NuGet.

  1. Open Visual Studio. Create a Console application.
  2. Choose Tools -> Library Package Manager -> Manage NuGets Package for Solution…
  3. Type “RhinoMocks” in search box without space between Rhino and Mocks word.
  4. Select RhinoMocks list item and click on install button.
  5. Select the project and click on OK button.
  6. Type namespace “Rhino.Mocks” and build the project.

It was built successfully, which means Rhino Mocks is successfully installed in your project.