Its funny you should talk about reflection, I was having the same discussion with a colleague about this thread. You could use it to do you testing, but it just feels so heavy handed.
The nice thing is if you are using injection you can plug-in test versions of the objects. It might help to have a concrete example to work with here and we could come up with a way of testing it.


Reply With Quote
This argument is a good one, and it came up in our internal discussions as well. The counter-argument was, that I may want to test other components, that use my domain object as input, and verify that they can handle incorrect data. But I am not sure that the counter-argument is valid: after all, if there is absolutely no way to construct an object in a certain way, then nobody will ever get it as input...