@@ -77,7 +77,7 @@ public async Task RecoveryTest(int expectedNumberOfAttempts, bool isFailureScena
7777 {
7878 Directory . Delete ( directory . Path , true ) ;
7979
80- string fileWatcherLogPrefix = $ "File watcher: ( '{ directory . Path } ')";
80+ string fileWatcherLogSuffix = $ "(path: '{ directory . Path } ')";
8181
8282 // 1 trace per attempt + 1 trace per failed attempt
8383 int expectedTracesBeforeRecovery = ( expectedNumberOfAttempts * 2 ) - 1 ;
@@ -88,7 +88,7 @@ public async Task RecoveryTest(int expectedNumberOfAttempts, bool isFailureScena
8888 expectedTracesAfterRecovery ++ ;
8989 }
9090
91- await TestHelpers . Await ( ( ) =>
91+ await TestHelpers . Await ( ( ) =>
9292 {
9393 return traceWriter . Traces . Count == expectedTracesBeforeRecovery ;
9494 } , pollingInterval : 500 ) ;
@@ -132,7 +132,7 @@ await TestHelpers.Await(() =>
132132 Assert . Equal ( expectedInterval , ( int ) actualInterval . TotalSeconds ) ;
133133 }
134134
135- Assert . True ( traceWriter . Traces . All ( t => t . Message . StartsWith ( fileWatcherLogPrefix ) ) ) ;
135+ Assert . True ( traceWriter . Traces . All ( t => t . Message . EndsWith ( fileWatcherLogSuffix ) ) ) ;
136136
137137 if ( isFailureScenario )
138138 {
@@ -142,6 +142,8 @@ await TestHelpers.Await(() =>
142142 {
143143 Assert . Contains ( "File watcher recovered." , traceWriter . Traces . Last ( ) . Message ) ;
144144 }
145+
146+ Assert . Equal ( ScriptConstants . TraceSourceFileWatcher , traceWriter . Traces . Last ( ) . Source ) ;
145147 }
146148 }
147149
@@ -168,14 +170,14 @@ public void FileChanges_SendsExpectedNotification(WatcherChangeTypes changeType)
168170 File . Delete ( filePath ) ;
169171 } ;
170172
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 ;
172174
173175 FileWatcherTest ( directory . Path , action , handler ) ;
174176 }
175177 }
176178
177179 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 )
179181 {
180182 var traceWriter = new TestTraceWriter ( System . Diagnostics . TraceLevel . Verbose ) ;
181183
@@ -201,7 +203,7 @@ public void FileWatcherTest(string path, Action<AutoRecoveringFileSystemWatcher>
201203
202204 private class TestFileSystemWatcher : AutoRecoveringFileSystemWatcher
203205 {
204- public TestFileSystemWatcher ( string path , string filter = "*.*" ,
206+ public TestFileSystemWatcher ( string path , string filter = "*.*" ,
205207 bool includeSubdirectories = true , WatcherChangeTypes changeTypes = WatcherChangeTypes . All , TraceWriter traceWriter = null )
206208 : base ( path , filter , includeSubdirectories , changeTypes , traceWriter )
207209 {
0 commit comments