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:
<
The property value can be retreived using reflection. This will require the use of Type.GetField Method (String, BindingFlags) and the FieldInfo.GetValue Method
string propertyName = "bar";
FieldInfo fieldInfo = typeof(foo).GetField(propertyName, BindingFlags.NonPublic | BindingFlags.Static);
object fieldValue = fieldInfo.GetValue(null);