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
responseHttpResponseMessageThe non-null caller-owned response to capture without disposing it.
configureControllerAction<ControllerSnapshotOptions>The non-null callback applied once to independent effective controller options.
configureSnapshotAction<SnapshotSettings>An optional callback applied once to independent effective snapshot settings.
cancellationTokenCancellationTokenToken that cancels response reading and snapshot file operations.
sourceFilestringCalling source-file path supplied by the compiler for snapshot placement.
testNamestringCalling 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
responseHttpResponseMessageThe non-null caller-owned response to capture without disposing it.
configureSnapshotAction<SnapshotSettings>The non-null callback applied once to independent effective snapshot settings.
cancellationTokenCancellationTokenToken that cancels response reading and snapshot file operations.
sourceFilestringCalling source-file path supplied by the compiler for snapshot placement.
testNamestringCalling 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
responseHttpResponseMessageThe non-null caller-owned response representing the exchange.
configureExchangeAction<HttpExchangeSnapshotOptions>The non-null callback applied once to independent recorder options, or global or package defaults for direct capture.
configureSnapshotAction<SnapshotSettings>An optional callback applied once to independent effective snapshot settings.
cancellationTokenCancellationTokenToken that cancels exchange reading and snapshot file operations.
sourceFilestringCalling source-file path supplied by the compiler for snapshot placement.
testNamestringCalling 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
responseHttpResponseMessageThe non-null caller-owned response representing the exchange.
configureSnapshotAction<SnapshotSettings>The non-null callback applied once to independent effective snapshot settings.
cancellationTokenCancellationTokenToken that cancels exchange reading and snapshot file operations.
sourceFilestringCalling source-file path supplied by the compiler for snapshot placement.
testNamestringCalling 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
recorderHttpExchangeRecorderThe non-null caller-owned recorder whose completed exchanges are copied.
configureSnapshotAction<SnapshotSettings>The non-null callback applied once to independent effective snapshot settings.
cancellationTokenCancellationTokenToken checked before capture and used for snapshot file operations.
sourceFilestringCalling source-file path supplied by the compiler for snapshot placement.
testNamestringCalling 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
responseHttpResponseMessageThe non-null caller-owned response whose content is read.
configureSnapshotAction<SnapshotSettings>The non-null callback applied once to independent effective snapshot settings.
cancellationTokenCancellationTokenToken that cancels response reading and snapshot file operations.
sourceFilestringCalling source-file path supplied by the compiler for snapshot placement.
testNamestringCalling 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
contentHttpContentThe non-null caller-owned HTTP content to read without disposing it.
configureSnapshotAction<SnapshotSettings>The non-null callback applied once to independent effective snapshot settings.
cancellationTokenCancellationTokenToken that cancels content reading and snapshot file operations.
sourceFilestringCalling source-file path supplied by the compiler for snapshot placement.
testNamestringCalling member name supplied by the compiler for snapshot naming.
Returns
- Task
A task that completes when the normalized JSON matches or is updated.