.NET API
AgentDefinitionStoreContract
Tracon.Testing.Contracts.Xunit.dllBehavior tests for the IAgentDefinitionStore contract.
public abstract class AgentDefinitionStoreContract : TenantIsolationContract<IAgentDefinitionStore>, IAsyncLifetime, IAsyncDisposableInheritance
Section titled “Inheritance”object ← TenantIsolationContract<IAgentDefinitionStore> ← AgentDefinitionStoreContract
Implements
Section titled “Implements”IAsyncLifetime, IAsyncDisposable
Inherited Members
Section titled “Inherited Members”TenantIsolationContract<IAgentDefinitionStore>.TenantA, TenantIsolationContract<IAgentDefinitionStore>.TenantB, TenantIsolationContract<IAgentDefinitionStore>.CreateStoreAsync(), TenantIsolationContract<IAgentDefinitionStore>.UseAmbientTenant(MutableTenantContext), TenantIsolationContract<IAgentDefinitionStore>.InitializeAsync(), TenantIsolationContract<IAgentDefinitionStore>.DisposeAsync(), TenantIsolationContract<IAgentDefinitionStore>.OnDisposeAsync(), TenantIsolationContract<IAgentDefinitionStore>.SeedAsync(string, string), TenantIsolationContract<IAgentDefinitionStore>.ExistsAsync(string, object), TenantIsolationContract<IAgentDefinitionStore>.CountAsync(string), TenantIsolationContract<IAgentDefinitionStore>.TryDeleteAsync(string, object), TenantIsolationContract<IAgentDefinitionStore>.TryOverwriteAsync(string, string), TenantIsolationContract<IAgentDefinitionStore>.Tenant_cannot_read_another_tenants_record(), TenantIsolationContract<IAgentDefinitionStore>.Tenant_reads_its_own_record(), TenantIsolationContract<IAgentDefinitionStore>.Tenant_does_not_see_another_tenants_record_in_the_list(), TenantIsolationContract<IAgentDefinitionStore>.Tenant_cannot_delete_another_tenants_record(), TenantIsolationContract<IAgentDefinitionStore>.Same_name_lives_independently_across_two_tenants(), TenantIsolationContract<IAgentDefinitionStore>.AmbientTenant, TenantIsolationContract<IAgentDefinitionStore>.Store, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”These tests run against every implementation. A behavior difference between the in-memory store and the PostgreSQL store is a bug; this class catches that difference.
Constructors
Section titled “Constructors”AgentDefinitionStoreContract()
Section titled “ AgentDefinitionStoreContract()”protected AgentDefinitionStoreContract()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.
DeleteAsync_removes_all_versions()
Section titled “ DeleteAsync_removes_all_versions()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentDefinitionStoreContract.cs", 122)]public Task DeleteAsync_removes_all_versions()Returns
Section titled “Returns”Each_tenants_version_counter_is_its_own()
Section titled “ Each_tenants_version_counter_is_its_own()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentDefinitionStoreContract.cs", 294)]public Task Each_tenants_version_counter_is_its_own()Returns
Section titled “Returns”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.
GetAsync_for_a_missing_definition_returns_null()
Section titled “ GetAsync_for_a_missing_definition_returns_null()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentDefinitionStoreContract.cs", 134)]public Task GetAsync_for_a_missing_definition_returns_null()Returns
Section titled “Returns”GetVersionAsync_for_a_missing_agent_returns_null()
Section titled “ GetVersionAsync_for_a_missing_agent_returns_null()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentDefinitionStoreContract.cs", 159)]public Task GetVersionAsync_for_a_missing_agent_returns_null()Returns
Section titled “Returns”GetVersionAsync_for_a_missing_version_returns_null()
Section titled “ GetVersionAsync_for_a_missing_version_returns_null()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentDefinitionStoreContract.cs", 151)]public Task GetVersionAsync_for_a_missing_version_returns_null()Returns
Section titled “Returns”GetVersionAsync_returns_the_requested_version()
Section titled “ GetVersionAsync_returns_the_requested_version()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentDefinitionStoreContract.cs", 138)]public Task GetVersionAsync_returns_the_requested_version()Returns
Section titled “Returns”ListAsync_orders_by_name()
Section titled “ ListAsync_orders_by_name()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentDefinitionStoreContract.cs", 163)]public Task ListAsync_orders_by_name()Returns
Section titled “Returns”ListVersionsAsync_orders_newest_to_oldest()
Section titled “ ListVersionsAsync_orders_newest_to_oldest()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentDefinitionStoreContract.cs", 82)]public Task ListVersionsAsync_orders_newest_to_oldest()Returns
Section titled “Returns”RollbackAsync_for_a_missing_agent_throws()
Section titled “ RollbackAsync_for_a_missing_agent_throws()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentDefinitionStoreContract.cs", 118)]public Task RollbackAsync_for_a_missing_agent_throws()Returns
Section titled “Returns”RollbackAsync_saves_the_old_version_as_a_new_version()
Section titled “ RollbackAsync_saves_the_old_version_as_a_new_version()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentDefinitionStoreContract.cs", 94)]public Task RollbackAsync_saves_the_old_version_as_a_new_version()Returns
Section titled “Returns”RollbackAsync_to_a_missing_version_throws()
Section titled “ RollbackAsync_to_a_missing_version_throws()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentDefinitionStoreContract.cs", 110)]public Task RollbackAsync_to_a_missing_version_throws()Returns
Section titled “Returns”SaveAsync_increments_version_and_keeps_history()
Section titled “ SaveAsync_increments_version_and_keeps_history()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentDefinitionStoreContract.cs", 61)]public Task SaveAsync_increments_version_and_keeps_history()Returns
Section titled “Returns”SaveAsync_marks_origin_as_database()
Section titled “ SaveAsync_marks_origin_as_database()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentDefinitionStoreContract.cs", 74)]public Task SaveAsync_marks_origin_as_database()Returns
Section titled “Returns”SaveAsync_round_trips_all_definition_fields()
Section titled “ SaveAsync_round_trips_all_definition_fields()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentDefinitionStoreContract.cs", 175)]public Task SaveAsync_round_trips_all_definition_fields()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.
Remarks
Section titled “Remarks”The tenant is not a parameter on the interface; it is read from ITenantContext. Each hook therefore sets the active tenant first.
Tenant_cannot_roll_back_another_tenants_definition()
Section titled “ Tenant_cannot_roll_back_another_tenants_definition()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/AgentDefinitionStoreContract.cs", 280)]public Task Tenant_cannot_roll_back_another_tenants_definition()Returns
Section titled “Returns”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.