Interface IProtoHostBuilder

Namespace
ProtoTest.Core
Assembly
ProtoTest.Core.dll

Defines the builder contract for constructing and configuring a ProtoHost.

public interface IProtoHostBuilder
Extension Methods

Methods

AddResource(IProtoResource)

Registers a run-scoped resource: infrastructure the whole suite owns, such as a database container, released when the host is disposed after the run has stopped.

IProtoHostBuilder AddResource(IProtoResource resource)

Parameters

resource IProtoResource

Returns

IProtoHostBuilder

AddRunGate(string, Func<ProtoRunGateContext, ProtoRunGateResult>)

Registers a Run gate defined by a delegate.

IProtoHostBuilder AddRunGate(string name, Func<ProtoRunGateContext, ProtoRunGateResult> evaluate)

Parameters

name string
evaluate Func<ProtoRunGateContext, ProtoRunGateResult>

Returns

IProtoHostBuilder

AddRunGate<TGate>()

Registers a Run gate evaluated once the suite finishes. Gates see everything the run's collectors produced; a failed gate fails the run after the reports are written.

IProtoHostBuilder AddRunGate<TGate>() where TGate : class, IProtoRunGate

Returns

IProtoHostBuilder

Type Parameters

TGate

AddRunHook<TRunHook>()

Registers a suite-level lifecycle hook.

IProtoHostBuilder AddRunHook<TRunHook>() where TRunHook : class, IProtoRunHook

Returns

IProtoHostBuilder

Type Parameters

TRunHook

AddTestHook<THook>()

Registers a global execution lifecycle hook.

IProtoHostBuilder AddTestHook<THook>() where THook : class, IProtoTestHook

Returns

IProtoHostBuilder

The current IProtoHostBuilder instance.

Type Parameters

THook

Build()

Builds and initializes the configured ProtoHost instance.

ProtoHost Build()

Returns

ProtoHost

A fully configured ProtoHost.

ConfigureAppConfiguration(Action<IConfigurationBuilder>)

Configures the application configuration (appsettings.json, environment variables, etc.).

IProtoHostBuilder ConfigureAppConfiguration(Action<IConfigurationBuilder> configure)

Parameters

configure Action<IConfigurationBuilder>

Returns

IProtoHostBuilder

The current IProtoHostBuilder instance.

ConfigureServices(Action<IServiceCollection>)

Registers dependencies with the internal service collection.

IProtoHostBuilder ConfigureServices(Action<IServiceCollection> configure)

Parameters

configure Action<IServiceCollection>

Returns

IProtoHostBuilder

The current IProtoHostBuilder instance.

ConfigureTestIds(Action<ProtoTestIdOptions>)

Configures numeric test execution IDs generated by the host.

IProtoHostBuilder ConfigureTestIds(Action<ProtoTestIdOptions> configure)

Parameters

configure Action<ProtoTestIdOptions>

Returns

IProtoHostBuilder

ConfigureTracing(Action<ProtoTraceOptions>)

Configures the automatic execution trace written by ProtoTest.Core.

IProtoHostBuilder ConfigureTracing(Action<ProtoTraceOptions> configure)

Parameters

configure Action<ProtoTraceOptions>

Returns

IProtoHostBuilder