El TecnoBaúl de Kiquenet

Kiquenet boring stories

Posts Tagged ‘privateaccessors’

Create Private Accessors for Visual Studio 2012

Posted by kiquenet en 19 mayo 2014

Con Visual Studio 2012 desaparece la creación desde IDE de los Private Accessors.

Posibles soluciones: crear los Private Accessors con la clase Microsoft.VisualStudio.TestTools.UnitTesting.PrivateObject o usar el comando publicize.exe.

Open a command prompt, or a “VS2013 x86 Native Tools Command Prompt” to have the search path already set up, and run publicize.

In case you do not have the path set up correctly, the tool can be found at
%Program Files (x86)%\Microsoft Visual Studio 11.0\Common7\IDE for Visual Studio 2012 or %Program Files (x86)%\Microsoft Visual Studio 12.0\Common7\IDE for VS 2013.

publicize.exe [options] input-assembly

publicize.exe creates classes named NameOfTheSourceClass_Accessor. In case the class to be tested is called MyClass, the accessor is named MyClass_Accessor.

Starting with Visual Studio 2012, private accessors cannot be created any more by the IDE. The post Home-made Private Accessor for Visual Studio 2012+ presents an approach on how to create private accessors using the classMicrosoft.VisualStudio.TestTools.UnitTesting.PrivateObject.

Axel Mayer noted in the MSDN forums post How to create private accessors in VS 2012 that one can use the command line tool publicize.exe to create private accessors too.



Home-made Private Accessor for Visual Studio 2012+

How to create private accessors in VS 2012

publicize.exe documentation

Posted in .NET, VisualStudio | Etiquetado: , | Leave a Comment »