Skip to content
Open
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
6 changes: 3 additions & 3 deletions docs/recording.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public Task SameKey()
return Verify("TheValue");
}
```
<sup><a href='/src/Verify.Tests/RecordingTests.cs#L281-L292' title='Snippet source file'>snippet source</a> | <a href='#snippet-RecordingSameKey' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/RecordingTests.cs#L290-L301' title='Snippet source file'>snippet source</a> | <a href='#snippet-RecordingSameKey' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Results in:
Expand Down Expand Up @@ -188,7 +188,7 @@ public Task Case()
return Verify("TheValue");
}
```
<sup><a href='/src/Verify.Tests/RecordingTests.cs#L303-L314' title='Snippet source file'>snippet source</a> | <a href='#snippet-RecordingIgnoreCase' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/RecordingTests.cs#L312-L323' title='Snippet source file'>snippet source</a> | <a href='#snippet-RecordingIgnoreCase' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Results in:
Expand Down Expand Up @@ -343,7 +343,7 @@ public Task PauseResume()
return Verify();
}
```
<sup><a href='/src/Verify.Tests/RecordingTests.cs#L225-L240' title='Snippet source file'>snippet source</a> | <a href='#snippet-RecordingPauseResume' title='Start of snippet'>anchor</a></sup>
<sup><a href='/src/Verify.Tests/RecordingTests.cs#L234-L249' title='Snippet source file'>snippet source</a> | <a href='#snippet-RecordingPauseResume' title='Start of snippet'>anchor</a></sup>
<!-- endSnippet -->

Results in:
Expand Down
3 changes: 3 additions & 0 deletions src/Verify.Tests/RecordingTests.Reset.verified.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
name1: value
}
9 changes: 9 additions & 0 deletions src/Verify.Tests/RecordingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,15 @@ public Task ClearIdentifier()
return Verify(Recording.Stop("ClearIdentifier"));
}

[Fact]
public async Task Reset()
{
Recording.Start();
Recording.Add("name1", "value");
await Verify();
Assert.False(Recording.IsRecording());
}

#region RecordingPauseResume

[Fact]
Expand Down
3 changes: 3 additions & 0 deletions src/Verify/Recording/Recording.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ public static IDisposable Start()
return new Disposable();
}

internal static void Reset() =>
asyncLocal.Value = null;

class Disposable :
IDisposable
{
Expand Down
1 change: 1 addition & 0 deletions src/Verify/Verifier/InnerVerifier_Inner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ async Task<VerifyResult> VerifyInner(object? root, Func<Task>? cleanup, IEnumera

await cleanup();

Recording.Reset();
await engine.ThrowIfRequired();

var filePairs = new List<FilePair>(engine.Equal);
Expand Down