@@ -253,7 +253,10 @@ public void Wrapping_nothing_using_static_wrap_syntax_should_throw()
253253 public void Wrapping_only_one_policy_using_static_wrap_syntax_should_throw ( )
254254 {
255255 Policy singlePolicy = Policy . Handle < Exception > ( ) . Retry ( ) ;
256+
257+ #pragma warning disable S3878 // Remove this array creation and simply pass the elements
256258 Action config = ( ) => Policy . Wrap ( new [ ] { singlePolicy } ) ;
259+ #pragma warning restore S3878
257260
258261 config . Should ( ) . Throw < ArgumentException > ( ) . And . ParamName . Should ( ) . Be ( "policies" ) ;
259262 }
@@ -263,7 +266,7 @@ public void Wrapping_two_policies_using_static_wrap_syntax_should_not_throw()
263266 {
264267 Policy retry = Policy . Handle < Exception > ( ) . Retry ( ) ;
265268 Policy breaker = Policy . Handle < Exception > ( ) . CircuitBreaker ( 1 , TimeSpan . FromSeconds ( 10 ) ) ;
266- Action config = ( ) => Policy . Wrap ( new [ ] { retry , breaker } ) ;
269+ Action config = ( ) => Policy . Wrap ( retry , breaker ) ;
267270
268271 config . Should ( ) . NotThrow ( ) ;
269272 }
@@ -275,7 +278,7 @@ public void Wrapping_more_than_two_policies_using_static_wrap_syntax_should_not_
275278 Policy divideByZeroRetry = Policy . Handle < DivideByZeroException > ( ) . Retry ( 2 ) ;
276279 Policy breaker = Policy . Handle < Exception > ( ) . CircuitBreaker ( 1 , TimeSpan . FromSeconds ( 10 ) ) ;
277280
278- Action config = ( ) => Policy . Wrap ( new [ ] { divideByZeroRetry , retry , breaker } ) ;
281+ Action config = ( ) => Policy . Wrap ( divideByZeroRetry , retry , breaker ) ;
279282
280283 config . Should ( ) . NotThrow ( ) ;
281284 }
@@ -308,7 +311,7 @@ public void Wrapping_nothing_using_static_wrap_strongly_typed_syntax_should_thro
308311 public void Wrapping_only_one_policy_using_static_wrap_strongly_typed_syntax_should_throw ( )
309312 {
310313 Policy < int > singlePolicy = Policy < int > . Handle < Exception > ( ) . Retry ( ) ;
311- Action config = ( ) => Policy . Wrap < int > ( new [ ] { singlePolicy } ) ;
314+ Action config = ( ) => Policy . Wrap < int > ( singlePolicy ) ;
312315
313316 config . Should ( ) . Throw < ArgumentException > ( ) . And . ParamName . Should ( ) . Be ( "policies" ) ;
314317 }
@@ -318,7 +321,7 @@ public void Wrapping_two_policies_using_static_wrap_strongly_typed_syntax_should
318321 {
319322 Policy < int > retry = Policy < int > . Handle < Exception > ( ) . Retry ( ) ;
320323 Policy < int > breaker = Policy < int > . Handle < Exception > ( ) . CircuitBreaker ( 1 , TimeSpan . FromSeconds ( 10 ) ) ;
321- Action config = ( ) => Policy . Wrap < int > ( new [ ] { retry , breaker } ) ;
324+ Action config = ( ) => Policy . Wrap < int > ( retry , breaker ) ;
322325
323326 config . Should ( ) . NotThrow ( ) ;
324327 }
@@ -330,7 +333,7 @@ public void Wrapping_more_than_two_policies_using_static_wrap_strongly_typed_syn
330333 Policy < int > divideByZeroRetry = Policy < int > . Handle < DivideByZeroException > ( ) . Retry ( 2 ) ;
331334 Policy < int > breaker = Policy < int > . Handle < Exception > ( ) . CircuitBreaker ( 1 , TimeSpan . FromSeconds ( 10 ) ) ;
332335
333- Action config = ( ) => Policy . Wrap < int > ( new [ ] { divideByZeroRetry , retry , breaker } ) ;
336+ Action config = ( ) => Policy . Wrap < int > ( divideByZeroRetry , retry , breaker ) ;
334337
335338 config . Should ( ) . NotThrow ( ) ;
336339 }
0 commit comments