Ejemplo n.º 1
0
        public void Equals_returns_false_for_two_collections_which_are_equal_but_have_duplicates(BagEqualityComparer <string> sut)
        {
            var collectionOne = new[] { "one", "two", "two", "three", "two" };
            var collectionTwo = new[] { "one", "three", "one", "two" };

            Assert.That(sut.Equals(collectionOne, collectionTwo), Is.False);
        }
Ejemplo n.º 2
0
        public void Equals_returns_false_for_two_collections_which_have_different_elements(BagEqualityComparer <string> sut)
        {
            var collectionOne = new[] { "one", "two", "three" };
            var collectionTwo = new[] { "one", "two", "THREE" };

            Assert.That(sut.Equals(collectionOne, collectionTwo), Is.False);
        }
Ejemplo n.º 3
0
        public void Equals_returns_true_for_two_collections_which_are_equal_but_ordered_differently(BagEqualityComparer <string> sut)
        {
            var collectionOne = new[] { "one", "two", "three" };
            var collectionTwo = new[] { "one", "three", "two" };

            Assert.That(sut.Equals(collectionOne, collectionTwo), Is.True);
        }
Ejemplo n.º 4
0
        public void Equals_returns_result_respecting_alternative_item_equality_comparer()
        {
            var sut = new BagEqualityComparer <string>(StringComparer.InvariantCultureIgnoreCase, StringComparer.InvariantCultureIgnoreCase);

            var collectionOne = new[] { "one", "two", "three" };
            var collectionTwo = new[] { "one", "two", "THREE" };

            Assert.That(sut.Equals(collectionOne, collectionTwo), Is.True);
        }
Ejemplo n.º 5
0
        public void Equals_returns_true_comparing_equivalent_object_collections_which_are_equatable_but_not_comparable(BagEqualityComparer <Pet> sut)
        {
            var coll1 = new[] { new Pet {
                                    Name = "A"
                                }, new Pet {
                                    Name = "B"
                                }, new Pet {
                                    Name = "C"
                                }, };
            var coll2 = new[] { new Pet {
                                    Name = "B"
                                }, new Pet {
                                    Name = "C"
                                }, new Pet {
                                    Name = "A"
                                }, };

            Assert.That(sut.Equals(coll1, coll2), Is.True);
        }
Ejemplo n.º 6
0
 public void Equals_returns_true_when_both_collecions_are_null(BagEqualityComparer <string> sut)
 {
     Assert.That(sut.Equals(null, null), Is.True);
 }
Ejemplo n.º 7
0
        public void Equals_returns_false_when_first_collecion_is_null(BagEqualityComparer <string> sut)
        {
            var collectionTwo = new[] { "one", "two", "three" };

            Assert.That(sut.Equals(null, collectionTwo), Is.False);
        }
Ejemplo n.º 8
0
        public void Equals_returns_false_when_second_collecion_is_null(BagEqualityComparer <string> sut)
        {
            var collectionOne = new[] { "one", "two", "three" };

            Assert.That(sut.Equals(collectionOne, null), Is.False);
        }
Ejemplo n.º 9
0
        public void Equals_returns_true_for_reference_equal_collections(BagEqualityComparer <string> sut)
        {
            var collectionOne = new[] { "one", "two", "three" };

            Assert.That(sut.Equals(collectionOne, collectionOne), Is.True);
        }