> ## Documentation Index
> Fetch the complete documentation index at: https://easyaf.nimbleapps.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# BreakdanceTestBase

> A base class for unit tests that maintains an [IHost](https://learn.microsoft.com/dotnet/api/microsoft.extensions.hosting.ihost) with configuration and a Dep...

## Definition

**Assembly:** CloudNimble.Breakdance.Assemblies.dll

**Namespace:** CloudNimble.Breakdance.Assemblies

**Inheritance:** System.Object

## Syntax

```csharp theme={"dark"}
CloudNimble.Breakdance.Assemblies.BreakdanceTestBase
```

## Summary

A base class for unit tests that maintains an [IHost](https://learn.microsoft.com/dotnet/api/microsoft.extensions.hosting.ihost) with configuration and a Dependency Injection container.

## Constructors

### &#x20;.ctor

Creates a new [BreakdanceTestBase](https://easyaf.nimbleapps.cloud/breakdance/api-reference/CloudNimble/Breakdance/Assemblies/BreakdanceTestBase.md) instance.

#### Syntax

```csharp theme={"dark"}
public BreakdanceTestBase()
```

### &#x20;.ctor Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public Object()
```

## Properties

### &#x20;DefaultScope

Provides a default [IServiceScope](https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicescope) implementation to contain scoped services.

#### Syntax

```csharp theme={"dark"}
public Microsoft.Extensions.DependencyInjection.IServiceScope DefaultScope { get; set; }
```

#### Property Value

Type: `Microsoft.Extensions.DependencyInjection.IServiceScope`

### &#x20;TestHost

The [IHost](https://learn.microsoft.com/dotnet/api/microsoft.extensions.hosting.ihost) instance containing the test host.

#### Syntax

```csharp theme={"dark"}
public Microsoft.Extensions.Hosting.IHost TestHost { get; internal set; }
```

#### Property Value

Type: `Microsoft.Extensions.Hosting.IHost`

### &#x20;TestHostBuilder

The [IHostBuilder](https://easyaf.nimbleapps.cloud/breakdance/api-reference/Microsoft/Extensions/Hosting/IHostBuilder.md) instance used to configure the test host.

#### Syntax

```csharp theme={"dark"}
public Microsoft.Extensions.Hosting.IHostBuilder TestHostBuilder { get; internal set; }
```

#### Property Value

Type: `Microsoft.Extensions.Hosting.IHostBuilder`

## Methods

### &#x20;AssemblySetup Virtual

Method used by test assemblies to setup the environment.

#### Syntax

```csharp theme={"dark"}
public virtual void AssemblySetup()
```

#### Remarks

With MSTest, use \[AssemblyInitialize].
With NUnit, use \[OneTimeSetup].
With xUnit, good luck: [https://xunit.net/docs/shared-context](https://xunit.net/docs/shared-context)
This method calls [BreakdanceTestBase.AssemblySetupAsync](https://easyaf.nimbleapps.cloud/breakdance/api-reference/CloudNimble/Breakdance/Assemblies/BreakdanceTestBase.md#assemblysetupasync) synchronously.

### &#x20;AssemblySetupAsync Virtual

Method used by test assemblies to setup the environment asynchronously.

#### Syntax

```csharp theme={"dark"}
public virtual System.Threading.Tasks.Task AssemblySetupAsync()
```

#### Returns

Type: `System.Threading.Tasks.Task`

#### Remarks

With MSTest, use \[AssemblyInitialize] with async Task return type.
With NUnit, use \[OneTimeSetup] with async Task return type.
With xUnit, good luck: [https://xunit.net/docs/shared-context](https://xunit.net/docs/shared-context)

### &#x20;AssemblyTearDown Virtual

Method used by test assemblies to clean up the environment.

#### Syntax

```csharp theme={"dark"}
public virtual void AssemblyTearDown()
```

#### Remarks

With MSTest, use \[AssemblyCleanup].
With NUnit, use \[OneTimeTearDown].
With xUnit, good luck: [https://xunit.net/docs/shared-context](https://xunit.net/docs/shared-context)
This method calls [BreakdanceTestBase.AssemblyTearDownAsync](https://easyaf.nimbleapps.cloud/breakdance/api-reference/CloudNimble/Breakdance/Assemblies/BreakdanceTestBase.md#assemblyteardownasync) synchronously.

### &#x20;AssemblyTearDownAsync Virtual

Method used by test assemblies to clean up the environment asynchronously.

#### Syntax

```csharp theme={"dark"}
public virtual System.Threading.Tasks.Task AssemblyTearDownAsync()
```

#### Returns

Type: `System.Threading.Tasks.Task`

#### Remarks

With MSTest, use \[AssemblyCleanup] with async Task return type.
With NUnit, use \[OneTimeTearDown] with async Task return type.
With xUnit, good luck: [https://xunit.net/docs/shared-context](https://xunit.net/docs/shared-context)

### &#x20;ClassSetup Virtual

Method used by test classes to setup the environment.

#### Syntax

```csharp theme={"dark"}
public virtual void ClassSetup()
```

#### Remarks

With MSTest, use \[ClassInitialize].
With NUnit, use \[OneTimeSetup].
With xUnit, good luck: [https://xunit.net/docs/shared-context](https://xunit.net/docs/shared-context)
This method calls [BreakdanceTestBase.ClassSetupAsync](https://easyaf.nimbleapps.cloud/breakdance/api-reference/CloudNimble/Breakdance/Assemblies/BreakdanceTestBase.md#classsetupasync) synchronously.

### &#x20;ClassSetupAsync Virtual

Method used by test classes to setup the environment asynchronously.

#### Syntax

```csharp theme={"dark"}
public virtual System.Threading.Tasks.Task ClassSetupAsync()
```

#### Returns

Type: `System.Threading.Tasks.Task`

#### Remarks

With MSTest, use \[ClassInitialize] with async Task return type.
With NUnit, use \[OneTimeSetup] with async Task return type.
With xUnit, good luck: [https://xunit.net/docs/shared-context](https://xunit.net/docs/shared-context)

### &#x20;ClassTearDown Virtual

Method used by test classes to clean up the environment.

#### Syntax

```csharp theme={"dark"}
public virtual void ClassTearDown()
```

#### Remarks

With MSTest, use \[ClassCleanup].
With NUnit, use \[OneTimeTearDown].
With xUnit, good luck: [https://xunit.net/docs/shared-context](https://xunit.net/docs/shared-context)
This method calls [BreakdanceTestBase.ClassTearDownAsync](https://easyaf.nimbleapps.cloud/breakdance/api-reference/CloudNimble/Breakdance/Assemblies/BreakdanceTestBase.md#classteardownasync) synchronously.

### &#x20;ClassTearDownAsync Virtual

Method used by test classes to clean up the environment asynchronously.

#### Syntax

```csharp theme={"dark"}
public virtual System.Threading.Tasks.Task ClassTearDownAsync()
```

#### Returns

Type: `System.Threading.Tasks.Task`

#### Remarks

With MSTest, use \[ClassCleanup] with async Task return type.
With NUnit, use \[OneTimeTearDown] with async Task return type.
With xUnit, good luck: [https://xunit.net/docs/shared-context](https://xunit.net/docs/shared-context)

### &#x20;Dispose

Clean up disposable objects in the environment.

#### Syntax

```csharp theme={"dark"}
public void Dispose()
```

### &#x20;DisposeAsync

Asynchronously clean up disposable objects in the environment.

#### Syntax

```csharp theme={"dark"}
public System.Threading.Tasks.ValueTask DisposeAsync()
```

#### Returns

Type: `System.Threading.Tasks.ValueTask`

### &#x20;Equals Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public virtual bool Equals(object obj)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `obj` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;Equals Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public static bool Equals(object objA, object objB)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `objA` | `object?` | - |
| `objB` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;GetHashCode Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public virtual int GetHashCode()
```

#### Returns

Type: `int`

### &#x20;GetKeyedService Virtual

Get service of type *T* from the System.IServiceProvider.

#### Syntax

```csharp theme={"dark"}
public virtual T GetKeyedService<T>(string key) where T : class
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `key` | `string` | The key of the service to get. |

#### Returns

Type: `T`
A service object of type *T*.

#### Type Parameters

* `T` - The type of service object to get.

### &#x20;GetKeyedServices Virtual

Get services of type *T* from the System.IServiceProvider.

#### Syntax

```csharp theme={"dark"}
public virtual System.Collections.Generic.IEnumerable<T> GetKeyedServices<T>(string key) where T : class
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `key` | `string` | The |

#### Returns

Type: `System.Collections.Generic.IEnumerable<T>`
An [IEnumerable\`1](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable-1) of type *T*.

#### Type Parameters

* `T` - The type of service object to get.

### &#x20;GetScopedService

Get the requested service from the specified [IServiceScope](https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicescope).

#### Syntax

```csharp theme={"dark"}
public T GetScopedService<T>(Microsoft.Extensions.DependencyInjection.IServiceScope scope) where T : class
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `scope` | `Microsoft.Extensions.DependencyInjection.IServiceScope` | - |

#### Returns

Type: `T`

#### Type Parameters

* `T` -

### &#x20;GetScopedService

Get the requested service from the default [IServiceScope](https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicescope) provided by Breakdance.

#### Syntax

```csharp theme={"dark"}
public T GetScopedService<T>() where T : class
```

#### Returns

Type: `T`

#### Type Parameters

* `T` -

### &#x20;GetScopedServices

Get the requested service from the specified [IServiceScope](https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicescope).

#### Syntax

```csharp theme={"dark"}
public System.Collections.Generic.IEnumerable<T> GetScopedServices<T>(Microsoft.Extensions.DependencyInjection.IServiceScope scope) where T : class
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `scope` | `Microsoft.Extensions.DependencyInjection.IServiceScope` | - |

#### Returns

Type: `System.Collections.Generic.IEnumerable<T>`

#### Type Parameters

* `T` -

### &#x20;GetScopedServices

Get the requested service from the default [IServiceScope](https://learn.microsoft.com/dotnet/api/microsoft.extensions.dependencyinjection.iservicescope) provided by Breakdance.

#### Syntax

```csharp theme={"dark"}
public System.Collections.Generic.IEnumerable<T> GetScopedServices<T>() where T : class
```

#### Returns

Type: `System.Collections.Generic.IEnumerable<T>`

#### Type Parameters

* `T` -

### &#x20;GetService Virtual

Get service of type *T* from the System.IServiceProvider.

#### Syntax

```csharp theme={"dark"}
public virtual T GetService<T>() where T : class
```

#### Returns

Type: `T`
A service object of type *T*.

#### Type Parameters

* `T` - The type of service object to get.

### &#x20;GetServices Virtual

Get an enumeration of services of type *T* from the System.IServiceProvider.

#### Syntax

```csharp theme={"dark"}
public virtual System.Collections.Generic.IEnumerable<T> GetServices<T>() where T : class
```

#### Returns

Type: `System.Collections.Generic.IEnumerable<T>`
An enumeration of services of type *T*.

#### Type Parameters

* `T` - The type of service object to get.

### &#x20;GetType Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public System.Type GetType()
```

#### Returns

Type: `System.Type`

### &#x20;MemberwiseClone Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
protected internal object MemberwiseClone()
```

#### Returns

Type: `object`

### &#x20;ReferenceEquals Inherited

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public static bool ReferenceEquals(object objA, object objB)
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `objA` | `object?` | - |
| `objB` | `object?` | - |

#### Returns

Type: `bool`

### &#x20;ResetTestHostBuilder

Resets the test host by disposing of the current TestHost and initializing a new default TestHostBuilder.
This prepares the environment for a fresh test setup.

#### Syntax

```csharp theme={"dark"}
public void ResetTestHostBuilder()
```

### &#x20;SetClaimsPrincipalSelectorToThreadPrincipal

Sets the [ClaimsPrincipalSelector](https://learn.microsoft.com/dotnet/api/system.security.claims.claimsprincipal.claimsprincipalselector) to the [CurrentPrincipal](https://learn.microsoft.com/dotnet/api/system.threading.thread.currentprincipal).

#### Syntax

```csharp theme={"dark"}
public static void SetClaimsPrincipalSelectorToThreadPrincipal()
```

#### Remarks

This is used in non-ASP.NET Core testing situations where you're not going to pull the Identity from a request-specific DI Container.

### &#x20;SetClaimsPrincipalSelectorToThreadPrincipal

Sets the [ClaimsPrincipalSelector](https://learn.microsoft.com/dotnet/api/system.security.claims.claimsprincipal.claimsprincipalselector) to the [CurrentPrincipal](https://learn.microsoft.com/dotnet/api/system.threading.thread.currentprincipal) and sets the latter to a new ClaimsIdentity with the specified claims.

#### Syntax

```csharp theme={"dark"}
public static void SetClaimsPrincipalSelectorToThreadPrincipal(System.Collections.Generic.List<System.Security.Claims.Claim> claims, string authenticationType = "BreakdanceTests", string nameType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", string roleType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role")
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `claims` | `System.Collections.Generic.List<System.Security.Claims.Claim>` | The Claims to set for the test run. |
| `authenticationType` | `string` | If needed, the AuthenticationType of the ClaimsIdentity. Defaults to "BreakdanceTests". |
| `nameType` | `string` | The ClaimType to specify for the Name claim. Defaults to [NameIdentifier](https://learn.microsoft.com/dotnet/api/system.security.claims.claimtypes.nameidentifier). |
| `roleType` | `string` | The ClaimType to specify for Role claims. Defaults to [Role](https://learn.microsoft.com/dotnet/api/system.security.claims.claimtypes.role). |

#### Remarks

This is used in non-ASP.NET Core testing situations where you're not going to pull the Identity from a request-specific DI Container.

### &#x20;SetClaimsPrincipalSelectorToThreadPrincipal

Sets the [ClaimsPrincipalSelector](https://learn.microsoft.com/dotnet/api/system.security.claims.claimsprincipal.claimsprincipalselector) to the [CurrentPrincipal](https://learn.microsoft.com/dotnet/api/system.threading.thread.currentprincipal) and sets the latter to a new ClaimsIdentity with the specified claim.

#### Syntax

```csharp theme={"dark"}
public static void SetClaimsPrincipalSelectorToThreadPrincipal(System.Security.Claims.Claim claim, string authenticationType = "BreakdanceTests", string nameType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", string roleType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role")
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `claim` | `System.Security.Claims.Claim` | The Claims to set for the test run. |
| `authenticationType` | `string` | If needed, the AuthenticationType of the ClaimsIdentity. Defaults to "BreakdanceTests". |
| `nameType` | `string` | The ClaimType to specify for the Name claim. Defaults to [NameIdentifier](https://learn.microsoft.com/dotnet/api/system.security.claims.claimtypes.nameidentifier). |
| `roleType` | `string` | The ClaimType to specify for Role claims. Defaults to [Role](https://learn.microsoft.com/dotnet/api/system.security.claims.claimtypes.role). |

#### Remarks

This is used in non-ASP.NET Core testing situations where you're not going to pull the Identity from a request-specific DI Container.

### &#x20;SetThreadPrincipal

Sets the [ClaimsPrincipalSelector](https://learn.microsoft.com/dotnet/api/system.security.claims.claimsprincipal.claimsprincipalselector) to a new ClaimsIdentity with the specified claims.

#### Syntax

```csharp theme={"dark"}
public static void SetThreadPrincipal(System.Collections.Generic.List<System.Security.Claims.Claim> claims, string authenticationType = "BreakdanceTests", string nameType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", string roleType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role")
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `claims` | `System.Collections.Generic.List<System.Security.Claims.Claim>` | The Claims to set for the test run. |
| `authenticationType` | `string` | If needed, the AuthenticationType of the ClaimsIdentity. Defaults to "BreakdanceTests". |
| `nameType` | `string` | The ClaimType to specify for the Name claim. Defaults to [NameIdentifier](https://learn.microsoft.com/dotnet/api/system.security.claims.claimtypes.nameidentifier). |
| `roleType` | `string` | The ClaimType to specify for Role claims. Defaults to [Role](https://learn.microsoft.com/dotnet/api/system.security.claims.claimtypes.role). |

#### Remarks

This is used in non-ASP.NET Core testing situations where you're not going to pull the Identity from a request-specific DI Container.

### &#x20;SetThreadPrincipal

Sets the [ClaimsPrincipalSelector](https://learn.microsoft.com/dotnet/api/system.security.claims.claimsprincipal.claimsprincipalselector) to a new ClaimsIdentity with the specified claim.

#### Syntax

```csharp theme={"dark"}
public static void SetThreadPrincipal(System.Security.Claims.Claim claim, string authenticationType = "BreakdanceTests", string nameType = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", string roleType = "http://schemas.microsoft.com/ws/2008/06/identity/claims/role")
```

#### Parameters

| Name | Type | Description |
| - | - | - |
| `claim` | `System.Security.Claims.Claim` | The Claims to set for the test run. |
| `authenticationType` | `string` | If needed, the AuthenticationType of the ClaimsIdentity. Defaults to "BreakdanceTests". |
| `nameType` | `string` | The ClaimType to specify for the Name claim. Defaults to [NameIdentifier](https://learn.microsoft.com/dotnet/api/system.security.claims.claimtypes.nameidentifier). |
| `roleType` | `string` | The ClaimType to specify for Role claims. Defaults to [Role](https://learn.microsoft.com/dotnet/api/system.security.claims.claimtypes.role). |

#### Remarks

This is used in non-ASP.NET Core testing situations where you're not going to pull the Identity from a request-specific DI Container.

### &#x20;TestSetup Virtual

Method used by test classes to setup the environment.

#### Syntax

```csharp theme={"dark"}
public virtual void TestSetup()
```

#### Remarks

With MSTest, use \[TestInitialize].
With NUnit, use \[Setup].
With xUnit, good luck: [https://xunit.net/docs/shared-context](https://xunit.net/docs/shared-context)
This method calls [BreakdanceTestBase.TestSetupAsync](https://easyaf.nimbleapps.cloud/breakdance/api-reference/CloudNimble/Breakdance/Assemblies/BreakdanceTestBase.md#testsetupasync) synchronously.

### &#x20;TestSetupAsync Virtual

Method used by test classes to setup the environment asynchronously.

#### Syntax

```csharp theme={"dark"}
public virtual System.Threading.Tasks.Task TestSetupAsync()
```

#### Returns

Type: `System.Threading.Tasks.Task`

#### Remarks

With MSTest, use \[TestInitialize] with async Task return type.
With NUnit, use \[Setup] with async Task return type.
With xUnit, good luck: [https://xunit.net/docs/shared-context](https://xunit.net/docs/shared-context)

### &#x20;TestTearDown Virtual

Method used by test classes to clean up the environment.

#### Syntax

```csharp theme={"dark"}
public virtual void TestTearDown()
```

#### Remarks

With MSTest, use \[TestCleanup].
With NUnit, use \[TearDown].
With xUnit, good luck: [https://xunit.net/docs/shared-context](https://xunit.net/docs/shared-context)
This method calls [BreakdanceTestBase.TestTearDownAsync](https://easyaf.nimbleapps.cloud/breakdance/api-reference/CloudNimble/Breakdance/Assemblies/BreakdanceTestBase.md#testteardownasync) synchronously.

### &#x20;TestTearDownAsync Virtual

Method used by test classes to clean up the environment asynchronously.

#### Syntax

```csharp theme={"dark"}
public virtual System.Threading.Tasks.Task TestTearDownAsync()
```

#### Returns

Type: `System.Threading.Tasks.Task`

#### Remarks

With MSTest, use \[TestCleanup] with async Task return type.
With NUnit, use \[TearDown] with async Task return type.
With xUnit, good luck: [https://xunit.net/docs/shared-context](https://xunit.net/docs/shared-context)

### &#x20;ToString Inherited Virtual

> [!NOTE]
>
> Inherited from `object`

#### Syntax

```csharp theme={"dark"}
public virtual string ToString()
```

#### Returns

Type: `string?`

## Related APIs

* System.IDisposable
* System.IAsyncDisposable


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.