@@ -202,6 +202,294 @@ public void Should_Not_Throw_If_No_Matching_Issues()
202
202
}
203
203
}
204
204
205
+ public sealed class TheBreakBuildOnIssuesMethodWithPriorityAndProviderTypeParameters
206
+ {
207
+ [ Fact ]
208
+ public void Should_Throw_If_Issues_Is_Null ( )
209
+ {
210
+ // Given
211
+ IEnumerable < IIssue > issues = null ;
212
+ var minimumPriority = IssuePriority . Undefined ;
213
+ IList < string > issueProvidersToConsider = [ ] ;
214
+ IList < string > issueProvidersToIgnore = [ ] ;
215
+
216
+ // When
217
+ var result = Record . Exception ( ( ) => BuildBreaker . BreakBuildOnIssues (
218
+ issues ,
219
+ minimumPriority ,
220
+ issueProvidersToConsider ,
221
+ issueProvidersToIgnore ) ) ;
222
+
223
+ // Then
224
+ result . IsArgumentNullException ( "issues" ) ;
225
+ }
226
+
227
+ [ Fact ]
228
+ public void Should_Throw_If_IssueProvidersToConsider_Is_Null ( )
229
+ {
230
+ // Given
231
+ IEnumerable < IIssue > issues = [
232
+ IssueBuilder
233
+ . NewIssue ( "Message Foo" , "ProviderType Foo" , "ProviderName Foo" )
234
+ . Create ( ) ] ;
235
+ var minimumPriority = IssuePriority . Undefined ;
236
+ IList < string > issueProvidersToConsider = null ;
237
+ IList < string > issueProvidersToIgnore = [ ] ;
238
+
239
+ // When
240
+ var result = Record . Exception ( ( ) => BuildBreaker . BreakBuildOnIssues (
241
+ issues ,
242
+ minimumPriority ,
243
+ issueProvidersToConsider ,
244
+ issueProvidersToIgnore ) ) ;
245
+
246
+ // Then
247
+ result . IsArgumentNullException ( "issueProvidersToConsider" ) ;
248
+ }
249
+
250
+ [ Fact ]
251
+ public void Should_Throw_If_IssueProvidersToIgnore_Is_Null ( )
252
+ {
253
+ // Given
254
+ IEnumerable < IIssue > issues = [
255
+ IssueBuilder
256
+ . NewIssue ( "Message Foo" , "ProviderType Foo" , "ProviderName Foo" )
257
+ . WithPriority ( IssuePriority . Error )
258
+ . Create ( ) ] ;
259
+ var minimumPriority = IssuePriority . Warning ;
260
+ IList < string > issueProvidersToConsider = [ ] ;
261
+ IList < string > issueProvidersToIgnore = null ;
262
+
263
+ // When
264
+ var result = Record . Exception ( ( ) => BuildBreaker . BreakBuildOnIssues (
265
+ issues ,
266
+ minimumPriority ,
267
+ issueProvidersToConsider ,
268
+ issueProvidersToIgnore ) ) ;
269
+
270
+ // Then
271
+ result . IsArgumentNullException ( "issueProvidersToIgnore" ) ;
272
+ }
273
+
274
+ [ Fact ]
275
+ public void Should_Throw_If_Any_Issue_And_No_Filter ( )
276
+ {
277
+ // Given
278
+ IEnumerable < IIssue > issues = [
279
+ IssueBuilder
280
+ . NewIssue ( "Message Foo" , "ProviderType Foo" , "ProviderName Foo" )
281
+ . Create ( ) ] ;
282
+ var minimumPriority = IssuePriority . Undefined ;
283
+ IList < string > issueProvidersToConsider = [ ] ;
284
+ IList < string > issueProvidersToIgnore = [ ] ;
285
+
286
+ // When
287
+ var result = Record . Exception ( ( ) => BuildBreaker . BreakBuildOnIssues (
288
+ issues ,
289
+ minimumPriority ,
290
+ issueProvidersToConsider ,
291
+ issueProvidersToIgnore ) ) ;
292
+
293
+ // Then
294
+ result . IsIssuesFoundException ( "Found 1 issue." ) ;
295
+ }
296
+
297
+ [ Theory ]
298
+ [ InlineData ( IssuePriority . Undefined ) ]
299
+ [ InlineData ( IssuePriority . Hint ) ]
300
+ [ InlineData ( IssuePriority . Suggestion ) ]
301
+ [ InlineData ( IssuePriority . Warning ) ]
302
+ public void Should_Throw_If_Issue_Of_Relevant_Priority ( IssuePriority priority )
303
+ {
304
+ // Given
305
+ IEnumerable < IIssue > issues = [
306
+ IssueBuilder
307
+ . NewIssue ( "Message Foo" , "ProviderType Foo" , "ProviderName Foo" )
308
+ . WithPriority ( IssuePriority . Warning )
309
+ . Create ( ) ] ;
310
+ var minimumPriority = priority ;
311
+ IList < string > issueProvidersToConsider = [ ] ;
312
+ IList < string > issueProvidersToIgnore = [ ] ;
313
+
314
+ // When
315
+ var result = Record . Exception ( ( ) => BuildBreaker . BreakBuildOnIssues (
316
+ issues ,
317
+ minimumPriority ,
318
+ issueProvidersToConsider ,
319
+ issueProvidersToIgnore ) ) ;
320
+
321
+ // Then
322
+ result . IsIssuesFoundException ( "Found 1 issue." ) ;
323
+ }
324
+
325
+ [ Theory ]
326
+ [ InlineData ( IssuePriority . Error ) ]
327
+ public void Should_Not_Throw_If_No_Issue_Of_Relevant_Priority ( IssuePriority priority )
328
+ {
329
+ // Given
330
+ IEnumerable < IIssue > issues = [
331
+ IssueBuilder
332
+ . NewIssue ( "Message Foo" , "ProviderType Foo" , "ProviderName Foo" )
333
+ . WithPriority ( IssuePriority . Warning )
334
+ . Create ( ) ] ;
335
+ var minimumPriority = priority ;
336
+ IList < string > issueProvidersToConsider = [ ] ;
337
+ IList < string > issueProvidersToIgnore = [ ] ;
338
+
339
+ // When
340
+ BuildBreaker . BreakBuildOnIssues (
341
+ issues ,
342
+ minimumPriority ,
343
+ issueProvidersToConsider ,
344
+ issueProvidersToIgnore ) ;
345
+
346
+ // Then
347
+ }
348
+
349
+ [ Theory ]
350
+ [ InlineData ( "ProviderType Foo" ) ]
351
+ [ InlineData ( "ProviderType Foo,ProviderType Bar" ) ]
352
+ public void Should_Throw_If_IssueProvider_To_Consider ( string value )
353
+ {
354
+ // Given
355
+ IEnumerable < IIssue > issues = [
356
+ IssueBuilder
357
+ . NewIssue ( "Message Foo" , "ProviderType Foo" , "ProviderName Foo" )
358
+ . Create ( ) ] ;
359
+ var minimumPriority = IssuePriority . Undefined ;
360
+ IList < string > issueProvidersToConsider = value . Split ( ',' ) ;
361
+ IList < string > issueProvidersToIgnore = [ ] ;
362
+
363
+ // When
364
+ var result = Record . Exception ( ( ) => BuildBreaker . BreakBuildOnIssues (
365
+ issues ,
366
+ minimumPriority ,
367
+ issueProvidersToConsider ,
368
+ issueProvidersToIgnore ) ) ;
369
+
370
+ // Then
371
+ result . IsIssuesFoundException ( "Found 1 issue." ) ;
372
+ }
373
+
374
+ [ Theory ]
375
+ [ InlineData ( "ProviderType Bar" ) ]
376
+ public void Should_Not_Throw_If_No_Issue_Is_Not_In_List_Of_Issue_Providers_To_Consider ( string value )
377
+ {
378
+ // Given
379
+ IEnumerable < IIssue > issues = [
380
+ IssueBuilder
381
+ . NewIssue ( "Message Foo" , "ProviderType Foo" , "ProviderName Foo" )
382
+ . WithPriority ( IssuePriority . Warning )
383
+ . Create ( ) ] ;
384
+ var minimumPriority = IssuePriority . Undefined ;
385
+ IList < string > issueProvidersToConsider = value . Split ( ',' ) ;
386
+ IList < string > issueProvidersToIgnore = [ ] ;
387
+
388
+ // When
389
+ BuildBreaker . BreakBuildOnIssues (
390
+ issues ,
391
+ minimumPriority ,
392
+ issueProvidersToConsider ,
393
+ issueProvidersToIgnore ) ;
394
+
395
+ // Then
396
+ }
397
+
398
+ [ Theory ]
399
+ [ InlineData ( "ProviderType Bar" ) ]
400
+ public void Should_Throw_If_IssueProvider_Is_Not_Ignored ( string value )
401
+ {
402
+ // Given
403
+ IEnumerable < IIssue > issues = [
404
+ IssueBuilder
405
+ . NewIssue ( "Message Foo" , "ProviderType Foo" , "ProviderName Foo" )
406
+ . Create ( ) ] ;
407
+ var minimumPriority = IssuePriority . Undefined ;
408
+ IList < string > issueProvidersToConsider = [ ] ;
409
+ IList < string > issueProvidersToIgnore = value . Split ( ',' ) ;
410
+
411
+ // When
412
+ var result = Record . Exception ( ( ) => BuildBreaker . BreakBuildOnIssues (
413
+ issues ,
414
+ minimumPriority ,
415
+ issueProvidersToConsider ,
416
+ issueProvidersToIgnore ) ) ;
417
+
418
+ // Then
419
+ result . IsIssuesFoundException ( "Found 1 issue." ) ;
420
+ }
421
+
422
+ [ Theory ]
423
+ [ InlineData ( "ProviderType Foo" ) ]
424
+ [ InlineData ( "ProviderType Foo,ProviderType Bar" ) ]
425
+ public void Should_Not_Throw_If_IssueProvider_Is_Ignored ( string value )
426
+ {
427
+ // Given
428
+ IEnumerable < IIssue > issues = [
429
+ IssueBuilder
430
+ . NewIssue ( "Message Foo" , "ProviderType Foo" , "ProviderName Foo" )
431
+ . WithPriority ( IssuePriority . Warning )
432
+ . Create ( ) ] ;
433
+ var minimumPriority = IssuePriority . Undefined ;
434
+ IList < string > issueProvidersToConsider = [ ] ;
435
+ IList < string > issueProvidersToIgnore = value . Split ( ',' ) ;
436
+
437
+ // When
438
+ BuildBreaker . BreakBuildOnIssues (
439
+ issues ,
440
+ minimumPriority ,
441
+ issueProvidersToConsider ,
442
+ issueProvidersToIgnore ) ;
443
+
444
+ // Then
445
+ }
446
+
447
+ [ Fact ]
448
+ public void Should_Not_Throw_If_IssueProvider_Is_To_Consider_And_Ignored ( )
449
+ {
450
+ // Given
451
+ IEnumerable < IIssue > issues = [
452
+ IssueBuilder
453
+ . NewIssue ( "Message Foo" , "ProviderType Foo" , "ProviderName Foo" )
454
+ . Create ( ) ] ;
455
+ var minimumPriority = IssuePriority . Undefined ;
456
+ IList < string > issueProvidersToConsider = [ "ProviderType Foo" ] ;
457
+ IList < string > issueProvidersToIgnore = [ "ProviderType Foo" ] ;
458
+
459
+ // When
460
+ BuildBreaker . BreakBuildOnIssues (
461
+ issues ,
462
+ minimumPriority ,
463
+ issueProvidersToConsider ,
464
+ issueProvidersToIgnore ) ;
465
+
466
+ // Then
467
+ }
468
+
469
+ [ Fact ]
470
+ public void Should_Not_Throw_If_Priority_Matches_But_IssueProvider_Is_Ignored ( )
471
+ {
472
+ // Given
473
+ IEnumerable < IIssue > issues = [
474
+ IssueBuilder
475
+ . NewIssue ( "Message Foo" , "ProviderType Foo" , "ProviderName Foo" )
476
+ . WithPriority ( IssuePriority . Warning )
477
+ . Create ( ) ] ;
478
+ var minimumPriority = IssuePriority . Warning ;
479
+ IList < string > issueProvidersToConsider = [ ] ;
480
+ IList < string > issueProvidersToIgnore = [ "ProviderType Foo" ] ;
481
+
482
+ // When
483
+ BuildBreaker . BreakBuildOnIssues (
484
+ issues ,
485
+ minimumPriority ,
486
+ issueProvidersToConsider ,
487
+ issueProvidersToIgnore ) ;
488
+
489
+ // Then
490
+ }
491
+ }
492
+
205
493
public sealed class TheBreakBuildOnIssuesMethodWithPredicateParameter
206
494
{
207
495
[ Fact ]
0 commit comments