Reputation: 14145
I'm trying to test userservice and I want to fake datetime using Fakes.ShimsContext like it was told on this page
On test execution I'm getting
UnitTestIsolation instrumentation failed to initialize. Please restart Visual Studio and rerun this test
Any difference is that I'm using nunit framework.
Is there any issues I should be aware when using nunit with Microsoft Fakes and Shims?
Upvotes: 4
Views: 3639
Reputation: 2957
Make sure you're using the Visual Studio test runner and not the nUnit, MSTest, or Resharper test runners. Fakes requires permission to instrument your code, if your test runnner doesn't have that capability or permission, it'll fail with the error you just got.
You also need to be running Microsoft Visual Studio Ultimate or Premium edition, and if you're in Windows 8 or 8.1 you need to be running in admin mode. You cannot use Professional edition to run Fakes.
If you're still having issues, check the Event Viewer, it should have a corresponding exception which maybe you can work through or post here for us to help you work through.
Upvotes: 4