# TestCluster

Package: [Microsoft.Orleans.TestingHost](/orleans/docs/api/csharp/microsoft.orleans.testinghost/) 10.0.0

[NuGet package](https://www.nuget.org/packages/Microsoft.Orleans.TestingHost) | [Source](https://github.com/dotnet/orleans/blob/e4e752cedecc2976811db49802c7a999b1f1c704/src/Orleans.TestingHost/TestCluster.cs#L38)

```csharp
public class TestCluster : IAsyncDisposable, IDisposable
```

A host class for local testing with Orleans using in-process silos. Runs a Primary and optionally secondary silos in separate app domains, and client in the main app domain. Additional silos can also be started in-process on demand if required for particular test cases.

## Remarks

Make sure that your test project references your test grains and test grain interfaces projects, and has CopyLocal=True set on those references [which should be the default].

## Constructors

- [TestCluster(TestClusterOptions, IReadOnlyList&lt;IConfigurationSource&gt;, ITestClusterPortAllocator)](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/constructors/constructor-orleans-testinghost-testclusteroptions-system-collections-generic-ir-2cad549b/)

## Properties

- [Client](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/properties/client-f2816cbb/)
- [ConfigurationSources](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/properties/configurationsources-236bb66b/)
- [CreateSiloAsync](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/properties/createsiloasync-1672850b/)
- [GrainFactory](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/properties/grainfactory-37f734cb/)
- [Options](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/properties/options-82bfa5fe/)
- [PortAllocator](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/properties/portallocator-3d6bf44d/)
- [Primary](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/properties/primary-2ac40f05/)
- [SecondarySilos](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/properties/secondarysilos-160253ca/)
- [ServiceProvider](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/properties/serviceprovider-b8be68d1/)
- [Silos](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/properties/silos-48e611e3/)

## Methods

- [DeactivateAsync(GrainId)](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/deactivateasync-orleans-runtime-grainid-a00d0fa2/)
- [DeactivateAsync(IAddressable)](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/deactivateasync-orleans-runtime-iaddressable-ca38fd22/)
- [DefaultCreateSiloAsync(string, IConfiguration)](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/defaultcreatesiloasync-string-microsoft-extensions-configuration-iconfiguration-4f4fa175/)
- [Deploy](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/deploy-9b52de7e/)
- [DeployAsync](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/deployasync-a87abe73/)
- [Dispose](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/dispose-0e48dc68/)
- [DisposeAsync](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/disposeasync-04d86e40/)
- [GetActiveSilos](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/getactivesilos-283e8449/)
- [GetLivenessStabilizationTime(ClusterMembershipOptions, bool)](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/getlivenessstabilizationtime-orleans-configuration-clustermembershipoptions-bool-aa019a4c/)
- [GetLog](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/getlog-a68e569e/)
- [GetSiloForAddress(SiloAddress)](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/getsiloforaddress-orleans-runtime-siloaddress-1c6e6e3b/)
- [GetSiloServiceProvider(SiloAddress)](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/getsiloserviceprovider-orleans-runtime-siloaddress-f7a0741f/)
- [InitializeClientAsync](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/initializeclientasync-014b493d/)
- [KillClientAsync](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/killclientasync-7c73a0ff/)
- [KillSiloAsync(SiloHandle)](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/killsiloasync-orleans-testinghost-silohandle-bd02b21f/)
- [MigrateAsync(GrainId, SiloAddress?)](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/migrateasync-orleans-runtime-grainid-orleans-runtime-siloaddress-nullable-6369b8f7/)
- [MigrateAsync(IAddressable, SiloAddress?)](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/migrateasync-orleans-runtime-iaddressable-orleans-runtime-siloaddress-nullable-22710b01/)
- [RestartSiloAsync(SiloHandle)](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/restartsiloasync-orleans-testinghost-silohandle-69932e82/)
- [RestartStoppedSecondarySiloAsync(string)](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/restartstoppedsecondarysiloasync-string-df78143d/)
- [StartAdditionalSilo(bool)](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/startadditionalsilo-bool-29a85f80/)
- [StartAdditionalSiloAsync(bool)](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/startadditionalsiloasync-bool-b6e72487/)
- [StartAdditionalSilosAsync(int, bool)](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/startadditionalsilosasync-int-bool-90a14c74/)
- [StartSiloAsync(int, TestClusterOptions, IReadOnlyList&lt;IConfigurationSource&gt;, bool)](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/startsiloasync-int-orleans-testinghost-testclusteroptions-system-collections-gen-31da1389/)
- [StartSiloAsync(TestCluster, int, TestClusterOptions, IReadOnlyList&lt;IConfigurationSource&gt;, bool)](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/startsiloasync-orleans-testinghost-testcluster-int-orleans-testinghost-testclust-f05dbb39/)
- [StopAllSilos](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/stopallsilos-49d0eb32/)
- [StopAllSilosAsync](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/stopallsilosasync-8ae3b417/)
- [StopClusterClientAsync](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/stopclusterclientasync-0cbb6af7/)
- [StopPrimarySiloAsync](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/stopprimarysiloasync-a5bfca01/)
- [StopSecondarySilosAsync](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/stopsecondarysilosasync-138d31f6/)
- [StopSiloAsync(SiloHandle)](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/stopsiloasync-orleans-testinghost-silohandle-f43cad87/)
- [TryGetGrainContext(GrainId, IGrainContext?)](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/trygetgraincontext-orleans-runtime-grainid-out-orleans-runtime-igraincontext-nul-fdbd0842/)
- [WaitForClusterManifestToStabilizeAsync(bool)](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/waitforclustermanifesttostabilizeasync-bool-1c071ac2/)
- [WaitForDeactivationAsync(GrainId)](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/waitfordeactivationasync-orleans-runtime-grainid-c72de505/)
- [WaitForDeactivationAsync(IAddressable)](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/waitfordeactivationasync-orleans-runtime-iaddressable-7eb90623/)
- [WaitForLivenessToStabilizeAsync(bool)](/orleans/docs/api/csharp/microsoft.orleans.testinghost/orleans.testinghost.testcluster/methods/waitforlivenesstostabilizeasync-bool-e1ef88fe/)
