# QuotaStoreContract

> 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.quotastorecontract/
> Summary: QuotaStoreContract: Behavior tests for the IQuotaStore contract.

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

Behavior tests for the [IQuotaStore](/api/tracon.iquotastore/) contract.

```csharp
public abstract class QuotaStoreContract : TenantIsolationContract<IQuotaStore>, 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;IQuotaStore&gt;</a> ← <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/">TenantIsolationContract&lt;IQuotaStore&gt;</a> ← <a href="/api/tracon.testing.contracts.storage.quotastorecontract/">QuotaStoreContract</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.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_TenantA">TenantIsolationContract&lt;IQuotaStore&gt;.TenantA</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_TenantB">TenantIsolationContract&lt;IQuotaStore&gt;.TenantB</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_UseAmbientTenant_Tracon_Testing_Contracts_Storage_MutableTenantContext_">TenantIsolationContract&lt;IQuotaStore&gt;.UseAmbientTenant(MutableTenantContext)</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_SeedAsync_System_String_System_String_System_Threading_CancellationToken_">TenantIsolationContract&lt;IQuotaStore&gt;.SeedAsync(string, string, CancellationToken)</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_ExistsAsync_System_String_System_Object_">TenantIsolationContract&lt;IQuotaStore&gt;.ExistsAsync(string, object)</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_CountAsync_System_String_System_Threading_CancellationToken_">TenantIsolationContract&lt;IQuotaStore&gt;.CountAsync(string, CancellationToken)</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_TryDeleteAsync_System_String_System_Object_">TenantIsolationContract&lt;IQuotaStore&gt;.TryDeleteAsync(string, object)</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_TryOverwriteAsync_System_String_System_String_">TenantIsolationContract&lt;IQuotaStore&gt;.TryOverwriteAsync(string, string)</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_CancellableReadAsync_System_Threading_CancellationToken_">TenantIsolationContract&lt;IQuotaStore&gt;.CancellableReadAsync(CancellationToken)</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_CancellableWriteAsync_System_Threading_CancellationToken_">TenantIsolationContract&lt;IQuotaStore&gt;.CancellableWriteAsync(CancellationToken)</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_WroteAnythingAsync">TenantIsolationContract&lt;IQuotaStore&gt;.WroteAnythingAsync()</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_Tenant_cannot_read_another_tenants_record">TenantIsolationContract&lt;IQuotaStore&gt;.Tenant_cannot_read_another_tenants_record()</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_Tenant_reads_its_own_record">TenantIsolationContract&lt;IQuotaStore&gt;.Tenant_reads_its_own_record()</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_Tenant_does_not_see_another_tenants_record_in_the_list">TenantIsolationContract&lt;IQuotaStore&gt;.Tenant_does_not_see_another_tenants_record_in_the_list()</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_Tenant_cannot_delete_another_tenants_record">TenantIsolationContract&lt;IQuotaStore&gt;.Tenant_cannot_delete_another_tenants_record()</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_Same_name_lives_independently_across_two_tenants">TenantIsolationContract&lt;IQuotaStore&gt;.Same_name_lives_independently_across_two_tenants()</a>, <a href="/api/tracon.testing.contracts.storage.tenantisolationcontract-1/#Tracon_Testing_Contracts_Storage_TenantIsolationContract_1_AmbientTenant">TenantIsolationContract&lt;IQuotaStore&gt;.AmbientTenant</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_CreateStoreAsync">StoreCancellationContract&lt;IQuotaStore&gt;.CreateStoreAsync()</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_InitializeAsync">StoreCancellationContract&lt;IQuotaStore&gt;.InitializeAsync()</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_DisposeAsync">StoreCancellationContract&lt;IQuotaStore&gt;.DisposeAsync()</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_OnDisposeAsync">StoreCancellationContract&lt;IQuotaStore&gt;.OnDisposeAsync()</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_CancellableReadAsync_System_Threading_CancellationToken_">StoreCancellationContract&lt;IQuotaStore&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;IQuotaStore&gt;.CancellableWriteAsync(CancellationToken)</a>, <a href="/api/tracon.testing.contracts.storage.storecancellationcontract-1/#Tracon_Testing_Contracts_Storage_StoreCancellationContract_1_WroteAnythingAsync">StoreCancellationContract&lt;IQuotaStore&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;IQuotaStore&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;IQuotaStore&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;IQuotaStore&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;IQuotaStore&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

The in-memory store and the PostgreSQL store must pass the same
scenarios. Two rules are especially critical: scope uniqueness
(`COALESCE(agent_name, '')`) and the atomicity of usage increments
(`ON CONFLICT DO UPDATE`).

## Constructors

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract__ctor"></a> QuotaStoreContract\(\)

```csharp
protected QuotaStoreContract()
```

## Methods

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_A_different_metric_is_a_separate_claim"></a> A\_different\_metric\_is\_a\_separate\_claim\(\)

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_A_different_tenants_identically_shaped_claim_is_independent"></a> A\_different\_tenants\_identically\_shaped\_claim\_is\_independent\(\)

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_A_different_threshold_percent_is_a_separate_claim"></a> A\_different\_threshold\_percent\_is\_a\_separate\_claim\(\)

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_A_new_period_starts_with_no_claim_even_if_the_previous_period_already_has_one"></a> A\_new\_period\_starts\_with\_no\_claim\_even\_if\_the\_previous\_period\_already\_has\_one\(\)

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_A_period_left_out_of_the_period_starts_is_not_returned"></a> A\_period\_left\_out\_of\_the\_period\_starts\_is\_not\_returned\(\)

A period missing from [QuotaUsageQuery.PeriodStarts](/api/tracon.quotausagequery/#Tracon_QuotaUsageQuery_PeriodStarts) returns no counters.

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_A_threshold_already_claimed_in_this_period_is_not_claimed_again"></a> A\_threshold\_already\_claimed\_in\_this\_period\_is\_not\_claimed\_again\(\)

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_Another_tenants_rule_is_not_visible"></a> Another\_tenants\_rule\_is\_not\_visible\(\)

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_Another_tenants_usage_is_not_visible"></a> Another\_tenants\_usage\_is\_not\_visible\(\)

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_Claim_fails_when_the_usage_row_does_not_exist_yet"></a> Claim\_fails\_when\_the\_usage\_row\_does\_not\_exist\_yet\(\)

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_Concurrent_claims_of_the_same_threshold_let_only_one_caller_win"></a> Concurrent\_claims\_of\_the\_same\_threshold\_let\_only\_one\_caller\_win\(\)

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_Concurrent_increments_lose_no_increment"></a> Concurrent\_increments\_lose\_no\_increment\(\)

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

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

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

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

Reports how many records the given tenant sees through the listing endpoint.

```csharp
protected override ValueTask<int> CountAsync(string tenantId, CancellationToken cancellationToken)
```

#### Parameters

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

`cancellationToken` [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.cancellationtoken)

The token every store call inside the hook must be handed; see
[TenantIsolationContract.SeedAsync](/api/tracon.testing.contracts.storage/).

#### Returns

 [ValueTask](https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\-1)<[int](https://learn.microsoft.com/dotnet/api/system.int32)\>

The number of records seen.

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_Deleted_rule_is_not_read_back"></a> Deleted\_rule\_is\_not\_read\_back\(\)

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_Deleting_a_nonexistent_rule_returns_false"></a> Deleting\_a\_nonexistent\_rule\_returns\_false\(\)

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_Different_agent_becomes_a_separate_rule"></a> Different\_agent\_becomes\_a\_separate\_rule\(\)

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_Different_period_becomes_a_separate_rule"></a> Different\_period\_becomes\_a\_separate\_rule\(\)

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_Empty_limits_are_preserved_as_null"></a> Empty\_limits\_are\_preserved\_as\_null\(\)

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_Empty_period_starts_return_no_counters"></a> Empty\_period\_starts\_return\_no\_counters\(\)

An empty [QuotaUsageQuery.PeriodStarts](/api/tracon.quotausagequery/#Tracon_QuotaUsageQuery_PeriodStarts) names no period and returns nothing.

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

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

Reports whether the record is visible from the given tenant's viewpoint.

```csharp
protected override ValueTask<bool> ExistsAsync(string tenantId, object key)
```

#### Parameters

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

`key` [object](https://learn.microsoft.com/dotnet/api/system.object)

The key returned by [TenantIsolationContract.SeedAsync](/api/tracon.testing.contracts.storage/).

#### 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 record is visible.

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_First_claim_of_a_threshold_succeeds"></a> First\_claim\_of\_a\_threshold\_succeeds\(\)

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_Period_starts_apply_together_with_the_other_filters"></a> Period\_starts\_apply\_together\_with\_the\_other\_filters\(\)

The period filter applies together with the agent and period filters.

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_Saved_rule_is_read_back"></a> Saved\_rule\_is\_read\_back\(\)

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_Saving_the_same_scope_a_second_time_overwrites_it"></a> Saving\_the\_same\_scope\_a\_second\_time\_overwrites\_it\(\)

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

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

Writes a sample record for the given tenant.

```csharp
protected override ValueTask<object> SeedAsync(string tenantId, string name, CancellationToken cancellationToken)
```

#### Parameters

`tenantId` [string](https://learn.microsoft.com/dotnet/api/system.string)

The tenant that owns the record.

`name` [string](https://learn.microsoft.com/dotnet/api/system.string)

The name distinguishing the record. The same name may be used by two tenants.

`cancellationToken` [CancellationToken](https://learn.microsoft.com/dotnet/api/system.threading.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.

#### Returns

 [ValueTask](https://learn.microsoft.com/dotnet/api/system.threading.tasks.valuetask\-1)<[object](https://learn.microsoft.com/dotnet/api/system.object)\>

The key to use for reading the record back.

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_Separate_period_keeps_a_separate_counter"></a> Separate\_period\_keeps\_a\_separate\_counter\(\)

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

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

Attempts to delete the record on behalf of the given tenant.

```csharp
protected override ValueTask<bool?> TryDeleteAsync(string tenantId, object key)
```

#### Parameters

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

`key` [object](https://learn.microsoft.com/dotnet/api/system.object)

The key returned by [TenantIsolationContract.SeedAsync](/api/tracon.testing.contracts.storage/).

#### 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 delete succeeded, [false](https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool)
if the record was not found; [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null) if the store does
not offer deletion.

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_Usage_increments_both_the_agent_and_tenant_counters"></a> Usage\_increments\_both\_the\_agent\_and\_tenant\_counters\(\)

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_Usage_is_filtered_by_agent_name"></a> Usage\_is\_filtered\_by\_agent\_name\(\)

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_Usage_is_filtered_by_period"></a> Usage\_is\_filtered\_by\_period\(\)

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_Usage_is_filtered_to_the_given_period_starts"></a> Usage\_is\_filtered\_to\_the\_given\_period\_starts\(\)

[QuotaUsageQuery.PeriodStarts](/api/tracon.quotausagequery/#Tracon_QuotaUsageQuery_PeriodStarts) returns only the counters of
the named periods, each for its given first day. The admission check
reads usage before every run; a store that ignores the filter returns
the tenant's whole history on each read.

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_Usage_that_adds_no_run_adds_its_tokens_and_cost_to_a_counter_that_does_not_exist_yet"></a> Usage\_that\_adds\_no\_run\_adds\_its\_tokens\_and\_cost\_to\_a\_counter\_that\_does\_not\_exist\_yet\(\)

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_Usage_that_adds_no_run_leaves_the_run_count_where_the_root_put_it"></a> Usage\_that\_adds\_no\_run\_leaves\_the\_run\_count\_where\_the\_root\_put\_it\(\)

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)

### <a id="Tracon_Testing_Contracts_Storage_QuotaStoreContract_Usage_with_undefined_price_does_not_break_the_cost_total"></a> Usage\_with\_undefined\_price\_does\_not\_break\_the\_cost\_total\(\)

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

 [Task](https://learn.microsoft.com/dotnet/api/system.threading.tasks.task)
