Assembly: Gallio (in Gallio.dll) Version: 3.3.0.0 (3.3.610.0)
Syntax
| C# |
|---|
public ActionChain<PatternTestInstanceState, PatternTestActions> DecorateChildTestChain { get; } |
| Visual Basic (Declaration) |
|---|
Public ReadOnly Property DecorateChildTestChain As ActionChain(Of PatternTestInstanceState, PatternTestActions) |
Remarks
This method runs in the TestContext of the test instance in the Execute lifecycle phase.
This method may apply any number of decorations to the child test's actions to the supplied PatternTestActions object. The child test's original actions are unmodified by this operation and the decorated actions are discarded once the child test is finished.
A typical use of this method is to augment the SetUpTestInstanceChain and TearDownTestInstanceChain behaviors of the child test with additional contributions provided by the parent.
It is also possible to decorate descendants besides direct children. To do so, decorate the child's DecorateChildTestChain behavior to perpetuate the decoration down to more deeply nested descendants. This process of recursive decoration may be carried along to whatever depth is required.
The following actions are typically performed during this phase:
- Adding additional actions for the child test to the PatternTestActions.
- Accessing user data via Data.
The following actions are forbidden during this phase because they would either go unnoticed or have undesirable side-effects upon test execution:
- Modifying the PatternTest object in any way.
- Modifying the PatternTestState object in any way.
- Modifying the PatternTestStep object in any way.
The PatternTestInstanceState represents the state of the currently executing instance of this test; not the child. The child has not started running yet. When the child runs, the decorator actions installed in PatternTestActions will be invoked with references to the child's state as usual.
For some purposes it may be useful to save the PatternTestInstanceState for later use in the decorated action. For example, if the decorated action needs to invoke a method on the parent test fixture, then it will need to have the parent's PatternTestInstanceState. This is very easy using anonymous delegates (due to variable capture) but can also be accomplished with other means as required.
