1
Vote

In some scenarios, Actions may be Initializations

description

initializations should be reusable as actions.
 
Ordinarily, this might be achievable via an adapter:
 
GivenThat<InitializerIsRun>();
 
When<Adapted<InitializerIsRun>>();
 

But this interrupts the BDD/natural language syntax. Transparently support initializations as actions?

The only scenario where initializations can be reused as actions is when working with a target method without a return value. Otherwise, the signatures do not match and cannot be adapted (can't create a return value from a void).
 
So, just modify the unit test interface that takes only a target type to have a When override that aceepts an initialization.

comments