Class ControllerSnapshotExtensions
- Namespace
- XBullet.EasyTesting.Verify.Xunit
- Assembly
- XBullet.EasyTesting.Verify.Xunit.dll
Verify.Xunit extensions for controller responses.
public static class ControllerSnapshotExtensions
- Inheritance
-
ControllerSnapshotExtensions
- Inherited Members
Remarks
See Verify.Xunit integration and compare it with the built-in snapshot engine.
Methods
VerifyControllerSnapshot(HttpResponseMessage, ControllerSnapshotOptions?, VerifySettings?, CancellationToken, string)
Verifies the request, status, stable headers, and normalized body of a controller response. JSON bodies are compared structurally rather than as formatting-sensitive strings.
public static SettingsTask VerifyControllerSnapshot(this HttpResponseMessage response, ControllerSnapshotOptions? options = null, VerifySettings? settings = null, CancellationToken cancellationToken = default, string sourceFile = "")
Parameters
responseHttpResponseMessageThe non-null response whose request metadata, status, headers, and content are read. The method does not own or dispose it; the caller remains responsible for disposal.
optionsControllerSnapshotOptionsController snapshot inclusion, redaction, and scrubbing settings. When null, configured controller-snapshot defaults are used, or package defaults when no global template exists. Supplied options remain caller-owned.
settingsVerifySettingsVerify naming, scrubbing, and comparison settings, or null to use Verify.Xunit defaults. The extension passes the instance to Verify without taking ownership.
cancellationTokenCancellationTokenCancels response-content reading and snapshot-model creation. It does not independently cancel Verify after the model has been created. The default token does not request cancellation.
sourceFilestringThe calling source-file path passed to Verify for snapshot naming and placement. The compiler supplies it by default; callers should normally omit it.
Returns
- SettingsTask
A Verify settings task for the asynchronous snapshot model. Configure it further if needed and await it to complete verification and any received-file side effects.
VerifyHttpExchangeSnapshot(HttpResponseMessage, HttpExchangeSnapshotOptions?, VerifySettings?, CancellationToken, string)
Verifies the complete request and response represented by an HTTP response. JSON bodies are compared structurally rather than as formatting-sensitive strings.
public static SettingsTask VerifyHttpExchangeSnapshot(this HttpResponseMessage response, HttpExchangeSnapshotOptions? options = null, VerifySettings? settings = null, CancellationToken cancellationToken = default, string sourceFile = "")
Parameters
responseHttpResponseMessageThe non-null response used to locate a recorder-attached exchange or construct one from its request and response content. The method does not own or dispose it.
optionsHttpExchangeSnapshotOptionsComplete-exchange inclusion, redaction, and scrubbing settings. When null, recorder settings are used for a recorded response; otherwise, configured exchange defaults or package defaults apply. Options supplied for a recorded response must be compatible with the recorder's original options.
settingsVerifySettingsVerify naming, scrubbing, and comparison settings, or null to use Verify.Xunit defaults. The extension passes the instance to Verify without taking ownership.
cancellationTokenCancellationTokenCancels exchange lookup and request or response content reading while the snapshot model is created. It does not independently cancel Verify afterward. The default token does not request cancellation.
sourceFilestringThe calling source-file path passed to Verify for snapshot naming and placement. The compiler supplies it by default; callers should normally omit it.
Returns
- SettingsTask
A Verify settings task for the asynchronous exchange model. Configure it further if needed and await it to complete verification and any received-file side effects.
VerifyHttpExchangesSnapshot(HttpExchangeRecorder, VerifySettings?, CancellationToken, string)
Verifies every complete request/response exchange captured by an HTTP exchange recorder.
public static SettingsTask VerifyHttpExchangesSnapshot(this HttpExchangeRecorder recorder, VerifySettings? settings = null, CancellationToken cancellationToken = default, string sourceFile = "")
Parameters
recorderHttpExchangeRecorderThe non-null recorder whose completed exchanges are copied in request order. The method does not reset, own, or dispose it; exchanges captured after the copy are not included.
settingsVerifySettingsVerify naming, scrubbing, and comparison settings, or null to use Verify.Xunit defaults. The extension passes the instance to Verify without taking ownership.
cancellationTokenCancellationTokenCancels snapshot-array creation before the recorder is copied. Snapshot creation is otherwise synchronous, and the token does not independently cancel Verify afterward. The default token does not request cancellation.
sourceFilestringThe calling source-file path passed to Verify for snapshot naming and placement. The compiler supplies it by default; callers should normally omit it.
Returns
- SettingsTask
A Verify settings task for the asynchronous exchange array. Configure it further if needed and await it to complete verification and any received-file side effects.