示例#1
0
        public void Reverse_RepeatedValues(int listLength, int index, int count)
        {
            PooledList <T> list = GenericListFactory(1);

            for (int i = 1; i < listLength; i++)
            {
                list.Add(list[0]);
            }
            PooledList <T> listBefore = list.ToPooledList();

            list.Reverse(index, count);

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

            int j = 0;

            for (int i = index; i < index + count; i++)
            {
                Assert.Equal(list[i], listBefore[index + count - (j + 1)]); //"Expect them to be the same."
                j++;
            }

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

            list.Dispose();
            listBefore.Dispose();
        }
示例#2
0
        public void Reverse(int listLength)
        {
            PooledList <T> list       = GenericListFactory(listLength);
            PooledList <T> listBefore = list.ToPooledList();

            list.Reverse();

            for (int i = 0; i < listBefore.Count; i++)
            {
                Assert.Equal(list[i], listBefore[listBefore.Count - (i + 1)]); //"Expect them to be the same."
            }

            list.Dispose();
            listBefore.Dispose();
        }