# DistributedApplicationFactory

- Kind: `class`
- Package: [Aspire.Hosting.Testing](/reference/api/csharp/aspire.hosting.testing.md)
- Version: `13.3.0`
- Namespace: `Aspire.Hosting.Testing`
- Target framework: `net10.0`
- Source: [GitHub](https://github.com/microsoft/aspire/blob/5bd693ae1897dee5e2ce71c2cc08879c1c7eff51/src/Aspire.Hosting.Testing/DistributedApplicationFactory.cs)
- Implements: `IAsyncDisposable`, `IDisposable`

Factory for creating a distributed application for testing.

## Definition

```csharp
namespace Aspire.Hosting.Testing;

public class DistributedApplicationFactory
    : System.IAsyncDisposable,
      System.IDisposable
{
    // ...
}
```

## Constructors

- [DistributedApplicationFactory(Type, string[])](/reference/api/csharp/aspire.hosting.testing/distributedapplicationfactory/constructors.md#constructor-type-string) -- Factory for creating a distributed application for testing.
- [DistributedApplicationFactory(Type)](/reference/api/csharp/aspire.hosting.testing/distributedapplicationfactory/constructors.md#constructor-type) -- Initializes a new instance of the [DistributedApplicationFactory](/reference/api/csharp/aspire.hosting.testing/distributedapplicationfactory.md) class.

## Methods

- [CreateHttpClient(string, string?)](/reference/api/csharp/aspire.hosting.testing/distributedapplicationfactory/methods.md#createhttpclient-string-string) : `HttpClient` -- Creates an instance of `Http.HttpClient` that is configured to route requests to the specified resource and endpoint.
- [Dispose](/reference/api/csharp/aspire.hosting.testing/distributedapplicationfactory/methods.md#dispose) `virtual` -- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- [DisposeAsync](/reference/api/csharp/aspire.hosting.testing/distributedapplicationfactory/methods.md#disposeasync) : `ValueTask` `virtual` -- Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
- [GetConnectionString(string)](/reference/api/csharp/aspire.hosting.testing/distributedapplicationfactory/methods.md#getconnectionstring-string) : `ValueTask<string?>` -- Gets the connection string for the specified resource.
- [GetEndpoint(string, string?)](/reference/api/csharp/aspire.hosting.testing/distributedapplicationfactory/methods.md#getendpoint-string-string) : `Uri` -- Gets the endpoint for the specified resource.
- [StartAsync(CancellationToken)](/reference/api/csharp/aspire.hosting.testing/distributedapplicationfactory/methods.md#startasync-cancellationtoken) : `Task` -- Starts the application.
