public void DistinctBy_throws_ArgumentNullException() { IEnumerable <object> enumeration = new[] { "a", "b", "c" }; object action(object value) => value; Assert.Throws <ArgumentNullException>(() => IEnumerableExtensions.DistinctBy((IEnumerable <object>)null, action).Iterate()); Assert.Throws <ArgumentNullException>(() => IEnumerableExtensions.DistinctBy(enumeration, (Func <object, object>)null).Iterate()); }