33
44#nullable enable
55
6- using System . Collections . Immutable ;
76using System . Runtime . CompilerServices ;
87
98namespace Microsoft . DotNet . Watch . UnitTests ;
@@ -142,6 +141,8 @@ public async Task UpdateAndRudeEdit(TriggerEvent trigger)
142141 {
143142 var testAsset = CopyTestAsset ( "WatchAppMultiProc" , trigger ) ;
144143
144+ var tfm = ToolsetInfo . CurrentTargetFramework ;
145+
145146 var workingDirectory = testAsset . Path ;
146147 var hostDir = Path . Combine ( testAsset . Path , "Host" ) ;
147148 var hostProject = Path . Combine ( hostDir , "Host.csproj" ) ;
@@ -219,18 +220,18 @@ async Task MakeValidDependencyChange()
219220 {
220221 var hasUpdateSourceA = w . CreateCompletionSource ( ) ;
221222 var hasUpdateSourceB = w . CreateCompletionSource ( ) ;
222- w . Reporter . OnProjectProcessOutput += ( projectPath , line ) =>
223+ w . Reporter . OnProcessOutput += line =>
223224 {
224225 if ( line . Content . Contains ( "<Updated Lib>" ) )
225226 {
226- if ( projectPath == serviceProjectA )
227+ if ( line . Content . StartsWith ( $ "[A ( { tfm } )]" ) )
227228 {
228229 if ( ! hasUpdateSourceA . Task . IsCompleted )
229230 {
230231 hasUpdateSourceA . SetResult ( ) ;
231232 }
232233 }
233- else if ( projectPath == serviceProjectB )
234+ else if ( line . Content . StartsWith ( $ "[B ( { tfm } )]" ) )
234235 {
235236 if ( ! hasUpdateSourceB . Task . IsCompleted )
236237 {
@@ -239,7 +240,7 @@ async Task MakeValidDependencyChange()
239240 }
240241 else
241242 {
242- Assert . Fail ( "Only service projects should be updated" ) ;
243+ Assert . Fail ( $ "Only service projects should be updated: ' { line . Content } ' ") ;
243244 }
244245 }
245246 } ;
@@ -273,9 +274,9 @@ public static void Common()
273274 async Task MakeRudeEditChange ( )
274275 {
275276 var hasUpdateSource = w . CreateCompletionSource ( ) ;
276- w . Reporter . OnProjectProcessOutput += ( projectPath , line ) =>
277+ w . Reporter . OnProcessOutput += line =>
277278 {
278- if ( projectPath == serviceProjectA && line . Content . Contains ( "Started A: 2" ) )
279+ if ( line . Content . StartsWith ( $ "[A ( { tfm } )]" ) && line . Content . Contains ( "Started A: 2" ) )
279280 {
280281 hasUpdateSource . SetResult ( ) ;
281282 }
@@ -300,6 +301,7 @@ async Task MakeRudeEditChange()
300301 public async Task UpdateAppliedToNewProcesses ( bool sharedOutput )
301302 {
302303 var testAsset = CopyTestAsset ( "WatchAppMultiProc" , sharedOutput ) ;
304+ var tfm = ToolsetInfo . CurrentTargetFramework ;
303305
304306 if ( sharedOutput )
305307 {
@@ -325,21 +327,21 @@ public async Task UpdateAppliedToNewProcesses(bool sharedOutput)
325327
326328 var hasUpdateA = new SemaphoreSlim ( initialCount : 0 ) ;
327329 var hasUpdateB = new SemaphoreSlim ( initialCount : 0 ) ;
328- w . Reporter . OnProjectProcessOutput += ( projectPath , line ) =>
330+ w . Reporter . OnProcessOutput += line =>
329331 {
330332 if ( line . Content . Contains ( "<Updated Lib>" ) )
331333 {
332- if ( projectPath == serviceProjectA )
334+ if ( line . Content . StartsWith ( $ "[A ( { tfm } )]" ) )
333335 {
334336 hasUpdateA . Release ( ) ;
335337 }
336- else if ( projectPath == serviceProjectB )
338+ else if ( line . Content . StartsWith ( $ "[B ( { tfm } )]" ) )
337339 {
338340 hasUpdateB . Release ( ) ;
339341 }
340342 else
341343 {
342- Assert . Fail ( "Only service projects should be updated" ) ;
344+ Assert . Fail ( $ "Only service projects should be updated: ' { line . Content } ' ") ;
343345 }
344346 }
345347 } ;
@@ -398,6 +400,7 @@ public enum UpdateLocation
398400 public async Task HostRestart ( UpdateLocation updateLocation )
399401 {
400402 var testAsset = CopyTestAsset ( "WatchAppMultiProc" , updateLocation ) ;
403+ var tfm = ToolsetInfo . CurrentTargetFramework ;
401404
402405 var workingDirectory = testAsset . Path ;
403406 var hostDir = Path . Combine ( testAsset . Path , "Host" ) ;
@@ -414,17 +417,17 @@ public async Task HostRestart(UpdateLocation updateLocation)
414417 var restartRequested = w . Reporter . RegisterSemaphore ( MessageDescriptor . RestartRequested ) ;
415418
416419 var hasUpdate = new SemaphoreSlim ( initialCount : 0 ) ;
417- w . Reporter . OnProjectProcessOutput += ( projectPath , line ) =>
420+ w . Reporter . OnProcessOutput += line =>
418421 {
419422 if ( line . Content . Contains ( "<Updated>" ) )
420423 {
421- if ( projectPath == hostProject )
424+ if ( line . Content . StartsWith ( $ "[Host ( { tfm } )]" ) )
422425 {
423426 hasUpdate . Release ( ) ;
424427 }
425428 else
426429 {
427- Assert . Fail ( "Only service projects should be updated" ) ;
430+ Assert . Fail ( $ "Only service projects should be updated: ' { line . Content } ' ") ;
428431 }
429432 }
430433 } ;
0 commit comments