Skip to content
Tracon

RunInputStoreContract

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

Behavior tests for the IRunInputStore contract.

public abstract class RunInputStoreContract : IAsyncLifetime, IAsyncDisposable

objectRunInputStoreContract

IAsyncLifetime, IAsyncDisposable

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.

The most valuable test is RunInputStoreContract.Polymorphic_content_round_trips_with_KEY_ORDER_preserved: a store that reorders object keys on write (for example, one backed by a JSON-typed column) can silently move the $type discriminator away from the first property, and the read then fails with a JsonException. Neither the build nor the other tests catch this.

protected RunInputStoreContract()

The input store under test.

protected IRunInputStore Store { get; }

IRunInputStore

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/RunInputStoreContract.cs", 134)]
public Task Another_tenants_input_cannot_be_read()

Task

Produces an empty input store for testing.

protected abstract ValueTask<IRunInputStore> CreateStoreAsync()

ValueTask<IRunInputStore>

A store ready for use.

public ValueTask DisposeAsync()

ValueTask

Called immediately after the class has been created, before it is used.

public ValueTask InitializeAsync()

ValueTask

Hook for the derived class to release its own resources.

protected virtual ValueTask OnDisposeAsync()

ValueTask

The completion task.

Polymorphic_content_round_trips_with_KEY_ORDER_preserved()

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

Task

Opens a run row at the given id before an input is written.

protected virtual ValueTask PrepareRunAsync(Guid runId, string tenantId)

runId Guid

The run id.

tenantId string

The tenant id.

ValueTask

The completion task.

In the SQL implementations, run_inputs.run_id is a foreign key into the runs table; the in-memory implementation has no such link, and the hook does nothing.

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/RunInputStoreContract.cs", 76)]
public Task Run_without_a_record_returns_null()

Task

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/RunInputStoreContract.cs", 80)]
public Task Second_write_is_IGNORED()

Task

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/RunInputStoreContract.cs", 59)]
public Task Written_input_round_trips_exactly()

Task