예제 #1
0
        public void HashSet_Generic_CopyTo_NegativeCount_ThrowsArgumentOutOfRangeException(int count)
        {
            PooledSet <T> set = (PooledSet <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));
        }
예제 #2
0
        public void HashSet_Generic_CopyTo_NoIndexDefaultsToZero(int count)
        {
            PooledSet <T> set = (PooledSet <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));
        }
예제 #3
0
        public void HashSet_Generic_RemoveWhere_NewObject(int setLength) // Regression Dev10_624201
        {
            object[]           array = new object[2];
            object             obj   = new object();
            PooledSet <object> set   = new PooledSet <object>();

            RegisterForDispose(set);

            set.Add(obj);
            set.Remove(obj);
            foreach (object o in set)
            {
            }
            set.CopyTo(array, 0, 2);
            set.RemoveWhere((element) => { return(false); });
        }