Class StubHttpExchangeSnapshotExtensions
- Namespace
- XBullet.EasyTesting.Snapshots
- Assembly
- XBullet.EasyTesting.Snapshots.Http.dll
Snapshot assertions for captured outbound HTTP exchanges.
public static class StubHttpExchangeSnapshotExtensions
- Inheritance
-
StubHttpExchangeSnapshotExtensions
- Inherited Members
Methods
ShouldMatchExchangeSnapshot(StubHttpExchange, StubHttpExchangeSnapshotOptions?, SnapshotSettings?, CancellationToken, string, string)
Asserts that one captured exchange matches its committed snapshot.
public static Task ShouldMatchExchangeSnapshot(this StubHttpExchange exchange, StubHttpExchangeSnapshotOptions? exchangeOptions = null, SnapshotSettings? snapshotSettings = null, CancellationToken cancellationToken = default, string sourceFile = "", string testName = "")
Parameters
exchangeStubHttpExchangeThe non-null exchange whose current request, response, and failure state is copied before comparison. It is read but not owned, retained, or mutated.
exchangeOptionsStubHttpExchangeSnapshotOptionsRequest, response, and output-format settings, or null to use a new default instance with JSON format. Supplied options are read but not owned or mutated.
snapshotSettingsSnapshotSettingsNaming, 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.
cancellationTokenCancellationTokenCancels snapshot-path locking and file I/O. Cancellation does not mutate or dispose the exchange or supplied options. The default token does not request cancellation.
sourceFilestringThe 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.
testNamestringThe 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 JSON, HTTP transcript, or YAML 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.
ShouldMatchExchangesSnapshot(StubHttpMessageHandler, StubHttpExchangeSnapshotOptions?, SnapshotSettings?, CancellationToken, string, string)
Asserts that all exchanges captured by a stub match their committed snapshot.
public static Task ShouldMatchExchangesSnapshot(this StubHttpMessageHandler handler, StubHttpExchangeSnapshotOptions? exchangeOptions = null, SnapshotSettings? snapshotSettings = null, CancellationToken cancellationToken = default, string sourceFile = "", string testName = "")
Parameters
handlerStubHttpMessageHandlerThe non-null handler whose current exchange collection is copied before comparison. Exchanges recorded after that point are not included. The method does not own or dispose the handler.
exchangeOptionsStubHttpExchangeSnapshotOptionsRequest, response, and output-format settings applied to every exchange, or null to use a new default instance with JSON format. Supplied options remain caller-owned.
snapshotSettingsSnapshotSettingsNaming, 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.
cancellationTokenCancellationTokenCancels 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.
sourceFilestringThe 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.
testNamestringThe 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 exchange-array snapshot matches or is updated according to the effective settings and selected format. A new or differing snapshot writes a received file before throwing when updates are disabled.