public void InsertRangeValidations(T[] items, Func <T[], IEnumerable <T> > constructIEnumerable)
            {
                using (var list = new PooledList <T>(constructIEnumerable(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.InsertRange(bad[i], constructIEnumerable(items))); //"ArgumentOutOfRangeException expected"
                    }

                    Assert.Throws <ArgumentNullException>(() => list.InsertRange(0, null)); //"ArgumentNullException expected."
                }
            }
            public void InsertRangeIEnumerable(T[] itemsX, T[] itemsY, int index, int repeat, Func <T[], IEnumerable <T> > constructIEnumerable)
            {
                PooledList <T> list = new PooledList <T>(constructIEnumerable(itemsX));

                for (int i = 0; i < repeat; i++)
                {
                    list.InsertRange(index, constructIEnumerable(itemsY));
                }

                foreach (T item in itemsY)
                {
                    Assert.True(list.Contains(item));                               //"Should contain the item."
                }
                Assert.Equal(list.Count, itemsX.Length + (itemsY.Length * repeat)); //"Should have the same result."

                for (int i = 0; i < index; i++)
                {
                    Assert.Equal(list[i], itemsX[i]); //"Should have the same result."
                }

                for (int i = index; i < index + (itemsY.Length * repeat); i++)
                {
                    Assert.Equal(list[i], itemsY[(i - index) % itemsY.Length]); //"Should have the same result."
                }

                for (int i = index + (itemsY.Length * repeat); i < list.Count; i++)
                {
                    Assert.Equal(list[i], itemsX[i - (itemsY.Length * repeat)]); //"Should have the same result."
                }

                //InsertRange into itself
                list.Dispose();
                list = new PooledList <T>(constructIEnumerable(itemsX));
                list.InsertRange(index, list);

                foreach (T item in itemsX)
                {
                    Assert.True(list.Contains(item));                    //"Should contain the item."
                }
                Assert.Equal(list.Count, itemsX.Length + itemsX.Length); //"Should have the same result."

                for (int i = 0; i < index; i++)
                {
                    Assert.Equal(list[i], itemsX[i]); //"Should have the same result."
                }

                for (int i = index; i < index + itemsX.Length; i++)
                {
                    Assert.Equal(list[i], itemsX[(i - index) % itemsX.Length]); //"Should have the same result."
                }

                for (int i = index + (itemsX.Length); i < list.Count; i++)
                {
                    Assert.Equal(list[i], itemsX[i - (itemsX.Length)]); //"Should have the same result."
                }

                list.Dispose();
            }