visual-studio-2012vs-unit-testing-frameworkmicrosoft-fakes

Add Fakes Assembly option missing


I'm trying to get the Microsoft Fakes up and running in a Unit test project that I've set up in my solution.

For some reason the Add Fakes Assembly option is missing which means I can't create mockups of assemblies. And since this is the only alternative to add the Microsoft.QualityTools.Testing.Fakes assembly I can't use the Shim functionality either.

I've recently installed Visual Studio 2012 Professional and installed update 3 and this is the first go in Visual Studio 2012. And I haven't changed any settings. Although I have installed ReSharper, could this be the culprit?


Solution

  • Both Visual Studio 2022, 2019, and 2017 only has this feature in the Enterprise edition (they both have 3 main editions: Community, Professional and Enterprise.). See screenshot for 2019 and 2022 later. Visual Studio 2019 added support for Fakes in .NET Core (.NET Core 5).

    If you'd only need the Stub functionality, then you could simply pick other mocking frameworks. You mention Shims, which is an advanced functionality. I have heard some mock frameworks which can be close to that advanced.

    I've heard of Prig (https://marketplace.visualstudio.com/items?itemName=sug.Prig-OpenSourceAlternativetoMicrosoftFakes), but I haven't ever tried it. @neaGaze says it's not supported in VS 2017.

    Versions of the Visual Studio feature matrix's (https://visualstudio.microsoft.com/vs/compare/) related section:

    Visual Studio 2017 feature matrix - only Enterprise offers Fakes:

    Visual Studio 2017 feature matrix table screenshot

    Same true for Visual Studio 2019 (table restyled to be compressed):

    Visual Studio 2019 feature matrix table screenshot

    And Visual Studio 2022 (table restyled to be compressed):

    Visual Studio 2022 feature matrix table screenshot


    Visual Studio 2015: Microsoft Fakes is available in Premium Edition and up.

    http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2919309-provide-microsoft-fakes-with-all-visual-studio-edi