In RhinoMocks or Moq, can properties on an object be set before the constructor is called?
I’m trying to test a method.
The class containing the method has some code in it’s constructor which depends on some members being set, unfortunately there’s no params in the constructor to set them so I must set them through a property. Is there any way to set this property before calling the constructor in RhinoMocks or Moq?
How would that work? Setting a property on an object that does not yet exist?
I think you should recognize that there is something wrong with the design of your class and try to change it so that it becomes more testable, for example by using dependency injection.