public void Equals_returns_true_for_two_collections_which_are_equal(ListEqualityComparer <string> sut) { var collectionOne = new[] { "one", "two", "three" }; var collectionTwo = new[] { "one", "two", "three" }; Assert.That(sut.Equals(collectionOne, collectionTwo), Is.True); }
public void Equals_returns_false_for_two_collections_which_have_different_elements(ListEqualityComparer <string> sut) { var collectionOne = new[] { "one", "two", "three" }; var collectionTwo = new[] { "one", "two", "THREE" }; Assert.That(sut.Equals(collectionOne, collectionTwo), Is.False); }
public void Equals_returns_false_for_two_collections_which_are_equal_but_have_duplicates(ListEqualityComparer <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); }
public void Equals_returns_result_respecting_alternative_item_equality_comparer() { var sut = new ListEqualityComparer <string>(StringComparer.InvariantCultureIgnoreCase); var collectionOne = new[] { "one", "two", "three" }; var collectionTwo = new[] { "one", "two", "THREE" }; Assert.That(sut.Equals(collectionOne, collectionTwo), Is.True); }
public void ListEqualityComparerReturnsTrueIfFirstAndSecondAreBothNull() { var comparer = new ListEqualityComparer <int>(); IList <int> first = null; IList <int> second = null; bool result = comparer.Equals(first, second); Assert.IsTrue(result); }
public void ListEqualityComparerReturnsFalseIfSecondListIsNull() { var comparer = new ListEqualityComparer <int>(); IList <int> first = new List <int> { 1, 2, 3, 4, 5 }; IList <int> second = null; bool result = comparer.Equals(first, second); Assert.IsFalse(result); }
public void ListEqualityComparerReturnsTrueIfListsAreSameReference() { var comparer = new ListEqualityComparer <int>(); IList <int> first = new List <int> { 1, 2, 3, 4, 5 }; IList <int> second = first; bool result = comparer.Equals(first, second); Assert.IsTrue(result); }
public void ListEqualityComparerReturnsFalseIfFirstIsGreaterLengthThanSecond() { var comparer = new ListEqualityComparer <int>(); IList <int> first = new List <int> { 1, 2, 3, 4, 5 }; IList <int> second = new List <int>(); bool result = comparer.Equals(first, second); Assert.IsFalse(result); }
public void ListEqualityComparerReturnsFalseIfFirstAndSecondListElementsAreTheSameButDifferentOrder() { var comparer = new ListEqualityComparer <int>(); IList <int> first = new List <int> { 1, 2, 3, 4, 5 }; IList <int> second = new List <int> { 5, 4, 3, 2, 1 }; bool result = comparer.Equals(first, second); Assert.IsFalse(result); }
public void ListEqualityComparerReturnsFalseIfFirstAndSecondListElementsAreNotTheSame() { var comparer = new ListEqualityComparer <int>(); IList <int> first = new List <int> { 1, 2, 3, 4, 5 }; IList <int> second = new List <int> { 6, 7, 8, 9, 10 }; bool result = comparer.Equals(first, second); Assert.IsFalse(result); }
public void Equals_returns_true_comparing_equivalent_object_collections_which_are_equatable_but_not_comparable(ListEqualityComparer <Pet> sut) { var coll1 = new[] { new Pet { Name = "A" }, new Pet { Name = "B" }, new Pet { Name = "C" }, }; var coll2 = new[] { new Pet { Name = "A" }, new Pet { Name = "B" }, new Pet { Name = "C" }, }; Assert.That(sut.Equals(coll1, coll2), Is.True); }
public virtual bool Equals(object?other, IEqualityComparer comparer) => ListEqualityComparer <T> .Equals(Items, other, comparer);
public void Equals_returns_true_when_both_collecions_are_null(ListEqualityComparer <string> sut) { Assert.That(sut.Equals(null, null), Is.True); }
public void Equals_returns_false_when_first_collecion_is_null(ListEqualityComparer <string> sut) { var collectionTwo = new[] { "one", "two", "three" }; Assert.That(sut.Equals(null, collectionTwo), Is.False); }
public void Equals_returns_false_when_second_collecion_is_null(ListEqualityComparer <string> sut) { var collectionOne = new[] { "one", "two", "three" }; Assert.That(sut.Equals(collectionOne, null), Is.False); }
public void Equals_returns_true_for_reference_equal_collections(ListEqualityComparer <string> sut) { var collectionOne = new[] { "one", "two", "three" }; Assert.That(sut.Equals(collectionOne, collectionOne), Is.True); }
public override bool Equals(object obj) { MD5Checksum other = obj as MD5Checksum; return(other != null && ListEqualityComparer <byte> .Equals(this.Bytes, other.Bytes)); }
public bool Equals(object other, IEqualityComparer comparer) { return(ListEqualityComparer <T> .Equals(this, other, comparer)); }