Skip to content
Tracon

AgentSourceContract

Namespace Tracon.Testing.Contracts.AgentSources · Assembly Tracon.Testing.Contracts.Xunit.dll

Behavior tests for an IAgentSource implementation.

public abstract class AgentSourceContract : IAsyncLifetime, IAsyncDisposable
Inheritance
object ← AgentSourceContract
Derived
TenantAwareAgentSourceContract, VersionedAgentSourceContract
Implements
IAsyncLifetime, IAsyncDisposable
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
protected AgentSourceContract()

Gets an agent name the source definitely resolves.

protected abstract string KnownAgentName { get; }

string

Gets the source under test.

protected IAgentSource Source { get; }

IAgentSource

Gets an agent name the source definitely does not resolve.

protected virtual string UnknownAgentName { get; }

string

[Fact]
public Task A_pre_cancelled_token_is_honored()

Task

Creates a source ready for use.

protected abstract ValueTask<IAgentSource> CreateSourceAsync()

ValueTask<IAgentSource>

public ValueTask DisposeAsync()

ValueTask

Every name IAgentSource.ListAsync reports must resolve.

[Fact]
public Task Every_listed_agent_resolves()

Task

Called immediately after the class has been created, before it is used.

public ValueTask InitializeAsync()

ValueTask

[Fact]
public Task Known_agent_resolves()

Task

[Fact]
public Task Listed_descriptors_name_the_source()

Task

[Fact]
public Task Listed_names_are_unique_and_valid()

Task

[Fact]
public Task Listing_is_repeatable()

Task

[Fact]
public Task Listing_is_safe_under_concurrency()

Task

[Fact]
public void Name_is_not_empty()
[Fact]
public Task Priority_is_stable_across_calls()

Task

[Fact]
public Task Resolution_is_safe_under_concurrency()

Task

The other half of the M7 consistency rule (see IAgentSource): a name IAgentSource.ResolveAsync resolves must also appear in IAgentSource.ListAsync. AgentSourceContract.KnownAgentName is guaranteed resolvable by contract (see AgentSourceContract.Known_agent_resolves), so it doubles as the “resolvable name” this direction needs without a dedicated fixture hook.

[Fact]
public Task Resolved_agent_is_listed()

Task

[Fact]
public Task Unknown_agent_returns_null()

Task