When testing VS2012 Ultimate I tried to use the new Microsoft Fakes framework to mock a simple static method. Running the test went fine, but I kept getting a ShimNotSupportedException when debugging the test.
After goggling and trying all kinds of stuff I finally managed to debug the test by following these steps:
- Deleted the local.testsettings file (both in VS and on disk)
- Deleted the <solution>.vsmdi file (both in VS and on disk)
- Made sure IntelliTrace had these settings (not sure if this mattered):
- Restarted VS2012
- Made sure that no .testsettings file were selected here
Debugging of tests now works fine!
(Running/debugging the tests from Resharper still does not work – but I can live with this.)
I tried to add a new .testsettings file (with CodeAnalysis and everything else disabled) – but this makes the ShimNotSupportedException reappear again.
Similar Fakes/ShimNotSupportedException/Debug issues have been reported to MS, so I hope they get this resolved soon.
Another sad fact is that the Fakes framework is only available in the Ultimate edition of Visual Studio 2012 – which retails at over USD 13,000. This makes absolutely no sense at all. ALL developers should use unit testing as part of their tool belt – and isolating tests using a mocking framework plays a key role. Microsoft Moles could be used for free in the previous VS 2010 version – and it worked great. This is very disappointing.
Please vote for this issue here: http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2919309-provide-microsoft-fakes-with-all-visual-studio-edi