I don't generally recommend doing property injection since that creates strange dependency chains that the users of your class may not be aware of. This is why constructor injection is usually preferred.
However, there a few rare cases when this is necessary.
Chris, you can manually set the value and this is fine if you only have one instance where you need to set the property, but as soon as you have to do this again you should use Simon's recommended method.
That way, when you need to add another injected property to the setup (also not recommended), you will only have one place to fix it for all of your tests.
This follows the DRY principle. However, jumping to Simon's solution right off is not recommended either, that smells of needless complexity if you only ever do it once.
On Monday, February 25, 2013 1:22:21 PM UTC-6, Simon Hohenadl wrote:
Yes, that would be the way to do it without behavior configuration.