Class DocxSnapshotOptions
- Namespace
- PDiffy
- Assembly
- PDiffy.dll
What to leave out of a DOCX snapshot, or change in it, for content a test doesn't care about. Ignored sections still print their header with "(ignored)" under it, and the snapshot's first lines list what was ignored.
public sealed class DocxSnapshotOptions
- Inheritance
-
DocxSnapshotOptions
- Inherited Members
Methods
Check(DocxCheckSet)
Records what a set of checks finds in a checks section, so the findings are approved with the snapshot: a
new problem fails the test, and a fixed one fails it too until the snapshot is accepted. Each line is the rule
and the path, with no message text. The checks look at the whole document, so
Ignore(params DocxSection[]) doesn't change them.
public DocxSnapshotOptions Check(DocxCheckSet set)
Parameters
setDocxCheckSetThe rules to apply, such as Latest.
Returns
Directory(string)
The folder for this snapshot, instead of Directory. Only the Snapshot.Verify
methods use it.
public DocxSnapshotOptions Directory(string directory)
Parameters
directorystring
Returns
Ignore(params DocxDetail[])
Leaves one detail out wherever it appears, such as ImageContents; the rest of each line stays.
public DocxSnapshotOptions Ignore(params DocxDetail[] details)
Parameters
detailsDocxDetail[]
Returns
Ignore(params DocxSection[])
Leaves whole sections out, such as Styles.
public DocxSnapshotOptions Ignore(params DocxSection[] sections)
Parameters
sectionsDocxSection[]
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 DocxSnapshotOptions Name(string name)
Parameters
namestring
Returns
ScrubDates()
Replaces dates in quoted text and link addresses with Date_1, Date_2 and so on. The same text always gets the same token. Recognizes the same dates as ScrubDates().
public DocxSnapshotOptions ScrubDates()
Returns
ScrubGuids()
Replaces GUIDs in quoted text and link addresses with Guid_1, Guid_2 and so on. The same text always gets the same token.
public DocxSnapshotOptions ScrubGuids()
Returns
ScrubText(Regex, string)
Replaces matches in quoted text (paragraph text, alt text, titles, field results and so on) and link addresses. The replacement can refer to groups, such as "Permit $1".
public DocxSnapshotOptions ScrubText(Regex pattern, string replacement)
Parameters
Returns
Use(DocxProfile)
Leaves out what a profile leaves out, such as Content. Further Ignore calls
leave out more.
public DocxSnapshotOptions Use(DocxProfile profile)
Parameters
profileDocxProfile
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 DocxSnapshotOptions Variant(string variant)
Parameters
variantstring