Class SnapshotAssertionExtensions

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

Fluent snapshot assertions for serializable values.

public static class SnapshotAssertionExtensions
Inheritance
SnapshotAssertionExtensions
Inherited Members

Methods

ShouldMatchSnapshot(object?, Action<SnapshotSettings>, CancellationToken, string, string)

Configures independent snapshot settings inline and asserts a serialized value.

public static Task ShouldMatchSnapshot(this object? actual, Action<SnapshotSettings> configureSnapshot, CancellationToken cancellationToken = default, string sourceFile = "", string testName = "")

Parameters

actual object

The value to serialize, including null.

configureSnapshot Action<SnapshotSettings>

A non-null callback applied once to settings extended from global or package defaults.

cancellationToken CancellationToken

Token that cancels snapshot locking and asynchronous 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 after a match or allowed update; otherwise throws SnapshotMismatchException.

ShouldMatchSnapshot(object?, string, CancellationToken, string, string)

Serializes a value and compares it with a distinct JSON snapshot variant.

public static Task ShouldMatchSnapshot(this object? actual, string variant, CancellationToken cancellationToken = default, string sourceFile = "", string testName = "")

Parameters

actual object

The value to serialize, including null.

variant string

The non-empty variant distinguishing snapshots within the calling test.

cancellationToken CancellationToken

Token that cancels snapshot locking and asynchronous 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 after a match or allowed update; otherwise throws SnapshotMismatchException.

ShouldMatchSnapshot(object?, SnapshotSettings?, CancellationToken, string, string)

Serializes a value and compares it with its committed JSON snapshot.

public static Task ShouldMatchSnapshot(this object? actual, SnapshotSettings? snapshotSettings = null, CancellationToken cancellationToken = default, string sourceFile = "", string testName = "")

Parameters

actual object

The value to serialize, including null.

snapshotSettings SnapshotSettings

Optional settings merged with global or package defaults.

cancellationToken CancellationToken

Token that cancels snapshot locking and asynchronous 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 after a match or allowed update; otherwise throws SnapshotMismatchException.