Can i use VS2010 PrivateObject to access a static field inside a static class?

后端 未结 3 737
甜味超标
甜味超标 2021-02-12 13:50

Is it possible to get access to a private static field inside a static class, using the VS2010 Unit Test class PrivateObject ?

Let say i have the following class:

<
3条回答
  •  天涯浪人
    2021-02-12 14:32

    PrivateType class is analogous to PrivateObject for invoking private static members. Overloaded GetStaticFieldOrProperty methods may be used. http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting.privatetype(v=VS.100).aspx

提交回复
热议问题