Class TestAuthenticationEventRecorder
- Namespace
- XBullet.EasyTesting.Authentication
- Assembly
- XBullet.EasyTesting.dll
Records redacted authentication events and exposes fluent assertions.
public sealed class TestAuthenticationEventRecorder : ITestScenarioResource
- Inheritance
-
TestAuthenticationEventRecorder
- Implements
- Inherited Members
Remarks
Events may be recorded concurrently. Each read returns a point-in-time array snapshot; a reset does not prevent events from being added concurrently afterward. JWT-shaped values in captured failure messages are replaced before storage.
Properties
Events
Gets a point-in-time copy of recorded authentication events.
public IReadOnlyList<TestAuthenticationEvent> Events { get; }
Property Value
- IReadOnlyList<TestAuthenticationEvent>
A newly allocated, read-only array snapshot in recording order. The caller may retain the snapshot; later recordings and resets do not change it.
Methods
CaptureDiagnosticsAsync(CancellationToken)
Captures the currently recorded authentication events for diagnostics.
public ValueTask<object?> CaptureDiagnosticsAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenAccepted for the resource contract but not observed because capture completes synchronously. The default token does not request cancellation.
Returns
- ValueTask<object>
An already-completed value task containing a newly allocated event-array snapshot. The caller may retain it; subsequent recordings and resets do not change the snapshot.
Reset()
Clears all recorded events.
public void Reset()
ResetAsync(CancellationToken)
Clears all authentication events currently held by the recorder.
public ValueTask ResetAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenAccepted for the resource contract but not observed because reset completes synchronously. The default token does not request cancellation.
Returns
- ValueTask
A value task that is already complete after the events have been cleared.
Should()
Starts a fluent assertion chain over the recorded events.
public TestAuthenticationEventAssertions Should()
Returns
- TestAuthenticationEventAssertions
A new assertion object that references this recorder and evaluates its current event snapshot each time an assertion runs.