.NET API
CustomToolContract
Tracon.Testing.Contracts.Xunit.dllBehavior tests for a code-defined custom tool registration.
public abstract class CustomToolContract : IAsyncLifetime, IAsyncDisposable- Inheritance
- object ← CustomToolContract
- Derived
- RepeatableToolContract
- Implements
- IAsyncLifetime, IAsyncDisposable
- Inherited Members
- object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
Section titled “Constructors”CustomToolContract()
Section titled “ CustomToolContract()”protected CustomToolContract()Properties
Section titled “Properties”ExpectedResultText
Section titled “ ExpectedResultText”Gets the semantic result text expected from an argument-free invocation.
protected abstract string ExpectedResultText { get; }Property Value
Section titled “Property Value”Registration
Section titled “ Registration”The registration under test.
protected TraconToolRegistration Registration { get; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”Concurrent_server_calls_complete()
Section titled “ Concurrent_server_calls_complete()”Starts eight calls against the SAME singleton instance before awaiting any of them, and requires every one to run to completion.
[Fact]public Task Concurrent_server_calls_complete()Returns
Section titled “Returns”Remarks
Section titled “Remarks”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.
CreateRegistrationAsync()
Section titled “ CreateRegistrationAsync()”Creates the custom tool registration under test.
protected abstract ValueTask<TraconToolRegistration> CreateRegistrationAsync()Returns
Section titled “Returns”ValueTask<TraconToolRegistration>
DisposeAsync()
Section titled “ DisposeAsync()”public ValueTask DisposeAsync()Returns
Section titled “Returns”InitializeAsync()
Section titled “ InitializeAsync()”Called immediately after the class has been created, before it is used.
public ValueTask InitializeAsync()Returns
Section titled “Returns”Metadata_is_self_consistent()
Section titled “ Metadata_is_self_consistent()”[Fact]public void Metadata_is_self_consistent()Name_is_stable_and_valid()
Section titled “ Name_is_stable_and_valid()”[Fact]public void Name_is_stable_and_valid()