public void OfNullCollection_ShouldHaveZeroHashCode() { var firstCollection = (string[])null; var firstByValue = new CollectionByValue <string>(firstCollection, StrictOptions); Assert.AreEqual(0, firstByValue.GetHashCode()); }
public void OfSameCountCollectionsWithSameFirstItem_ShouldHaveSameHashCode() { var firstCollection = new[] { "1" }; var secondCollection = new[] { "1" }; var firstByValue = new CollectionByValue <string>(firstCollection, StrictOptions); var secondByValue = new CollectionByValue <string>(secondCollection, StrictOptions); Assert.AreEqual(firstByValue.GetHashCode(), secondByValue.GetHashCode()); }
public void OfCollectionWithNotComparableItems_ShouldNotThrowWhenGetHashCode([Values] bool strictOrdering) { var collection = new[] { new NotComparableClass(), new NotComparableClass() }; var byValue = new CollectionByValue <NotComparableClass>( collection, new Options <NotComparableClass>(strictOrdering, null)); Assert.DoesNotThrow(() => byValue.GetHashCode()); }