I have an object the references a bunch of Properties.Settings.Default...
values and I need to stub these in the unit test for this object.
Unfortunately the type for the settings object is declared as internal
and so I can't access it from the unit test project.
How can I stub up the return values for these properties? I'm using Rhino Mocks for mocking.
In general, I wouldn't. Instead of your "inner" objects actually reading Properties.Settings.Default, have them declare a cconfigurable property (either at construction time, or via properties), and have another piece of code populate them.
That way, you can test everything but the default reading stuff in your unit tests, and you become less coupled to a way of reading the defaults, making it easier to switch the mechanism in the future.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With