Unit tests fail when using Moles 0.94 and VS2012, "Hosting rules specify that the test type 'Unit Test' cannot run in the host adapter 'Moles'"

StackOverflow https://stackoverflow.com/questions/13511135

Question

I'm trying to run some Unit Tests using Moles 0.94 and VS2012 in preparation to moving to TFS 2012.
The tests currently work fine on a TFS 2010 build server.

The first error I got was:

The host type 'Moles' cannot be loaded for the following reason: The key 'Moles' cannot be found. Make sure that the appropriate host adapter is installed on the machine. Exception doesn't have a stacktrace

I found that the Moles installer didn't create the correct entries in the registry, as per a comment in this post: Test Fails Due to Moles Under 64-bit Process

I decided to update my registry, so under Visual Studio\11.0\ the host adapters are now there too. They were only there for 10.0 before.

In my test.settings file I've tried both Force 32 bit and Run in 64 bit.
I've added the following to my Assembly.cs:

[assembly: MolesAssemblySettings(Bitness = MolesBitness.x64)]

I now get the following error:

Hosting rules specify that the test type 'Unit Test' cannot run in the host adapter 'Moles'. To run this test in 'Moles', change the hosting rules. To use the default test host for tests that cannot be run in the specified host adapter, change the test settings.

Any help would be appreciated.

Was it helpful?

Solution

Please keep in mind that in Visual Studio 2012, Moles framework has been replaced with Fakes. Here is how to migrate: http://www.hoonzis.com/fakes-is-new-test-isolation-framework/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top