public void TrimExcess_doesnt_throw() { var bigData = CreateTestData(); var smallData = CreateTestData(10); var hashSet = new ObservableHashSet <int>(bigData.Concat(smallData)); foreach (var item in bigData) { hashSet.Remove(item); } hashSet.TrimExcess(); }