Beispiel #1
0
        public void RemoveUndefinedTest(int index)
        {
            var collection = new AvoidingLargeObjectHeapCollection <int>(_getEnumerable(50000));

            Assert.False(collection.Remove(index));
            Assert.Equal(50000, collection.Count);
        }
Beispiel #2
0
        public void GettingIndexOutOfRangeExceptionTest(int index)
        {
            var collection = new AvoidingLargeObjectHeapCollection <int>(_getEnumerable(50000));

            int result;

            Assert.Throws <IndexOutOfRangeException>(() => result = collection[index]);
        }
Beispiel #3
0
        public void CopyToTest()
        {
            var collection = new AvoidingLargeObjectHeapCollection <int>(_getEnumerable(3));
            var dest       = new int[10];

            collection.CopyTo(dest, 5);

            Assert.Equal(new int[] { 0, 0, 0, 0, 0, 0, 1, 2, 0, 0 }, dest);
        }
Beispiel #4
0
        public void SetValueByIndexTest(int index)
        {
            var collection = new AvoidingLargeObjectHeapCollection <int>(_getEnumerable(50000));

            collection[index] = index * 2;

            Assert.Equal(index * 2, collection[index]);
            if (index > 0)
            {
                Assert.Equal(index - 1, collection[index - 1]);
            }
        }
Beispiel #5
0
        public void RemoveTest(int index)
        {
            var collection = new AvoidingLargeObjectHeapCollection <int>(_getEnumerable(50000));

            Assert.True(collection.Remove(index));
            Assert.Equal(49999, collection.Count);
            if (index > 0)
            {
                Assert.Equal(index - 1, collection[index - 1]);
            }
            if (index < 49999)
            {
                Assert.Equal(index + 1, collection[index]);
            }
        }
Beispiel #6
0
        public void GetValueByIndexTest(int index)
        {
            var collection = new AvoidingLargeObjectHeapCollection <int>(_getEnumerable(50000));

            Assert.Equal(index, collection[index]);
        }
Beispiel #7
0
        public void CountTest(int count)
        {
            var collection = new AvoidingLargeObjectHeapCollection <int>(_getEnumerable(count));

            Assert.Equal(count, collection.Count);
        }