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

Rhino Mocks Direct download

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

Visual Studio Add Reference

Click on the Browse button. Choose the downlaoded 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 successfull that means Rhino Mocks is successfully added in your project.

Setup Rhino Mocks Solution using NuGet

NuGet is an easy way to added your project 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. Rhino Mocks using NuGet
  6. Select the project and click on OK button.
  7. Type namespace "Rhino.Mocks" and build the project.

It build successfully that means Rhino Mocks is successfully installed in your project.

Rhino Mocks Tutorial

Join our newsletter and get an occasional email with a technology and dotnetpattern.com news update.