Table of Contents

Class MatchesSnapshotRendererExtensions

Namespace
TUnit.Assertions.Extensions
Assembly
SnapshotAssertions.TUnit.dll

Renderer-projected entry points for MatchesSnapshot. Two overloads cover the common shapes for projecting an arbitrary source type to a canonical string before snapshot comparison: a polymorphic overload taking a SnapshotRenderer<T> subclass (configurable, stateful renderers) and a delegate-shaped overload taking a Func<T, TResult> (single-use inline projections; also the shape used by sibling family packages that publish renderers as static helper methods without taking a reference on SnapshotAssertions).

public static class MatchesSnapshotRendererExtensions
Inheritance
MatchesSnapshotRendererExtensions
Inherited Members

Methods

MatchesSnapshot<T>(IAssertionSource<T>, SnapshotRenderer<T>)

Asserts that source's actual value, after canonical-string rendering via renderer, matches the snapshot baseline. Use this overload when the renderer is a reusable subclass that owns configuration or state.

public static RenderedSnapshotAssertion<T> MatchesSnapshot<T>(this IAssertionSource<T> source, SnapshotRenderer<T> renderer)

Parameters

source IAssertionSource<T>

The assertion source over T.

renderer SnapshotRenderer<T>

The renderer projecting T to a canonical string. Must not be null.

Returns

RenderedSnapshotAssertion<T>

The renderer-projected snapshot assertion, ready for further chaining (.WithName, .AtPath, .WithOptions, .WithScrubber).

Type Parameters

T

The source value type.

Exceptions

ArgumentNullException

renderer is null.

MatchesSnapshot<T>(IAssertionSource<T>, Func<T, string>)

Asserts that source's actual value, after canonical-string rendering via render, matches the snapshot baseline. Use this overload for single-use inline projections (e.g. obj => obj.ToCanonicalString()) or when composing with a sibling family package's static renderer method without taking a reference on its assembly.

public static RenderedSnapshotAssertion<T> MatchesSnapshot<T>(this IAssertionSource<T> source, Func<T, string> render)

Parameters

source IAssertionSource<T>

The assertion source over T.

render Func<T, string>

The rendering function. Must not be null.

Returns

RenderedSnapshotAssertion<T>

The renderer-projected snapshot assertion, ready for further chaining (.WithName, .AtPath, .WithOptions, .WithScrubber).

Type Parameters

T

The source value type.

Exceptions

ArgumentNullException

render is null.