If you need to get the field and values only for Unit Testing, consider using Microsoft PrivateObject
Here you can check the internal state of data items during unit testing, if you need to, which looks like what you are trying to do.
In your unit tests, you can do the following:
MyObject obj = new MyObject();
PrivateObject privateAccessor = new PrivateObject(obj);
Dictionary<string, double> dict = privateAccessor.GetFieldOrProperty("averages") as Dictionary<string, double>;
Then you can get and set any values you need from the Dictionary.
source
share