.NET API
AttachmentStoreContract
Tracon.Testing.Contracts.Xunit.dllBehavior tests for the IAttachmentStore contract.
public abstract class AttachmentStoreContract : TenantIsolationContract<IAttachmentStore>, IAsyncLifetime, IAsyncDisposable- Inheritance
- object ← StoreCancellationContract<IAttachmentStore> ← TenantIsolationContract<IAttachmentStore> ← AttachmentStoreContract
- Implements
- IAsyncLifetime, IAsyncDisposable
- Inherited Members
- TenantIsolationContract<IAttachmentStore>.TenantA, TenantIsolationContract<IAttachmentStore>.TenantB, TenantIsolationContract<IAttachmentStore>.UseAmbientTenant(MutableTenantContext), TenantIsolationContract<IAttachmentStore>.SeedAsync(string, string, CancellationToken), TenantIsolationContract<IAttachmentStore>.ExistsAsync(string, object), TenantIsolationContract<IAttachmentStore>.CountAsync(string, CancellationToken), TenantIsolationContract<IAttachmentStore>.TryDeleteAsync(string, object), TenantIsolationContract<IAttachmentStore>.TryOverwriteAsync(string, string), TenantIsolationContract<IAttachmentStore>.CancellableReadAsync(CancellationToken), TenantIsolationContract<IAttachmentStore>.CancellableWriteAsync(CancellationToken), TenantIsolationContract<IAttachmentStore>.WroteAnythingAsync(), 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, StoreCancellationContract<IAttachmentStore>.CreateStoreAsync(), StoreCancellationContract<IAttachmentStore>.InitializeAsync(), StoreCancellationContract<IAttachmentStore>.DisposeAsync(), StoreCancellationContract<IAttachmentStore>.OnDisposeAsync(), StoreCancellationContract<IAttachmentStore>.CancellableReadAsync(CancellationToken), StoreCancellationContract<IAttachmentStore>.CancellableWriteAsync(CancellationToken), StoreCancellationContract<IAttachmentStore>.WroteAnythingAsync(), StoreCancellationContract<IAttachmentStore>.Canceled_token_throws_on_read(), StoreCancellationContract<IAttachmentStore>.The_write_this_contract_checks_can_be_read_back(), StoreCancellationContract<IAttachmentStore>.Canceled_token_throws_on_write_and_leaves_no_trace(), StoreCancellationContract<IAttachmentStore>.Store, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”Every implementation must pass the same scenarios; in particular, tenant isolation and attachments being removed when a session is deleted must behave identically.
Constructors
Section titled “Constructors”AttachmentStoreContract()
Section titled “ AttachmentStoreContract()”protected AttachmentStoreContract()Methods
Section titled “Methods”Another_tenants_attachment_is_not_visible()
Section titled “ Another_tenants_attachment_is_not_visible()”[Fact]public Task Another_tenants_attachment_is_not_visible()Returns
Section titled “Returns”Bulk_delete_by_session_removes_only_matches()
Section titled “ Bulk_delete_by_session_removes_only_matches()”[Fact]public Task Bulk_delete_by_session_removes_only_matches()Returns
Section titled “Returns”Content_is_read_back_as_is()
Section titled “ Content_is_read_back_as_is()”[Fact]public Task Content_is_read_back_as_is()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.
Delete_succeeds_once_and_returns_false_the_second_time()
Section titled “ Delete_succeeds_once_and_returns_false_the_second_time()”[Fact]public Task Delete_succeeds_once_and_returns_false_the_second_time()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.
Listing_filters_by_session()
Section titled “ Listing_filters_by_session()”[Fact]public Task Listing_filters_by_session()Returns
Section titled “Returns”Record_metadata_is_stored_correctly()
Section titled “ Record_metadata_is_stored_correctly()”[Fact]public Task Record_metadata_is_stored_correctly()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.
Session_based_delete_does_not_delete_the_others_attachments()
Section titled “ Session_based_delete_does_not_delete_the_others_attachments()”[Fact]public Task Session_based_delete_does_not_delete_the_others_attachments()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.