Skip to content
Tracon

TenantProviderBindingStoreContract

Namespace Tracon.Testing.Contracts.Storage · Assembly Tracon.Testing.Contracts.Xunit.dll

Behavior tests for the ITenantProviderBindingStore contract.

public abstract class TenantProviderBindingStoreContract : TenantIsolationContract<ITenantProviderBindingStore>, IAsyncLifetime, IAsyncDisposable
Inheritance
object ← StoreCancellationContract<ITenantProviderBindingStore> ← TenantIsolationContract<ITenantProviderBindingStore> ← TenantProviderBindingStoreContract
Implements
IAsyncLifetime, IAsyncDisposable
Inherited Members
TenantIsolationContract<ITenantProviderBindingStore>.TenantA, TenantIsolationContract<ITenantProviderBindingStore>.TenantB, TenantIsolationContract<ITenantProviderBindingStore>.UseAmbientTenant(MutableTenantContext), TenantIsolationContract<ITenantProviderBindingStore>.SeedAsync(string, string, CancellationToken), TenantIsolationContract<ITenantProviderBindingStore>.ExistsAsync(string, object), TenantIsolationContract<ITenantProviderBindingStore>.CountAsync(string, CancellationToken), TenantIsolationContract<ITenantProviderBindingStore>.TryDeleteAsync(string, object), TenantIsolationContract<ITenantProviderBindingStore>.TryOverwriteAsync(string, string), TenantIsolationContract<ITenantProviderBindingStore>.CancellableReadAsync(CancellationToken), TenantIsolationContract<ITenantProviderBindingStore>.CancellableWriteAsync(CancellationToken), TenantIsolationContract<ITenantProviderBindingStore>.WroteAnythingAsync(), TenantIsolationContract<ITenantProviderBindingStore>.Tenant_cannot_read_another_tenants_record(), TenantIsolationContract<ITenantProviderBindingStore>.Tenant_reads_its_own_record(), TenantIsolationContract<ITenantProviderBindingStore>.Tenant_does_not_see_another_tenants_record_in_the_list(), TenantIsolationContract<ITenantProviderBindingStore>.Tenant_cannot_delete_another_tenants_record(), TenantIsolationContract<ITenantProviderBindingStore>.Same_name_lives_independently_across_two_tenants(), TenantIsolationContract<ITenantProviderBindingStore>.AmbientTenant, StoreCancellationContract<ITenantProviderBindingStore>.CreateStoreAsync(), StoreCancellationContract<ITenantProviderBindingStore>.InitializeAsync(), StoreCancellationContract<ITenantProviderBindingStore>.DisposeAsync(), StoreCancellationContract<ITenantProviderBindingStore>.OnDisposeAsync(), StoreCancellationContract<ITenantProviderBindingStore>.CancellableReadAsync(CancellationToken), StoreCancellationContract<ITenantProviderBindingStore>.CancellableWriteAsync(CancellationToken), StoreCancellationContract<ITenantProviderBindingStore>.WroteAnythingAsync(), StoreCancellationContract<ITenantProviderBindingStore>.Canceled_token_throws_on_read(), StoreCancellationContract<ITenantProviderBindingStore>.The_write_this_contract_checks_can_be_read_back(), StoreCancellationContract<ITenantProviderBindingStore>.Canceled_token_throws_on_write_and_leaves_no_trace(), StoreCancellationContract<ITenantProviderBindingStore>.Store, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

This contract never asserts a secret value: the store carries only the configuration key’s NAME. It exists to prove tenant isolation and round-tripping of that name plus the optional endpoint.

protected TenantProviderBindingStoreContract()

A_binding_is_deleted_whatever_case_the_caller_uses()

Section titled “ A_binding_is_deleted_whatever_case_the_caller_uses()”
[Fact]
public Task A_binding_is_deleted_whatever_case_the_caller_uses()

Task

A_binding_saved_under_a_different_case_replaces_the_existing_one()

Section titled “ A_binding_saved_under_a_different_case_replaces_the_existing_one()”
[Fact]
public Task A_binding_saved_under_a_different_case_replaces_the_existing_one()

Task

A_provider_name_is_matched_case_insensitively(string, string)

Section titled “ A_provider_name_is_matched_case_insensitively(string, string)”
[Theory]
[InlineData(new object?[] { "OpenAI", "openai" })]
[InlineData(new object?[] { "openai", "OpenAI" })]
[InlineData(new object?[] { "OPENAI", "openai" })]
public Task A_provider_name_is_matched_case_insensitively(string savedAs, string requestedAs)

savedAs string

requestedAs string

Task

A_tenant_is_matched_case_insensitively(string, string)

Section titled “ A_tenant_is_matched_case_insensitively(string, string)”
[Theory]
[InlineData(new object?[] { "acme", "Acme" })]
[InlineData(new object?[] { "Acme", "acme" })]
[InlineData(new object?[] { "ACME", "acme" })]
public Task A_tenant_is_matched_case_insensitively(string savedAs, string requestedAs)

savedAs string

requestedAs string

Task

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

protected override ValueTask<int> CountAsync(string tenantId, CancellationToken cancellationToken)

tenantId string

The reading tenant.

cancellationToken CancellationToken

The token every store call inside the hook must be handed; see TenantIsolationContract.SeedAsync.

ValueTask<int>

The number of records seen.

[Fact]
public Task Endpoint_is_optional()

Task

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

protected override ValueTask<bool> ExistsAsync(string tenantId, object key)

tenantId string

The reading tenant.

key object

The key returned by TenantIsolationContract.SeedAsync.

ValueTask<bool>

true if the record is visible.

Listing_returns_every_provider_binding_of_the_tenant()

Section titled “ Listing_returns_every_provider_binding_of_the_tenant()”
[Fact]
public Task Listing_returns_every_provider_binding_of_the_tenant()

Task

[Fact]
public Task Missing_binding_returns_null()

Task

[Fact]
public Task Saved_binding_is_read_back()

Task

SeedAsync(string, string, CancellationToken)

Section titled “ SeedAsync(string, string, CancellationToken)”

Writes a sample record for the given tenant.

protected override ValueTask<object> SeedAsync(string tenantId, string name, CancellationToken cancellationToken)

tenantId string

The tenant that owns the record.

name string

The name distinguishing the record. The same name may be used by two tenants.

cancellationToken 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.

ValueTask<object>

The key to use for reading the record back.

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

protected override ValueTask<bool?> TryDeleteAsync(string tenantId, object key)

tenantId string

The tenant attempting the delete.

key object

The key returned by TenantIsolationContract.SeedAsync.

ValueTask<bool?>

true if the delete succeeded, false if the record was not found; null if the store does not offer deletion.

Upsert_replaces_the_existing_binding_for_the_same_tenant_and_provider()

Section titled “ Upsert_replaces_the_existing_binding_for_the_same_tenant_and_provider()”
[Fact]
public Task Upsert_replaces_the_existing_binding_for_the_same_tenant_and_provider()

Task