Class StubHttpRequestSnapshotExtensions

Namespace
XBullet.EasyTesting.Snapshots
Assembly
XBullet.EasyTesting.Snapshots.Http.dll

Snapshot assertions for captured outbound HTTP requests.

public static class StubHttpRequestSnapshotExtensions
Inheritance
StubHttpRequestSnapshotExtensions
Inherited Members

Methods

ShouldMatchRequestSnapshot(StubHttpRequest, StubHttpRequestSnapshotOptions?, SnapshotSettings?, CancellationToken, string, string)

Asserts that one captured outbound request matches its committed JSON snapshot.

public static Task ShouldMatchRequestSnapshot(this StubHttpRequest request, StubHttpRequestSnapshotOptions? requestOptions = null, SnapshotSettings? snapshotSettings = null, CancellationToken cancellationToken = default, string sourceFile = "", string testName = "")

Parameters

request StubHttpRequest

The non-null captured request converted to a stable model before comparison. It is read but not owned, retained, or mutated.

requestOptions StubHttpRequestSnapshotOptions

Request inclusion, redaction, and scrubbing settings, or null to use a new default instance. Supplied options are read synchronously but not owned or mutated.

snapshotSettings SnapshotSettings

Naming, storage, serialization, update, and general scrubbing settings. When null, configured global defaults are used, or package defaults when no global template exists. Supplied settings remain caller-owned.

cancellationToken CancellationToken

Cancels snapshot-path locking and file I/O. Cancellation does not mutate or dispose the captured request or supplied options. The default token does not request cancellation.

sourceFile string

The calling source-file path used to locate and name the snapshot. The compiler supplies it by default; callers should normally omit it. An empty or invalid path is rejected.

testName string

The calling member name used when no explicit snapshot name is configured. The compiler supplies it by default; callers should normally omit it.

Returns

Task

A task that completes when the snapshot matches or is updated according to the effective settings. A new or differing snapshot writes a received file before throwing when updates are disabled.

ShouldMatchRequestsSnapshot(StubHttpMessageHandler, StubHttpRequestSnapshotOptions?, SnapshotSettings?, CancellationToken, string, string)

Asserts that all requests captured by a stub match their committed JSON snapshot.

public static Task ShouldMatchRequestsSnapshot(this StubHttpMessageHandler handler, StubHttpRequestSnapshotOptions? requestOptions = null, SnapshotSettings? snapshotSettings = null, CancellationToken cancellationToken = default, string sourceFile = "", string testName = "")

Parameters

handler StubHttpMessageHandler

The non-null handler whose current request collection is copied before comparison. Requests recorded after that point are not included. The method does not own or dispose the handler.

requestOptions StubHttpRequestSnapshotOptions

Request inclusion, redaction, and scrubbing settings applied to every captured request, or null to use a new default instance. Supplied options remain caller-owned.

snapshotSettings SnapshotSettings

Naming, storage, serialization, update, and general scrubbing settings. When null, configured global defaults are used, or package defaults when no global template exists. Supplied settings remain caller-owned.

cancellationToken CancellationToken

Cancels snapshot-path locking and file I/O. Cancellation does not mutate or dispose the handler or supplied options. The default token does not request cancellation.

sourceFile string

The calling source-file path used to locate and name the snapshot. The compiler supplies it by default; callers should normally omit it. An empty or invalid path is rejected.

testName string

The calling member name used when no explicit snapshot name is configured. The compiler supplies it by default; callers should normally omit it.

Returns

Task

A task that completes when the request-array snapshot matches or is updated according to the effective settings. A new or differing snapshot writes a received file before throwing when updates are disabled.