.NET API
TenantEgressPolicyStoreContract
Tracon.Testing.Contracts.Xunit.dllBehavior tests for the ITenantEgressPolicyStore contract.
public abstract class TenantEgressPolicyStoreContract : TenantIsolationContract<ITenantEgressPolicyStore>, IAsyncLifetime, IAsyncDisposable- Inheritance
- object ← StoreCancellationContract<ITenantEgressPolicyStore> ← TenantIsolationContract<ITenantEgressPolicyStore> ← TenantEgressPolicyStoreContract
- Implements
- IAsyncLifetime, IAsyncDisposable
- Inherited Members
- TenantIsolationContract<ITenantEgressPolicyStore>.TenantA, TenantIsolationContract<ITenantEgressPolicyStore>.TenantB, TenantIsolationContract<ITenantEgressPolicyStore>.UseAmbientTenant(MutableTenantContext), TenantIsolationContract<ITenantEgressPolicyStore>.SeedAsync(string, string, CancellationToken), TenantIsolationContract<ITenantEgressPolicyStore>.ExistsAsync(string, object), TenantIsolationContract<ITenantEgressPolicyStore>.CountAsync(string, CancellationToken), TenantIsolationContract<ITenantEgressPolicyStore>.TryDeleteAsync(string, object), TenantIsolationContract<ITenantEgressPolicyStore>.TryOverwriteAsync(string, string), TenantIsolationContract<ITenantEgressPolicyStore>.CancellableReadAsync(CancellationToken), TenantIsolationContract<ITenantEgressPolicyStore>.CancellableWriteAsync(CancellationToken), TenantIsolationContract<ITenantEgressPolicyStore>.WroteAnythingAsync(), TenantIsolationContract<ITenantEgressPolicyStore>.Tenant_cannot_read_another_tenants_record(), TenantIsolationContract<ITenantEgressPolicyStore>.Tenant_reads_its_own_record(), TenantIsolationContract<ITenantEgressPolicyStore>.Tenant_does_not_see_another_tenants_record_in_the_list(), TenantIsolationContract<ITenantEgressPolicyStore>.Tenant_cannot_delete_another_tenants_record(), TenantIsolationContract<ITenantEgressPolicyStore>.Same_name_lives_independently_across_two_tenants(), TenantIsolationContract<ITenantEgressPolicyStore>.AmbientTenant, StoreCancellationContract<ITenantEgressPolicyStore>.CreateStoreAsync(), StoreCancellationContract<ITenantEgressPolicyStore>.InitializeAsync(), StoreCancellationContract<ITenantEgressPolicyStore>.DisposeAsync(), StoreCancellationContract<ITenantEgressPolicyStore>.OnDisposeAsync(), StoreCancellationContract<ITenantEgressPolicyStore>.CancellableReadAsync(CancellationToken), StoreCancellationContract<ITenantEgressPolicyStore>.CancellableWriteAsync(CancellationToken), StoreCancellationContract<ITenantEgressPolicyStore>.WroteAnythingAsync(), StoreCancellationContract<ITenantEgressPolicyStore>.Canceled_token_throws_on_read(), StoreCancellationContract<ITenantEgressPolicyStore>.The_write_this_contract_checks_can_be_read_back(), StoreCancellationContract<ITenantEgressPolicyStore>.Canceled_token_throws_on_write_and_leaves_no_trace(), StoreCancellationContract<ITenantEgressPolicyStore>.Store, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”A tenant carries at most ONE policy (there is no “name” dimension), so the
isolation base’s generic name parameter is ignored here; every
scenario still proves the SAME thing the other store contracts do:
tenant A’s policy is invisible to and unwritable by tenant B.
Constructors
Section titled “Constructors”TenantEgressPolicyStoreContract()
Section titled “ TenantEgressPolicyStoreContract()”protected TenantEgressPolicyStoreContract()Methods
Section titled “Methods”A_policy_is_deleted_whatever_case_the_caller_uses()
Section titled “ A_policy_is_deleted_whatever_case_the_caller_uses()”[Fact]public Task A_policy_is_deleted_whatever_case_the_caller_uses()Returns
Section titled “Returns”A_policy_saved_under_a_different_case_replaces_the_existing_one()
Section titled “ A_policy_saved_under_a_different_case_replaces_the_existing_one()”[Fact]public Task A_policy_saved_under_a_different_case_replaces_the_existing_one()Returns
Section titled “Returns”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)Parameters
Section titled “Parameters”savedAs string
requestedAs string
Returns
Section titled “Returns”CountAsync(string, CancellationToken)
Section titled “ CountAsync(string, CancellationToken)”Reports how many records the given tenant sees through the listing endpoint.
protected override ValueTask<int> CountAsync(string tenantId, CancellationToken cancellationToken)Parameters
Section titled “Parameters”tenantId string
The reading tenant.
cancellationToken CancellationToken
The token every store call inside the hook must be handed; see TenantIsolationContract.SeedAsync.
Returns
Section titled “Returns”The number of records seen.
Deleting_the_policy_makes_the_tenant_unrestricted_again()
Section titled “ Deleting_the_policy_makes_the_tenant_unrestricted_again()”[Fact]public Task Deleting_the_policy_makes_the_tenant_unrestricted_again()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.
Saved_policy_is_read_back()
Section titled “ Saved_policy_is_read_back()”[Fact]public Task Saved_policy_is_read_back()Returns
Section titled “Returns”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)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.
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.
Returns
Section titled “Returns”The key to use for reading the record back.
Tenant_with_no_saved_policy_is_unrestricted()
Section titled “ Tenant_with_no_saved_policy_is_unrestricted()”[Fact]public Task Tenant_with_no_saved_policy_is_unrestricted()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.
Upsert_replaces_the_existing_policy()
Section titled “ Upsert_replaces_the_existing_policy()”[Fact]public Task Upsert_replaces_the_existing_policy()