33
44#nullable enable
55
6- using System . Collections . Immutable ;
76using System . Runtime . CompilerServices ;
87
98namespace Microsoft . DotNet . Watch . UnitTests ;
@@ -139,6 +138,8 @@ public async Task UpdateAndRudeEdit(TriggerEvent trigger)
139138 {
140139 var testAsset = CopyTestAsset ( "WatchAppMultiProc" , trigger ) ;
141140
141+ var tfm = ToolsetInfo . CurrentTargetFramework ;
142+
142143 var workingDirectory = testAsset . Path ;
143144 var hostDir = Path . Combine ( testAsset . Path , "Host" ) ;
144145 var hostProject = Path . Combine ( hostDir , "Host.csproj" ) ;
@@ -216,18 +217,18 @@ async Task MakeValidDependencyChange()
216217 {
217218 var hasUpdateSourceA = w . CreateCompletionSource ( ) ;
218219 var hasUpdateSourceB = w . CreateCompletionSource ( ) ;
219- w . Reporter . OnProjectProcessOutput += ( projectPath , line ) =>
220+ w . Reporter . OnProcessOutput += line =>
220221 {
221222 if ( line . Content . Contains ( "<Updated Lib>" ) )
222223 {
223- if ( projectPath == serviceProjectA )
224+ if ( line . Content . StartsWith ( $ "[A ( { tfm } )]" ) )
224225 {
225226 if ( ! hasUpdateSourceA . Task . IsCompleted )
226227 {
227228 hasUpdateSourceA . SetResult ( ) ;
228229 }
229230 }
230- else if ( projectPath == serviceProjectB )
231+ else if ( line . Content . StartsWith ( $ "[B ( { tfm } )]" ) )
231232 {
232233 if ( ! hasUpdateSourceB . Task . IsCompleted )
233234 {
@@ -236,7 +237,7 @@ async Task MakeValidDependencyChange()
236237 }
237238 else
238239 {
239- Assert . Fail ( "Only service projects should be updated" ) ;
240+ Assert . Fail ( $ "Only service projects should be updated: ' { line . Content } ' ") ;
240241 }
241242 }
242243 } ;
@@ -270,9 +271,9 @@ public static void Common()
270271 async Task MakeRudeEditChange ( )
271272 {
272273 var hasUpdateSource = w . CreateCompletionSource ( ) ;
273- w . Reporter . OnProjectProcessOutput += ( projectPath , line ) =>
274+ w . Reporter . OnProcessOutput += line =>
274275 {
275- if ( projectPath == serviceProjectA && line . Content . Contains ( "Started A: 2" ) )
276+ if ( line . Content . StartsWith ( $ "[ServiceA ( { tfm } )]" ) && line . Content . Contains ( "Started A: 2" ) )
276277 {
277278 hasUpdateSource . SetResult ( ) ;
278279 }
@@ -297,6 +298,7 @@ async Task MakeRudeEditChange()
297298 public async Task UpdateAppliedToNewProcesses ( bool sharedOutput )
298299 {
299300 var testAsset = CopyTestAsset ( "WatchAppMultiProc" , sharedOutput ) ;
301+ var tfm = ToolsetInfo . CurrentTargetFramework ;
300302
301303 if ( sharedOutput )
302304 {
@@ -322,21 +324,21 @@ public async Task UpdateAppliedToNewProcesses(bool sharedOutput)
322324
323325 var hasUpdateA = new SemaphoreSlim ( initialCount : 0 ) ;
324326 var hasUpdateB = new SemaphoreSlim ( initialCount : 0 ) ;
325- w . Reporter . OnProjectProcessOutput += ( projectPath , line ) =>
327+ w . Reporter . OnProcessOutput += line =>
326328 {
327329 if ( line . Content . Contains ( "<Updated Lib>" ) )
328330 {
329- if ( projectPath == serviceProjectA )
331+ if ( line . Content . StartsWith ( $ "[A ( { tfm } )]" ) )
330332 {
331333 hasUpdateA . Release ( ) ;
332334 }
333- else if ( projectPath == serviceProjectB )
335+ else if ( line . Content . StartsWith ( $ "[B ( { tfm } )]" ) )
334336 {
335337 hasUpdateB . Release ( ) ;
336338 }
337339 else
338340 {
339- Assert . Fail ( "Only service projects should be updated" ) ;
341+ Assert . Fail ( $ "Only service projects should be updated: ' { line . Content } ' ") ;
340342 }
341343 }
342344 } ;
@@ -395,6 +397,7 @@ public enum UpdateLocation
395397 public async Task HostRestart ( UpdateLocation updateLocation )
396398 {
397399 var testAsset = CopyTestAsset ( "WatchAppMultiProc" , updateLocation ) ;
400+ var tfm = ToolsetInfo . CurrentTargetFramework ;
398401
399402 var workingDirectory = testAsset . Path ;
400403 var hostDir = Path . Combine ( testAsset . Path , "Host" ) ;
@@ -411,17 +414,17 @@ public async Task HostRestart(UpdateLocation updateLocation)
411414 var restartRequested = w . Reporter . RegisterSemaphore ( MessageDescriptor . RestartRequested ) ;
412415
413416 var hasUpdate = new SemaphoreSlim ( initialCount : 0 ) ;
414- w . Reporter . OnProjectProcessOutput += ( projectPath , line ) =>
417+ w . Reporter . OnProcessOutput += line =>
415418 {
416419 if ( line . Content . Contains ( "<Updated>" ) )
417420 {
418- if ( projectPath == hostProject )
421+ if ( line . Content . StartsWith ( $ "[Host ( { tfm } )]" ) )
419422 {
420423 hasUpdate . Release ( ) ;
421424 }
422425 else
423426 {
424- Assert . Fail ( "Only service projects should be updated" ) ;
427+ Assert . Fail ( $ "Only service projects should be updated: ' { line . Content } ' ") ;
425428 }
426429 }
427430 } ;
0 commit comments