public void ToHashSet_NullSelector_Exception() { IEnumerable <DerivedType> a = new DerivedType[0]; Func <DerivedType, int> selector = null; Assert.That(() => a.ToHashSet(selector), Throws.InstanceOf <ArgumentNullException>()); }