Exemple #1
0
        public void HashSet_Generic_TrimExcess_AfterClearingAndAddingAllElementsBack(int setLength)
        {
            if (setLength > 0)
            {
                PooledSet <T> set = (PooledSet <T>)GenericISetFactory(setLength);
                set.TrimExcess();
                set.Clear();
                set.TrimExcess();
                Assert.Equal(0, set.Count);

                AddToCollection(set, setLength);
                set.TrimExcess();
                Assert.Equal(setLength, set.Count);
            }
        }
 /// <summary>
 /// Returns a set of ModifyEnumerable delegates that modify the enumerable passed to them.
 /// </summary>
 protected override IEnumerable <ModifyEnumerable> GetModifyEnumerables(ModifyOperation operations)
 {
     if ((operations & ModifyOperation.Clear) == ModifyOperation.Clear)
     {
         yield return((IEnumerable enumerable) =>
         {
             PooledSet <string> casted = ((PooledSet <string>)enumerable);
             if (casted.Count > 0)
             {
                 casted.Clear();
                 return true;
             }
             return false;
         });
     }
 }
Exemple #3
0
 public void IterationCleanup()
 {
     hashSet.Clear();
     pooledSet.Clear();
 }