Class TestOrchestrationEntityFeature
- Namespace
- XBullet.EasyTesting.AzureFunctions
- Assembly
- XBullet.EasyTesting.AzureFunctions.dll
Records orchestrator entity interactions and supplies explicitly configured call results.
public sealed class TestOrchestrationEntityFeature : TaskOrchestrationEntityFeature, ITestScenarioResource
- Inheritance
-
TestOrchestrationEntityFeature
- Implements
- Inherited Members
- Extension Methods
Remarks
Attach with WithEntities(TaskOrchestrationEntityFeature). Signals record submissions only. Lock scopes mark local critical sections; they do not simulate distributed mutual exclusion. Configure handlers before use and await all operations before resetting.
Properties
CallHandler
Gets or sets entity call behavior.
public Func<RecordedEntityOperation, Task<object?>>? CallHandler { get; set; }
Property Value
- Func<RecordedEntityOperation, Task<object>>
A required callback for calls, including void calls. Typed results use assignment compatibility.
Operations
Gets entity call attempts in invocation order.
public IReadOnlyList<RecordedEntityOperation> Operations { get; }
Property Value
- IReadOnlyList<RecordedEntityOperation>
A detached list retaining original input and options references.
SignalHandler
Gets or sets signal submission behavior.
public Func<RecordedEntityOperation, Task>? SignalHandler { get; set; }
Property Value
- Func<RecordedEntityOperation, Task>
An optional callback; null accepts and records the submission without delivery.
Methods
CallEntityAsync(EntityInstanceId, string, object?, CallEntityOptions?)
Calls an operation on an entity and waits for it to complete.
public override Task CallEntityAsync(EntityInstanceId id, string operationName, object? input = null, CallEntityOptions? options = null)
Parameters
idEntityInstanceIdThe target entity.
operationNamestringThe name of the operation.
inputobjectThe operation input.
optionsCallEntityOptionsThe call options.
Returns
- Task
A task that completes when the operation has been completed.
CallEntityAsync<TResult>(EntityInstanceId, string, object?, CallEntityOptions?)
Calls an operation on an entity and waits for it to complete.
public override Task<TResult> CallEntityAsync<TResult>(EntityInstanceId id, string operationName, object? input = null, CallEntityOptions? options = null)
Parameters
idEntityInstanceIdThe target entity.
operationNamestringThe name of the operation.
inputobjectThe operation input.
optionsCallEntityOptionsThe call options.
Returns
- Task<TResult>
The result of the entity operation.
Type Parameters
TResultThe result type of the entity operation.
CaptureDiagnosticsAsync(CancellationToken)
Captures entity IDs, operation names, kinds, and sequence numbers.
public ValueTask<object?> CaptureDiagnosticsAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancels before capture.
Returns
InCriticalSection(out IReadOnlyList<EntityInstanceId>)
Gets a value indicating whether this orchestration is in a critical section, and if true, any entity locks are owned by this instance.
public override bool InCriticalSection(out IReadOnlyList<EntityInstanceId> entityIds)
Parameters
entityIdsIReadOnlyList<EntityInstanceId>The list of locked entities.
Returns
- bool
True if any locks are owned, false otherwise.
LockEntitiesAsync(IEnumerable<EntityInstanceId>)
Acquires one or more entity locks.
public override Task<IAsyncDisposable> LockEntitiesAsync(IEnumerable<EntityInstanceId> entityIds)
Parameters
entityIdsIEnumerable<EntityInstanceId>The entity IDs to lock.
Returns
- Task<IAsyncDisposable>
An async-disposable which can be disposed to release the lock.
ResetAsync(CancellationToken)
Clears recordings and active local scope markers, retaining configured handlers.
public ValueTask ResetAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancels before any state changes.
Returns
- ValueTask
A completed task after reset.
SignalEntityAsync(EntityInstanceId, string, object?, SignalEntityOptions?)
Calls an operation on an entity, but does not wait for completion.
public override Task SignalEntityAsync(EntityInstanceId id, string operationName, object? input = null, SignalEntityOptions? options = null)
Parameters
idEntityInstanceIdThe target entity.
operationNamestringThe name of the operation.
inputobjectThe operation input.
optionsSignalEntityOptionsThe signal options.
Returns
- Task
A task that represents scheduling of the signal operation. Dependening on implementation, this may complete either when the operation has been signalled, or when the signal action has been enqueued by the context.