.NET API
SessionStoreContract
Tracon.Testing.Contracts.Xunit.dllBehavior tests for the ISessionStore contract.
public abstract class SessionStoreContract : TenantIsolationContract<ISessionStore>, IAsyncLifetime, IAsyncDisposableInheritance
Section titled “Inheritance”object ← TenantIsolationContract<ISessionStore> ← SessionStoreContract
Implements
Section titled “Implements”IAsyncLifetime, IAsyncDisposable
Inherited Members
Section titled “Inherited Members”TenantIsolationContract<ISessionStore>.TenantA, TenantIsolationContract<ISessionStore>.TenantB, TenantIsolationContract<ISessionStore>.CreateStoreAsync(), TenantIsolationContract<ISessionStore>.UseAmbientTenant(MutableTenantContext), TenantIsolationContract<ISessionStore>.InitializeAsync(), TenantIsolationContract<ISessionStore>.DisposeAsync(), TenantIsolationContract<ISessionStore>.OnDisposeAsync(), TenantIsolationContract<ISessionStore>.SeedAsync(string, string), TenantIsolationContract<ISessionStore>.ExistsAsync(string, object), TenantIsolationContract<ISessionStore>.CountAsync(string), TenantIsolationContract<ISessionStore>.TryDeleteAsync(string, object), TenantIsolationContract<ISessionStore>.TryOverwriteAsync(string, string), TenantIsolationContract<ISessionStore>.Tenant_cannot_read_another_tenants_record(), TenantIsolationContract<ISessionStore>.Tenant_reads_its_own_record(), TenantIsolationContract<ISessionStore>.Tenant_does_not_see_another_tenants_record_in_the_list(), TenantIsolationContract<ISessionStore>.Tenant_cannot_delete_another_tenants_record(), TenantIsolationContract<ISessionStore>.Same_name_lives_independently_across_two_tenants(), TenantIsolationContract<ISessionStore>.AmbientTenant, TenantIsolationContract<ISessionStore>.Store, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”Session state is opaque; the store must return the content back exactly, without interpreting it.
Constructors
Section titled “Constructors”SessionStoreContract()
Section titled “ SessionStoreContract()”protected SessionStoreContract()Methods
Section titled “Methods”A_later_write_that_carries_no_owner_does_not_CLEAR_the_stored_one()
Section titled “ A_later_write_that_carries_no_owner_does_not_CLEAR_the_stored_one()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 499)]public Task A_later_write_that_carries_no_owner_does_not_CLEAR_the_stored_one()Returns
Section titled “Returns”A_session_saved_without_StateMafVersion_reads_back_null()
Section titled “ A_session_saved_without_StateMafVersion_reads_back_null()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 82)]public Task A_session_saved_without_StateMafVersion_reads_back_null()Returns
Section titled “Returns”A_session_saved_without_an_owner_reads_back_null()
Section titled “ A_session_saved_without_an_owner_reads_back_null()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 402)]public Task A_session_saved_without_an_owner_reads_back_null()Returns
Section titled “Returns”An_owned_session_round_trips_its_owner()
Section titled “ An_owned_session_round_trips_its_owner()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 387)]public Task An_owned_session_round_trips_its_owner()Returns
Section titled “Returns”An_owner_at_the_maximum_allowed_length_round_trips_whole()
Section titled “ An_owner_at_the_maximum_allowed_length_round_trips_whole()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 481)]public Task An_owner_at_the_maximum_allowed_length_round_trips_whole()Returns
Section titled “Returns”An_unowned_session_can_still_be_given_an_owner()
Section titled “ An_unowned_session_can_still_be_given_an_owner()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 529)]public Task An_unowned_session_can_still_be_given_an_owner()Returns
Section titled “Returns”CountAsync(string)
Section titled “ CountAsync(string)”Reports how many records the given tenant sees through the listing endpoint.
protected override ValueTask<int> CountAsync(string tenantId)Parameters
Section titled “Parameters”tenantId string
The reading tenant.
Returns
Section titled “Returns”The number of records seen.
Delete_removes_the_record()
Section titled “ Delete_removes_the_record()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 124)]public Task Delete_removes_the_record()Returns
Section titled “Returns”ExistsAsync(string, object)
Section titled “ ExistsAsync(string, object)”Reports whether the record is visible from the given tenant’s viewpoint.
protected override ValueTask<bool> ExistsAsync(string tenantId, object key)Parameters
Section titled “Parameters”tenantId string
The reading tenant.
key object
The key returned by TenantIsolationContract.SeedAsync.
Returns
Section titled “Returns”true if the record is visible.
GetOwnerTenantIdAsync_returns_null_for_a_never_used_id()
Section titled “ GetOwnerTenantIdAsync_returns_null_for_a_never_used_id()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 543)]public Task GetOwnerTenantIdAsync_returns_null_for_a_never_used_id()Returns
Section titled “Returns”GetOwnerTenantIdAsync_returns_the_real_owner_independent_of_the_ambient_tenant()
Section titled “ GetOwnerTenantIdAsync_returns_the_real_owner_independent_of_the_ambient_tenant()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 550)]public Task GetOwnerTenantIdAsync_returns_the_real_owner_independent_of_the_ambient_tenant()Returns
Section titled “Returns”Nonexistent_session_returns_null()
Section titled “ Nonexistent_session_returns_null()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 134)]public Task Nonexistent_session_returns_null()Returns
Section titled “Returns”Query_applies_paging()
Section titled “ Query_applies_paging()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 163)]public Task Query_applies_paging()Returns
Section titled “Returns”Query_applies_the_owner_filter_BEFORE_paging()
Section titled “ Query_applies_the_owner_filter_BEFORE_paging()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 432)]public Task Query_applies_the_owner_filter_BEFORE_paging()Returns
Section titled “Returns”Query_filters_by_agent_name()
Section titled “ Query_filters_by_agent_name()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 152)]public Task Query_filters_by_agent_name()Returns
Section titled “Returns”Query_filters_by_owner_and_never_returns_an_unowned_row()
Section titled “ Query_filters_by_owner_and_never_returns_an_unowned_row()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 413)]public Task Query_filters_by_owner_and_never_returns_an_unowned_row()Returns
Section titled “Returns”Query_starts_with_the_most_recently_updated()
Section titled “ Query_starts_with_the_most_recently_updated()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 138)]public Task Query_starts_with_the_most_recently_updated()Returns
Section titled “Returns”SaveAsync_advances_the_version_so_a_stale_update_cannot_match_it()
Section titled “ SaveAsync_advances_the_version_so_a_stale_update_cannot_match_it()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 315)]public Task SaveAsync_advances_the_version_so_a_stale_update_cannot_match_it()Returns
Section titled “Returns”Saving_with_the_same_id_overwrites_the_record_and_keeps_the_creation_time()
Section titled “ Saving_with_the_same_id_overwrites_the_record_and_keeps_the_creation_time()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 95)]public Task Saving_with_the_same_id_overwrites_the_record_and_keeps_the_creation_time()Returns
Section titled “Returns”SeedAsync(string, string)
Section titled “ SeedAsync(string, string)”Writes a sample record for the given tenant.
protected override ValueTask<object> SeedAsync(string tenantId, string name)Parameters
Section titled “Parameters”tenantId string
The tenant that owns the record.
name string
The name distinguishing the record. The same name may be used by two tenants.
Returns
Section titled “Returns”The key to use for reading the record back.
Remarks
Section titled “Remarks”The tenant is not a parameter in the interface; it is read from ITenantContext. That is why every hook sets the current tenant first.
Session_state_round_trips_without_corruption()
Section titled “ Session_state_round_trips_without_corruption()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 46)]public Task Session_state_round_trips_without_corruption()Returns
Section titled “Returns”StateSchemaVersion_and_StateMafVersion_round_trip()
Section titled “ StateSchemaVersion_and_StateMafVersion_round_trip()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 65)]public Task StateSchemaVersion_and_StateMafVersion_round_trip()Returns
Section titled “Returns”The_same_owner_stays_separate_in_two_tenants()
Section titled “ The_same_owner_stays_separate_in_two_tenants()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 461)]public Task The_same_owner_stays_separate_in_two_tenants()Returns
Section titled “Returns”TryCreateAsync_only_one_concurrent_call_with_the_same_id_wins()
Section titled “ TryCreateAsync_only_one_concurrent_call_with_the_same_id_wins()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 205)]public Task TryCreateAsync_only_one_concurrent_call_with_the_same_id_wins()Returns
Section titled “Returns”TryCreateAsync_returns_false_and_does_not_overwrite_for_an_existing_id()
Section titled “ TryCreateAsync_returns_false_and_does_not_overwrite_for_an_existing_id()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 190)]public Task TryCreateAsync_returns_false_and_does_not_overwrite_for_an_existing_id()Returns
Section titled “Returns”TryCreateAsync_returns_true_and_saves_for_a_new_id()
Section titled “ TryCreateAsync_returns_true_and_saves_for_a_new_id()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 178)]public Task TryCreateAsync_returns_true_and_saves_for_a_new_id()Returns
Section titled “Returns”TryCreateAsync_same_id_wins_independently_in_two_tenants()
Section titled “ TryCreateAsync_same_id_wins_independently_in_two_tenants()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 227)]public Task TryCreateAsync_same_id_wins_independently_in_two_tenants()Returns
Section titled “Returns”TryCreateAsync_stamps_the_first_version()
Section titled “ TryCreateAsync_stamps_the_first_version()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 236)]public Task TryCreateAsync_stamps_the_first_version()Returns
Section titled “Returns”TryDeleteAsync(string, object)
Section titled “ TryDeleteAsync(string, object)”Attempts to delete the record on behalf of the given tenant.
protected override ValueTask<bool?> TryDeleteAsync(string tenantId, object key)Parameters
Section titled “Parameters”tenantId string
The tenant attempting the delete.
key object
The key returned by TenantIsolationContract.SeedAsync.
Returns
Section titled “Returns”true if the delete succeeded, false if the record was not found; null if the store does not offer deletion.
TryUpdateAsync_cannot_reach_another_tenants_record()
Section titled “ TryUpdateAsync_cannot_reach_another_tenants_record()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 334)]public Task TryUpdateAsync_cannot_reach_another_tenants_record()Returns
Section titled “Returns”TryUpdateAsync_only_one_concurrent_call_from_the_same_version_wins()
Section titled “ TryUpdateAsync_only_one_concurrent_call_from_the_same_version_wins()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 288)]public Task TryUpdateAsync_only_one_concurrent_call_from_the_same_version_wins()Returns
Section titled “Returns”TryUpdateAsync_refuses_a_stale_version_and_leaves_the_record_alone()
Section titled “ TryUpdateAsync_refuses_a_stale_version_and_leaves_the_record_alone()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 264)]public Task TryUpdateAsync_refuses_a_stale_version_and_leaves_the_record_alone()Returns
Section titled “Returns”TryUpdateAsync_replaces_the_record_and_advances_the_version()
Section titled “ TryUpdateAsync_replaces_the_record_and_advances_the_version()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 247)]public Task TryUpdateAsync_replaces_the_record_and_advances_the_version()Returns
Section titled “Returns”TryUpdateAsync_returns_false_for_an_id_that_does_not_exist()
Section titled “ TryUpdateAsync_returns_false_for_an_id_that_does_not_exist()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 284)]public Task TryUpdateAsync_returns_false_for_an_id_that_does_not_exist()Returns
Section titled “Returns”TryUpdateAsync_writes_the_records_own_tenant_not_the_ambient_one()
Section titled “ TryUpdateAsync_writes_the_records_own_tenant_not_the_ambient_one()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/SessionStoreContract.cs", 360)]public Task TryUpdateAsync_writes_the_records_own_tenant_not_the_ambient_one()