public void HashSet_Generic_CopyTo_NegativeCount_ThrowsArgumentOutOfRangeException(int count) { SegmentedHashSet <T> set = (SegmentedHashSet <T>)GenericISetFactory(count); T[] arr = new T[count]; Assert.Throws <ArgumentOutOfRangeException>(() => set.CopyTo(arr, 0, -1)); Assert.Throws <ArgumentOutOfRangeException>(() => set.CopyTo(arr, 0, int.MinValue)); }
public void HashSet_Generic_CopyTo_NoIndexDefaultsToZero(int count) { SegmentedHashSet <T> set = (SegmentedHashSet <T>)GenericISetFactory(count); T[] arr1 = new T[count]; T[] arr2 = new T[count]; set.CopyTo(arr1); set.CopyTo(arr2, 0); Assert.True(arr1.SequenceEqual(arr2)); }
public void HashSet_Generic_RemoveWhere_NewObject() // Regression Dev10_624201 { object[] array = new object[2]; object obj = new(); SegmentedHashSet <object> set = new SegmentedHashSet <object>(); set.Add(obj); set.Remove(obj); foreach (object o in set) { } set.CopyTo(array, 0, 2); set.RemoveWhere((element) => { return(false); }); }