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
TExampleThe 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
scenarioBuilderFunc<ExampleRow<TExample>, ThenChain<T>>A function that receives the example row and returns a terminal then chain.
ctCancellationTokenOptional cancellation token.
Returns
Type Parameters
TThe 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
scenarioBuilderFunc<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.
ctCancellationTokenOptional cancellation token.
Returns
- Task<ExamplesResult>
An ExamplesResult containing results for all examples.
Type Parameters
TThe 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
scenarioBuilderFunc<ExampleRow<TExample>, ThenChain<T>>A function that receives the example row and returns a terminal then chain.
ctCancellationTokenOptional cancellation token.
Returns
- Task<ExamplesResult>
An ExamplesResult containing results for all examples.
Type Parameters
TThe type carried through the scenario chain.