@@ -14,6 +14,10 @@ This is a generated file, please edit src\FluentAssertions.Analyzers.FluentAsser
1414- [ AssertNotZero] ( #scenario-assertnotzero ) - ` number.Should().NotBe(0); `
1515- [ CollectionAssertAreEqual] ( #scenario-collectionassertareequal ) - ` collection.Should().Equal(expected); `
1616- [ CollectionAssertAreNotEqual] ( #scenario-collectionassertarenotequal ) - ` collection.Should().NotEqual(expected); `
17+ - [ CollectionAssertContains] ( #scenario-collectionassertcontains ) - ` collection.Should().Contain(2); `
18+ - [ CollectionAssertContains_WithCasting] ( #scenario-collectionassertcontains_withcasting ) - ` collection.Should().Contain((int)item); `
19+ - [ CollectionAssertDoesNotContain] ( #scenario-collectionassertdoesnotcontain ) - ` collection.Should().NotContain(4); `
20+ - [ CollectionAssertDoesNotContain_WithCasting] ( #scenario-collectionassertdoesnotcontain_withcasting ) - ` collection.Should().NotContain((int)item); `
1721
1822
1923## Scenarios
@@ -389,4 +393,120 @@ CollectionAssert.AreNotEqual(expected, collection); /* fail message: Assert.Th
389393collection .Should ().NotEqual (expected ); /* fail message: Did not expect collections {1, 2, 3} and {1, 2, 3} to be equal. */
390394```
391395
396+ ### scenario: CollectionAssertContains
397+
398+ ``` cs
399+ // arrange
400+ var collection = new [] { 1 , 2 , 3 };
401+
402+ // old assertion:
403+ CollectionAssert .Contains (collection , 2 );
404+
405+ // new assertion:
406+ collection .Should ().Contain (2 );
407+ ```
408+
409+ #### Failure messages
410+
411+ ``` cs
412+ var collection = new [] { 1 , 2 , 3 };
413+
414+ // old assertion:
415+ CollectionAssert .Contains (collection , 4 ); /* fail message: Assert.That(collection, Has.Member(actual))
416+ Expected: some item equal to 4
417+ But was: < 1, 2, 3 >
418+ */
419+
420+ // new assertion:
421+ collection .Should ().Contain (4 ); /* fail message: Expected collection {1, 2, 3} to contain 4. */
422+ ```
423+
424+ ### scenario: CollectionAssertContains_WithCasting
425+
426+ ``` cs
427+ // arrange
428+ var collection = new [] { 1 , 2 , 3 };
429+ object item = 2 ;
430+
431+ // old assertion:
432+ CollectionAssert .Contains (collection , item );
433+
434+ // new assertion:
435+ collection .Should ().Contain ((int )item );
436+ ```
437+
438+ #### Failure messages
439+
440+ ``` cs
441+ var collection = new [] { 1 , 2 , 3 };
442+ object item = 4 ;
443+
444+ // old assertion:
445+ CollectionAssert .Contains (collection , item ); /* fail message: Assert.That(collection, Has.Member(actual))
446+ Expected: some item equal to 4
447+ But was: < 1, 2, 3 >
448+ */
449+
450+ // new assertion:
451+ collection .Should ().Contain ((int )item ); /* fail message: Expected collection {1, 2, 3} to contain 4. */
452+ ```
453+
454+ ### scenario: CollectionAssertDoesNotContain
455+
456+ ``` cs
457+ // arrange
458+ var collection = new [] { 1 , 2 , 3 };
459+
460+ // old assertion:
461+ CollectionAssert .DoesNotContain (collection , 4 );
462+
463+ // new assertion:
464+ collection .Should ().NotContain (4 );
465+ ```
466+
467+ #### Failure messages
468+
469+ ``` cs
470+ var collection = new [] { 1 , 2 , 3 };
471+
472+ // old assertion:
473+ CollectionAssert .DoesNotContain (collection , 2 ); /* fail message: Assert.That(collection, Has.No.Member(actual))
474+ Expected: not some item equal to 2
475+ But was: < 1, 2, 3 >
476+ */
477+
478+ // new assertion:
479+ collection .Should ().NotContain (2 ); /* fail message: Expected collection {1, 2, 3} to not contain 2. */
480+ ```
481+
482+ ### scenario: CollectionAssertDoesNotContain_WithCasting
483+
484+ ``` cs
485+ // arrange
486+ var collection = new [] { 1 , 2 , 3 };
487+ object item = 4 ;
488+
489+ // old assertion:
490+ CollectionAssert .DoesNotContain (collection , item );
491+
492+ // new assertion:
493+ collection .Should ().NotContain ((int )item );
494+ ```
495+
496+ #### Failure messages
497+
498+ ``` cs
499+ var collection = new [] { 1 , 2 , 3 };
500+ object item = 2 ;
501+
502+ // old assertion:
503+ CollectionAssert .DoesNotContain (collection , item ); /* fail message: Assert.That(collection, Has.No.Member(actual))
504+ Expected: not some item equal to 2
505+ But was: < 1, 2, 3 >
506+ */
507+
508+ // new assertion:
509+ collection .Should ().NotContain ((int )item ); /* fail message: Expected collection {1, 2, 3} to not contain 2. */
510+ ```
511+
392512
0 commit comments