DistributedApplicationFactory Methods
Class Methods 6 members
Factory for creating a distributed application for testing.
Creates an instance of
Http.HttpClient that is configured to route requests to the specified resource and endpoint. public class DistributedApplicationFactory{ public HttpClient CreateHttpClient( string resourceName, string? endpointName = null) { // ... }}Parameters
resourceName string endpointName string? optional Returns
HttpClient The Http.HttpClient. Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public class DistributedApplicationFactory{ public virtual void Dispose() { // ... }} Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
public class DistributedApplicationFactory{ public virtual ValueTask DisposeAsync() { // ... }}Returns
ValueTask A task that represents the asynchronous dispose operation. Gets the connection string for the specified resource.
public class DistributedApplicationFactory{ public ValueTask<string?> GetConnectionString( string resourceName) { // ... }}Parameters
resourceName string The resource name. Returns
ValueTask<string?> The connection string for the specified resource. Exceptions
ArgumentException The resource was not found or does not expose a connection string. Gets the endpoint for the specified resource.
public class DistributedApplicationFactory{ public Uri GetEndpoint( string resourceName, string? endpointName = null) { // ... }}Parameters
resourceName string The resource name. endpointName string? optional The optional endpoint name. If none are specified, the single defined endpoint is returned. Returns
Uri A URI representation of the endpoint. Exceptions
ArgumentException The resource was not found, no matching endpoint was found, or multiple endpoints were found. InvalidOperationException The resource has no endpoints. Starts the application.
public class DistributedApplicationFactory{ public Task StartAsync( CancellationToken cancellationToken = default(CancellationToken)) { // ... }}Parameters
cancellationToken CancellationToken optional A token used to signal cancellation. Returns
Task A Tasks.Task representing the completion of the operation.