@@ -635,6 +635,9 @@ var collection = new[] { 1, 2, 3 };
635
635
636
636
// old assertion:
637
637
CollectionAssert .Contains (collection , 2 );
638
+ Assert .That (collection , Has .Member (2 ));
639
+ Assert .That (collection , Does .Contain (2 ));
640
+ Assert .That (collection , Contains .Item (2 ));
638
641
639
642
// new assertion:
640
643
collection .Should ().Contain (2 );
@@ -650,6 +653,14 @@ CollectionAssert.Contains(collection, 4); /* fail message: Assert.That(collect
650
653
Expected: some item equal to 4
651
654
But was: < 1, 2, 3 >
652
655
*/
656
+ Assert .That (collection , Has .Member (4 )); /* fail message: Assert.That(collection, Has.Member(4))
657
+ Expected: some item equal to 4
658
+ But was: < 1, 2, 3 >
659
+ */
660
+ Assert .That (collection , Does .Contain (4 )); /* fail message: Assert.That(collection, Does.Contain(4))
661
+ Expected: some item equal to 4
662
+ But was: < 1, 2, 3 >
663
+ */
653
664
654
665
// new assertion:
655
666
collection .Should ().Contain (4 ); /* fail message: Expected collection {1, 2, 3} to contain 4. */
@@ -664,6 +675,8 @@ object item = 2;
664
675
665
676
// old assertion:
666
677
CollectionAssert .Contains (collection , item );
678
+ Assert .That (collection , Has .Member (item ));
679
+ Assert .That (collection , Does .Contain (item ));
667
680
668
681
// new assertion:
669
682
collection .Should ().Contain ((int )item );
@@ -676,10 +689,22 @@ var collection = new[] { 1, 2, 3 };
676
689
object item = 4 ;
677
690
678
691
// old assertion:
692
+ Assert .That (collection , Contains .Item (item )); /* fail message: Assert.That(collection, Contains.Item(item))
693
+ Expected: some item equal to 4
694
+ But was: < 1, 2, 3 >
695
+ */
679
696
CollectionAssert .Contains (collection , item ); /* fail message: Assert.That(collection, Has.Member(actual))
680
697
Expected: some item equal to 4
681
698
But was: < 1, 2, 3 >
682
699
*/
700
+ Assert .That (collection , Has .Member (item )); /* fail message: Assert.That(collection, Has.Member(item))
701
+ Expected: some item equal to 4
702
+ But was: < 1, 2, 3 >
703
+ */
704
+ Assert .That (collection , Does .Contain (item )); /* fail message: Assert.That(collection, Does.Contain(item))
705
+ Expected: some item equal to 4
706
+ But was: < 1, 2, 3 >
707
+ */
683
708
684
709
// new assertion:
685
710
collection .Should ().Contain ((int )item ); /* fail message: Expected collection {1, 2, 3} to contain 4. */
@@ -693,6 +718,8 @@ var collection = new[] { 1, 2, 3 };
693
718
694
719
// old assertion:
695
720
CollectionAssert .DoesNotContain (collection , 4 );
721
+ Assert .That (collection , Has .No .Member (4 ));
722
+ Assert .That (collection , Does .Not .Contain (4 ));
696
723
697
724
// new assertion:
698
725
collection .Should ().NotContain (4 );
@@ -708,6 +735,14 @@ CollectionAssert.DoesNotContain(collection, 2); /* fail message: Assert.That(c
708
735
Expected: not some item equal to 2
709
736
But was: < 1, 2, 3 >
710
737
*/
738
+ Assert .That (collection , Has .No .Member (2 )); /* fail message: Assert.That(collection, Has.No.Member(2))
739
+ Expected: not some item equal to 2
740
+ But was: < 1, 2, 3 >
741
+ */
742
+ Assert .That (collection , Does .Not .Contain (2 )); /* fail message: Assert.That(collection, Does.Not.Contain(2))
743
+ Expected: not some item equal to 2
744
+ But was: < 1, 2, 3 >
745
+ */
711
746
712
747
// new assertion:
713
748
collection .Should ().NotContain (2 ); /* fail message: Expected collection {1, 2, 3} to not contain 2. */
@@ -722,6 +757,8 @@ object item = 4;
722
757
723
758
// old assertion:
724
759
CollectionAssert .DoesNotContain (collection , item );
760
+ Assert .That (collection , Has .No .Member (item ));
761
+ Assert .That (collection , Does .Not .Contain (item ));
725
762
726
763
// new assertion:
727
764
collection .Should ().NotContain ((int )item );
@@ -738,6 +775,14 @@ CollectionAssert.DoesNotContain(collection, item); /* fail message: Assert.Tha
738
775
Expected: not some item equal to 2
739
776
But was: < 1, 2, 3 >
740
777
*/
778
+ Assert .That (collection , Has .No .Member (item )); /* fail message: Assert.That(collection, Has.No.Member(item))
779
+ Expected: not some item equal to 2
780
+ But was: < 1, 2, 3 >
781
+ */
782
+ Assert .That (collection , Does .Not .Contain (item )); /* fail message: Assert.That(collection, Does.Not.Contain(item))
783
+ Expected: not some item equal to 2
784
+ But was: < 1, 2, 3 >
785
+ */
741
786
742
787
// new assertion:
743
788
collection .Should ().NotContain ((int )item ); /* fail message: Expected collection {1, 2, 3} to not contain 2. */
0 commit comments