public void PooledInsert_String()
        {
            var list = new PooledList <string>();

            for (int j = 0; j < N; ++j)
            {
                list.Insert(0, stringToAdd);          // Insert at the begining of the list
                list.Insert(j / 2, stringToAdd);      // Insert in the middle of the list
                list.Insert(list.Count, stringToAdd); // Insert at the end of the list
            }
            list.Dispose();
        }
        public void PooledInsert_Int()
        {
            var list = new PooledList <int>();

            for (int j = 0; j < N; ++j)
            {
                list.Insert(0, j);          // Insert at the begining of the list
                list.Insert(j / 2, j);      // Insert in the middle of the list
                list.Insert(list.Count, j); // Insert at the end of the list
            }
            list.Dispose();
        }
            public void BasicInsert(T[] items, T item, int index, int repeat)
            {
                using (var list = new PooledList <T>(items))
                {
                    for (int i = 0; i < repeat; i++)
                    {
                        list.Insert(index, item);
                    }

                    Assert.True(list.Contains(item));                //"Expect it to contain the item."
                    Assert.Equal(list.Count, items.Length + repeat); //"Expect to be the same."

                    for (int i = 0; i < index; i++)
                    {
                        Assert.Equal(list[i], items[i]); //"Expect to be the same."
                    }

                    for (int i = index; i < index + repeat; i++)
                    {
                        Assert.Equal(list[i], item); //"Expect to be the same."
                    }


                    for (int i = index + repeat; i < list.Count; i++)
                    {
                        Assert.Equal(list[i], items[i - repeat]); //"Expect to be the same."
                    }
                }
            }
 public void InsertValidations(T[] items)
 {
     using (var list = new PooledList <T>(items))
     {
         int[] bad = new int[] { items.Length + 1, items.Length + 2, int.MaxValue, -1, -2, int.MinValue };
         for (int i = 0; i < bad.Length; i++)
         {
             Assert.Throws <ArgumentOutOfRangeException>(() => list.Insert(bad[i], items[0])); //"ArgumentOutOfRangeException expected."
         }
     }
 }