@@ -93,18 +93,18 @@ public void Should_control_executions_per_specification(int maxParallelization,
9393 TotalActions = totalActions ;
9494 Scenario = $ "MaxParallelization { maxParallelization } ; MaxQueuing { maxQueuingActions } ; TotalActions { totalActions } ; CancelQueuing { cancelQueuing } ; CancelExecuting { cancelExecuting } : { scenario } ";
9595
96- IBulkheadPolicy bulkhead = GetBulkhead ( maxParallelization , maxQueuingActions ) ;
96+ var bulkhead = GetBulkhead ( maxParallelization , maxQueuingActions ) ;
9797 using ( bulkhead )
9898 {
9999 BulkheadForStats = bulkhead ;
100100
101101 // Set up delegates which we can track whether they've started; and control when we allow them to complete (to release their semaphore slot).
102102 Actions = new TraceableAction [ totalActions ] ;
103- for ( int i = 0 ; i < totalActions ; i ++ ) { Actions [ i ] = new TraceableAction ( i , StatusChangedEvent , TestOutputHelper ) ; }
103+ for ( var i = 0 ; i < totalActions ; i ++ ) { Actions [ i ] = new TraceableAction ( i , StatusChangedEvent , TestOutputHelper ) ; }
104104
105105 // Throw all the delegates at the bulkhead simultaneously.
106106 Tasks = new Task [ totalActions ] ;
107- for ( int i = 0 ; i < totalActions ; i ++ ) { Tasks [ i ] = ExecuteOnBulkhead ( bulkhead , Actions [ i ] ) ; }
107+ for ( var i = 0 ; i < totalActions ; i ++ ) { Tasks [ i ] = ExecuteOnBulkhead ( bulkhead , Actions [ i ] ) ; }
108108
109109 OutputStatus ( "Immediately after queueing..." ) ;
110110
@@ -204,7 +204,7 @@ protected void UpdateActuals()
204204 {
205205 ActualCompleted = ActualCancelled = ActualExecuting = ActualRejects = ActualQueuing = ActualFaulted = 0 ;
206206
207- foreach ( TraceableAction action in Actions )
207+ foreach ( var action in Actions )
208208 {
209209 switch ( action . Status )
210210 {
@@ -285,7 +285,7 @@ protected AssertionFailure ActualsMatchExpecteds()
285285
286286 protected AssertionFailure AllTasksCompleted ( )
287287 {
288- int countTasksCompleted = Tasks . Count ( t => t . IsCompleted ) ;
288+ var countTasksCompleted = Tasks . Count ( t => t . IsCompleted ) ;
289289 if ( countTasksCompleted < TotalActions )
290290 {
291291 return new AssertionFailure ( TotalActions , countTasksCompleted , nameof ( countTasksCompleted ) ) ;
@@ -296,7 +296,7 @@ protected AssertionFailure AllTasksCompleted()
296296
297297 protected void EnsureNoUnbservedTaskExceptions ( )
298298 {
299- for ( int i = 0 ; i < Tasks . Length ; i ++ )
299+ for ( var i = 0 ; i < Tasks . Length ; i ++ )
300300 {
301301 try
302302 {
@@ -313,14 +313,14 @@ protected void EnsureNoUnbservedTaskExceptions()
313313
314314 protected AssertionFailure Expect ( int expected , Func < int > actualFunc , string measure )
315315 {
316- int actual = actualFunc ( ) ;
316+ var actual = actualFunc ( ) ;
317317 return actual != expected ? new AssertionFailure ( expected , actual , measure ) : null ;
318318 }
319319
320320 protected void Within ( TimeSpan timeSpan , Func < AssertionFailure > actionContainingAssertions )
321321 {
322- TimeSpan permitted = timeSpan ;
323- Stopwatch watch = Stopwatch . StartNew ( ) ;
322+ var permitted = timeSpan ;
323+ var watch = Stopwatch . StartNew ( ) ;
324324 while ( true )
325325 {
326326 var potentialFailure = actionContainingAssertions ( ) ;
@@ -336,7 +336,7 @@ protected void Within(TimeSpan timeSpan, Func<AssertionFailure> actionContaining
336336 throw new InvalidOperationException ( "Code should never reach here. Preceding assertion should fail." ) ;
337337 }
338338
339- bool signaled = StatusChangedEvent . WaitOne ( ShimTimeSpan ) ;
339+ var signaled = StatusChangedEvent . WaitOne ( ShimTimeSpan ) ;
340340 if ( signaled )
341341 {
342342 // Following TraceableAction.CaptureCompletion() signalling the AutoResetEvent,
@@ -360,7 +360,7 @@ protected void OutputStatus(string statusHeading)
360360 TestOutputHelper . WriteLine ( "Bulkhead: {0} slots out of {1} available." , ActualBulkheadFree , MaxParallelization ) ;
361361 TestOutputHelper . WriteLine ( "Bulkhead queue: {0} slots out of {1} available." , ActualQueueFree , MaxQueuingActions ) ;
362362
363- for ( int i = 0 ; i < Actions . Length ; i ++ )
363+ for ( var i = 0 ; i < Actions . Length ; i ++ )
364364 {
365365 TestOutputHelper . WriteLine ( "Action {0}: {1}" , i , Actions [ i ] . Status ) ;
366366 }
@@ -382,7 +382,7 @@ public void Dispose()
382382
383383 if ( Actions != null )
384384 {
385- foreach ( TraceableAction action in Actions )
385+ foreach ( var action in Actions )
386386 {
387387 action . Dispose ( ) ;
388388 }
0 commit comments