.NET API
JobHandlerContract
Tracon.Testing.Contracts.Xunit.dllBehavior tests for the IJobHandler at-least-once contract: a handler must not reprocess an item already reported, and must observe cancellation between items.
public abstract class JobHandlerContract : IAsyncLifetime, IAsyncDisposableInheritance
Section titled “Inheritance”Implements
Section titled “Implements”IAsyncLifetime, IAsyncDisposable
Inherited Members
Section titled “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”JobHandlerContract()
Section titled “ JobHandlerContract()”protected JobHandlerContract()Properties
Section titled “Properties”Handler
Section titled “ Handler”The handler under test.
protected IJobHandler Handler { get; }Property Value
Section titled “Property Value”HandlerKey
Section titled “ HandlerKey”The handler key the job records this contract builds carry. Override when the handler under test needs its real key (a built-in one from JobHandlerKeys, or the consumer’s own); the value never reaches dispatch here, because the contract calls the handler directly.
protected virtual string HandlerKey { get; }Property Value
Section titled “Property Value”The job identifier shared by every JobContext built during this instance’s tests. A handler that keys other state by job id (an eval run record, for example) can create that state against this value inside JobHandlerContract.CreateHandlerAsync.
protected Guid JobId { get; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”Cancellation_is_observed_between_items()
Section titled “ Cancellation_is_observed_between_items()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/Scheduling/JobHandlerContract.cs", 93)]public Task Cancellation_is_observed_between_items()Returns
Section titled “Returns”Completed_items_are_not_processed_again()
Section titled “ Completed_items_are_not_processed_again()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/Scheduling/JobHandlerContract.cs", 69)]public Task Completed_items_are_not_processed_again()Returns
Section titled “Returns”CreateHandlerAsync()
Section titled “ CreateHandlerAsync()”Creates the handler under test, performing whatever async setup it needs (an eval suite and run record, a workflow registration, and so on).
protected abstract ValueTask<IJobHandler> CreateHandlerAsync()Returns
Section titled “Returns”CreateItem(int, JobItemStatus)
Section titled “ CreateItem(int, JobItemStatus)”Creates one job item the handler under test can process.
protected abstract JobItemRecord CreateItem(int sequence, JobItemStatus status)Parameters
Section titled “Parameters”sequence int
The item’s position within the job.
status JobItemStatus
The item’s starting status.
Returns
Section titled “Returns”CreateJob(IReadOnlyList<JobItemRecord>)
Section titled “ CreateJob(IReadOnlyList<JobItemRecord>)”Builds the job record wrapping items. Override to
set a specific target name or payload the handler under test needs.
protected virtual JobRecord CreateJob(IReadOnlyList<JobItemRecord> items)Parameters
Section titled “Parameters”items IReadOnlyList<JobItemRecord>
Returns
Section titled “Returns”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”Only_pending_items_are_processed_on_a_retry()
Section titled “ Only_pending_items_are_processed_on_a_retry()”[Fact("/Users/farukatasoy/Desktop/projects/Tracon/src/Tracon.Testing.Contracts.Xunit/Contracts/Scheduling/JobHandlerContract.cs", 79)]public Task Only_pending_items_are_processed_on_a_retry()