Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I share a Microsoft Fakes unit test with a developer using Visual Studio Professional?

I'm running VS 2012 Premium and have written a few tests using Fakes. A member of my team is running VS 2010 Professional. After importing my unit tests, he's receiving compilation errors on that the references to both the Fakes assembly - Microsoft.QualityTools.Testing.Fakes - and the generated Fakes assembly from the project reference - MyProject.Fakes - don't exist.

Is there to share unit tests with Fakes with a developer who is not running VS Premium or Ultimate? At least so the solution compiles in his IDE?

like image 589
gooddeeds Avatar asked Nov 11 '22 03:11

gooddeeds


1 Answers

It's not a good solution, but workaround to exclude only Fakes tests by specifying FAKES_NOT_SUPPORTED conditional constant in the projects on local machines.

Because Fakes are available only in VS Premium/Ultimate editions 2012/2013 and Enterprise 2015(i.e not available in Community and Professional Editions) I wrapped the test methods using shims in #if !FAKES_NOT_SUPPORTED conditions, to allow easily exclude them on Community and Professional Editions

#if !FAKES_NOT_SUPPORTED
[ TestMethod()]
public void TestWithShim()
{
}
#endif //!FAKES_NOT_SUPPORTED
like image 80
Michael Freidgeim Avatar answered Nov 15 '22 07:11

Michael Freidgeim