Not sure if this should be considered a bug but Assert.Equal compares IEnumerable<T> and IReadOnlyDictionary<TKey, TValue> correctly, so one could assume ILookup<TKey, TValue> are covered too.
It is not the case, Assert.Equal sees lookups as collections of IGrouping<TKey, TElement> which implements IEnumerable<TElement> and therefore only compares values regardless of keys.
I don't think the IReadOnlyDictionary<TKey, TValue> case is explicitly covered, but comparing collections of KeyValuePair<TKey, TValue> compares both the key and the value which is not the case with IGrouping<TKey, TElement>.
As an example:
ILookup<bool, int> evens =
Enumerable.Range(0, 10).ToLookup(
i => ((i % 2) == 0),
i => i);
ILookup<bool, int> odds =
Enumerable.Range(0, 10).ToLookup(
i => ((i % 2) == 1),
i => i);
Assert.Equal(evens, odds);
succeeds because both lookups have the same values but the keys associated to these values are different.
Not sure if this should be considered a bug but
Assert.EqualcomparesIEnumerable<T>andIReadOnlyDictionary<TKey, TValue>correctly, so one could assumeILookup<TKey, TValue>are covered too.It is not the case,
Assert.Equalsees lookups as collections ofIGrouping<TKey, TElement>which implementsIEnumerable<TElement>and therefore only compares values regardless of keys.I don't think the
IReadOnlyDictionary<TKey, TValue>case is explicitly covered, but comparing collections ofKeyValuePair<TKey, TValue>compares both the key and the value which is not the case withIGrouping<TKey, TElement>.As an example:
succeeds because both lookups have the same values but the keys associated to these values are different.