public void CollectionsWithSameCountOfNulls_ShouldBeEqual() { var first = new[] { "a", null, null }; var second = new[] { null, "a", null }; Assert.IsTrue(MultiSetEqualityComparer.Equals(first, second)); }
public void ShouldUseGivenEqualityComparer() { var first = new[] { 1 }; var second = new[] { 22 }; Assert.IsTrue(MultiSetEqualityComparer.Equals(first, second, new AlwaysEqualsEqualityComparer <int>())); }
public void NullCollections_ShouldBeEqual() { var first = (string[])null; var second = (string[])null; Assert.IsTrue(MultiSetEqualityComparer.Equals(first, second)); }
public void CollectionsWithDifferentNullItemsCount_ShouldBeNotEqual() { var first = new[] { "a", null }; var second = new[] { null, "a", null }; Assert.IsFalse(MultiSetEqualityComparer.Equals(first, second)); }
public void MultisetCollectionsWithDifferentCountsOfItem_ShouldBeNotEqual() { var first = new[] { "a", "b", "b" }; var second = new[] { "a", "a", "b" }; Assert.IsFalse(MultiSetEqualityComparer.Equals(first, second)); }
public void ShouldHandleNullItems() { var first = new[] { "a", null }; var second = new[] { "a", null }; Assert.IsTrue(MultiSetEqualityComparer.Equals(first, second)); }
public void ShuffledCollectionsWithSameItems_ShouldBeEqual() { var first = new[] { "a", "b" }; var second = new[] { "b", "a" }; Assert.IsTrue(MultiSetEqualityComparer.Equals(first, second)); }
public void NotNullCollection_ShouldBeNotEqualToNullOne() { var first = new string[] { }; var second = (string[])null; Assert.IsFalse(MultiSetEqualityComparer.Equals(first, second)); }
public void EmptyCollections_ShouldBeEqual() { var first = new string[] { }; var second = new string[] { }; Assert.IsTrue(MultiSetEqualityComparer.Equals(first, second)); }
public bool Equals(CollectionByValue <T> other) { if (other is null) { return(false); } var inOrder = Options.InOrder || other.Options.InOrder; if (inOrder) { if (_collection is null) { return(other._collection is null); } if (other._collection is null) { return(false); } if (_collection.Count != other._collection.Count) { return(false); } return(_collection.SequenceEqual(other._collection, Options.EqualityComparer)); } else { return(MultiSetEqualityComparer.Equals(_collection, other._collection, Options.EqualityComparer)); } }
public bool Equals(DictionaryByValue <TKey, TValue> other) { if (other is null) { return(false); } return(MultiSetEqualityComparer.Equals( _collection, other._collection, Options.KeysEqualityComparer, Options.ValuesEqualityComparer)); }
public void NullDicts_ShouldBeEqual() { var first = (IDict)null; var second = (IDict)null; Assert.IsTrue(MultiSetEqualityComparer.Equals(first, second, default, default));