How dependency resolution and functional injection work
masterTickSpec provides several ways to resolve additional parameters in step methods beyond simple regex captures:
- Instance Stashing (Functional Injection): If a step method returns a value, TickSpec stashes that instance under its type. Subsequent steps can request that type as a parameter. Only one value per type is stashed per scenario.
- Dependency Resolution: If an instance isn't found in the cache, TickSpec attempts to instantiate the required type using its widest constructor. Arguments for the constructor are resolved recursively. Constructed instances are then cached.
- Scenario Metadata: To access scenario-specific info like tags, include a parameter of type
ScenarioMetadatain your step method or constructor.
Lifecycle: Instances are per-scenario. The cache is cleared after each scenario, and any IDisposable instances are automatically disposed.