TeamCity only supports the MsTest testrunner for running MS Tests. This testrunner does not support the brilliant Fakes Framework.
If you run the tests with MsTest – you’ll get the legendary ShimNotSupportedException – which you can read more about here.
The Visual Studio 2012 Test Runner however supports Fakes – here’s how to make Team City use this runner instead of MsTest:
|“C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe” /inIsolation UnitTest.dll|
Note that this requires Visual Studio 2012 on the Build Agent machine. I know a lot of you don’t like this – so you can also just copy the files in the \TestWindow folder to your Build Agent and use vstest.console.exe directly.
Another thing which is nice is that the VSTest is a lot faster than MsTest.