## Microsoft Moles with Visual Studio 2012... Sort of.

I think Microsoft Moles is one of, if not the best software testing isolation framework available for C#.Net, the only near rival that can mock and stub non-virtual classes and other difficult to isolate objects is Typemock isolator. Which, at its very cheapest and feature barren is still around $800, whereas Moles was free! So in Visual Studio 2012 they aren't releasing the Moles package and instead including all the tooling with the Fakes framework, which is only in Visual Studio Ultimate edition aka$13000.

So for us poorer developers, if we want to use Moles in Visual Studio 2012. We have 2 options:

1. Figure out how to deploy the Moles Host Adapter in Visual Studio 2012 - My attempts at this have failed so far, if anyone has figured this option out let me know!
• Create an External Tool in Visual Studio 2012.
• For the second option, in VS2012 go to Tools -> External Tools...
You can then call the Moles runner which in turn can call the NUnit runner or the Mstest runner, or your chosen framework.

Moles and NUnit example

Command - Add the Moles.runner.exe path

Arguments - /runner: /args="/domain=None"
Initial Directory - Bin directory of the build output for the test project.
For NUnit its also necessary to build the Nunit sample from the moles install with the same version of NUnit that you plan to use. Then you can add a reference to Microsoft.Moles.NUnit and a using of Microsoft.Moles.Framework.NUnit. Methods just need the [Moled] attribute when you want to run them in the Moles host.
Then when you run the External Tool you created e.g. "Run NUnit and Moles", it outputs results to the output window in Visual Studio.

Any way to use the power of Moles in VS2012 is a step in the right direction!