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
actualobjectThe value to serialize, including null.
configureSnapshotAction<SnapshotSettings>A non-null callback applied once to settings extended from global or package defaults.
cancellationTokenCancellationTokenToken that cancels snapshot locking and asynchronous 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 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
actualobjectThe value to serialize, including null.
variantstringThe non-empty variant distinguishing snapshots within the calling test.
cancellationTokenCancellationTokenToken that cancels snapshot locking and asynchronous 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 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
actualobjectThe value to serialize, including null.
snapshotSettingsSnapshotSettingsOptional settings merged with global or package defaults.
cancellationTokenCancellationTokenToken that cancels snapshot locking and asynchronous 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 after a match or allowed update; otherwise throws SnapshotMismatchException.