Table of Contents

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

T

The 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

effect Action<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

effect Func<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

effect Func<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

effect Func<T, Task>

Side-effect that receives the carried value.

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

effect Func<T, ValueTask>

Side-effect that receives the carried value.

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

title string

Display title for this step.

effect Action<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

title string

Display title for this step.

effect Func<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

title string

Display title for this step.

effect Func<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

title string

Display title for this step.

effect Func<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

title string

Display title for this step.

effect Func<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

f Func<T, CancellationToken, Task<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

f Func<T, CancellationToken, ValueTask<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

f Func<T, Task<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

f Func<T, ValueTask<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

f Func<T, TOut>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

title string

Display title for this step.

f Func<T, CancellationToken, Task<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

title string

Display title for this step.

f Func<T, CancellationToken, ValueTask<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

title string

Display title for this step.

f Func<T, Task<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

title string

Display title for this step.

f Func<T, ValueTask<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

title string

Display title for this step.

f Func<T, TOut>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

title string
state TState
effect Action<T, TState>

Returns

ScenarioChain<T>

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

title string
state TState
f Func<T, TState, Task<TOut>>

Returns

ScenarioChain<TOut>

Type Parameters

TState
TOut

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

title string
state TState
f Func<T, TState, TOut>

Returns

ScenarioChain<TOut>

Type Parameters

TState
TOut

But(Action<T>)

Adds a But side effect with a default title. Keeps the current value.

public ScenarioChain<T> But(Action<T> effect)

Parameters

effect Action<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

effect Func<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

effect Func<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

effect Func<T, Task>

Side-effect that receives the carried value.

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

effect Func<T, ValueTask>

Side-effect that receives the carried value.

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

title string

Display title for this step.

effect Action<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

title string

Display title for this step.

effect Func<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

title string

Display title for this step.

effect Func<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

title string

Display title for this step.

effect Func<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

title string

Display title for this step.

effect Func<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

f Func<T, CancellationToken, Task<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

f Func<T, CancellationToken, ValueTask<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

f Func<T, Task<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

f Func<T, ValueTask<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

f Func<T, TOut>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

title string

Display title for this step.

f Func<T, CancellationToken, Task<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

title string

Display title for this step.

f Func<T, CancellationToken, ValueTask<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

title string

Display title for this step.

f Func<T, Task<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

title string

Display title for this step.

f Func<T, ValueTask<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

title string

Display title for this step.

f Func<T, TOut>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

title string
state TState
effect Action<T, TState>

Returns

ScenarioChain<T>

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

title string
state TState
f Func<T, TState, TOut>

Returns

ScenarioChain<TOut>

Type Parameters

TState
TOut

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

effect Action<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

effect Func<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

effect Func<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

effect Func<T, Task>

Cleanup action that receives the carried value.

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

effect Func<T, ValueTask>

Cleanup action that receives the carried value.

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

title string

Display title for this finally handler.

effect Action<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

title string

Display title for this finally handler.

effect Func<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

title string

Display title for this finally handler.

effect Func<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

title string

Display title for this finally handler.

effect Func<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

title string

Display title for this finally handler.

effect Func<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

title string
state TState
effect Action<T, TState>

Returns

ScenarioChain<T>

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

title string
state TState
effect Func<T, TState, Task>

Returns

ScenarioChain<T>

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

assertion Action

Asynchronous 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

assertion Action<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

predicate Func<bool>

Predicate to evaluate.

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

predicate Func<Task<bool>>

Predicate to evaluate.

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

assertion Func<Task>

Asynchronous assertion.

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

assertion Func<ValueTask>

Asynchronous assertion.

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

predicate Func<T, bool>

Predicate evaluated against the carried value.

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

predicate Func<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

assertion Func<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

predicate Func<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

assertion Func<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

predicate Func<T, Task<bool>>

Predicate evaluated against the carried value.

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

assertion Func<T, Task>

Asynchronous assertion that receives the carried value.

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

predicate Func<T, ValueTask<bool>>

Predicate evaluated against the carried value.

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

assertion Func<T, ValueTask>

Asynchronous assertion that receives the carried value.

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

title string

Display title for the assertion.

assertion Action

Asynchronous assertion.

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

title string

Display title for the assertion.

assertion Action<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

title string

Display title for the assertion.

predicate Func<bool>

Predicate to evaluate.

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

title string

Display title for the assertion.

predicate Func<Task<bool>>

Predicate to evaluate.

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

title string

Display title for the assertion.

assertion Func<Task>

Asynchronous assertion.

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

title string

Display title for the assertion.

assertion Func<ValueTask>

Asynchronous assertion.

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

title string

Display title for the assertion.

predicate Func<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

title string

Display title for the assertion.

predicate Func<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

title string

Display title for the assertion.

assertion Func<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

title string

Display title for the assertion.

predicate Func<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

title string

Display title for the assertion.

assertion Func<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

title string

Display title for the assertion.

predicate Func<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

title string

Display title for the assertion.

assertion Func<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

title string

Display title for the assertion.

predicate Func<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

title string

Display title for the assertion.

assertion Func<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

assertion Func<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

TOut

The 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

assertion Func<T, Task<TOut>>

Asynchronous function that receives the carried value.

Returns

ThenChain<TOut>

A ThenChain<T> for further chaining.

Type Parameters

TOut

The 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

title string

Display title for the assertion.

assertion Func<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

TOut

The 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

title string

Display title for the assertion.

assertion Func<T, Task<TOut>>

Asynchronous function that receives the carried value.

Returns

ThenChain<TOut>

A ThenChain<T> for further chaining.

Type Parameters

TOut

The 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

title string
state TState
assertion Action<T, TState>

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

title string

Display title for the assertion.

state TState

State value to pass to the predicate function.

predicate Func<T, TState, bool>

Predicate evaluated against the carried value and state.

Returns

ThenChain<T>

A ThenChain<T> for further chaining.

Type Parameters

TState

The 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

title string
state TState
predicate Func<T, TState, Task<bool>>

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

effect Action<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

effect Func<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

effect Func<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

effect Func<T, Task>

Side-effect that receives the carried value.

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

effect Func<T, ValueTask>

Side-effect that receives the carried value.

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

title string

Display title for this step.

effect Action<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

title string

Display title for this step.

effect Func<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

title string

Display title for this step.

effect Func<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

title string

Display title for this step.

effect Func<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

title string

Display title for this step.

effect Func<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

f Func<T, CancellationToken, Task<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

f Func<T, CancellationToken, ValueTask<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

f Func<T, Task<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

f Func<T, ValueTask<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

f Func<T, TOut>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

title string

Display title for this step.

f Func<T, CancellationToken, Task<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

title string

Display title for this step.

f Func<T, CancellationToken, ValueTask<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

title string

Display title for this step.

f Func<T, Task<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

title string

Display title for this step.

f Func<T, ValueTask<TOut>>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

title string

Display title for this step.

f Func<T, TOut>

Transformation applied to the carried value.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TOut

The 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

title string

Display title for this step.

state TState

State value to pass to the effect function.

effect Action<T, TState>

Side-effect that receives the carried value and state.

Returns

ScenarioChain<T>

The same ScenarioChain<T> for further chaining.

Type Parameters

TState

The 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

title string
state TState
f Func<T, TState, CancellationToken, Task<TOut>>

Returns

ScenarioChain<TOut>

Type Parameters

TState
TOut

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

title string
state TState
f Func<T, TState, Task<TOut>>

Returns

ScenarioChain<TOut>

Type Parameters

TState
TOut

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

title string
state TState
f Func<T, TState, ValueTask<TOut>>

Returns

ScenarioChain<TOut>

Type Parameters

TState
TOut

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

title string

Display title for this step.

state TState

State value to pass to the transform function.

f Func<T, TState, TOut>

Transformation applied to the carried value and state.

Returns

ScenarioChain<TOut>

A new ScenarioChain<T> carrying the transformed value.

Type Parameters

TState

The type of state to pass.

TOut

The result type of the transformation.

See Also