.NET API
ApiKeyStoreContract
Tracon.Testing.Contracts.Xunit.dllBehavior tests for the IApiKeyStore contract.
public abstract class ApiKeyStoreContract : TenantIsolationContract<IApiKeyStore>, IAsyncLifetime, IAsyncDisposableInheritance
Section titled “Inheritance”object ← TenantIsolationContract<IApiKeyStore> ← ApiKeyStoreContract
Implements
Section titled “Implements”IAsyncLifetime, IAsyncDisposable
Inherited Members
Section titled “Inherited Members”TenantIsolationContract<IApiKeyStore>.TenantA, TenantIsolationContract<IApiKeyStore>.TenantB, TenantIsolationContract<IApiKeyStore>.CreateStoreAsync(), TenantIsolationContract<IApiKeyStore>.UseAmbientTenant(MutableTenantContext), TenantIsolationContract<IApiKeyStore>.InitializeAsync(), TenantIsolationContract<IApiKeyStore>.DisposeAsync(), TenantIsolationContract<IApiKeyStore>.OnDisposeAsync(), TenantIsolationContract<IApiKeyStore>.SeedAsync(string, string), TenantIsolationContract<IApiKeyStore>.ExistsAsync(string, object), TenantIsolationContract<IApiKeyStore>.CountAsync(string), TenantIsolationContract<IApiKeyStore>.TryDeleteAsync(string, object), TenantIsolationContract<IApiKeyStore>.TryOverwriteAsync(string, string), TenantIsolationContract<IApiKeyStore>.Tenant_cannot_read_another_tenants_record(), TenantIsolationContract<IApiKeyStore>.Tenant_reads_its_own_record(), TenantIsolationContract<IApiKeyStore>.Tenant_does_not_see_another_tenants_record_in_the_list(), TenantIsolationContract<IApiKeyStore>.Tenant_cannot_delete_another_tenants_record(), TenantIsolationContract<IApiKeyStore>.Same_name_lives_independently_across_two_tenants(), TenantIsolationContract<IApiKeyStore>.AmbientTenant, TenantIsolationContract<IApiKeyStore>.Store, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”In this contract, the raw key value is visible only in the ApiKeyCreationResult.PlaintextKey returned by IApiKeyStore.CreateAsync; no read path (IApiKeyStore.ListAsync, IApiKeyStore.FindByHashAsync) returns the raw value or its hash.
Constructors
Section titled “Constructors”ApiKeyStoreContract()
Section titled “ ApiKeyStoreContract()”protected ApiKeyStoreContract()Methods
Section titled “Methods”Active_scope_is_found_system_wide()
Section titled “ Active_scope_is_found_system_wide()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/ApiKeyStoreContract.cs", 135)]public Task Active_scope_is_found_system_wide()Returns
Section titled “Returns”Cannot_revoke_another_tenants_key()
Section titled “ Cannot_revoke_another_tenants_key()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/ApiKeyStoreContract.cs", 101)]public Task Cannot_revoke_another_tenants_key()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.
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.
Expiration_is_read_back()
Section titled “ Expiration_is_read_back()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/ApiKeyStoreContract.cs", 124)]public Task Expiration_is_read_back()Returns
Section titled “Returns”Finding_another_tenants_key_by_hash_returns_the_correct_tenant()
Section titled “ Finding_another_tenants_key_by_hash_returns_the_correct_tenant()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/ApiKeyStoreContract.cs", 155)]public Task Finding_another_tenants_key_by_hash_returns_the_correct_tenant()Returns
Section titled “Returns”Found_by_hash_of_the_raw_value()
Section titled “ Found_by_hash_of_the_raw_value()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/ApiKeyStoreContract.cs", 57)]public Task Found_by_hash_of_the_raw_value()Returns
Section titled “Returns”Last_used_timestamp_is_updated()
Section titled “ Last_used_timestamp_is_updated()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/ApiKeyStoreContract.cs", 112)]public Task Last_used_timestamp_is_updated()Returns
Section titled “Returns”Revoked_key_carries_RevokedAt_and_appears_inactive()
Section titled “ Revoked_key_carries_RevokedAt_and_appears_inactive()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/ApiKeyStoreContract.cs", 79)]public Task Revoked_key_carries_RevokedAt_and_appears_inactive()Returns
Section titled “Returns”Revoked_keys_scope_is_no_longer_active()
Section titled “ Revoked_keys_scope_is_no_longer_active()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/ApiKeyStoreContract.cs", 146)]public Task Revoked_keys_scope_is_no_longer_active()Returns
Section titled “Returns”Same_key_cannot_be_revoked_twice()
Section titled “ Same_key_cannot_be_revoked_twice()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/ApiKeyStoreContract.cs", 92)]public Task Same_key_cannot_be_revoked_twice()Returns
Section titled “Returns”Saved_key_is_read_back()
Section titled “ Saved_key_is_read_back()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/ApiKeyStoreContract.cs", 41)]public Task Saved_key_is_read_back()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.
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.
Unknown_hash_is_not_found()
Section titled “ Unknown_hash_is_not_found()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/ApiKeyStoreContract.cs", 69)]public Task Unknown_hash_is_not_found()