@@ -77,7 +77,7 @@ public async Task RecoveryTest(int expectedNumberOfAttempts, bool isFailureScena
77
77
{
78
78
Directory . Delete ( directory . Path , true ) ;
79
79
80
- string fileWatcherLogPrefix = $ "File watcher: ( '{ directory . Path } ')";
80
+ string fileWatcherLogSuffix = $ "(path: '{ directory . Path } ')";
81
81
82
82
// 1 trace per attempt + 1 trace per failed attempt
83
83
int expectedTracesBeforeRecovery = ( expectedNumberOfAttempts * 2 ) - 1 ;
@@ -88,7 +88,7 @@ public async Task RecoveryTest(int expectedNumberOfAttempts, bool isFailureScena
88
88
expectedTracesAfterRecovery ++ ;
89
89
}
90
90
91
- await TestHelpers . Await ( ( ) =>
91
+ await TestHelpers . Await ( ( ) =>
92
92
{
93
93
return traceWriter . Traces . Count == expectedTracesBeforeRecovery ;
94
94
} , pollingInterval : 500 ) ;
@@ -132,7 +132,7 @@ await TestHelpers.Await(() =>
132
132
Assert . Equal ( expectedInterval , ( int ) actualInterval . TotalSeconds ) ;
133
133
}
134
134
135
- Assert . True ( traceWriter . Traces . All ( t => t . Message . StartsWith ( fileWatcherLogPrefix ) ) ) ;
135
+ Assert . True ( traceWriter . Traces . All ( t => t . Message . EndsWith ( fileWatcherLogSuffix ) ) ) ;
136
136
137
137
if ( isFailureScenario )
138
138
{
@@ -142,6 +142,8 @@ await TestHelpers.Await(() =>
142
142
{
143
143
Assert . Contains ( "File watcher recovered." , traceWriter . Traces . Last ( ) . Message ) ;
144
144
}
145
+
146
+ Assert . Equal ( ScriptConstants . TraceSourceFileWatcher , traceWriter . Traces . Last ( ) . Source ) ;
145
147
}
146
148
}
147
149
@@ -168,14 +170,14 @@ public void FileChanges_SendsExpectedNotification(WatcherChangeTypes changeType)
168
170
File . Delete ( filePath ) ;
169
171
} ;
170
172
171
- Func < FileSystemEventArgs , bool > handler = a => string . Equals ( a . FullPath , filePath , StringComparison . OrdinalIgnoreCase ) && a . ChangeType == changeType ;
173
+ Func < FileSystemEventArgs , bool > handler = a => string . Equals ( a . FullPath , filePath , StringComparison . OrdinalIgnoreCase ) && a . ChangeType == changeType ;
172
174
173
175
FileWatcherTest ( directory . Path , action , handler ) ;
174
176
}
175
177
}
176
178
177
179
public void FileWatcherTest ( string path , Action < AutoRecoveringFileSystemWatcher > action , Func < FileSystemEventArgs , bool > changeHandler ,
178
- WatcherChangeTypes changeTypes = WatcherChangeTypes . All , bool expectEvent = true )
180
+ WatcherChangeTypes changeTypes = WatcherChangeTypes . All , bool expectEvent = true )
179
181
{
180
182
var traceWriter = new TestTraceWriter ( System . Diagnostics . TraceLevel . Verbose ) ;
181
183
@@ -201,7 +203,7 @@ public void FileWatcherTest(string path, Action<AutoRecoveringFileSystemWatcher>
201
203
202
204
private class TestFileSystemWatcher : AutoRecoveringFileSystemWatcher
203
205
{
204
- public TestFileSystemWatcher ( string path , string filter = "*.*" ,
206
+ public TestFileSystemWatcher ( string path , string filter = "*.*" ,
205
207
bool includeSubdirectories = true , WatcherChangeTypes changeTypes = WatcherChangeTypes . All , TraceWriter traceWriter = null )
206
208
: base ( path , filter , includeSubdirectories , changeTypes , traceWriter )
207
209
{
0 commit comments