Table of Contents

Class ExamplesBuilder<TExample>

Namespace
TinyBDD
Assembly
TinyBDD.dll

Fluent builder for data-driven scenarios that executes a scenario template for each example row.

public sealed class ExamplesBuilder<TExample>

Type Parameters

TExample

The type of example data.

Inheritance
ExamplesBuilder<TExample>
Inherited Members

Methods

AssertAllPassedAsync<T>(Func<ExampleRow<TExample>, ThenChain<T>>, CancellationToken)

Executes the scenario for each example row and asserts all passed.

public Task AssertAllPassedAsync<T>(Func<ExampleRow<TExample>, ThenChain<T>> scenarioBuilder, CancellationToken ct = default)

Parameters

scenarioBuilder Func<ExampleRow<TExample>, ThenChain<T>>

A function that receives the example row and returns a terminal then chain.

ct CancellationToken

Optional cancellation token.

Returns

Task

Type Parameters

T

The type carried through the scenario chain.

Exceptions

AggregateException

Thrown when one or more examples failed.

ForEachAsync<T>(Func<ExampleRow<TExample>, ScenarioChain<T>>, CancellationToken)

Executes the scenario for each example row using a builder function that creates a ScenarioChain<T>.

public Task<ExamplesResult> ForEachAsync<T>(Func<ExampleRow<TExample>, ScenarioChain<T>> scenarioBuilder, CancellationToken ct = default)

Parameters

scenarioBuilder Func<ExampleRow<TExample>, ScenarioChain<T>>

A function that receives the example row and returns a scenario chain. The chain should end with a Then step but not call AssertPassed.

ct CancellationToken

Optional cancellation token.

Returns

Task<ExamplesResult>

An ExamplesResult containing results for all examples.

Type Parameters

T

The type carried through the scenario chain.

ForEachAsync<T>(Func<ExampleRow<TExample>, ThenChain<T>>, CancellationToken)

Executes the scenario for each example row using a builder function that creates a ThenChain<T>.

public Task<ExamplesResult> ForEachAsync<T>(Func<ExampleRow<TExample>, ThenChain<T>> scenarioBuilder, CancellationToken ct = default)

Parameters

scenarioBuilder Func<ExampleRow<TExample>, ThenChain<T>>

A function that receives the example row and returns a terminal then chain.

ct CancellationToken

Optional cancellation token.

Returns

Task<ExamplesResult>

An ExamplesResult containing results for all examples.

Type Parameters

T

The type carried through the scenario chain.