Skip to content
Tracon

CustomToolContract

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

Behavior tests for a code-defined custom tool registration.

public abstract class CustomToolContract : IAsyncLifetime, IAsyncDisposable

objectCustomToolContract

RepeatableToolContract

IAsyncLifetime, IAsyncDisposable

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

protected CustomToolContract()

Gets the semantic result text expected from an argument-free invocation.

protected abstract string ExpectedResultText { get; }

string

The registration under test.

protected TraconToolRegistration Registration { get; }

TraconToolRegistration

Starts eight calls against the SAME singleton instance before awaiting any of them, and requires every one to run to completion.

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/Tools/CustomToolContract.cs", 51)]
public Task Concurrent_server_calls_complete()

Task

This contract has no knowledge of what the tool’s arguments or result mean, so it cannot assert that concurrent calls returned the RIGHT, non-corrupted value for each caller — only that none of them faulted (TaskStatus.RanToCompletion), which a naive non-thread-safe shared field (a counter, a cache, a mutable buffer) tends to violate under real concurrent access. A tool with per-call state worth corrupting is proven at the semantic level by its own tests — see ConcurrentToolInvocationTests in Tracon.AspNetCore.FunctionalTests for a body that deliberately holds a shared Barrier to guarantee genuine overlap.

Creates the custom tool registration under test.

protected abstract ValueTask<TraconToolRegistration> CreateRegistrationAsync()

ValueTask<TraconToolRegistration>

public ValueTask DisposeAsync()

ValueTask

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

public ValueTask InitializeAsync()

ValueTask

[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/Tools/CustomToolContract.cs", 73)]
public void Metadata_is_self_consistent()
[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/Tools/CustomToolContract.cs", 27)]
public void Name_is_stable_and_valid()