# RunInputStoreContract

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.testing.contracts.storage.runinputstorecontract/
> Summary: RunInputStoreContract: Behavior tests for the IRunInputStore contract.

<div class="api-provenance">Namespace Tracon.Testing.Contracts.Storage · Assembly <code>Tracon.Testing.Contracts.Xunit.dll</code></div>

Behavior tests for the [IRunInputStore](/api/tracon.iruninputstore/) contract.

```csharp
public abstract class RunInputStoreContract : StoreCancellationContract<IRunInputStore>, IAsyncLifetime, IAsyncDisposable
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/">StoreCancellationContract&lt;IRunInputStore&gt;</a> ← <a href="/api/tracon.testing.contracts.storage.runinputstorecontract/">RunInputStoreContract</a></dd><dt>Implements</dt><dd>IAsyncLifetime, <a href="https://learn.microsoft.com/dotnet/api/system.iasyncdisposable">IAsyncDisposable</a></dd><dt>Inherited Members</dt><dd><a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_CreateStoreAsync">StoreCancellationContract&lt;IRunInputStore&gt;.CreateStoreAsync()</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_InitializeAsync">StoreCancellationContract&lt;IRunInputStore&gt;.InitializeAsync()</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_DisposeAsync">StoreCancellationContract&lt;IRunInputStore&gt;.DisposeAsync()</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_OnDisposeAsync">StoreCancellationContract&lt;IRunInputStore&gt;.OnDisposeAsync()</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_CancellableReadAsync_System_Threading_CancellationToken_">StoreCancellationContract&lt;IRunInputStore&gt;.CancellableReadAsync(CancellationToken)</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_CancellableWriteAsync_System_Threading_CancellationToken_">StoreCancellationContract&lt;IRunInputStore&gt;.CancellableWriteAsync(CancellationToken)</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_WroteAnythingAsync">StoreCancellationContract&lt;IRunInputStore&gt;.WroteAnythingAsync()</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_Canceled_token_throws_on_read">StoreCancellationContract&lt;IRunInputStore&gt;.Canceled_token_throws_on_read()</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_The_write_this_contract_checks_can_be_read_back">StoreCancellationContract&lt;IRunInputStore&gt;.The_write_this_contract_checks_can_be_read_back()</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_Canceled_token_throws_on_write_and_leaves_no_trace">StoreCancellationContract&lt;IRunInputStore&gt;.Canceled_token_throws_on_write_and_leaves_no_trace()</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_Store">StoreCancellationContract&lt;IRunInputStore&gt;.Store</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a></dd></dl>

## Remarks

Every implementation must pass the same scenarios.

The most valuable test is
[RunInputStoreContract.Polymorphic_content_round_trips_with_KEY_ORDER_preserved](/api/tracon.testing.contracts.storage.runinputstorecontract/#Tracon_Testing_Contracts_Storage_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

### <a id="Tracon_Testing_Contracts_Storage_RunInputStoreContract__ctor"></a> RunInputStoreContract\(\)

```csharp
protected RunInputStoreContract()
```

## Methods

### <a id="Tracon_Testing_Contracts_Storage_RunInputStoreContract_A_run_with_values_and_no_messages_still_records_the_values"></a> A\_run\_with\_values\_and\_no\_messages\_still\_records\_the\_values\(\)

```csharp
[Fact]
public Task A_run_with_values_and_no_messages_still_records_the_values()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_RunInputStoreContract_Another_tenants_input_cannot_be_read"></a> Another\_tenants\_input\_cannot\_be\_read\(\)

```csharp
[Fact]
public Task Another_tenants_input_cannot_be_read()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_RunInputStoreContract_CancellableReadAsync_System_Threading_CancellationToken_"></a> CancellableReadAsync\(CancellationToken\)

Calls one **read** method of the store with the given
token.

```csharp
protected override ValueTask CancellableReadAsync(CancellationToken cancellationToken)
```

#### Parameters

`cancellationToken` [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken)

The token the store must observe.

#### Returns

 [ValueTask](https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask)

The completion task; any result is discarded.

### <a id="Tracon_Testing_Contracts_Storage_RunInputStoreContract_CancellableWriteAsync_System_Threading_CancellationToken_"></a> CancellableWriteAsync\(CancellationToken\)

Calls one **write** method of the store with the given
token.

```csharp
protected override ValueTask CancellableWriteAsync(CancellationToken cancellationToken)
```

#### Parameters

`cancellationToken` [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken)

The token the store must observe.

#### Returns

 [ValueTask](https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask)

The completion task.

#### Remarks

The write must be one [StoreCancellationContract.WroteAnythingAsync](/api/tracon.testing.contracts.storage/) 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](/api/tracon.testing.contracts.storage/)
runs the same pair with a live token and requires the read to find it.

### <a id="Tracon_Testing_Contracts_Storage_RunInputStoreContract_Missing_parameters_and_empty_parameters_stay_distinct"></a> Missing\_parameters\_and\_empty\_parameters\_stay\_distinct\(\)

```csharp
[Fact]
public Task Missing_parameters_and_empty_parameters_stay_distinct()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_RunInputStoreContract_Parameter_values_round_trip_exactly"></a> Parameter\_values\_round\_trip\_exactly\(\)

```csharp
[Fact]
public Task Parameter_values_round_trip_exactly()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_RunInputStoreContract_Polymorphic_content_round_trips_with_KEY_ORDER_preserved"></a> Polymorphic\_content\_round\_trips\_with\_KEY\_ORDER\_preserved\(\)

```csharp
[Fact]
public Task Polymorphic_content_round_trips_with_KEY_ORDER_preserved()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_RunInputStoreContract_PrepareRunAsync_System_Guid_System_String_"></a> PrepareRunAsync\(Guid, string\)

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

```csharp
protected virtual ValueTask PrepareRunAsync(Guid runId, string tenantId)
```

#### Parameters

`runId` [Guid](https://learn.microsoft.com/dotnet/api/system.guid)

The run id.

`tenantId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The tenant id.

#### Returns

 [ValueTask](https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask)

The completion task.

#### 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.

### <a id="Tracon_Testing_Contracts_Storage_RunInputStoreContract_Run_without_a_record_returns_null"></a> Run\_without\_a\_record\_returns\_null\(\)

```csharp
[Fact]
public Task Run_without_a_record_returns_null()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_RunInputStoreContract_Second_write_is_IGNORED"></a> Second\_write\_is\_IGNORED\(\)

```csharp
[Fact]
public Task Second_write_is_IGNORED()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_RunInputStoreContract_Second_write_never_changes_the_recorded_parameters"></a> Second\_write\_never\_changes\_the\_recorded\_parameters\(\)

```csharp
[Fact]
public Task Second_write_never_changes_the_recorded_parameters()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_RunInputStoreContract_Written_input_round_trips_exactly"></a> Written\_input\_round\_trips\_exactly\(\)

```csharp
[Fact]
public Task Written_input_round_trips_exactly()
```

#### Returns

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_RunInputStoreContract_WroteAnythingAsync"></a> WroteAnythingAsync\(\)

Reports whether [StoreCancellationContract.CancellableWriteAsync](/api/tracon.testing.contracts.storage/) left anything
behind.

```csharp
protected override ValueTask<bool> WroteAnythingAsync()
```

#### Returns

 [ValueTask](https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\-1)<[bool](https://learn.microsoft.com/dotnet/api/system.boolean)\>

[true](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool) if the store holds any record the write would have created.
