Skip to content
Tracon

PendingApprovalStoreContract

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

Behavior tests for the IPendingApprovalStore contract.

public abstract class PendingApprovalStoreContract : TenantIsolationContract<IPendingApprovalStore>, IAsyncLifetime, IAsyncDisposable

objectTenantIsolationContract<IPendingApprovalStore>PendingApprovalStoreContract

IAsyncLifetime, IAsyncDisposable

TenantIsolationContract<IPendingApprovalStore>.TenantA, TenantIsolationContract<IPendingApprovalStore>.TenantB, TenantIsolationContract<IPendingApprovalStore>.CreateStoreAsync(), TenantIsolationContract<IPendingApprovalStore>.UseAmbientTenant(MutableTenantContext), TenantIsolationContract<IPendingApprovalStore>.InitializeAsync(), TenantIsolationContract<IPendingApprovalStore>.DisposeAsync(), TenantIsolationContract<IPendingApprovalStore>.OnDisposeAsync(), TenantIsolationContract<IPendingApprovalStore>.SeedAsync(string, string), TenantIsolationContract<IPendingApprovalStore>.ExistsAsync(string, object), TenantIsolationContract<IPendingApprovalStore>.CountAsync(string), TenantIsolationContract<IPendingApprovalStore>.TryDeleteAsync(string, object), TenantIsolationContract<IPendingApprovalStore>.TryOverwriteAsync(string, string), TenantIsolationContract<IPendingApprovalStore>.Tenant_cannot_read_another_tenants_record(), TenantIsolationContract<IPendingApprovalStore>.Tenant_reads_its_own_record(), TenantIsolationContract<IPendingApprovalStore>.Tenant_does_not_see_another_tenants_record_in_the_list(), TenantIsolationContract<IPendingApprovalStore>.Tenant_cannot_delete_another_tenants_record(), TenantIsolationContract<IPendingApprovalStore>.Same_name_lives_independently_across_two_tenants(), TenantIsolationContract<IPendingApprovalStore>.AmbientTenant, TenantIsolationContract<IPendingApprovalStore>.Store, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

A pending approval request is a security record: one tenant’s operator cannot see, and must not be able to decide, another tenant’s approval. The PendingApprovalStoreContract.TryDeleteAsync hook is wired to the mutation operation here — IPendingApprovalStore.DecideAsync — its meaning is “decide”, not “delete”, but the two-way isolation check needs the same shape.

protected PendingApprovalStoreContract()

Absent_presentation_is_read_back_as_null()

Section titled “ Absent_presentation_is_read_back_as_null()”
[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/PendingApprovalStoreContract.cs", 109)]
public Task Absent_presentation_is_read_back_as_null()

Task

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

protected override ValueTask<int> CountAsync(string tenantId)

tenantId string

The reading tenant.

ValueTask<int>

The number of records seen.

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/PendingApprovalStoreContract.cs", 64)]
public Task Created_request_is_read_back()

Task

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/PendingApprovalStoreContract.cs", 140)]
public Task Deciding_updates_status_and_actor()

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.

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/PendingApprovalStoreContract.cs", 176)]
public Task Expired_request_is_closed_and_returned()

Task

Expiry_scan_does_not_exceed_the_max_limit()

Section titled “ Expiry_scan_does_not_exceed_the_max_limit()”
[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/PendingApprovalStoreContract.cs", 195)]
public Task Expiry_scan_does_not_exceed_the_max_limit()

Task

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/PendingApprovalStoreContract.cs", 123)]
public Task Listing_returns_only_pending_requests()

Task

Opens a run row at the given id before an approval request is written.

protected virtual ValueTask PrepareRunAsync(Guid runId, string tenantId)

runId Guid

The run id.

tenantId string

The tenant id.

ValueTask

The completion task.

In the SQL implementations, pending_approvals.run_id is a foreign key into the runs table (the SAME pattern as RunInputStoreContract.PrepareRunAsync); the in-memory implementation has no such link, and the hook does nothing.

Presentation_round_trips_through_create_and_get()

Section titled “ Presentation_round_trips_through_create_and_get()”
[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/PendingApprovalStoreContract.cs", 81)]
public Task Presentation_round_trips_through_create_and_get()

Task

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/PendingApprovalStoreContract.cs", 161)]
public Task Second_decision_is_rejected()

Task

Writes a sample record for the given tenant.

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

tenantId string

The tenant that owns the record.

name string

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

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.