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
sourceIAssertionSource<T>The assertion source over
T.rendererSnapshotRenderer<T>The renderer projecting
Tto 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
TThe source value type.
Exceptions
- ArgumentNullException
rendereris 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
sourceIAssertionSource<T>The assertion source over
T.renderFunc<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
TThe source value type.
Exceptions
- ArgumentNullException
renderis null.