Skip to content
Tracon

AttachmentStoreContract

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

Behavior tests for the IAttachmentStore contract.

public abstract class AttachmentStoreContract : TenantIsolationContract<IAttachmentStore>, IAsyncLifetime, IAsyncDisposable

objectTenantIsolationContract<IAttachmentStore>AttachmentStoreContract

IAsyncLifetime, IAsyncDisposable

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

Every implementation must pass the same scenarios; in particular, tenant isolation and attachments being removed when a session is deleted must behave identically.

protected AttachmentStoreContract()

Another_tenants_attachment_is_not_visible()

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

Task

Bulk_delete_by_session_removes_only_matches()

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

Task

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AttachmentStoreContract.cs", 57)]
public Task Content_is_read_back_as_is()

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.

Delete_succeeds_once_and_returns_false_the_second_time()

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

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/AttachmentStoreContract.cs", 84)]
public Task Listing_filters_by_session()

Task

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AttachmentStoreContract.cs", 43)]
public Task Record_metadata_is_stored_correctly()

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.

Session_based_delete_does_not_delete_the_others_attachments()

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

Task

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.