# SessionStoreContract

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.testing.contracts.storage.sessionstorecontract/
> Summary: SessionStoreContract: Behavior tests for the ISessionStore contract.

<div class="api-provenance">Namespace Tracon.Testing.Contracts.Storage · Assembly <code>Tracon.Testing.Contracts.Xunit.dll</code></div>

Behavior tests for the [ISessionStore](/api/tracon.isessionstore/) contract.

```csharp
public abstract class SessionStoreContract : TenantIsolationContract<ISessionStore>, IAsyncLifetime, IAsyncDisposable
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/">StoreCancellationContract&lt;ISessionStore&gt;</a> ← <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/">TenantIsolationContract&lt;ISessionStore&gt;</a> ← <a href="/api/tracon.testing.contracts.storage.sessionstorecontract/">SessionStoreContract</a></dd><dt>Implements</dt><dd>IAsyncLifetime, <a href="https://learn.microsoft.com/dotnet/api/system.iasyncdisposable">IAsyncDisposable</a></dd><dt>Inherited Members</dt><dd><a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_TenantA">TenantIsolationContract&lt;ISessionStore&gt;.TenantA</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_TenantB">TenantIsolationContract&lt;ISessionStore&gt;.TenantB</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_UseAmbientTenant_Tracon_Testing_Contracts_Storage_MutableTenantContext_">TenantIsolationContract&lt;ISessionStore&gt;.UseAmbientTenant(MutableTenantContext)</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_SeedAsync_System_String_System_String_System_Threading_CancellationToken_">TenantIsolationContract&lt;ISessionStore&gt;.SeedAsync(string, string, CancellationToken)</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_ExistsAsync_System_String_System_Object_">TenantIsolationContract&lt;ISessionStore&gt;.ExistsAsync(string, object)</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_CountAsync_System_String_System_Threading_CancellationToken_">TenantIsolationContract&lt;ISessionStore&gt;.CountAsync(string, CancellationToken)</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_TryDeleteAsync_System_String_System_Object_">TenantIsolationContract&lt;ISessionStore&gt;.TryDeleteAsync(string, object)</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_TryOverwriteAsync_System_String_System_String_">TenantIsolationContract&lt;ISessionStore&gt;.TryOverwriteAsync(string, string)</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_CancellableReadAsync_System_Threading_CancellationToken_">TenantIsolationContract&lt;ISessionStore&gt;.CancellableReadAsync(CancellationToken)</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_CancellableWriteAsync_System_Threading_CancellationToken_">TenantIsolationContract&lt;ISessionStore&gt;.CancellableWriteAsync(CancellationToken)</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_WroteAnythingAsync">TenantIsolationContract&lt;ISessionStore&gt;.WroteAnythingAsync()</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_Tenant_cannot_read_another_tenants_record">TenantIsolationContract&lt;ISessionStore&gt;.Tenant_cannot_read_another_tenants_record()</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_Tenant_reads_its_own_record">TenantIsolationContract&lt;ISessionStore&gt;.Tenant_reads_its_own_record()</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_Tenant_does_not_see_another_tenants_record_in_the_list">TenantIsolationContract&lt;ISessionStore&gt;.Tenant_does_not_see_another_tenants_record_in_the_list()</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_Tenant_cannot_delete_another_tenants_record">TenantIsolationContract&lt;ISessionStore&gt;.Tenant_cannot_delete_another_tenants_record()</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_Same_name_lives_independently_across_two_tenants">TenantIsolationContract&lt;ISessionStore&gt;.Same_name_lives_independently_across_two_tenants()</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_AmbientTenant">TenantIsolationContract&lt;ISessionStore&gt;.AmbientTenant</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_CreateStoreAsync">StoreCancellationContract&lt;ISessionStore&gt;.CreateStoreAsync()</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_InitializeAsync">StoreCancellationContract&lt;ISessionStore&gt;.InitializeAsync()</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_DisposeAsync">StoreCancellationContract&lt;ISessionStore&gt;.DisposeAsync()</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_OnDisposeAsync">StoreCancellationContract&lt;ISessionStore&gt;.OnDisposeAsync()</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_CancellableReadAsync_System_Threading_CancellationToken_">StoreCancellationContract&lt;ISessionStore&gt;.CancellableReadAsync(CancellationToken)</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_CancellableWriteAsync_System_Threading_CancellationToken_">StoreCancellationContract&lt;ISessionStore&gt;.CancellableWriteAsync(CancellationToken)</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_WroteAnythingAsync">StoreCancellationContract&lt;ISessionStore&gt;.WroteAnythingAsync()</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_Canceled_token_throws_on_read">StoreCancellationContract&lt;ISessionStore&gt;.Canceled_token_throws_on_read()</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_The_write_this_contract_checks_can_be_read_back">StoreCancellationContract&lt;ISessionStore&gt;.The_write_this_contract_checks_can_be_read_back()</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_Canceled_token_throws_on_write_and_leaves_no_trace">StoreCancellationContract&lt;ISessionStore&gt;.Canceled_token_throws_on_write_and_leaves_no_trace()</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_Store">StoreCancellationContract&lt;ISessionStore&gt;.Store</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a></dd></dl>

## Remarks

Session state is opaque; the store must return the content back exactly, without interpreting it.

## Constructors

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract__ctor"></a> SessionStoreContract\(\)

```csharp
protected SessionStoreContract()
```

## Methods

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_A_later_write_that_carries_no_owner_does_not_CLEAR_the_stored_one"></a> A\_later\_write\_that\_carries\_no\_owner\_does\_not\_CLEAR\_the\_stored\_one\(\)

```csharp
[Fact]
public Task A_later_write_that_carries_no_owner_does_not_CLEAR_the_stored_one()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_A_session_saved_without_StateMafVersion_reads_back_null"></a> A\_session\_saved\_without\_StateMafVersion\_reads\_back\_null\(\)

```csharp
[Fact]
public Task A_session_saved_without_StateMafVersion_reads_back_null()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_A_session_saved_without_an_owner_reads_back_null"></a> A\_session\_saved\_without\_an\_owner\_reads\_back\_null\(\)

```csharp
[Fact]
public Task A_session_saved_without_an_owner_reads_back_null()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_An_owned_session_round_trips_its_owner"></a> An\_owned\_session\_round\_trips\_its\_owner\(\)

```csharp
[Fact]
public Task An_owned_session_round_trips_its_owner()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_An_owner_at_the_maximum_allowed_length_round_trips_whole"></a> An\_owner\_at\_the\_maximum\_allowed\_length\_round\_trips\_whole\(\)

```csharp
[Fact]
public Task An_owner_at_the_maximum_allowed_length_round_trips_whole()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_An_unowned_session_can_still_be_given_an_owner"></a> An\_unowned\_session\_can\_still\_be\_given\_an\_owner\(\)

```csharp
[Fact]
public Task An_unowned_session_can_still_be_given_an_owner()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_CountAsync_System_String_System_Threading_CancellationToken_"></a> CountAsync\(string, CancellationToken\)

Reports how many records the given tenant sees through the listing endpoint.

```csharp
protected override ValueTask<int> CountAsync(string tenantId, CancellationToken cancellationToken)
```

#### Parameters

`tenantId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The reading tenant.

`cancellationToken` [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken)

The token every store call inside the hook must be handed; see
[TenantIsolationContract.SeedAsync](/api/tracon.testing.contracts.storage/).

#### Returns

 [ValueTask](https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\-1)<[int](https://learn.microsoft.com/dotnet/api/system.int32)\>

The number of records seen.

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_Delete_removes_the_record"></a> Delete\_removes\_the\_record\(\)

```csharp
[Fact]
public Task Delete_removes_the_record()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_ExistsAsync_System_String_System_Object_"></a> ExistsAsync\(string, object\)

Reports whether the record is visible from the given tenant's viewpoint.

```csharp
protected override ValueTask<bool> ExistsAsync(string tenantId, object key)
```

#### Parameters

`tenantId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The reading tenant.

`key` [object](https://learn.microsoft.com/dotnet/api/system.object)

The key returned by [TenantIsolationContract.SeedAsync](/api/tracon.testing.contracts.storage/).

#### Returns

 [ValueTask](https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\-1)<[bool](https://learn.microsoft.com/dotnet/api/system.boolean)\>

[true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) if the record is visible.

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_GetOwnerTenantIdAsync_returns_null_for_a_never_used_id"></a> GetOwnerTenantIdAsync\_returns\_null\_for\_a\_never\_used\_id\(\)

```csharp
[Fact]
public Task GetOwnerTenantIdAsync_returns_null_for_a_never_used_id()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_GetOwnerTenantIdAsync_returns_the_real_owner_independent_of_the_ambient_tenant"></a> GetOwnerTenantIdAsync\_returns\_the\_real\_owner\_independent\_of\_the\_ambient\_tenant\(\)

```csharp
[Fact]
public Task GetOwnerTenantIdAsync_returns_the_real_owner_independent_of_the_ambient_tenant()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_Nonexistent_session_returns_null"></a> Nonexistent\_session\_returns\_null\(\)

```csharp
[Fact]
public Task Nonexistent_session_returns_null()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_Query_applies_paging"></a> Query\_applies\_paging\(\)

```csharp
[Fact]
public Task Query_applies_paging()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_Query_applies_the_owner_filter_BEFORE_paging"></a> Query\_applies\_the\_owner\_filter\_BEFORE\_paging\(\)

```csharp
[Fact]
public Task Query_applies_the_owner_filter_BEFORE_paging()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_Query_filters_by_agent_name"></a> Query\_filters\_by\_agent\_name\(\)

```csharp
[Fact]
public Task Query_filters_by_agent_name()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_Query_filters_by_owner_and_never_returns_an_unowned_row"></a> Query\_filters\_by\_owner\_and\_never\_returns\_an\_unowned\_row\(\)

```csharp
[Fact]
public Task Query_filters_by_owner_and_never_returns_an_unowned_row()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_Query_starts_with_the_most_recently_updated"></a> Query\_starts\_with\_the\_most\_recently\_updated\(\)

```csharp
[Fact]
public Task Query_starts_with_the_most_recently_updated()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_SaveAsync_advances_the_version_so_a_stale_update_cannot_match_it"></a> SaveAsync\_advances\_the\_version\_so\_a\_stale\_update\_cannot\_match\_it\(\)

```csharp
[Fact]
public Task SaveAsync_advances_the_version_so_a_stale_update_cannot_match_it()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_Saving_with_the_same_id_overwrites_the_record_and_keeps_the_creation_time"></a> Saving\_with\_the\_same\_id\_overwrites\_the\_record\_and\_keeps\_the\_creation\_time\(\)

```csharp
[Fact]
public Task Saving_with_the_same_id_overwrites_the_record_and_keeps_the_creation_time()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_SeedAsync_System_String_System_String_System_Threading_CancellationToken_"></a> SeedAsync\(string, string, CancellationToken\)

Writes a sample record for the given tenant.

```csharp
protected override ValueTask<object> SeedAsync(string tenantId, string name, CancellationToken cancellationToken)
```

#### Parameters

`tenantId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The tenant that owns the record.

`name` [string](https://learn.microsoft.com/dotnet/api/system.string)

The name distinguishing the record. The same name may be used by two tenants.

`cancellationToken` [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken)

The token every store call inside the hook must be handed. The
cancellation contract calls this hook with a token that is already
cancelled, so a hook that drops the token reports a store as sound
when it is not.

#### Returns

 [ValueTask](https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\-1)<[object](https://learn.microsoft.com/dotnet/api/system.object)\>

The key to use for reading the record back.

#### Remarks

The tenant is not a parameter in the interface; it is read from
[ITenantContext](/api/tracon.itenantcontext/). That is why every hook sets the current
tenant first.

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_Session_state_round_trips_without_corruption"></a> Session\_state\_round\_trips\_without\_corruption\(\)

```csharp
[Fact]
public Task Session_state_round_trips_without_corruption()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_StateSchemaVersion_and_StateMafVersion_round_trip"></a> StateSchemaVersion\_and\_StateMafVersion\_round\_trip\(\)

```csharp
[Fact]
public Task StateSchemaVersion_and_StateMafVersion_round_trip()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_The_same_owner_stays_separate_in_two_tenants"></a> The\_same\_owner\_stays\_separate\_in\_two\_tenants\(\)

```csharp
[Fact]
public Task The_same_owner_stays_separate_in_two_tenants()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_TryCreateAsync_only_one_concurrent_call_with_the_same_id_wins"></a> TryCreateAsync\_only\_one\_concurrent\_call\_with\_the\_same\_id\_wins\(\)

```csharp
[Fact]
public Task TryCreateAsync_only_one_concurrent_call_with_the_same_id_wins()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_TryCreateAsync_returns_false_and_does_not_overwrite_for_an_existing_id"></a> TryCreateAsync\_returns\_false\_and\_does\_not\_overwrite\_for\_an\_existing\_id\(\)

```csharp
[Fact]
public Task TryCreateAsync_returns_false_and_does_not_overwrite_for_an_existing_id()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_TryCreateAsync_returns_true_and_saves_for_a_new_id"></a> TryCreateAsync\_returns\_true\_and\_saves\_for\_a\_new\_id\(\)

```csharp
[Fact]
public Task TryCreateAsync_returns_true_and_saves_for_a_new_id()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_TryCreateAsync_same_id_wins_independently_in_two_tenants"></a> TryCreateAsync\_same\_id\_wins\_independently\_in\_two\_tenants\(\)

```csharp
[Fact]
public Task TryCreateAsync_same_id_wins_independently_in_two_tenants()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_TryCreateAsync_stamps_the_first_version"></a> TryCreateAsync\_stamps\_the\_first\_version\(\)

```csharp
[Fact]
public Task TryCreateAsync_stamps_the_first_version()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_TryDeleteAsync_System_String_System_Object_"></a> TryDeleteAsync\(string, object\)

Attempts to delete the record on behalf of the given tenant.

```csharp
protected override ValueTask<bool?> TryDeleteAsync(string tenantId, object key)
```

#### Parameters

`tenantId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The tenant attempting the delete.

`key` [object](https://learn.microsoft.com/dotnet/api/system.object)

The key returned by [TenantIsolationContract.SeedAsync](/api/tracon.testing.contracts.storage/).

#### Returns

 [ValueTask](https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\-1)<[bool](https://learn.microsoft.com/dotnet/api/system.boolean)?\>

[true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) if the delete succeeded, [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool)
if the record was not found; [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) if the store does
not offer deletion.

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_TryUpdateAsync_cannot_reach_another_tenants_record"></a> TryUpdateAsync\_cannot\_reach\_another\_tenants\_record\(\)

```csharp
[Fact]
public Task TryUpdateAsync_cannot_reach_another_tenants_record()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_TryUpdateAsync_only_one_concurrent_call_from_the_same_version_wins"></a> TryUpdateAsync\_only\_one\_concurrent\_call\_from\_the\_same\_version\_wins\(\)

```csharp
[Fact]
public Task TryUpdateAsync_only_one_concurrent_call_from_the_same_version_wins()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_TryUpdateAsync_refuses_a_stale_version_and_leaves_the_record_alone"></a> TryUpdateAsync\_refuses\_a\_stale\_version\_and\_leaves\_the\_record\_alone\(\)

```csharp
[Fact]
public Task TryUpdateAsync_refuses_a_stale_version_and_leaves_the_record_alone()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_TryUpdateAsync_replaces_the_record_and_advances_the_version"></a> TryUpdateAsync\_replaces\_the\_record\_and\_advances\_the\_version\(\)

```csharp
[Fact]
public Task TryUpdateAsync_replaces_the_record_and_advances_the_version()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_TryUpdateAsync_returns_false_for_an_id_that_does_not_exist"></a> TryUpdateAsync\_returns\_false\_for\_an\_id\_that\_does\_not\_exist\(\)

```csharp
[Fact]
public Task TryUpdateAsync_returns_false_for_an_id_that_does_not_exist()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_SessionStoreContract_TryUpdateAsync_writes_the_records_own_tenant_not_the_ambient_one"></a> TryUpdateAsync\_writes\_the\_records\_own\_tenant\_not\_the\_ambient\_one\(\)

```csharp
[Fact]
public Task TryUpdateAsync_writes_the_records_own_tenant_not_the_ambient_one()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)
