Skip to content
Tracon

WebhookStoreContract

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

Behavior tests for the IWebhookStore contract.

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

This contract has no secret field. The store only carries the name of the configuration key the secret is read from; tests verify this.

protected WebhookStoreContract()

Another_tenants_subscription_is_not_visible()

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

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 Deleted_subscription_is_not_read_back()

Task

Deleting_a_subscription_also_deletes_its_deliveries()

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

Task

[Fact]
public Task Deliveries_are_filtered_by_status()

Task

[Fact]
public Task Delivery_record_is_read_back()

Task

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

Task

[Fact]
public Task Event_name_matches_exactly()

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.

Failed_delivery_does_not_record_a_delivery_time()

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

Task

Failure_counter_increments_and_disables_the_subscription_at_the_threshold()

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

Task

Header_configuration_keys_are_preserved()

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

Task

Header_names_that_differ_only_in_case_do_not_fail_the_save()

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

Task

[Fact]
public Task Headers_are_preserved()

Task

[Fact]
public Task Saved_subscription_is_read_back()

Task

Saving_a_subscription_again_writes_the_failure_counter_it_carries()

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

Task

Saving_the_same_name_a_second_time_overwrites_it()

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

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.

[Fact]
public Task Subscribers_for_an_event_are_found()

Task

[Fact]
public Task Successful_delivery_resets_the_counter()

Task

[Fact]
public Task Successful_delivery_result_is_recorded()

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.