Interface ITestScenarioEnvironmentResource

Namespace
XBullet.EasyTesting.Hosting
Assembly
XBullet.EasyTesting.dll

An external dependency that starts before a scenario host and contributes dynamic test configuration or services.

public interface ITestScenarioEnvironmentResource : IAsyncDisposable
Inherited Members

Methods

CaptureDiagnosticsAsync(CancellationToken)

Captures the current state before a failed scenario is cleaned up.

ValueTask<object?> CaptureDiagnosticsAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancels diagnostic collection for this resource. The default token does not request cancellation. A thrown exception, including cancellation, is recorded as a diagnostic capture failure so cleanup can continue.

Returns

ValueTask<object>

A serializable diagnostic value, or null when the resource has no state to report. Ownership remains with the resource unless its implementation states otherwise.

ConfigureConfiguration(IConfigurationBuilder)

Adds configuration values after the external dependency has started.

void ConfigureConfiguration(IConfigurationBuilder configuration)

Parameters

configuration IConfigurationBuilder

The application configuration builder to mutate. The caller owns the builder; the resource must not retain or dispose it.

ConfigureServices(IServiceCollection)

Adds or replaces services after the external dependency has started.

void ConfigureServices(IServiceCollection services)

Parameters

services IServiceCollection

The scenario's service collection to mutate before the test host is built. The caller owns the collection; the resource must not retain or dispose it.

StartAsync(CancellationToken)

Starts the external dependency and waits until it is ready for the scenario.

ValueTask StartAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancels startup and readiness checks. When cancellation prevents scenario creation, the scenario context still disposes the resource. The default token does not request cancellation.

Returns

ValueTask

A task that completes when the dependency is ready for the test host.