Howto guide for AutoFixture.NUnit2

With the release of AutoFixture.NUnit2 earlier today, here is some guidance howto get it working

NUnit Documentation: Addin Identification, Loading and Installation

NUnit examines all assemblies in the bin/addins directory, looking for public classes with the NUnitAddinAttribute and implementing the IAddin interface. It loads all those it finds as Addins.

After package install you need to copy packages\AutoFixture.NUnit2.3.9.0\lib\net40\Ploeh.AutoFixture.NUnit2.Addins.dll to bin\addins folder

But where exactly is bin/addins located. The short answer is where is the nunit.exe or nunit-console.exe located

Here is some default locations

  • NUnit2.6.2 -> C:\Program Files (x86)\NUnit 2.6.2\bin\addins
  • R# 8 -> C:\Program Files (x86)\JetBrains\ReSharper\v8.0\Bin\addins
  • TestDriven.Net -> C:\Program Files (x86)\TestDriven.NET 3\NUnit\2.6\addins

Mark Seemann better explains how to use AutoDataAttribute here:

NUnit example

[Test, AutoData]
public void IntroductoryTest(
    int expectedNumber, MyClass sut)
{
    int result = sut.Echo(expectedNumber);
    Assert.Equal(expectedNumber, result);
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s