@@ -117,19 +117,18 @@ private Collaborators GetCollaborators()
117
117
private class TestFailureDetector : FailureDetector
118
118
{
119
119
#pragma warning disable CS0420
120
- // ReSharper disable once InconsistentNaming
121
- internal volatile bool isAvailable = true ;
122
- public override bool IsAvailable => Volatile . Read ( ref isAvailable ) ;
123
-
124
- // ReSharper disable once InconsistentNaming
125
- internal volatile bool called ;
126
- public override bool IsMonitoring => Volatile . Read ( ref called ) ;
127
- #pragma warning restore CS0420
120
+ private volatile bool _isAvailable = true ;
121
+ public override bool IsAvailable => Volatile . Read ( ref _isAvailable ) ;
122
+ public void SetAvailable ( bool available ) => Volatile . Write ( ref _isAvailable , available ) ;
123
+
124
+ private volatile bool _called ;
125
+ public override bool IsMonitoring => Volatile . Read ( ref _called ) ;
128
126
129
127
public override void HeartBeat ( )
130
128
{
131
- called = true ;
129
+ Volatile . Write ( ref _called , true ) ;
132
130
}
131
+ #pragma warning restore CS0420
133
132
}
134
133
135
134
private readonly Config _config ;
@@ -167,7 +166,7 @@ public async Task ProtocolStateActor_must_in_inbound_mode_accept_payload_after_A
167
166
168
167
reader . Tell ( TestAssociate ( 33 ) , TestActor ) ;
169
168
170
- await AwaitConditionAsync ( ( ) => collaborators . FailureDetector . called , DefaultTimeout ) ;
169
+ await AwaitConditionAsync ( ( ) => collaborators . FailureDetector . IsMonitoring , DefaultTimeout ) ;
171
170
172
171
var wrappedHandle = await ExpectMsgOfAsync ( DefaultTimeout , "expected InboundAssociation" , o =>
173
172
{
@@ -181,7 +180,7 @@ public async Task ProtocolStateActor_must_in_inbound_mode_accept_payload_after_A
181
180
182
181
wrappedHandle . ReadHandlerSource . SetResult ( new ActorHandleEventListener ( TestActor ) ) ;
183
182
184
- Assert . True ( collaborators . FailureDetector . called ) ;
183
+ Assert . True ( collaborators . FailureDetector . IsMonitoring ) ;
185
184
186
185
// Heartbeat was sent in response to Associate
187
186
await AwaitConditionAsync ( ( ) => LastActivityIsHeartbeat ( collaborators . Registry ) , DefaultTimeout ) ;
@@ -236,7 +235,8 @@ public async Task ProtocolStateActor_must_in_outbound_mode_delay_readiness_until
236
235
failureDetector : collaborators . FailureDetector ) ) ;
237
236
238
237
await AwaitConditionAsync ( ( ) => LastActivityIsAssociate ( collaborators . Registry , 42 ) , DefaultTimeout ) ;
239
- Assert . True ( collaborators . FailureDetector . called ) ;
238
+
239
+ await AwaitConditionAsync ( ( ) => collaborators . FailureDetector . IsMonitoring , DefaultTimeout ) ;
240
240
241
241
//keeps sending heartbeats
242
242
await AwaitConditionAsync ( ( ) => LastActivityIsHeartbeat ( collaborators . Registry ) , DefaultTimeout ) ;
@@ -393,9 +393,7 @@ public async Task ProtocolStateActor_must_disassociate_when_failure_detector_sig
393
393
//wait for one heartbeat
394
394
await AwaitConditionAsync ( ( ) => LastActivityIsHeartbeat ( collaborators . Registry ) , DefaultTimeout ) ;
395
395
396
- #pragma warning disable CS0420
397
- Volatile . Write ( ref collaborators . FailureDetector . isAvailable , false ) ;
398
- #pragma warning restore CS0420
396
+ collaborators . FailureDetector . SetAvailable ( false ) ;
399
397
400
398
await ExpectMsgOfAsync ( "expected Disassociated(DisassociateInfo.Unknown" , o =>
401
399
{
0 commit comments