Struct FromContext
- Namespace
- TinyBDD
- Assembly
- TinyBDD.dll
Helper that allows starting Given chains against an explicit ScenarioContext,
instead of relying on Current.
public readonly struct FromContext
- Inherited Members
Constructors
FromContext(ScenarioContext)
Helper that allows starting Given chains against an explicit ScenarioContext,
instead of relying on Current.
public FromContext(ScenarioContext ctx)
Parameters
ctxScenarioContextThe scenario context to use for subsequent calls.
Methods
Given<T>(Func<CancellationToken, Task<T>>)
Starts a token-aware Given step with a default title and asynchronous setup.
public ScenarioChain<T> Given<T>(Func<CancellationToken, Task<T>> setup)
Parameters
setupFunc<CancellationToken, Task<T>>Asynchronous factory that observes a CancellationToken.
Returns
- ScenarioChain<T>
A ScenarioChain<T> that can be continued with
When/Then.
Type Parameters
TThe type produced by the setup function.
Given<T>(Func<T>)
Starts a Given step with a default title and synchronous setup.
public ScenarioChain<T> Given<T>(Func<T> setup)
Parameters
setupFunc<T>Synchronous factory for the initial value.
Returns
- ScenarioChain<T>
A ScenarioChain<T> that can be continued with
When/Then.
Type Parameters
TThe type produced by the setup function.
Given<T>(string, Func<CancellationToken, Task<T>>)
Starts a token-aware Given step with an explicit title and asynchronous setup.
public ScenarioChain<T> Given<T>(string title, Func<CancellationToken, Task<T>> setup)
Parameters
titlestringHuman-friendly step title.
setupFunc<CancellationToken, Task<T>>Asynchronous factory that observes a CancellationToken.
Returns
- ScenarioChain<T>
A ScenarioChain<T> that can be continued with
When/Then.
Type Parameters
TThe type produced by the setup function.
Given<T>(string, Func<T>)
Starts a Given step with an explicit title and synchronous setup.
public ScenarioChain<T> Given<T>(string title, Func<T> setup)
Parameters
Returns
- ScenarioChain<T>
A ScenarioChain<T> that can be continued with
When/Then.
Type Parameters
TThe type produced by the setup function.