Class TestScenarioContext

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

Provides the scenario identifier and cleanup registration to host extensions.

public sealed class TestScenarioContext
Inheritance
TestScenarioContext
Inherited Members

Properties

ScenarioId

Gets the unique identifier for this scenario scope.

public string ScenarioId { get; }

Property Value

string

A non-empty identifier generated for this scope. The identifier remains stable until the scope is disposed.

Methods

DisposeWithScenario(IAsyncDisposable)

Registers an asynchronously disposable scenario-owned resource.

public void DisposeWithScenario(IAsyncDisposable resource)

Parameters

resource IAsyncDisposable

The resource whose ownership transfers to the scenario. It is disposed once during cleanup, in reverse registration order.

DisposeWithScenario(IDisposable)

Registers a disposable scenario-owned resource.

public void DisposeWithScenario(IDisposable resource)

Parameters

resource IDisposable

The resource whose ownership transfers to the scenario. It is disposed once during cleanup, in reverse registration order.

OnCleanup(Func<ValueTask>)

Registers a custom scenario cleanup action.

public void OnCleanup(Func<ValueTask> cleanup)

Parameters

cleanup Func<ValueTask>

The asynchronous action invoked once during scenario cleanup. Cleanup actions run sequentially in reverse registration order. All actions run even when an earlier action fails, and their failures are reported together.