.NET API
RunInputStoreContract
Tracon.Testing.Contracts.Xunit.dllBehavior tests for the IRunInputStore contract.
public abstract class RunInputStoreContract : StoreCancellationContract<IRunInputStore>, IAsyncLifetime, IAsyncDisposable- Inheritance
- object ← StoreCancellationContract<IRunInputStore> ← RunInputStoreContract
- Implements
- IAsyncLifetime, IAsyncDisposable
- Inherited Members
- StoreCancellationContract<IRunInputStore>.CreateStoreAsync(), StoreCancellationContract<IRunInputStore>.InitializeAsync(), StoreCancellationContract<IRunInputStore>.DisposeAsync(), StoreCancellationContract<IRunInputStore>.OnDisposeAsync(), StoreCancellationContract<IRunInputStore>.CancellableReadAsync(CancellationToken), StoreCancellationContract<IRunInputStore>.CancellableWriteAsync(CancellationToken), StoreCancellationContract<IRunInputStore>.WroteAnythingAsync(), StoreCancellationContract<IRunInputStore>.Canceled_token_throws_on_read(), StoreCancellationContract<IRunInputStore>.The_write_this_contract_checks_can_be_read_back(), StoreCancellationContract<IRunInputStore>.Canceled_token_throws_on_write_and_leaves_no_trace(), StoreCancellationContract<IRunInputStore>.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.
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.
Constructors
Section titled “Constructors”RunInputStoreContract()
Section titled “ RunInputStoreContract()”protected RunInputStoreContract()Methods
Section titled “Methods”A_run_with_values_and_no_messages_still_records_the_values()
Section titled “ A_run_with_values_and_no_messages_still_records_the_values()”[Fact]public Task A_run_with_values_and_no_messages_still_records_the_values()Returns
Section titled “Returns”Another_tenants_input_cannot_be_read()
Section titled “ Another_tenants_input_cannot_be_read()”[Fact]public Task Another_tenants_input_cannot_be_read()Returns
Section titled “Returns”CancellableReadAsync(CancellationToken)
Section titled “ CancellableReadAsync(CancellationToken)”Calls one read method of the store with the given token.
protected override ValueTask CancellableReadAsync(CancellationToken cancellationToken)Parameters
Section titled “Parameters”cancellationToken CancellationToken
The token the store must observe.
Returns
Section titled “Returns”The completion task; any result is discarded.
CancellableWriteAsync(CancellationToken)
Section titled “ CancellableWriteAsync(CancellationToken)”Calls one write method of the store with the given token.
protected override ValueTask CancellableWriteAsync(CancellationToken cancellationToken)Parameters
Section titled “Parameters”cancellationToken CancellationToken
The token the store must observe.
Returns
Section titled “Returns”The completion task.
Remarks
Section titled “Remarks”The write must be one StoreCancellationContract.WroteAnythingAsync can see. A write this contract cannot read back proves nothing about side effects, which is why StoreCancellationContract.The_write_this_contract_checks_can_be_read_back runs the same pair with a live token and requires the read to find it.
Missing_parameters_and_empty_parameters_stay_distinct()
Section titled “ Missing_parameters_and_empty_parameters_stay_distinct()”[Fact]public Task Missing_parameters_and_empty_parameters_stay_distinct()Returns
Section titled “Returns”Parameter_values_round_trip_exactly()
Section titled “ Parameter_values_round_trip_exactly()”[Fact]public Task Parameter_values_round_trip_exactly()Returns
Section titled “Returns”Polymorphic_content_round_trips_with_KEY_ORDER_preserved()
Section titled “ Polymorphic_content_round_trips_with_KEY_ORDER_preserved()”[Fact]public Task Polymorphic_content_round_trips_with_KEY_ORDER_preserved()Returns
Section titled “Returns”PrepareRunAsync(Guid, string)
Section titled “ PrepareRunAsync(Guid, string)”Opens a run row at the given id before an input is written.
protected virtual ValueTask PrepareRunAsync(Guid runId, string tenantId)Parameters
Section titled “Parameters”runId Guid
The run id.
tenantId string
The tenant id.
Returns
Section titled “Returns”The completion task.
Remarks
Section titled “Remarks”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.
Run_without_a_record_returns_null()
Section titled “ Run_without_a_record_returns_null()”[Fact]public Task Run_without_a_record_returns_null()Returns
Section titled “Returns”Second_write_is_IGNORED()
Section titled “ Second_write_is_IGNORED()”[Fact]public Task Second_write_is_IGNORED()Returns
Section titled “Returns”Second_write_never_changes_the_recorded_parameters()
Section titled “ Second_write_never_changes_the_recorded_parameters()”[Fact]public Task Second_write_never_changes_the_recorded_parameters()Returns
Section titled “Returns”Written_input_round_trips_exactly()
Section titled “ Written_input_round_trips_exactly()”[Fact]public Task Written_input_round_trips_exactly()Returns
Section titled “Returns”WroteAnythingAsync()
Section titled “ WroteAnythingAsync()”Reports whether StoreCancellationContract.CancellableWriteAsync left anything behind.
protected override ValueTask<bool> WroteAnythingAsync()Returns
Section titled “Returns”true if the store holds any record the write would have created.