@@ -366,7 +366,7 @@ public void EventRecordWritten_AfterResubscribe_ShouldReceiveEvents()
366366 eventLog . Source = Constants . ApplicationLogName ;
367367 eventLog . WriteEntry ( "Test event after resubscribe" , EventLogEntryType . Information ) ;
368368
369- bool received = eventReceived . Wait ( TimeSpan . FromSeconds ( 5 ) ) ;
369+ bool received = eventReceived . Wait ( TimeSpan . FromSeconds ( 5 ) , TestContext . Current . CancellationToken ) ;
370370
371371 // Assert
372372 Assert . True ( received , "Did not receive event within timeout period" ) ;
@@ -413,7 +413,7 @@ public void EventRecordWritten_ShouldHaveRecordId()
413413 eventLog . Source = Constants . ApplicationLogName ;
414414 eventLog . WriteEntry ( "Test event for record ID" , EventLogEntryType . Information ) ;
415415
416- bool received = eventReceived . Wait ( TimeSpan . FromSeconds ( 5 ) ) ;
416+ bool received = eventReceived . Wait ( TimeSpan . FromSeconds ( 5 ) , TestContext . Current . CancellationToken ) ;
417417
418418 // Assert
419419 Assert . True ( received , "Did not receive event within timeout period" ) ;
@@ -445,7 +445,7 @@ public void EventRecordWritten_ShouldHaveValidTimeCreated()
445445 eventLog . Source = Constants . ApplicationLogName ;
446446 eventLog . WriteEntry ( "Test event for timestamp" , EventLogEntryType . Information ) ;
447447
448- bool received = eventReceived . Wait ( TimeSpan . FromSeconds ( 5 ) ) ;
448+ bool received = eventReceived . Wait ( TimeSpan . FromSeconds ( 5 ) , TestContext . Current . CancellationToken ) ;
449449 var afterWrite = DateTime . UtcNow . AddSeconds ( 1 ) ; // Add buffer for processing
450450
451451 // Assert
@@ -477,7 +477,7 @@ public void EventRecordWritten_ShouldIncludePathName()
477477 eventLog . Source = Constants . ApplicationLogName ;
478478 eventLog . WriteEntry ( "Test event for path validation" , EventLogEntryType . Information ) ;
479479
480- bool received = eventReceived . Wait ( TimeSpan . FromSeconds ( 5 ) ) ;
480+ bool received = eventReceived . Wait ( TimeSpan . FromSeconds ( 5 ) , TestContext . Current . CancellationToken ) ;
481481
482482 // Assert
483483 Assert . True ( received , "Did not receive event within timeout period" ) ;
@@ -506,7 +506,7 @@ public void EventRecordWritten_ShouldIncludeProperties()
506506 eventLog . Source = Constants . ApplicationLogName ;
507507 eventLog . WriteEntry ( "Test event for properties" , EventLogEntryType . Information ) ;
508508
509- bool received = eventReceived . Wait ( TimeSpan . FromSeconds ( 5 ) ) ;
509+ bool received = eventReceived . Wait ( TimeSpan . FromSeconds ( 5 ) , TestContext . Current . CancellationToken ) ;
510510
511511 // Assert
512512 Assert . True ( received , "Did not receive event within timeout period" ) ;
@@ -535,7 +535,7 @@ public void EventRecordWritten_ShouldProvideCorrectSender()
535535 eventLog . Source = Constants . ApplicationLogName ;
536536 eventLog . WriteEntry ( "Test event for sender validation" , EventLogEntryType . Information ) ;
537537
538- bool received = eventReceived . Wait ( TimeSpan . FromSeconds ( 5 ) ) ;
538+ bool received = eventReceived . Wait ( TimeSpan . FromSeconds ( 5 ) , TestContext . Current . CancellationToken ) ;
539539
540540 // Assert
541541 Assert . True ( received , "Did not receive event within timeout period" ) ;
@@ -574,7 +574,7 @@ public void EventRecordWritten_ShouldReceiveEventsInOrder()
574574 Thread . Sleep ( 50 ) ;
575575 eventLog . WriteEntry ( "Event C" , EventLogEntryType . Information ) ;
576576
577- bool received = countdown . Wait ( TimeSpan . FromSeconds ( 10 ) ) ;
577+ bool received = countdown . Wait ( TimeSpan . FromSeconds ( 10 ) , TestContext . Current . CancellationToken ) ;
578578
579579 // Assert
580580 Assert . True ( received , "Did not receive all events within timeout period" ) ;
@@ -613,7 +613,7 @@ public void EventRecordWritten_WhenErrorOccurs_ShouldReceiveEventRecordWithError
613613 eventLog . Source = Constants . ApplicationLogName ;
614614 eventLog . WriteEntry ( "Test event for error case" , EventLogEntryType . Information ) ;
615615
616- bool received = eventReceived . Wait ( TimeSpan . FromSeconds ( 5 ) ) ;
616+ bool received = eventReceived . Wait ( TimeSpan . FromSeconds ( 5 ) , TestContext . Current . CancellationToken ) ;
617617
618618 // Assert
619619 Assert . True ( received , "Did not receive event within timeout period" ) ;
@@ -646,7 +646,7 @@ public void EventRecordWritten_WhenMultipleEventsWritten_ShouldReceiveAll()
646646 eventLog . WriteEntry ( "Test event 2" , EventLogEntryType . Warning ) ;
647647 eventLog . WriteEntry ( "Test event 3" , EventLogEntryType . Error ) ;
648648
649- bool received = countdown . Wait ( TimeSpan . FromSeconds ( 10 ) ) ;
649+ bool received = countdown . Wait ( TimeSpan . FromSeconds ( 10 ) , TestContext . Current . CancellationToken ) ;
650650
651651 // Assert
652652 Assert . True ( received , "Did not receive all events within timeout period" ) ;
@@ -691,7 +691,7 @@ public void EventRecordWritten_WhenSubscribed_ShouldReceiveEvents()
691691 eventLog . Source = Constants . ApplicationLogName ;
692692 eventLog . WriteEntry ( "Test event for EventLogWatcher" , EventLogEntryType . Information ) ;
693693
694- bool received = eventReceived . Wait ( TimeSpan . FromSeconds ( 5 ) ) ;
694+ bool received = eventReceived . Wait ( TimeSpan . FromSeconds ( 5 ) , TestContext . Current . CancellationToken ) ;
695695
696696 // Assert
697697 Assert . True ( received , "Did not receive event within timeout period" ) ;
@@ -726,7 +726,7 @@ public void EventRecordWritten_WithBookmark_ShouldReceiveNewEvents()
726726 eventLog . Source = Constants . ApplicationLogName ;
727727 eventLog . WriteEntry ( "Test event after bookmark" , EventLogEntryType . Information ) ;
728728
729- bool received = eventReceived . Wait ( TimeSpan . FromSeconds ( 5 ) ) ;
729+ bool received = eventReceived . Wait ( TimeSpan . FromSeconds ( 5 ) , TestContext . Current . CancellationToken ) ;
730730
731731 // Assert
732732 Assert . True ( received , "Did not receive event within timeout period" ) ;
@@ -761,35 +761,35 @@ public async Task EventRecordWritten_WithConcurrentEventWrites_ShouldHandleAllEv
761761 using var log = new EventLog ( Constants . ApplicationLogName ) ;
762762 log . Source = Constants . ApplicationLogName ;
763763 log . WriteEntry ( "Concurrent event 1" , EventLogEntryType . Information ) ;
764- } ) ,
764+ } , TestContext . Current . CancellationToken ) ,
765765 Task . Run ( ( ) =>
766766 {
767767 using var log = new EventLog ( Constants . ApplicationLogName ) ;
768768 log . Source = Constants . ApplicationLogName ;
769769 log . WriteEntry ( "Concurrent event 2" , EventLogEntryType . Information ) ;
770- } ) ,
770+ } , TestContext . Current . CancellationToken ) ,
771771 Task . Run ( ( ) =>
772772 {
773773 using var log = new EventLog ( Constants . ApplicationLogName ) ;
774774 log . Source = Constants . ApplicationLogName ;
775775 log . WriteEntry ( "Concurrent event 3" , EventLogEntryType . Information ) ;
776- } ) ,
776+ } , TestContext . Current . CancellationToken ) ,
777777 Task . Run ( ( ) =>
778778 {
779779 using var log = new EventLog ( Constants . ApplicationLogName ) ;
780780 log . Source = Constants . ApplicationLogName ;
781781 log . WriteEntry ( "Concurrent event 4" , EventLogEntryType . Information ) ;
782- } ) ,
782+ } , TestContext . Current . CancellationToken ) ,
783783 Task . Run ( ( ) =>
784784 {
785785 using var log = new EventLog ( Constants . ApplicationLogName ) ;
786786 log . Source = Constants . ApplicationLogName ;
787787 log . WriteEntry ( "Concurrent event 5" , EventLogEntryType . Information ) ;
788- } )
788+ } , TestContext . Current . CancellationToken )
789789 } ;
790790
791791 await Task . WhenAll ( tasks ) ;
792- bool received = countdown . Wait ( TimeSpan . FromSeconds ( 10 ) ) ;
792+ bool received = countdown . Wait ( TimeSpan . FromSeconds ( 10 ) , TestContext . Current . CancellationToken ) ;
793793
794794 // Assert
795795 Assert . True ( received , $ "Did not receive all events within timeout period. Got { receivedEvents . Count } events") ;
@@ -835,7 +835,7 @@ public void EventRecordWritten_WithMultipleSubscribers_ShouldNotifyAll()
835835 eventLog . Source = Constants . ApplicationLogName ;
836836 eventLog . WriteEntry ( "Test event for multiple subscribers" , EventLogEntryType . Information ) ;
837837
838- bool received = countdown . Wait ( TimeSpan . FromSeconds ( 5 ) ) ;
838+ bool received = countdown . Wait ( TimeSpan . FromSeconds ( 5 ) , TestContext . Current . CancellationToken ) ;
839839
840840 // Assert
841841 Assert . True ( received , "Did not receive events in all subscribers within timeout period" ) ;
@@ -883,7 +883,7 @@ public void EventRecordWritten_WithRenderXmlFalse_ShouldNotIncludeXml()
883883 eventLog . Source = Constants . ApplicationLogName ;
884884 eventLog . WriteEntry ( "Test event without XML" , EventLogEntryType . Information ) ;
885885
886- bool received = eventReceived . Wait ( TimeSpan . FromSeconds ( 5 ) ) ;
886+ bool received = eventReceived . Wait ( TimeSpan . FromSeconds ( 5 ) , TestContext . Current . CancellationToken ) ;
887887
888888 // Assert
889889 Assert . True ( received , "Did not receive event within timeout period" ) ;
@@ -912,7 +912,7 @@ public void EventRecordWritten_WithRenderXmlTrue_ShouldIncludeXml()
912912 eventLog . Source = Constants . ApplicationLogName ;
913913 eventLog . WriteEntry ( "Test event for XML rendering" , EventLogEntryType . Information ) ;
914914
915- bool received = eventReceived . Wait ( TimeSpan . FromSeconds ( 5 ) ) ;
915+ bool received = eventReceived . Wait ( TimeSpan . FromSeconds ( 5 ) , TestContext . Current . CancellationToken ) ;
916916
917917 // Assert
918918 Assert . True ( received , "Did not receive event within timeout period" ) ;
@@ -967,7 +967,7 @@ public void Multiple_Watchers_OnSameLog_ShouldAllReceiveEvents()
967967 eventLog . Source = Constants . ApplicationLogName ;
968968 eventLog . WriteEntry ( "Test event for multiple watchers" , EventLogEntryType . Information ) ;
969969
970- bool received = countdown . Wait ( TimeSpan . FromSeconds ( 5 ) ) ;
970+ bool received = countdown . Wait ( TimeSpan . FromSeconds ( 5 ) , TestContext . Current . CancellationToken ) ;
971971
972972 // Assert
973973 Assert . True ( received , "Did not receive events in all watchers within timeout period" ) ;
0 commit comments