In my previous post I mentioned the PrivateObject class to call private fields or properties in unit tests. PrivateObject expects a string to specify the name of the private member. What bothers me about this approach is that you have to change all the usages of the string if you rename the private property. I […]
unit tests
Calling private methods and properties in unit tests with PrivateObject
Sometimes you have to write a unit test that has to set a private property or call a private method of an object. When applying DDD, property setters can be made private. Off course you can set them public in some cases, but most of the time there will be a good reason for using […]