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

# LiveTenant

> The test tenant a connector runs against.

```csharp
public abstract class LiveTenant
```

## Constructors

```csharp
protected LiveTenant()
```

## Fields

**Abandoned** `TimeSpan` *required*

The age at which a sweep deletes an object.

**Collection** `string` *required*

The collection that runs one at a time.

**Prefix** `string` *required*

The prefix of every object a run makes.

## Properties

**Actions** `IReadOnlyDictionary\<string, JsonObject\>` *required*

The actions a run may invoke, with what it fills in for each. The guard refuses any other.

**ApiSunset** `DateOnly?`

The day the vendor retires the API version the connector calls.

**Context** `ConnectionContext` *required*

A context with working credentials.

**DeletesAccounts** `bool` *required*

Whether the vendor can delete an account.

**Entitlements** `IReadOnlyDictionary\<string, IReadOnlyList\<string\>\>` *required*

The entitlements a run may grant, by field. The guard refuses a grant on any other field.

**IdentityField** `string` *required*

The account field a new account's identity goes in.

**IsReference** `bool` *required*

Whether this is the kit's reference target.

**Members** `IReadOnlyList\<string\>` *required*

The permanent accounts, by match key.

**MissingId** `string` *required*

An external id the vendor cannot hold.

**PageSize** `int` *required*

The page size every read asks for.

**RefusedContext** `ConnectionContext` *required*

A context whose secret the vendor refuses.

**Settling** `Settling` *required*

How long the vendor takes to show a write.

## Methods

### ArrangeIdentityAsync()

```csharp
public virtual Task ArrangeIdentityAsync(string identity, CancellationToken cancellationToken)
```

Makes an account exist before the host manages it.

#### Parameters

**identity** `string` *required*

**cancellationToken** `CancellationToken` *required*

#### Returns

`Task`

### DeleteAccountAsync()

```csharp
public abstract Task DeleteAccountAsync(string externalId, CancellationToken cancellationToken)
```

Deletes or deactivates an account at the vendor.

#### Parameters

**externalId** `string` *required*

**cancellationToken** `CancellationToken` *required*

#### Returns

`Task`

### FreeSeatsAsync()

```csharp
public virtual Task<int?> FreeSeatsAsync(CancellationToken cancellationToken)
```

Counts the seats free for a new account.

#### Parameters

**cancellationToken** `CancellationToken` *required*

#### Returns

`Task<int?>`

### InspectAsync()

```csharp
public abstract Task<TenantAccount?> InspectAsync(string externalId, CancellationToken cancellationToken)
```

Reads an account as the vendor holds it.

#### Parameters

**externalId** `string` *required*

**cancellationToken** `CancellationToken` *required*

#### Returns

`Task<TenantAccount>`

### Mint()

```csharp
public static string Mint(string run)
```

Mints a name for one run's object.

#### Parameters

**run** `string` *required*

#### Returns

`string`

### MintedAt()

```csharp
public static DateTimeOffset? MintedAt(string name)
```

Reads when a minted name was minted.

#### Parameters

**name** `string` *required*

#### Returns

`DateTimeOffset?`

### MintName()

```csharp
public string MintName()
```

Mints a name for a new object.

#### Returns

`string`

### NewAccount()

```csharp
public abstract JsonObject NewAccount(string name)
```

Builds a valid payload for a new account.

#### Parameters

**name** `string` *required*

#### Returns

`JsonObject`

### NewIdentity()

```csharp
public abstract string NewIdentity(string name)
```

Builds a new account's identity, the value its [IdentityField](https://klef.ai/docs/connector-sdk/reference/testing/livetenant.md) holds.

#### Parameters

**name** `string` *required*

#### Returns

`string`

### SeedAsync()

```csharp
public virtual Task SeedAsync(CancellationToken cancellationToken)
```

Makes what a run needs on the tenant.

#### Parameters

**cancellationToken** `CancellationToken` *required*

#### Returns

`Task`

### SweepAsync()

```csharp
public Task SweepAsync(ITargetConnector connector, ConnectorManifest manifest, CancellationToken cancellationToken)
```

Deletes what abandoned runs left behind.

#### Parameters

**connector** `ITargetConnector` *required*

**manifest** `ConnectorManifest` *required*

**cancellationToken** `CancellationToken` *required*

#### Returns

`Task`

### WritablePrincipal()

```csharp
public virtual string? WritablePrincipal(string kind)
```

A principal of a kind other than the account a run may change grants on, or [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) to skip.

#### Parameters

**kind** `string` *required*

#### Returns

`string`


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