@@ -31,69 +31,21 @@ public void TestCommonReadWithMounts()
31
31
public void TestWatcherOnRoot ( )
32
32
{
33
33
var fs = GetCommonMountFileSystemWithMounts ( ) ;
34
- var watcher = fs . Watch ( "/" ) ;
35
-
36
- var gotChange = false ;
37
- watcher . Created += ( sender , args ) =>
38
- {
39
- if ( args . FullPath == "/b/watched.txt" )
40
- {
41
- gotChange = true ;
42
- }
43
- } ;
44
-
45
- watcher . IncludeSubdirectories = true ;
46
- watcher . EnableRaisingEvents = true ;
47
-
48
- fs . WriteAllText ( "/b/watched.txt" , "test" ) ;
49
- System . Threading . Thread . Sleep ( 100 ) ;
50
- Assert . True ( gotChange ) ;
34
+ AssertFileCreatedEventDispatched ( fs , "/" , "/b/watched.txt" ) ;
51
35
}
52
36
53
37
[ Fact ]
54
38
public void TestWatcherOnMount ( )
55
39
{
56
40
var fs = GetCommonMountFileSystemWithMounts ( ) ;
57
- var watcher = fs . Watch ( "/b" ) ;
58
-
59
- var gotChange = false ;
60
- watcher . Created += ( sender , args ) =>
61
- {
62
- if ( args . FullPath == "/b/watched.txt" )
63
- {
64
- gotChange = true ;
65
- }
66
- } ;
67
-
68
- watcher . IncludeSubdirectories = true ;
69
- watcher . EnableRaisingEvents = true ;
70
-
71
- fs . WriteAllText ( "/b/watched.txt" , "test" ) ;
72
- System . Threading . Thread . Sleep ( 100 ) ;
73
- Assert . True ( gotChange ) ;
41
+ AssertFileCreatedEventDispatched ( fs , "/b" , "/b/watched.txt" ) ;
74
42
}
75
43
76
44
[ Fact ]
77
45
public void TestWatcherWithBackupOnRoot ( )
78
46
{
79
47
var fs = GetCommonMountFileSystemWithOnlyBackup ( ) ;
80
- var watcher = fs . Watch ( "/" ) ;
81
-
82
- var gotChange = false ;
83
- watcher . Created += ( sender , args ) =>
84
- {
85
- if ( args . FullPath == "/b/watched.txt" )
86
- {
87
- gotChange = true ;
88
- }
89
- } ;
90
-
91
- watcher . IncludeSubdirectories = true ;
92
- watcher . EnableRaisingEvents = true ;
93
-
94
- fs . WriteAllText ( "/b/watched.txt" , "test" ) ;
95
- System . Threading . Thread . Sleep ( 100 ) ;
96
- Assert . True ( gotChange ) ;
48
+ AssertFileCreatedEventDispatched ( fs , "/" , "/b/watched.txt" ) ;
97
49
}
98
50
99
51
[ Fact ]
0 commit comments