Class HttpResponseSnapshotConfigurationExtensions

Namespace
XBullet.EasyTesting.Snapshots
Assembly
XBullet.EasyTesting.Snapshots.Core.dll

Callback-configured overloads for built-in HTTP snapshot assertions.

public static class HttpResponseSnapshotConfigurationExtensions
Inheritance
HttpResponseSnapshotConfigurationExtensions
Inherited Members

Methods

ShouldMatchControllerSnapshot(HttpResponseMessage, Action<ControllerSnapshotOptions>, Action<SnapshotSettings>?, CancellationToken, string, string)

Configures controller options and optional snapshot settings inline.

public static Task ShouldMatchControllerSnapshot(this HttpResponseMessage response, Action<ControllerSnapshotOptions> configureController, Action<SnapshotSettings>? configureSnapshot = null, CancellationToken cancellationToken = default, string sourceFile = "", string testName = "")

Parameters

response HttpResponseMessage

The non-null caller-owned response to capture without disposing it.

configureController Action<ControllerSnapshotOptions>

The non-null callback applied once to independent effective controller options.

configureSnapshot Action<SnapshotSettings>

An optional callback applied once to independent effective snapshot settings.

cancellationToken CancellationToken

Token that cancels response reading and snapshot file operations.

sourceFile string

Calling source-file path supplied by the compiler for snapshot placement.

testName string

Calling member name supplied by the compiler for snapshot naming.

Returns

Task

A task that completes when the configured controller snapshot matches or is updated.

ShouldMatchControllerSnapshot(HttpResponseMessage, Action<SnapshotSettings>, CancellationToken, string, string)

Configures snapshot settings inline and asserts a controller response.

public static Task ShouldMatchControllerSnapshot(this HttpResponseMessage response, Action<SnapshotSettings> configureSnapshot, CancellationToken cancellationToken = default, string sourceFile = "", string testName = "")

Parameters

response HttpResponseMessage

The non-null caller-owned response to capture without disposing it.

configureSnapshot Action<SnapshotSettings>

The non-null callback applied once to independent effective snapshot settings.

cancellationToken CancellationToken

Token that cancels response reading and snapshot file operations.

sourceFile string

Calling source-file path supplied by the compiler for snapshot placement.

testName string

Calling member name supplied by the compiler for snapshot naming.

Returns

Task

A task that completes when the controller snapshot matches or is updated.

ShouldMatchHttpExchangeSnapshot(HttpResponseMessage, Action<HttpExchangeSnapshotOptions>, Action<SnapshotSettings>?, CancellationToken, string, string)

Configures an HTTP exchange and optional snapshot settings inline.

public static Task ShouldMatchHttpExchangeSnapshot(this HttpResponseMessage response, Action<HttpExchangeSnapshotOptions> configureExchange, Action<SnapshotSettings>? configureSnapshot = null, CancellationToken cancellationToken = default, string sourceFile = "", string testName = "")

Parameters

response HttpResponseMessage

The non-null caller-owned response representing the exchange.

configureExchange Action<HttpExchangeSnapshotOptions>

The non-null callback applied once to independent recorder options, or global or package defaults for direct capture.

configureSnapshot Action<SnapshotSettings>

An optional callback applied once to independent effective snapshot settings.

cancellationToken CancellationToken

Token that cancels exchange reading and snapshot file operations.

sourceFile string

Calling source-file path supplied by the compiler for snapshot placement.

testName string

Calling member name supplied by the compiler for snapshot naming.

Returns

Task

A task that completes when the configured exchange snapshot matches or is updated.

Remarks

For responses without an HttpExchangeRecorder, capture happens during this assertion. For recorder-backed responses, the callback starts from independent effective recorder options and transforms a copy of captured data without reading content again or changing the recorder. Capture-time exclusions and redactions cannot be reversed.

ShouldMatchHttpExchangeSnapshot(HttpResponseMessage, Action<SnapshotSettings>, CancellationToken, string, string)

Configures snapshot settings inline and asserts a complete HTTP exchange.

public static Task ShouldMatchHttpExchangeSnapshot(this HttpResponseMessage response, Action<SnapshotSettings> configureSnapshot, CancellationToken cancellationToken = default, string sourceFile = "", string testName = "")

Parameters

response HttpResponseMessage

The non-null caller-owned response representing the exchange.

configureSnapshot Action<SnapshotSettings>

The non-null callback applied once to independent effective snapshot settings.

cancellationToken CancellationToken

Token that cancels exchange reading and snapshot file operations.

sourceFile string

Calling source-file path supplied by the compiler for snapshot placement.

testName string

Calling member name supplied by the compiler for snapshot naming.

Returns

Task

A task that completes when the complete exchange snapshot matches or is updated.

ShouldMatchHttpExchangesSnapshot(HttpExchangeRecorder, Action<SnapshotSettings>, CancellationToken, string, string)

Configures snapshot settings inline and asserts all recorder exchanges.

public static Task ShouldMatchHttpExchangesSnapshot(this HttpExchangeRecorder recorder, Action<SnapshotSettings> configureSnapshot, CancellationToken cancellationToken = default, string sourceFile = "", string testName = "")

Parameters

recorder HttpExchangeRecorder

The non-null caller-owned recorder whose completed exchanges are copied.

configureSnapshot Action<SnapshotSettings>

The non-null callback applied once to independent effective snapshot settings.

cancellationToken CancellationToken

Token checked before capture and used for snapshot file operations.

sourceFile string

Calling source-file path supplied by the compiler for snapshot placement.

testName string

Calling member name supplied by the compiler for snapshot naming.

Returns

Task

A task that completes when all recorded exchange snapshots match or are updated.

ShouldMatchJsonBodySnapshot(HttpResponseMessage, Action<SnapshotSettings>, CancellationToken, string, string)

Configures snapshot settings inline and asserts a normalized JSON response body.

public static Task ShouldMatchJsonBodySnapshot(this HttpResponseMessage response, Action<SnapshotSettings> configureSnapshot, CancellationToken cancellationToken = default, string sourceFile = "", string testName = "")

Parameters

response HttpResponseMessage

The non-null caller-owned response whose content is read.

configureSnapshot Action<SnapshotSettings>

The non-null callback applied once to independent effective snapshot settings.

cancellationToken CancellationToken

Token that cancels response reading and snapshot file operations.

sourceFile string

Calling source-file path supplied by the compiler for snapshot placement.

testName string

Calling member name supplied by the compiler for snapshot naming.

Returns

Task

A task that completes when the normalized response body matches or is updated.

ShouldMatchJsonSnapshot(HttpContent, Action<SnapshotSettings>, CancellationToken, string, string)

Configures snapshot settings inline and asserts normalized JSON content.

public static Task ShouldMatchJsonSnapshot(this HttpContent content, Action<SnapshotSettings> configureSnapshot, CancellationToken cancellationToken = default, string sourceFile = "", string testName = "")

Parameters

content HttpContent

The non-null caller-owned HTTP content to read without disposing it.

configureSnapshot Action<SnapshotSettings>

The non-null callback applied once to independent effective snapshot settings.

cancellationToken CancellationToken

Token that cancels content reading and snapshot file operations.

sourceFile string

Calling source-file path supplied by the compiler for snapshot placement.

testName string

Calling member name supplied by the compiler for snapshot naming.

Returns

Task

A task that completes when the normalized JSON matches or is updated.