Skip to content
Tracon

JobScheduleStoreContract

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

Behavior tests for the IJobScheduleStore contract.

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

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.

DeleteAsync_removes_an_existing_schedule()

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

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.

GetAsync_returns_null_for_another_tenant()

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

Task

[Fact]
public Task ListAsync_returns_only_that_tenant()

Task

ListDueAsync_returns_only_enabled_and_due_schedules()

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

Task

SaveAsync_assigns_an_id_to_a_new_schedule()

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

Task

SaveAsync_keeps_the_id_and_updates_for_the_same_name()

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

Task

SaveAsync_round_trips_a_schedule_that_carries_no_payload()

Section titled “ SaveAsync_round_trips_a_schedule_that_carries_no_payload()”

A schedule saved with no payload round-trips through every provider.

[Fact]
public Task SaveAsync_round_trips_a_schedule_that_carries_no_payload()

Task

An unset payload used to be written as the literal null, which SQL Server’s CHECK (ISJSON(payload) = 1) rejects, while Postgres and SQLite accepted it - a provider divergence no in-memory test could see. The empty array satisfies all three, and the read-back has to agree with what was written.

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.

TryClaimNextRunAsync_a_second_claim_prevents_the_conflict()

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

Task

TryClaimNextRunAsync_fails_when_the_expected_value_does_not_match()

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

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.