@@ -201,8 +201,8 @@ public async Task WaitAsync_TimeoutAndToken_CancellationBeforeTimeout_ThrowsTask
201201 var task = Task . Delay ( 10000 ) ;
202202
203203 // Act & Assert (cancellation should win - use 5s timeout to ensure cancellation fires first on slow CI servers)
204- await Assert . ThrowsAsync < TaskCanceledException > ( async ( ) =>
205- await task . WaitAsync ( TimeSpan . FromSeconds ( 5 ) , cancelSource . Token ) ) ;
204+ await Assert . That ( async ( ) =>
205+ await task . WaitAsync ( TimeSpan . FromSeconds ( 5 ) , cancelSource . Token ) ) . Throws < TaskCanceledException > ( ) ;
206206 }
207207
208208 [ Test ]
@@ -642,7 +642,7 @@ public async Task WhenEach_NonGeneric_CompletesInOrder()
642642 await whenEachTask ;
643643
644644 // Assert - verify we got all tasks
645- Assert . AreEqual ( 3 , completed . Count ) ;
645+ await Assert . That ( completed . Count ) . IsEqualTo ( 3 ) ;
646646 }
647647
648648 [ Test ]
@@ -673,10 +673,10 @@ public async Task WhenEach_Generic_CompletesInOrder()
673673 await whenEachTask ;
674674
675675 // Assert - verify we got all results
676- Assert . AreEqual ( 3 , results . Count ) ;
677- Assert . Contains ( 1 , results ) ;
678- Assert . Contains ( 2 , results ) ;
679- Assert . Contains ( 3 , results ) ;
676+ await Assert . That ( results . Count ) . IsEqualTo ( 3 ) ;
677+ await Assert . That ( results . Contains ( 1 ) ) . IsTrue ( ) ;
678+ await Assert . That ( results . Contains ( 2 ) ) . IsTrue ( ) ;
679+ await Assert . That ( results . Contains ( 3 ) ) . IsTrue ( ) ;
680680 }
681681
682682 [ Test ]
@@ -693,7 +693,7 @@ public async Task WhenEach_NonGeneric_EmptyCollection_CompletesImmediately()
693693 }
694694
695695 // Assert
696- Assert . AreEqual ( 0 , count ) ;
696+ await Assert . That ( count ) . IsEqualTo ( 0 ) ;
697697 }
698698
699699 [ Test ]
@@ -710,34 +710,34 @@ public async Task WhenEach_Generic_EmptyCollection_CompletesImmediately()
710710 }
711711
712712 // Assert
713- Assert . AreEqual ( 0 , count ) ;
713+ await Assert . That ( count ) . IsEqualTo ( 0 ) ;
714714 }
715715
716716 [ Test ]
717- public void WhenEach_NonGeneric_NullTasks_ThrowsArgumentNullException ( )
717+ public async Task WhenEach_NonGeneric_NullTasks_ThrowsArgumentNullException ( )
718718 {
719719 // Act & Assert
720720#pragma warning disable IDE0022
721- Assert . ThrowsAsync < ArgumentNullException > ( async ( ) =>
721+ await Assert . That ( async ( ) =>
722722 {
723723 await foreach ( var task in Task . WhenEach ( ( IEnumerable < Task > ) null ! ) )
724724 {
725725 }
726- } ) ;
726+ } ) . Throws < ArgumentNullException > ( ) ;
727727#pragma warning restore IDE0022
728728 }
729729
730730 [ Test ]
731- public void WhenEach_Generic_NullTasks_ThrowsArgumentNullException ( )
731+ public async Task WhenEach_Generic_NullTasks_ThrowsArgumentNullException ( )
732732 {
733733 // Act & Assert
734734#pragma warning disable IDE0022
735- Assert . ThrowsAsync < ArgumentNullException > ( async ( ) =>
735+ await Assert . That ( async ( ) =>
736736 {
737737 await foreach ( var task in Task . WhenEach ( ( IEnumerable < Task < int > > ) null ! ) )
738738 {
739739 }
740- } ) ;
740+ } ) . Throws < ArgumentNullException > ( ) ;
741741#pragma warning restore IDE0022
742742 }
743743
@@ -774,7 +774,7 @@ public async Task WhenEach_NonGeneric_WithCancellation_StopsIterating()
774774 tcs3 . SetResult ( ) ;
775775
776776 // Assert
777- Assert . ThrowsAsync < OperationCanceledException > ( ( ) => whenEachTask ) ;
777+ await Assert . That ( ( ) => whenEachTask ) . Throws < OperationCanceledException > ( ) ;
778778 }
779779#endif
780780
@@ -802,9 +802,9 @@ public async Task WhenEach_Generic_WithFaultedTask_PropagatesException()
802802 await whenEachTask ;
803803
804804 // Assert - WhenEach completes, but the task itself is faulted
805- Assert . AreEqual ( 2 , results . Count ) ;
806- Assert . DoesNotThrowAsync ( ( ) => results [ 0 ] ) ;
807- Assert . ThrowsAsync < InvalidOperationException > ( ( ) => results [ 1 ] ) ;
805+ await Assert . That ( results . Count ) . IsEqualTo ( 2 ) ;
806+ await Assert . That ( async ( ) => await results [ 0 ] ) . ThrowsNothing ( ) ;
807+ await Assert . That ( async ( ) => await results [ 1 ] ) . Throws < InvalidOperationException > ( ) ;
808808 }
809809
810810 [ Test ]
@@ -823,11 +823,11 @@ public async Task WhenEach_NonGeneric_AlreadyCompletedTasks_YieldsAll()
823823 await foreach ( var task in Task . WhenEach ( tasks ) )
824824 {
825825 count ++ ;
826- Assert . True ( task . IsCompleted ) ;
826+ await Assert . That ( task . IsCompleted ) . IsTrue ( ) ;
827827 }
828828
829829 // Assert
830- Assert . AreEqual ( 3 , count ) ;
830+ await Assert . That ( count ) . IsEqualTo ( 3 ) ;
831831 }
832832
833833 [ Test ]
@@ -849,10 +849,10 @@ public async Task WhenEach_Generic_AlreadyCompletedTasks_YieldsAll()
849849 }
850850
851851 // Assert
852- Assert . AreEqual ( 3 , results . Count ) ;
853- Assert . Contains ( 1 , results ) ;
854- Assert . Contains ( 2 , results ) ;
855- Assert . Contains ( 3 , results ) ;
852+ await Assert . That ( results . Count ) . IsEqualTo ( 3 ) ;
853+ await Assert . That ( results . Contains ( 1 ) ) . IsTrue ( ) ;
854+ await Assert . That ( results . Contains ( 2 ) ) . IsTrue ( ) ;
855+ await Assert . That ( results . Contains ( 3 ) ) . IsTrue ( ) ;
856856 }
857857
858858 #endregion
0 commit comments