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.
- Direct download from hibernatingrhinos site.
- 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.
- acknowledgements.txt
- license.txt
- Rhino.Mocks.dll
- Rhino.Mocks.xml
Open Visual Studio. Create a console application and right click on the Add Reference button.
Click on the Browse button. Choose the downloaded folder and Add the “Rhino.Mocks.dll” file.
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.
- Open Visual Studio. Create a Console application.
- Choose Tools -> Library Package Manager -> Manage NuGets Package for Solution…
- Type “RhinoMocks” in search box without space between Rhino and Mocks word.
- Select RhinoMocks list item and click on install button.
- Select the project and click on OK button.
- Type namespace “Rhino.Mocks” and build the project.
It was built successfully, which means Rhino Mocks is successfully installed in your project.