.NET API
AgentFileStoreContract
Tracon.Testing.Contracts.Xunit.dllTenant isolation contract for the persistent agent file memory.
public abstract class AgentFileStoreContract : TenantIsolationContract<AgentFileStore>, IAsyncLifetime, IAsyncDisposableInheritance
Section titled “Inheritance”object ← TenantIsolationContract<AgentFileStore> ← AgentFileStoreContract
Implements
Section titled “Implements”IAsyncLifetime, IAsyncDisposable
Inherited Members
Section titled “Inherited Members”TenantIsolationContract<AgentFileStore>.TenantA, TenantIsolationContract<AgentFileStore>.TenantB, TenantIsolationContract<AgentFileStore>.CreateStoreAsync(), TenantIsolationContract<AgentFileStore>.UseAmbientTenant(MutableTenantContext), TenantIsolationContract<AgentFileStore>.InitializeAsync(), TenantIsolationContract<AgentFileStore>.DisposeAsync(), TenantIsolationContract<AgentFileStore>.OnDisposeAsync(), TenantIsolationContract<AgentFileStore>.SeedAsync(string, string), TenantIsolationContract<AgentFileStore>.ExistsAsync(string, object), TenantIsolationContract<AgentFileStore>.CountAsync(string), TenantIsolationContract<AgentFileStore>.TryDeleteAsync(string, object), TenantIsolationContract<AgentFileStore>.TryOverwriteAsync(string, string), TenantIsolationContract<AgentFileStore>.Tenant_cannot_read_another_tenants_record(), TenantIsolationContract<AgentFileStore>.Tenant_reads_its_own_record(), TenantIsolationContract<AgentFileStore>.Tenant_does_not_see_another_tenants_record_in_the_list(), TenantIsolationContract<AgentFileStore>.Tenant_cannot_delete_another_tenants_record(), TenantIsolationContract<AgentFileStore>.Same_name_lives_independently_across_two_tenants(), TenantIsolationContract<AgentFileStore>.AmbientTenant, TenantIsolationContract<AgentFileStore>.Store, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”File memory is not an IStore; it is the
Microsoft Agent Framework AI.AgentFileStore type. The tenant
is read from ITenantContext, and the agent name is read
from an implementation-defined ambient scope that AgentFileStoreContract.EnterRunScope
establishes – Tracon’s own stores read it from
TraconRunContext (Tracon.Core), which this package
deliberately does not reference (it depends on
Tracon.Abstractions only).
The ambient scope is set up at the start of each test body,
not in InitializeAsync: the xunit v3 (MTP) lifecycle hook can run
the test body as a separately scheduled task, which breaks an
AsyncLocal-based flow.
Constructors
Section titled “Constructors”AgentFileStoreContract()
Section titled “ AgentFileStoreContract()”protected AgentFileStoreContract()Methods
Section titled “Methods”CountAsync(string)
Section titled “ CountAsync(string)”Reports how many records the given tenant sees through the listing endpoint.
protected override ValueTask<int> CountAsync(string tenantId)Parameters
Section titled “Parameters”tenantId string
The reading tenant.
Returns
Section titled “Returns”The number of records seen.
Creating_a_directory_does_not_produce_a_record()
Section titled “ Creating_a_directory_does_not_produce_a_record()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentFileStoreContract.cs", 90)]public Task Creating_a_directory_does_not_produce_a_record()Returns
Section titled “Returns”Enter(string)
Section titled “ Enter(string)”Sets the active tenant and establishes the ambient run scope.
protected void Enter(string tenantId)Parameters
Section titled “Parameters”tenantId string
The tenant id.
EnterRunScope()
Section titled “ EnterRunScope()”Establishes whatever ambient run scope the store under test reads the
agent name from. Tracon’s own SQL-backed implementations read
TraconRunContext.Current (Tracon.Core); a
derived contract in a project that already references
Tracon.Core sets that up here.
protected abstract void EnterRunScope()ExistsAsync(string, object)
Section titled “ ExistsAsync(string, object)”Reports whether the record is visible from the given tenant’s viewpoint.
protected override ValueTask<bool> ExistsAsync(string tenantId, object key)Parameters
Section titled “Parameters”tenantId string
The reading tenant.
key object
The key returned by TenantIsolationContract.SeedAsync.
Returns
Section titled “Returns”true if the record is visible.
ExitRunScope()
Section titled “ ExitRunScope()”Clears the ambient run scope AgentFileStoreContract.EnterRunScope established.
protected abstract void ExitRunScope()Glob_filter_narrows_by_file_name()
Section titled “ Glob_filter_narrows_by_file_name()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentFileStoreContract.cs", 120)]public Task Glob_filter_narrows_by_file_name()Returns
Section titled “Returns”OnDisposeAsync()
Section titled “ OnDisposeAsync()”Hook for a derived class to release its own resources.
protected override ValueTask OnDisposeAsync()Returns
Section titled “Returns”A completed task.
Recursive_false_skips_matches_in_subdirectories()
Section titled “ Recursive_false_skips_matches_in_subdirectories()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentFileStoreContract.cs", 103)]public Task Recursive_false_skips_matches_in_subdirectories()Returns
Section titled “Returns”Search_does_not_find_another_tenants_file()
Section titled “ Search_does_not_find_another_tenants_file()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentFileStoreContract.cs", 77)]public Task Search_does_not_find_another_tenants_file()Returns
Section titled “Returns”Search_in_a_large_store_returns_only_the_target_directory()
Section titled “ Search_in_a_large_store_returns_only_the_target_directory()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentFileStoreContract.cs", 139)]public Task Search_in_a_large_store_returns_only_the_target_directory()Returns
Section titled “Returns”SeedAsync(string, string)
Section titled “ SeedAsync(string, string)”Writes a sample record for the given tenant.
protected override ValueTask<object> SeedAsync(string tenantId, string name)Parameters
Section titled “Parameters”tenantId string
The tenant that owns the record.
name string
The name distinguishing the record. The same name may be used by two tenants.
Returns
Section titled “Returns”The key to use for reading the record back.
TryDeleteAsync(string, object)
Section titled “ TryDeleteAsync(string, object)”Attempts to delete the record on behalf of the given tenant.
protected override ValueTask<bool?> TryDeleteAsync(string tenantId, object key)Parameters
Section titled “Parameters”tenantId string
The tenant attempting the delete.
key object
The key returned by TenantIsolationContract.SeedAsync.
Returns
Section titled “Returns”true if the delete succeeded, false if the record was not found; null if the store does not offer deletion.