Skip to content

Commit 7dfd1da

Browse files
committed
Capture the unowned recheck default before any test can change it
1 parent 9dc23e0 commit 7dfd1da

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎src/DiffEngine.Tests/ViewerClientUnownedTests.cs‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@ public class ViewerClientUnownedTests
1313
static readonly ViewerMessage settle = new(ViewerVerb.Settle, InlineKey.For("Tests.cs", 1));
1414

1515
// Read before any test can have changed it, so the restore below puts back the real default
16-
// rather than a copy of it kept here
17-
static readonly TimeSpan recheckUnownedAfter = ViewerClient.RecheckUnownedAfter;
16+
// rather than a copy of it kept here. A hook rather than a static field initializer: with no
17+
// static constructor that runs on first touching a static field, and TheMemoryExpires sets the
18+
// value before it touches one, so running first it captured Zero for every test after it.
19+
static TimeSpan recheckUnownedAfter;
20+
21+
[Before(Class)]
22+
public static void Remember() =>
23+
recheckUnownedAfter = ViewerClient.RecheckUnownedAfter;
1824

1925
[Before(Test)]
2026
public void Forget() =>

0 commit comments

Comments
 (0)