Class TextSnapshotOptions
- Namespace
- PDiffy
- Assembly
- PDiffy.dll
What to change in a text or JSON snapshot before it's compared, for values that differ on every run. Each scrub applies to the whole text.
public sealed class TextSnapshotOptions
- Inheritance
-
TextSnapshotOptions
- Inherited Members
Methods
Directory(string)
The folder for this snapshot, instead of Directory. Only the Snapshot.Verify
methods use it.
public TextSnapshotOptions Directory(string directory)
Parameters
directorystring
Returns
Extension(string)
The snapshot files' extension, without the dot, such as "csv"; "txt" when it isn't set. JSON snapshots always use "json".
public TextSnapshotOptions Extension(string extension)
Parameters
extensionstring
Returns
KeepDates()
Leaves dates as they are. JSON snapshots scrub strings that are a timestamp unless told to keep them.
public TextSnapshotOptions KeepDates()
Returns
KeepGuids()
Leaves GUIDs as they are. JSON snapshots scrub strings that are a GUID unless told to keep them.
public TextSnapshotOptions KeepGuids()
Returns
Name(string)
The snapshot's file name without extension, instead of one from the test file and method, such as
"TrailMapTests.TrailMap_ShouldMatch". Only the Snapshot.Verify methods use it.
public TextSnapshotOptions Name(string name)
Parameters
namestring
Returns
ScrubDates()
Replaces dates with Date_1, Date_2 and so on. The same text always gets the same token. Recognizes the same dates as ScrubDates().
public TextSnapshotOptions ScrubDates()
Returns
ScrubGuids()
Replaces GUIDs with Guid_1, Guid_2 and so on. The same text always gets the same token.
public TextSnapshotOptions ScrubGuids()
Returns
ScrubText(Regex, string)
Replaces matches anywhere in the text. The replacement can refer to groups, such as "Permit $1".
public TextSnapshotOptions ScrubText(Regex pattern, string replacement)
Parameters
Returns
Variant(string)
Added to the name, default or not, as {name}.{variant}, so each row of a theory gets its own snapshot and
keeps the test's name: o => o.Variant(trail). Only the Snapshot.Verify methods use it.
public TextSnapshotOptions Variant(string variant)
Parameters
variantstring