run tests with Microsoft.Moles instrumentation using the ReSharper tesrunner
I am working with a legacy code base and I am using Microsoft.Moles to get test doubles for non-abstract/non-interface types. I am using NUnit as the testframework. When I use the console runner everthing works fine, because as the docs say, I can start the runner this way:
moles.runner.exe /r:nunit-console.exe /args="/domain=None" ..
This is needed because Microsoft.Moles uses instrumentation to replace the real types with the fake ones.
However when I run the NUnit tests using the ReSharper testrunner, I get the following exception:
Microsoft.Moles.Framework.Moles.MoleInvalidOperationException: Microsoft.Moles.Framework.Moles.MoleInvalidOperationException: Moles requires tests to be IN an instrumented process.
In Visual Studio Unit Test, add the following attribute to your unit test method:
[TestMethod]
[HostType("Moles")] // add this attribute
public void Test()
{ ... }
Extensions are also available for most unit test frameworks. Please refer to the Moles manual.
Is there a way to make this work? If not, will it be supported in the next version of ReSharper?
I understand that Visual Studio 11 will have Microsoft.Moles integrated out of the box (it will be renamed to Microsoft Fakes though). It will aso have a new testrunner that is pluggable and hence will support NUnit, xUnit.NET etc. So ReSharper schould support it too.
Please sign in to leave a comment.
Hi!
Here is the related issue in our tracker: http://youtrack.jetbrains.com/issue/RSRP-184235 Please vote!