Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/inline-snapshots.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ public static class ModuleInitializer

Every `Verify*` then uses an inline snapshot, unless it is declined by one of the rules below, and accepting one appends the `.Snapshot(...)` call to the verify invocation.

Turning the switch off again withdraws what it left pending review. Snapshots the switch handed to DiffEngineTray, DiffEngineViewer or the staging directory, and that were never accepted, are dropped by the next test run, so review tooling does not go on offering to add a `.Snapshot(...)` call to a test that is back on `.verified.` files. The run that drops them has to have diff tooling enabled (so not a build server, and not `DiffEngine_Disabled`), and to build the same configuration and target framework as the run that queued them: the call sites are recorded under the project's intermediate directory, which a project that does not consume Verify's build props does not have, and which deleting `obj` removes. Snapshots queued by a version of Verify before this recording stay pending.

To decide per verification, pass a delegate:

<!-- snippet: StaticInlineDelegate -->
Expand Down
2 changes: 2 additions & 0 deletions docs/mdsource/inline-snapshots.source.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ snippet: StaticInline

Every `Verify*` then uses an inline snapshot, unless it is declined by one of the rules below, and accepting one appends the `.Snapshot(...)` call to the verify invocation.

Turning the switch off again withdraws what it left pending review. Snapshots the switch handed to DiffEngineTray, DiffEngineViewer or the staging directory, and that were never accepted, are dropped by the next test run, so review tooling does not go on offering to add a `.Snapshot(...)` call to a test that is back on `.verified.` files. The run that drops them has to have diff tooling enabled (so not a build server, and not `DiffEngine_Disabled`), and to build the same configuration and target framework as the run that queued them: the call sites are recorded under the project's intermediate directory, which a project that does not consume Verify's build props does not have, and which deleting `obj` removes. Snapshots queued by a version of Verify before this recording stay pending.

To decide per verification, pass a delegate:

snippet: StaticInlineDelegate
Expand Down
12 changes: 12 additions & 0 deletions src/StaticSettingsTests/BaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,17 @@ protected BaseTest()
VerifierSettings.Reset();
CombinationSettings.Reset();
DerivePathInfo(PathInfo.DeriveDefault);

// A test that queued with the switch on leaves a record in obj, and the next verification
// with the switch off would retire it through whatever owns the queue on this machine
if (Directory.Exists(InlineSwitchRecordsDirectory))
{
Directory.Delete(InlineSwitchRecordsDirectory, true);
}
}

protected static string InlineSwitchRecordsDirectory =>
Path.Combine(
AttributeReader.GetIntermediateDirectory(typeof(BaseTest).Assembly),
InlineSwitchRecords.DirectoryName);
}
Loading
Loading