Skip to main content

ResQ.Blockchain.MockNeoClient

MockNeoClient.GetEventsByIncidentAsync(string, CancellationToken) Method

Retrieves mock events by incident ID from the in-memory store.
public System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<ResQ.Blockchain.BlockchainEvent>> GetEventsByIncidentAsync(string incidentId, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));

Parameters

incidentId System.String The incident ID to query. cancellationToken System.Threading.CancellationToken Cancellation token for the operation. Implements GetEventsByIncidentAsync(string, CancellationToken)

Returns

System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyList<BlockchainEvent>>
A read-only list of events associated with the incident, or an empty list if none exist.

Example

// First record some events
var evt1 = new BlockchainEvent(..., Payload: "{\"incident\":\"inc-001\"}");
await mockClient.RecordEventAsync(evt1);

// Then retrieve them
var events = await mockClient.GetEventsByIncidentAsync("inc-001");
Console.WriteLine($"Found {events.Count} events");

Remarks

Events are stored when recorded via RecordEventAsync(BlockchainEvent, CancellationToken) if the payload contains an “incident” field. This method retrieves all events that were indexed under the specified incident ID.