@@ -921,9 +921,6 @@ public async Task ConnectAsync_CancellationRequested_PropagatesToken()
921921 // Connection might still be called before cancellation
922922 }
923923
924- private static void SubscribeAsync ( ConnectionStateTracker tracker , Func < ConnectionStates , CancellationToken , ValueTask > handler )
925- => ( ( IAsyncConnection ) tracker ) . StateChanged += handler ;
926-
927924 [ TestMethod ]
928925 public void AsyncStateChanged_AllConnected_Fires ( )
929926 {
@@ -935,7 +932,7 @@ public void AsyncStateChanged_AllConnected_Fires()
935932 tracker . Add ( conn2 ) ;
936933
937934 ConnectionStates ? firedState = null ;
938- SubscribeAsync ( tracker , ( state , _ ) => { firedState = state ; return default ; } ) ;
935+ tracker . StateChanged += ( state , _ ) => { firedState = state ; return default ; } ;
939936
940937 conn1 . SetState ( ConnectionStates . Connected ) ;
941938 conn2 . SetState ( ConnectionStates . Connected ) ;
@@ -954,7 +951,7 @@ public void AsyncStateChanged_TransitionSequence()
954951 tracker . Add ( conn2 ) ;
955952
956953 var states = new List < ConnectionStates > ( ) ;
957- SubscribeAsync ( tracker , ( state , _ ) => { states . Add ( state ) ; return default ; } ) ;
954+ tracker . StateChanged += ( state , _ ) => { states . Add ( state ) ; return default ; } ;
958955
959956 conn1 . SetState ( ConnectionStates . Connected ) ;
960957 conn2 . SetState ( ConnectionStates . Connected ) ;
@@ -991,7 +988,7 @@ public void AsyncStateChanged_BothSyncAndAsyncFire()
991988 ConnectionStates ? asyncState = null ;
992989
993990 Subscribe ( tracker , state => syncState = state ) ;
994- SubscribeAsync ( tracker , ( state , _ ) => { asyncState = state ; return default ; } ) ;
991+ tracker . StateChanged += ( state , _ ) => { asyncState = state ; return default ; } ;
995992
996993 conn . SetState ( ConnectionStates . Connected ) ;
997994
0 commit comments