Class ProtoDeviceBuilder

Namespace
ProtoTest.Devices
Assembly
ProtoTest.Devices.dll

Configures the device clients a suite talks to, mirroring the REST and GraphQL builders: a named client is declared once with how its addresses resolve, and the typed devices that use it hang off the client.

public sealed class ProtoDeviceBuilder
Inheritance
ProtoDeviceBuilder
Inherited Members
Extension Methods

Properties

ApplicationName

Gets the application the builder was registered under, or null.

public string? ApplicationName { get; }

Property Value

string

Services

Gets the service collection the clients are registered into; backend packages use it.

public IServiceCollection Services { get; }

Property Value

IServiceCollection

Methods

AddClient(string, IProtoDeviceTransport, string?, Func<ProtoExecutionContext, string, string>?)

Declares a named client whose devices connect through transport.

public ProtoDeviceClientBuilder AddClient(string name, IProtoDeviceTransport transport, string? path = null, Func<ProtoExecutionContext, string, string>? resolveAddress = null)

Parameters

name string
transport IProtoDeviceTransport
path string
resolveAddress Func<ProtoExecutionContext, string, string>

Returns

ProtoDeviceClientBuilder

AddClient(string, string, string?, Func<ProtoExecutionContext, string, string>?)

Declares a named client by the transport's registered name. resolveAddress receives the running test and the device id and returns the address to connect to; build one with ProtoDeviceAddress for the common template and application cases. path is used instead when an in-process transport applies, so one registration covers both modes.

public ProtoDeviceClientBuilder AddClient(string name, string transportName, string? path = null, Func<ProtoExecutionContext, string, string>? resolveAddress = null)

Parameters

name string
transportName string
path string
resolveAddress Func<ProtoExecutionContext, string, string>

Returns

ProtoDeviceClientBuilder

AddTransport(IProtoDeviceTransport)

Registers a transport instance, for a backend the suite configured itself (or a test).

public ProtoDeviceBuilder AddTransport(IProtoDeviceTransport transport)

Parameters

transport IProtoDeviceTransport

Returns

ProtoDeviceBuilder

AddTransport<TTransport>(string?)

Registers a transport backend by type. Its name defaults to the transport's own Name; a backend package registers its transport for the suite.

public ProtoDeviceBuilder AddTransport<TTransport>(string? name = null) where TTransport : class, IProtoDeviceTransport

Parameters

name string

Returns

ProtoDeviceBuilder

Type Parameters

TTransport