Skip to content

Commit a68e9e9

Browse files
committed
Use a ManualResetEvent in TestSubFileSystem.TestWatcherCaseSensitive
A bit friendlier for CI runners
1 parent d32ef47 commit a68e9e9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Zio.Tests/FileSystems/TestSubFileSystem.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,22 +93,22 @@ public void TestWatcherCaseSensitive(string physicalDir, string subDir, string f
9393

9494
var subFs = new SubFileSystem(physicalFs, subDir);
9595
var watcher = subFs.Watch("/");
96+
var waitHandle = new ManualResetEvent(false);
9697

97-
var gotChange = false;
9898
watcher.Created += (sender, args) =>
9999
{
100100
if (args.FullPath == filePath)
101101
{
102-
gotChange = true;
102+
waitHandle.Set();
103103
}
104104
};
105105

106106
watcher.IncludeSubdirectories = true;
107107
watcher.EnableRaisingEvents = true;
108108

109109
physicalFs.WriteAllText($"{physicalDir}{filePath}", "test");
110-
Thread.Sleep(100);
111-
Assert.True(gotChange);
110+
111+
Assert.True(waitHandle.WaitOne(100));
112112
}
113113

114114
[SkippableFact]

0 commit comments

Comments
 (0)