Class ProtoApplication
Resolves the named application that a client or web session targets: a system under test with a
base address and protocol descriptors. Reads values from its ProtoTest:Applications:{app}
section. A scope selects an application with its own Application setting, defaulting to the
scope's own name, so a REST client, GraphQL client, and browser session can share one application.
public static class ProtoApplication
- Inheritance
-
ProtoApplication
- Inherited Members
Fields
SectionPath
The configuration prefix under which named applications are declared.
public const string SectionPath = "ProtoTest:Applications"
Field Value
Methods
BaseUrl(IConfiguration, string)
Returns the base address configured for an application, or null.
public static string? BaseUrl(IConfiguration configuration, string applicationName)
Parameters
configurationIConfigurationapplicationNamestring
Returns
BaseUrl(ProtoExecutionContext, string)
Returns the base address of an application for a running test: an address a started instance advertised through infrastructure settings wins over static configuration.
public static string? BaseUrl(ProtoExecutionContext context, string applicationName)
Parameters
contextProtoExecutionContextapplicationNamestring
Returns
Endpoint(IConfiguration, string, string)
Returns the relative path configured for a named endpoint of an application, or null.
public static string? Endpoint(IConfiguration configuration, string applicationName, string endpointName)
Parameters
configurationIConfigurationapplicationNamestringendpointNamestring
Returns
EndpointAddress(ProtoExecutionContext, string, string?)
Returns the address of an application endpoint: the application's base URL joined with its
Endpoints:{endpointName} path when one is configured, or the base URL unchanged.
public static string? EndpointAddress(ProtoExecutionContext context, string applicationName, string? endpointName)
Parameters
contextProtoExecutionContextapplicationNamestringendpointNamestring
Returns
GrpcAddress(ProtoExecutionContext, string)
Returns an application's gRPC address for a running test, with the same precedence as
BaseUrl(ProtoExecutionContext, string): a published value wins over
ProtoTest:Applications:{applicationName}:Grpc:Address in static configuration. Returns
null when neither is set, so the caller can fall back to the base address.
public static string? GrpcAddress(ProtoExecutionContext context, string applicationName)
Parameters
contextProtoExecutionContextapplicationNamestring
Returns
MissingSettingMessage(string, string)
Returns the error message used when an application has no configured document.
public static string MissingSettingMessage(string applicationName, string setting)
Parameters
Returns
ResolveName(IConfiguration, string, string)
Returns the application a scope targets: its {scopeSection}:Application value, or
fallback (normally the client or session name) when unset.
public static string ResolveName(IConfiguration configuration, string scopeSection, string fallback)
Parameters
configurationIConfigurationscopeSectionstringfallbackstring
Returns
ResolveSetting(IConfiguration, ProtoInfrastructureSettings?, string)
The one application-setting precedence: an address a started piece published through ProtoInfrastructureSettings wins over static configuration. Readiness, the HTTP and gRPC client initializers, browser sessions and device clients all resolve through here, and a suite that reads an application setting itself (a connection string a container published, for example) uses the same rule instead of re-implementing it.
public static string? ResolveSetting(IConfiguration configuration, ProtoInfrastructureSettings? settings, string key)
Parameters
configurationIConfigurationsettingsProtoInfrastructureSettingskeystring
Returns
Section(IConfiguration, string)
Returns the configuration section that describes an application.
public static IConfigurationSection Section(IConfiguration configuration, string applicationName)
Parameters
configurationIConfigurationapplicationNamestring