Class ScenarioChain<T>
- Namespace
- TinyBDD
- Assembly
- TinyBDD.dll
Represents a fluent chain starting at Given and flowing through When,
And, But, and into Then where it becomes an awaitable ThenChain<T>.
public sealed class ScenarioChain<T>
Type Parameters
TThe value type carried by the chain at the current position.
- Inheritance
-
ScenarioChain<T>
- Inherited Members
- Extension Methods
Examples
var ctx = Bdd.CreateContext(this);
await Bdd.Given(ctx, "start", () => 10)
.When("add 5", (x, _) => Task.FromResult(x + 5))
.And(v => v * 2)
.But("no-op", _ => Task.CompletedTask)
.Then(v => v == 30);
Remarks
Steps are recorded and executed only when the terminal ThenChain<T> is awaited. Overloads are provided for synchronous and asynchronous transforms and side-effects, with optional titles and cancellation tokens. A "default title" is used when the provided title is empty; format may vary by step kind.
User code exceptions thrown inside delegates are captured as step failures and surfaced in Steps and reporters.
Methods
And(Action<T>)
Adds a And side effect with a default title. Keeps the current value.
public ScenarioChain<T> And(Action<T> effect)
Parameters
effectAction<T>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
And(Func<T, CancellationToken, Task>)
Adds a And side effect with a default title. Keeps the current value.
public ScenarioChain<T> And(Func<T, CancellationToken, Task> effect)
Parameters
effectFunc<T, CancellationToken, Task>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
And(Func<T, CancellationToken, ValueTask>)
Adds a And side effect with a default title. Keeps the current value.
public ScenarioChain<T> And(Func<T, CancellationToken, ValueTask> effect)
Parameters
effectFunc<T, CancellationToken, ValueTask>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
And(Func<T, Task>)
Adds a And side effect with a default title. Keeps the current value.
public ScenarioChain<T> And(Func<T, Task> effect)
Parameters
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
And(Func<T, ValueTask>)
Adds a And side effect with a default title. Keeps the current value.
public ScenarioChain<T> And(Func<T, ValueTask> effect)
Parameters
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
And(string, Action<T>)
Adds a And side effect with an explicit title. Keeps the current value.
public ScenarioChain<T> And(string title, Action<T> effect)
Parameters
titlestringDisplay title for this step.
effectAction<T>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
And(string, Func<T, CancellationToken, Task>)
Adds a And side effect with an explicit title. Keeps the current value.
public ScenarioChain<T> And(string title, Func<T, CancellationToken, Task> effect)
Parameters
titlestringDisplay title for this step.
effectFunc<T, CancellationToken, Task>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
And(string, Func<T, CancellationToken, ValueTask>)
Adds a And side effect with an explicit title. Keeps the current value.
public ScenarioChain<T> And(string title, Func<T, CancellationToken, ValueTask> effect)
Parameters
titlestringDisplay title for this step.
effectFunc<T, CancellationToken, ValueTask>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
And(string, Func<T, Task>)
Adds a And side effect with an explicit title. Keeps the current value.
public ScenarioChain<T> And(string title, Func<T, Task> effect)
Parameters
titlestringDisplay title for this step.
effectFunc<T, Task>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
And(string, Func<T, ValueTask>)
Adds a And side effect with an explicit title. Keeps the current value.
public ScenarioChain<T> And(string title, Func<T, ValueTask> effect)
Parameters
titlestringDisplay title for this step.
effectFunc<T, ValueTask>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
And<TOut>(Func<T, CancellationToken, Task<TOut>>)
Adds a And transformation with a default title using a token-aware task function.
public ScenarioChain<TOut> And<TOut>(Func<T, CancellationToken, Task<TOut>> f)
Parameters
fFunc<T, CancellationToken, Task<TOut>>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
And<TOut>(Func<T, CancellationToken, ValueTask<TOut>>)
Adds a And transformation with a default title using a token-aware value task function.
public ScenarioChain<TOut> And<TOut>(Func<T, CancellationToken, ValueTask<TOut>> f)
Parameters
fFunc<T, CancellationToken, ValueTask<TOut>>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
And<TOut>(Func<T, Task<TOut>>)
Adds a And transformation with a default title using task function.
public ScenarioChain<TOut> And<TOut>(Func<T, Task<TOut>> f)
Parameters
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
And<TOut>(Func<T, ValueTask<TOut>>)
Adds a And transformation with a default title using value task function.
public ScenarioChain<TOut> And<TOut>(Func<T, ValueTask<TOut>> f)
Parameters
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
And<TOut>(Func<T, TOut>)
Adds a And transformation with a default title using sync function.
public ScenarioChain<TOut> And<TOut>(Func<T, TOut> f)
Parameters
fFunc<T, TOut>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
And<TOut>(string, Func<T, CancellationToken, Task<TOut>>)
Adds a And transformation with an explicit title using a token-aware task function.
public ScenarioChain<TOut> And<TOut>(string title, Func<T, CancellationToken, Task<TOut>> f)
Parameters
titlestringDisplay title for this step.
fFunc<T, CancellationToken, Task<TOut>>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
And<TOut>(string, Func<T, CancellationToken, ValueTask<TOut>>)
Adds a And transformation with an explicit title using a token-aware value task function.
public ScenarioChain<TOut> And<TOut>(string title, Func<T, CancellationToken, ValueTask<TOut>> f)
Parameters
titlestringDisplay title for this step.
fFunc<T, CancellationToken, ValueTask<TOut>>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
And<TOut>(string, Func<T, Task<TOut>>)
Adds a And transformation with an explicit title using task function.
public ScenarioChain<TOut> And<TOut>(string title, Func<T, Task<TOut>> f)
Parameters
titlestringDisplay title for this step.
fFunc<T, Task<TOut>>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
And<TOut>(string, Func<T, ValueTask<TOut>>)
Adds a And transformation with an explicit title using value task function.
public ScenarioChain<TOut> And<TOut>(string title, Func<T, ValueTask<TOut>> f)
Parameters
titlestringDisplay title for this step.
fFunc<T, ValueTask<TOut>>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
And<TOut>(string, Func<T, TOut>)
Adds a And transformation with an explicit title using sync function.
public ScenarioChain<TOut> And<TOut>(string title, Func<T, TOut> f)
Parameters
titlestringDisplay title for this step.
fFunc<T, TOut>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
And<TState>(string, TState, Action<T, TState>)
Adds an And side effect with state, avoiding closure allocation.
public ScenarioChain<T> And<TState>(string title, TState state, Action<T, TState> effect)
Parameters
Returns
Type Parameters
TState
And<TState, TOut>(string, TState, Func<T, TState, Task<TOut>>)
Adds an And transformation with state using async Task, avoiding closure allocation.
public ScenarioChain<TOut> And<TState, TOut>(string title, TState state, Func<T, TState, Task<TOut>> f)
Parameters
Returns
- ScenarioChain<TOut>
Type Parameters
TStateTOut
And<TState, TOut>(string, TState, Func<T, TState, TOut>)
Adds an And transformation with state, avoiding closure allocation.
public ScenarioChain<TOut> And<TState, TOut>(string title, TState state, Func<T, TState, TOut> f)
Parameters
Returns
- ScenarioChain<TOut>
Type Parameters
TStateTOut
But(Action<T>)
Adds a But side effect with a default title. Keeps the current value.
public ScenarioChain<T> But(Action<T> effect)
Parameters
effectAction<T>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
But(Func<T, CancellationToken, Task>)
Adds a But side effect with a default title. Keeps the current value.
public ScenarioChain<T> But(Func<T, CancellationToken, Task> effect)
Parameters
effectFunc<T, CancellationToken, Task>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
But(Func<T, CancellationToken, ValueTask>)
Adds a But side effect with a default title. Keeps the current value.
public ScenarioChain<T> But(Func<T, CancellationToken, ValueTask> effect)
Parameters
effectFunc<T, CancellationToken, ValueTask>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
But(Func<T, Task>)
Adds a But side effect with a default title. Keeps the current value.
public ScenarioChain<T> But(Func<T, Task> effect)
Parameters
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
But(Func<T, ValueTask>)
Adds a But side effect with a default title. Keeps the current value.
public ScenarioChain<T> But(Func<T, ValueTask> effect)
Parameters
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
But(string, Action<T>)
Adds a But side effect with an explicit title. Keeps the current value.
public ScenarioChain<T> But(string title, Action<T> effect)
Parameters
titlestringDisplay title for this step.
effectAction<T>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
But(string, Func<T, CancellationToken, Task>)
Adds a But side effect with an explicit title. Keeps the current value.
public ScenarioChain<T> But(string title, Func<T, CancellationToken, Task> effect)
Parameters
titlestringDisplay title for this step.
effectFunc<T, CancellationToken, Task>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
But(string, Func<T, CancellationToken, ValueTask>)
Adds a But side effect with an explicit title. Keeps the current value.
public ScenarioChain<T> But(string title, Func<T, CancellationToken, ValueTask> effect)
Parameters
titlestringDisplay title for this step.
effectFunc<T, CancellationToken, ValueTask>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
But(string, Func<T, Task>)
Adds a But side effect with an explicit title. Keeps the current value.
public ScenarioChain<T> But(string title, Func<T, Task> effect)
Parameters
titlestringDisplay title for this step.
effectFunc<T, Task>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
But(string, Func<T, ValueTask>)
Adds a But side effect with an explicit title. Keeps the current value.
public ScenarioChain<T> But(string title, Func<T, ValueTask> effect)
Parameters
titlestringDisplay title for this step.
effectFunc<T, ValueTask>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
But<TOut>(Func<T, CancellationToken, Task<TOut>>)
Adds a But transformation with a default title using a token-aware task function.
public ScenarioChain<TOut> But<TOut>(Func<T, CancellationToken, Task<TOut>> f)
Parameters
fFunc<T, CancellationToken, Task<TOut>>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
But<TOut>(Func<T, CancellationToken, ValueTask<TOut>>)
Adds a But transformation with a default title using a token-aware value task function.
public ScenarioChain<TOut> But<TOut>(Func<T, CancellationToken, ValueTask<TOut>> f)
Parameters
fFunc<T, CancellationToken, ValueTask<TOut>>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
But<TOut>(Func<T, Task<TOut>>)
Adds a But transformation with a default title using task function.
public ScenarioChain<TOut> But<TOut>(Func<T, Task<TOut>> f)
Parameters
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
But<TOut>(Func<T, ValueTask<TOut>>)
Adds a But transformation with a default title using value task function.
public ScenarioChain<TOut> But<TOut>(Func<T, ValueTask<TOut>> f)
Parameters
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
But<TOut>(Func<T, TOut>)
Adds a But transformation with a default title using sync function.
public ScenarioChain<TOut> But<TOut>(Func<T, TOut> f)
Parameters
fFunc<T, TOut>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
But<TOut>(string, Func<T, CancellationToken, Task<TOut>>)
Adds a But transformation with an explicit title using a token-aware task function.
public ScenarioChain<TOut> But<TOut>(string title, Func<T, CancellationToken, Task<TOut>> f)
Parameters
titlestringDisplay title for this step.
fFunc<T, CancellationToken, Task<TOut>>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
But<TOut>(string, Func<T, CancellationToken, ValueTask<TOut>>)
Adds a But transformation with an explicit title using a token-aware value task function.
public ScenarioChain<TOut> But<TOut>(string title, Func<T, CancellationToken, ValueTask<TOut>> f)
Parameters
titlestringDisplay title for this step.
fFunc<T, CancellationToken, ValueTask<TOut>>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
But<TOut>(string, Func<T, Task<TOut>>)
Adds a But transformation with an explicit title using task function.
public ScenarioChain<TOut> But<TOut>(string title, Func<T, Task<TOut>> f)
Parameters
titlestringDisplay title for this step.
fFunc<T, Task<TOut>>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
But<TOut>(string, Func<T, ValueTask<TOut>>)
Adds a But transformation with an explicit title using value task function.
public ScenarioChain<TOut> But<TOut>(string title, Func<T, ValueTask<TOut>> f)
Parameters
titlestringDisplay title for this step.
fFunc<T, ValueTask<TOut>>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
But<TOut>(string, Func<T, TOut>)
Adds a But transformation with an explicit title using sync function.
public ScenarioChain<TOut> But<TOut>(string title, Func<T, TOut> f)
Parameters
titlestringDisplay title for this step.
fFunc<T, TOut>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
But<TState>(string, TState, Action<T, TState>)
Adds a But side effect with state, avoiding closure allocation.
public ScenarioChain<T> But<TState>(string title, TState state, Action<T, TState> effect)
Parameters
Returns
Type Parameters
TState
But<TState, TOut>(string, TState, Func<T, TState, TOut>)
Adds a But transformation with state, avoiding closure allocation.
public ScenarioChain<TOut> But<TState, TOut>(string title, TState state, Func<T, TState, TOut> f)
Parameters
Returns
- ScenarioChain<TOut>
Type Parameters
TStateTOut
Finally(Action<T>)
Registers a cleanup handler that executes after all steps complete. The handler receives the current chain value and executes even if subsequent steps fail.
public ScenarioChain<T> Finally(Action<T> effect)
Parameters
effectAction<T>Cleanup action that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
Finally(Func<T, CancellationToken, Task>)
Registers a cleanup handler that executes after all steps complete. The handler receives the current chain value and executes even if subsequent steps fail.
public ScenarioChain<T> Finally(Func<T, CancellationToken, Task> effect)
Parameters
effectFunc<T, CancellationToken, Task>Cleanup action that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
Finally(Func<T, CancellationToken, ValueTask>)
Registers a cleanup handler that executes after all steps complete. The handler receives the current chain value and executes even if subsequent steps fail.
public ScenarioChain<T> Finally(Func<T, CancellationToken, ValueTask> effect)
Parameters
effectFunc<T, CancellationToken, ValueTask>Cleanup action that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
Finally(Func<T, Task>)
Registers a cleanup handler that executes after all steps complete. The handler receives the current chain value and executes even if subsequent steps fail.
public ScenarioChain<T> Finally(Func<T, Task> effect)
Parameters
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
Finally(Func<T, ValueTask>)
Registers a cleanup handler that executes after all steps complete. The handler receives the current chain value and executes even if subsequent steps fail.
public ScenarioChain<T> Finally(Func<T, ValueTask> effect)
Parameters
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
Finally(string, Action<T>)
Registers a cleanup handler with an explicit title that executes after all steps complete. The handler receives the current chain value and executes even if subsequent steps fail.
public ScenarioChain<T> Finally(string title, Action<T> effect)
Parameters
titlestringDisplay title for this finally handler.
effectAction<T>Cleanup action that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
Finally(string, Func<T, CancellationToken, Task>)
Registers a cleanup handler with an explicit title that executes after all steps complete. The handler receives the current chain value and executes even if subsequent steps fail.
public ScenarioChain<T> Finally(string title, Func<T, CancellationToken, Task> effect)
Parameters
titlestringDisplay title for this finally handler.
effectFunc<T, CancellationToken, Task>Cleanup action that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
Finally(string, Func<T, CancellationToken, ValueTask>)
Registers a cleanup handler with an explicit title that executes after all steps complete. The handler receives the current chain value and executes even if subsequent steps fail.
public ScenarioChain<T> Finally(string title, Func<T, CancellationToken, ValueTask> effect)
Parameters
titlestringDisplay title for this finally handler.
effectFunc<T, CancellationToken, ValueTask>Cleanup action that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
Finally(string, Func<T, Task>)
Registers a cleanup handler with an explicit title that executes after all steps complete. The handler receives the current chain value and executes even if subsequent steps fail.
public ScenarioChain<T> Finally(string title, Func<T, Task> effect)
Parameters
titlestringDisplay title for this finally handler.
effectFunc<T, Task>Cleanup action that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
Finally(string, Func<T, ValueTask>)
Registers a cleanup handler with an explicit title that executes after all steps complete. The handler receives the current chain value and executes even if subsequent steps fail.
public ScenarioChain<T> Finally(string title, Func<T, ValueTask> effect)
Parameters
titlestringDisplay title for this finally handler.
effectFunc<T, ValueTask>Cleanup action that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
Finally<TState>(string, TState, Action<T, TState>)
Registers a cleanup handler with state that executes after all steps complete.
public ScenarioChain<T> Finally<TState>(string title, TState state, Action<T, TState> effect)
Parameters
Returns
Type Parameters
TState
Finally<TState>(string, TState, Func<T, TState, Task>)
Registers a cleanup handler with state using async Task.
public ScenarioChain<T> Finally<TState>(string title, TState state, Func<T, TState, Task> effect)
Parameters
Returns
Type Parameters
TState
Then(Action)
Adds a Then assertion with a default title (no value parameter) using a synchronous action.
public ThenChain<T> Then(Action assertion)
Parameters
assertionActionAsynchronous assertion.
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(Action<T>)
Adds a Then assertion with a default title using a synchronous action.
public ThenChain<T> Then(Action<T> assertion)
Parameters
assertionAction<T>Asynchronous assertion that receives the carried value.
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(Func<bool>)
Adds a Then boolean assertion with a default title (no value parameter).
public ThenChain<T> Then(Func<bool> predicate)
Parameters
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(Func<Task<bool>>)
Adds a Then boolean assertion with a default title (no value parameter).
public ThenChain<T> Then(Func<Task<bool>> predicate)
Parameters
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(Func<Task>)
Adds a Then assertion with a default title (no value parameter).
public ThenChain<T> Then(Func<Task> assertion)
Parameters
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(Func<ValueTask>)
Adds a Then assertion with a default title (no value parameter).
public ThenChain<T> Then(Func<ValueTask> assertion)
Parameters
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(Func<T, bool>)
Adds a Then boolean assertion with a default title
public ThenChain<T> Then(Func<T, bool> predicate)
Parameters
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(Func<T, CancellationToken, Task<bool>>)
Adds a Then boolean assertion with a default title observing a token.
public ThenChain<T> Then(Func<T, CancellationToken, Task<bool>> predicate)
Parameters
predicateFunc<T, CancellationToken, Task<bool>>Predicate evaluated against the carried value.
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(Func<T, CancellationToken, Task>)
Adds a Then assertion with a default title observing a token.
public ThenChain<T> Then(Func<T, CancellationToken, Task> assertion)
Parameters
assertionFunc<T, CancellationToken, Task>Asynchronous assertion that receives the carried value.
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(Func<T, CancellationToken, ValueTask<bool>>)
Adds a Then boolean assertion with a default title observing a token.
public ThenChain<T> Then(Func<T, CancellationToken, ValueTask<bool>> predicate)
Parameters
predicateFunc<T, CancellationToken, ValueTask<bool>>Predicate evaluated against the carried value.
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(Func<T, CancellationToken, ValueTask>)
Adds a Then assertion with a default title observing a token.
public ThenChain<T> Then(Func<T, CancellationToken, ValueTask> assertion)
Parameters
assertionFunc<T, CancellationToken, ValueTask>Asynchronous assertion that receives the carried value.
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(Func<T, Task<bool>>)
Adds a Then boolean assertion with a default title
public ThenChain<T> Then(Func<T, Task<bool>> predicate)
Parameters
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(Func<T, Task>)
Adds a Then assertion with a default title
public ThenChain<T> Then(Func<T, Task> assertion)
Parameters
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(Func<T, ValueTask<bool>>)
Adds a Then boolean assertion with a default title
public ThenChain<T> Then(Func<T, ValueTask<bool>> predicate)
Parameters
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(Func<T, ValueTask>)
Adds a Then assertion with a default title
public ThenChain<T> Then(Func<T, ValueTask> assertion)
Parameters
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(string, Action)
Adds a Then assertion with an explicit title (no value parameter) using a synchronous action.
public ThenChain<T> Then(string title, Action assertion)
Parameters
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(string, Action<T>)
Adds a Then assertion with an explicit title using a synchronous action.
public ThenChain<T> Then(string title, Action<T> assertion)
Parameters
titlestringDisplay title for the assertion.
assertionAction<T>Asynchronous assertion that receives the carried value.
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(string, Func<bool>)
Adds a Then boolean assertion with an explicit title (no value parameter).
public ThenChain<T> Then(string title, Func<bool> predicate)
Parameters
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(string, Func<Task<bool>>)
Adds a Then boolean assertion with an explicit title (no value parameter).
public ThenChain<T> Then(string title, Func<Task<bool>> predicate)
Parameters
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(string, Func<Task>)
Adds a Then assertion with an explicit title (no value parameter).
public ThenChain<T> Then(string title, Func<Task> assertion)
Parameters
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(string, Func<ValueTask>)
Adds a Then assertion with an explicit title (no value parameter).
public ThenChain<T> Then(string title, Func<ValueTask> assertion)
Parameters
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(string, Func<T, bool>)
Adds a Then boolean assertion with an explicit title
public ThenChain<T> Then(string title, Func<T, bool> predicate)
Parameters
titlestringDisplay title for the assertion.
predicateFunc<T, bool>Predicate evaluated against the carried value.
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(string, Func<T, CancellationToken, Task<bool>>)
Adds a Then boolean assertion with an explicit title observing a token.
public ThenChain<T> Then(string title, Func<T, CancellationToken, Task<bool>> predicate)
Parameters
titlestringDisplay title for the assertion.
predicateFunc<T, CancellationToken, Task<bool>>Predicate evaluated against the carried value.
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(string, Func<T, CancellationToken, Task>)
Adds a Then assertion with an explicit title observing a token.
public ThenChain<T> Then(string title, Func<T, CancellationToken, Task> assertion)
Parameters
titlestringDisplay title for the assertion.
assertionFunc<T, CancellationToken, Task>Asynchronous assertion that receives the carried value.
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(string, Func<T, CancellationToken, ValueTask<bool>>)
Adds a Then boolean assertion with an explicit title observing a token.
public ThenChain<T> Then(string title, Func<T, CancellationToken, ValueTask<bool>> predicate)
Parameters
titlestringDisplay title for the assertion.
predicateFunc<T, CancellationToken, ValueTask<bool>>Predicate evaluated against the carried value.
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(string, Func<T, CancellationToken, ValueTask>)
Adds a Then assertion with an explicit title observing a token.
public ThenChain<T> Then(string title, Func<T, CancellationToken, ValueTask> assertion)
Parameters
titlestringDisplay title for the assertion.
assertionFunc<T, CancellationToken, ValueTask>Asynchronous assertion that receives the carried value.
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(string, Func<T, Task<bool>>)
Adds a Then boolean assertion with an explicit title
public ThenChain<T> Then(string title, Func<T, Task<bool>> predicate)
Parameters
titlestringDisplay title for the assertion.
predicateFunc<T, Task<bool>>Predicate evaluated against the carried value.
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(string, Func<T, Task>)
Adds a Then assertion with an explicit title
public ThenChain<T> Then(string title, Func<T, Task> assertion)
Parameters
titlestringDisplay title for the assertion.
assertionFunc<T, Task>Asynchronous assertion that receives the carried value.
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(string, Func<T, ValueTask<bool>>)
Adds a Then boolean assertion with an explicit title
public ThenChain<T> Then(string title, Func<T, ValueTask<bool>> predicate)
Parameters
titlestringDisplay title for the assertion.
predicateFunc<T, ValueTask<bool>>Predicate evaluated against the carried value.
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then(string, Func<T, ValueTask>)
Adds a Then assertion with an explicit title
public ThenChain<T> Then(string title, Func<T, ValueTask> assertion)
Parameters
titlestringDisplay title for the assertion.
assertionFunc<T, ValueTask>Asynchronous assertion that receives the carried value.
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Then<TOut>(Func<T, CancellationToken, Task<TOut>>)
Adds a Then transform that returns a value used only for assertion side-effects.
public ThenChain<TOut> Then<TOut>(Func<T, CancellationToken, Task<TOut>> assertion)
Parameters
assertionFunc<T, CancellationToken, Task<TOut>>Asynchronous function that receives the carried value and a token.
Returns
- ThenChain<TOut>
A ThenChain<T> for further chaining.
Type Parameters
TOutThe result produced by the assertion delegate (ignored by the chain).
Then<TOut>(Func<T, Task<TOut>>)
Adds a Then transform that returns a value used only for assertion side-effects.
public ThenChain<TOut> Then<TOut>(Func<T, Task<TOut>> assertion)
Parameters
Returns
- ThenChain<TOut>
A ThenChain<T> for further chaining.
Type Parameters
TOutThe result produced by the assertion delegate (ignored by the chain).
Then<TOut>(string, Func<T, CancellationToken, Task<TOut>>)
Adds a Then transform that returns a value used only for assertion side-effects.
public ThenChain<TOut> Then<TOut>(string title, Func<T, CancellationToken, Task<TOut>> assertion)
Parameters
titlestringDisplay title for the assertion.
assertionFunc<T, CancellationToken, Task<TOut>>Asynchronous function that receives the carried value and a token.
Returns
- ThenChain<TOut>
A ThenChain<T> for further chaining.
Type Parameters
TOutThe result produced by the assertion delegate (ignored by the chain).
Then<TOut>(string, Func<T, Task<TOut>>)
Adds a Then transform that returns a value used only for assertion side-effects.
public ThenChain<TOut> Then<TOut>(string title, Func<T, Task<TOut>> assertion)
Parameters
titlestringDisplay title for the assertion.
assertionFunc<T, Task<TOut>>Asynchronous function that receives the carried value.
Returns
- ThenChain<TOut>
A ThenChain<T> for further chaining.
Type Parameters
TOutThe result produced by the assertion delegate (ignored by the chain).
Then<TState>(string, TState, Action<T, TState>)
Adds a Then assertion with state, avoiding closure allocation.
public ThenChain<T> Then<TState>(string title, TState state, Action<T, TState> assertion)
Parameters
Returns
- ThenChain<T>
Type Parameters
TState
Then<TState>(string, TState, Func<T, TState, bool>)
Adds a Then predicate with state, avoiding closure allocation.
public ThenChain<T> Then<TState>(string title, TState state, Func<T, TState, bool> predicate)
Parameters
titlestringDisplay title for the assertion.
stateTStateState value to pass to the predicate function.
predicateFunc<T, TState, bool>Predicate evaluated against the carried value and state.
Returns
- ThenChain<T>
A ThenChain<T> for further chaining.
Type Parameters
TStateThe type of state to pass.
Then<TState>(string, TState, Func<T, TState, Task<bool>>)
Adds a Then predicate with state using async Task, avoiding closure allocation.
public ThenChain<T> Then<TState>(string title, TState state, Func<T, TState, Task<bool>> predicate)
Parameters
Returns
- ThenChain<T>
Type Parameters
TState
When(Action<T>)
Adds a When side effect with a default title. Keeps the current value.
public ScenarioChain<T> When(Action<T> effect)
Parameters
effectAction<T>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
When(Func<T, CancellationToken, Task>)
Adds a When side effect with a default title. Keeps the current value.
public ScenarioChain<T> When(Func<T, CancellationToken, Task> effect)
Parameters
effectFunc<T, CancellationToken, Task>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
When(Func<T, CancellationToken, ValueTask>)
Adds a When side effect with a default title. Keeps the current value.
public ScenarioChain<T> When(Func<T, CancellationToken, ValueTask> effect)
Parameters
effectFunc<T, CancellationToken, ValueTask>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
When(Func<T, Task>)
Adds a When side effect with a default title. Keeps the current value.
public ScenarioChain<T> When(Func<T, Task> effect)
Parameters
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
When(Func<T, ValueTask>)
Adds a When side effect with a default title. Keeps the current value.
public ScenarioChain<T> When(Func<T, ValueTask> effect)
Parameters
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
When(string, Action<T>)
Adds a When side effect with an explicit title. Keeps the current value.
public ScenarioChain<T> When(string title, Action<T> effect)
Parameters
titlestringDisplay title for this step.
effectAction<T>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
When(string, Func<T, CancellationToken, Task>)
Adds a When side effect with an explicit title. Keeps the current value.
public ScenarioChain<T> When(string title, Func<T, CancellationToken, Task> effect)
Parameters
titlestringDisplay title for this step.
effectFunc<T, CancellationToken, Task>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
When(string, Func<T, CancellationToken, ValueTask>)
Adds a When side effect with an explicit title. Keeps the current value.
public ScenarioChain<T> When(string title, Func<T, CancellationToken, ValueTask> effect)
Parameters
titlestringDisplay title for this step.
effectFunc<T, CancellationToken, ValueTask>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
When(string, Func<T, Task>)
Adds a When side effect with an explicit title. Keeps the current value.
public ScenarioChain<T> When(string title, Func<T, Task> effect)
Parameters
titlestringDisplay title for this step.
effectFunc<T, Task>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
When(string, Func<T, ValueTask>)
Adds a When side effect with an explicit title. Keeps the current value.
public ScenarioChain<T> When(string title, Func<T, ValueTask> effect)
Parameters
titlestringDisplay title for this step.
effectFunc<T, ValueTask>Side-effect that receives the carried value.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
When<TOut>(Func<T, CancellationToken, Task<TOut>>)
Adds a When transformation with a default title using a token-aware task function.
public ScenarioChain<TOut> When<TOut>(Func<T, CancellationToken, Task<TOut>> f)
Parameters
fFunc<T, CancellationToken, Task<TOut>>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
When<TOut>(Func<T, CancellationToken, ValueTask<TOut>>)
Adds a When transformation with a default title using a token-aware value task function.
public ScenarioChain<TOut> When<TOut>(Func<T, CancellationToken, ValueTask<TOut>> f)
Parameters
fFunc<T, CancellationToken, ValueTask<TOut>>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
When<TOut>(Func<T, Task<TOut>>)
Adds a When transformation with a default title using task function.
public ScenarioChain<TOut> When<TOut>(Func<T, Task<TOut>> f)
Parameters
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
When<TOut>(Func<T, ValueTask<TOut>>)
Adds a When transformation with a default title using value task function.
public ScenarioChain<TOut> When<TOut>(Func<T, ValueTask<TOut>> f)
Parameters
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
When<TOut>(Func<T, TOut>)
Adds a When transformation with a default title using sync function.
public ScenarioChain<TOut> When<TOut>(Func<T, TOut> f)
Parameters
fFunc<T, TOut>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
When<TOut>(string, Func<T, CancellationToken, Task<TOut>>)
Adds a When transformation with an explicit title using a token-aware task function.
public ScenarioChain<TOut> When<TOut>(string title, Func<T, CancellationToken, Task<TOut>> f)
Parameters
titlestringDisplay title for this step.
fFunc<T, CancellationToken, Task<TOut>>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
When<TOut>(string, Func<T, CancellationToken, ValueTask<TOut>>)
Adds a When transformation with an explicit title using a token-aware value task function.
public ScenarioChain<TOut> When<TOut>(string title, Func<T, CancellationToken, ValueTask<TOut>> f)
Parameters
titlestringDisplay title for this step.
fFunc<T, CancellationToken, ValueTask<TOut>>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
When<TOut>(string, Func<T, Task<TOut>>)
Adds a When transformation with an explicit title using task function.
public ScenarioChain<TOut> When<TOut>(string title, Func<T, Task<TOut>> f)
Parameters
titlestringDisplay title for this step.
fFunc<T, Task<TOut>>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
When<TOut>(string, Func<T, ValueTask<TOut>>)
Adds a When transformation with an explicit title using value task function.
public ScenarioChain<TOut> When<TOut>(string title, Func<T, ValueTask<TOut>> f)
Parameters
titlestringDisplay title for this step.
fFunc<T, ValueTask<TOut>>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
When<TOut>(string, Func<T, TOut>)
Adds a When transformation with an explicit title using sync function.
public ScenarioChain<TOut> When<TOut>(string title, Func<T, TOut> f)
Parameters
titlestringDisplay title for this step.
fFunc<T, TOut>Transformation applied to the carried value.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TOutThe result type of the transformation.
When<TState>(string, TState, Action<T, TState>)
Adds a When side effect with state, avoiding closure allocation.
public ScenarioChain<T> When<TState>(string title, TState state, Action<T, TState> effect)
Parameters
titlestringDisplay title for this step.
stateTStateState value to pass to the effect function.
effectAction<T, TState>Side-effect that receives the carried value and state.
Returns
- ScenarioChain<T>
The same ScenarioChain<T> for further chaining.
Type Parameters
TStateThe type of state to pass.
When<TState, TOut>(string, TState, Func<T, TState, CancellationToken, Task<TOut>>)
Adds a When transformation with state using token-aware async Task, avoiding closure allocation.
public ScenarioChain<TOut> When<TState, TOut>(string title, TState state, Func<T, TState, CancellationToken, Task<TOut>> f)
Parameters
titlestringstateTStatefFunc<T, TState, CancellationToken, Task<TOut>>
Returns
- ScenarioChain<TOut>
Type Parameters
TStateTOut
When<TState, TOut>(string, TState, Func<T, TState, Task<TOut>>)
Adds a When transformation with state using async Task, avoiding closure allocation.
public ScenarioChain<TOut> When<TState, TOut>(string title, TState state, Func<T, TState, Task<TOut>> f)
Parameters
Returns
- ScenarioChain<TOut>
Type Parameters
TStateTOut
When<TState, TOut>(string, TState, Func<T, TState, ValueTask<TOut>>)
Adds a When transformation with state using async ValueTask, avoiding closure allocation.
public ScenarioChain<TOut> When<TState, TOut>(string title, TState state, Func<T, TState, ValueTask<TOut>> f)
Parameters
Returns
- ScenarioChain<TOut>
Type Parameters
TStateTOut
When<TState, TOut>(string, TState, Func<T, TState, TOut>)
Adds a When transformation with state, avoiding closure allocation.
public ScenarioChain<TOut> When<TState, TOut>(string title, TState state, Func<T, TState, TOut> f)
Parameters
titlestringDisplay title for this step.
stateTStateState value to pass to the transform function.
fFunc<T, TState, TOut>Transformation applied to the carried value and state.
Returns
- ScenarioChain<TOut>
A new ScenarioChain<T> carrying the transformed value.
Type Parameters
TStateThe type of state to pass.
TOutThe result type of the transformation.