@@ -52,8 +52,9 @@ public async Task IsolateAsync_Ok()
5252 called . Should ( ) . BeTrue ( ) ;
5353
5454 var outcome = await controller . OnActionPreExecuteAsync ( ResilienceContextPool . Shared . Get ( ) ) ;
55- outcome . Value . Exception . Should ( ) . BeOfType < IsolatedCircuitException > ( )
56- . And . Subject . As < IsolatedCircuitException > ( ) . RetryAfter . Should ( ) . BeNull ( ) ;
55+ var exception = outcome . Value . Exception . Should ( ) . BeOfType < IsolatedCircuitException > ( ) . Subject ;
56+ exception . RetryAfter . Should ( ) . BeNull ( ) ;
57+ exception . TelemetrySource . Should ( ) . NotBeNull ( ) ;
5758
5859 // now close it
5960 await controller . CloseCircuitAsync ( ResilienceContextPool . Shared . Get ( ) ) ;
@@ -119,8 +120,9 @@ public async Task OnActionPreExecute_CircuitOpenedByValue()
119120 using var controller = CreateController ( ) ;
120121
121122 await OpenCircuit ( controller , Outcome . FromResult ( 99 ) ) ;
122- var error = ( BrokenCircuitException ) ( await controller . OnActionPreExecuteAsync ( ResilienceContextPool . Shared . Get ( ) ) ) . Value . Exception ! ;
123- error . Should ( ) . BeOfType < BrokenCircuitException > ( ) . And . Subject . As < BrokenCircuitException > ( ) . RetryAfter . Should ( ) . NotBeNull ( ) ;
123+ var exception = ( BrokenCircuitException ) ( await controller . OnActionPreExecuteAsync ( ResilienceContextPool . Shared . Get ( ) ) ) . Value . Exception ! ;
124+ exception . RetryAfter . Should ( ) . NotBeNull ( ) ;
125+ exception . TelemetrySource . Should ( ) . NotBeNull ( ) ;
124126
125127 GetBlockedTill ( controller ) . Should ( ) . Be ( _timeProvider . GetUtcNow ( ) + _options . BreakDuration ) ;
126128 }
@@ -149,6 +151,7 @@ await OpenCircuit(
149151 stacks . Add ( e . StackTrace ! ) ;
150152 e . Message . Should ( ) . Be ( "The circuit is now open and is not allowing calls." ) ;
151153 e . RetryAfter . Should ( ) . NotBeNull ( ) ;
154+ e . TelemetrySource . Should ( ) . NotBeNull ( ) ;
152155
153156 if ( innerException )
154157 {
@@ -206,9 +209,10 @@ public async Task OnActionPreExecute_CircuitOpenedByException()
206209 using var controller = CreateController ( ) ;
207210
208211 await OpenCircuit ( controller , Outcome . FromException < int > ( new InvalidOperationException ( ) ) ) ;
209- var error = ( BrokenCircuitException ) ( await controller . OnActionPreExecuteAsync ( ResilienceContextPool . Shared . Get ( ) ) ) . Value . Exception ! ;
210- error . InnerException . Should ( ) . BeOfType < InvalidOperationException > ( ) ;
211- error . RetryAfter . Should ( ) . NotBeNull ( ) ;
212+ var exception = ( BrokenCircuitException ) ( await controller . OnActionPreExecuteAsync ( ResilienceContextPool . Shared . Get ( ) ) ) . Value . Exception ! ;
213+ exception . InnerException . Should ( ) . BeOfType < InvalidOperationException > ( ) ;
214+ exception . RetryAfter . Should ( ) . NotBeNull ( ) ;
215+ exception . TelemetrySource . Should ( ) . NotBeNull ( ) ;
212216 }
213217
214218 [ Fact ]
@@ -261,9 +265,11 @@ public async Task OnActionPreExecute_HalfOpen()
261265 // act
262266 await controller . OnActionPreExecuteAsync ( ResilienceContextPool . Shared . Get ( ) ) ;
263267 var error = ( await controller . OnActionPreExecuteAsync ( ResilienceContextPool . Shared . Get ( ) ) ) . Value . Exception ;
264- error . Should ( ) . BeOfType < BrokenCircuitException > ( ) . And . Subject . As < BrokenCircuitException > ( ) . RetryAfter . Should ( ) . NotBeNull ( ) ;
265268
266269 // assert
270+ var exception = error . Should ( ) . BeOfType < BrokenCircuitException > ( ) . Subject ;
271+ exception . RetryAfter . Should ( ) . NotBeNull ( ) ;
272+ exception . TelemetrySource . Should ( ) . NotBeNull ( ) ;
267273 controller . CircuitState . Should ( ) . Be ( CircuitState . HalfOpen ) ;
268274 called . Should ( ) . BeTrue ( ) ;
269275 }
@@ -465,7 +471,9 @@ public async Task OnActionFailureAsync_VoidResult_EnsureBreakingExceptionNotSet(
465471 // assert
466472 controller . LastException . Should ( ) . BeNull ( ) ;
467473 var outcome = await controller . OnActionPreExecuteAsync ( ResilienceContextPool . Shared . Get ( ) ) ;
468- outcome . Value . Exception . Should ( ) . BeOfType < BrokenCircuitException > ( ) . And . Subject . As < BrokenCircuitException > ( ) . RetryAfter . Should ( ) . NotBeNull ( ) ;
474+ var exception = outcome . Value . Exception . Should ( ) . BeOfType < BrokenCircuitException > ( ) . Subject ;
475+ exception . RetryAfter . Should ( ) . NotBeNull ( ) ;
476+ exception . TelemetrySource . Should ( ) . NotBeNull ( ) ;
469477 }
470478
471479 [ Fact ]
@@ -501,8 +509,9 @@ public async Task Flow_Closed_HalfOpen_Open_HalfOpen_Closed()
501509 TimeSpan advanceTimeRejected = TimeSpan . FromMilliseconds ( 1 ) ;
502510 AdvanceTime ( advanceTimeRejected ) ;
503511 var outcome = await controller . OnActionPreExecuteAsync ( ResilienceContextPool . Shared . Get ( ) ) ;
504- outcome . Value . Exception . Should ( ) . BeOfType < BrokenCircuitException > ( )
505- . And . Subject . As < BrokenCircuitException > ( ) . RetryAfter . Should ( ) . Be ( _options . BreakDuration - advanceTimeRejected ) ;
512+ var exception = outcome . Value . Exception . Should ( ) . BeOfType < BrokenCircuitException > ( ) . Subject ;
513+ exception . RetryAfter . Should ( ) . Be ( _options . BreakDuration - advanceTimeRejected ) ;
514+ exception . TelemetrySource . Should ( ) . NotBeNull ( ) ;
506515
507516 // wait and try, transition to half open
508517 AdvanceTime ( _options . BreakDuration + _options . BreakDuration ) ;
0 commit comments