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

objectTenantIsolationContract<IWebhookStore>WebhookStoreContract

IAsyncLifetime, IAsyncDisposable

TenantIsolationContract<IWebhookStore>.TenantA, TenantIsolationContract<IWebhookStore>.TenantB, TenantIsolationContract<IWebhookStore>.CreateStoreAsync(), TenantIsolationContract<IWebhookStore>.UseAmbientTenant(MutableTenantContext), TenantIsolationContract<IWebhookStore>.InitializeAsync(), TenantIsolationContract<IWebhookStore>.DisposeAsync(), TenantIsolationContract<IWebhookStore>.OnDisposeAsync(), TenantIsolationContract<IWebhookStore>.SeedAsync(string, string), TenantIsolationContract<IWebhookStore>.ExistsAsync(string, object), TenantIsolationContract<IWebhookStore>.CountAsync(string), TenantIsolationContract<IWebhookStore>.TryDeleteAsync(string, object), TenantIsolationContract<IWebhookStore>.TryOverwriteAsync(string, string), 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, TenantIsolationContract<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("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/WebhookStoreContract.cs", 135)]
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)

tenantId string

The reading tenant.

ValueTask<int>

The number of records seen.

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/WebhookStoreContract.cs", 145)]
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("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/WebhookStoreContract.cs", 154)]
public Task Deleting_a_subscription_also_deletes_its_deliveries()

Task

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/WebhookStoreContract.cs", 230)]
public Task Deliveries_are_filtered_by_status()

Task

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/WebhookStoreContract.cs", 167)]
public Task Delivery_record_is_read_back()

Task

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

Task

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/WebhookStoreContract.cs", 123)]
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("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/WebhookStoreContract.cs", 206)]
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("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/WebhookStoreContract.cs", 255)]
public Task Failure_counter_increments_and_disables_the_subscription_at_the_threshold()

Task

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/WebhookStoreContract.cs", 71)]
public Task Headers_are_preserved()

Task

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/WebhookStoreContract.cs", 55)]
public Task Saved_subscription_is_read_back()

Task

Saving_the_same_name_a_second_time_overwrites_it()

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

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.

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/WebhookStoreContract.cs", 101)]
public Task Subscribers_for_an_event_are_found()

Task

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/WebhookStoreContract.cs", 276)]
public Task Successful_delivery_resets_the_counter()

Task

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/WebhookStoreContract.cs", 181)]
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.