Class ProtoTestHostLifetime

Namespace
ProtoTest.Core
Assembly
ProtoTest.Core.dll

Owns the single root ProtoHost for a test assembly and enforces one-time initialization. Shared by every test-framework adapter so host lifetime, guards, and shutdown ordering stay identical across frameworks.

public sealed class ProtoTestHostLifetime
Inheritance
ProtoTestHostLifetime
Inherited Members
Extension Methods

Constructors

ProtoTestHostLifetime(string)

public ProtoTestHostLifetime(string initializationHint = "Initialize the ProtoTest assembly fixture before running tests.")

Parameters

initializationHint string

Adapter-specific guidance appended to the "not initialized" error message.

Properties

Host

Gets the initialized host.

public ProtoHost Host { get; }

Property Value

ProtoHost

Exceptions

InvalidOperationException

Thrown when accessed before initialization.

Methods

StartAsync(Action<IProtoHostBuilder>)

Builds and starts the host. Throws if it has already been initialized.

public Task StartAsync(Action<IProtoHostBuilder> configure)

Parameters

configure Action<IProtoHostBuilder>

Returns

Task

StopAsync()

Stops and disposes the host, clearing it so later access reports "not initialized".

public Task StopAsync()

Returns

Task