public void CopyToWithIndexGreaterThanArrayLengthThrowsException()
        {
            var deque = new Deque <Int32>(new[] { 1, 2, 3 });
            var array = new Int32[1];

            Assert.Throws <ArgumentOutOfRangeException>(() => deque.CopyTo(array, 2));
            Assert.True(array.AllDefault());
        }
        public void CopyToWithNegativeIndexThrowsException()
        {
            var deque = new Deque <Int32>(new[] { 1, 2, 3 });
            var array = new Int32[1];

            Assert.Throws <ArgumentOutOfRangeException>(() => deque.CopyTo(array, -1));
            Assert.True(array.AllDefault());
        }
Beispiel #3
0
        public void CopyToWithIndexEqualToArrayLengthThrowsException()
        {
            ICollection deque = new Deque <Int32>(new[] { 1, 2, 3 });
            var         array = new Int32[1];

            Assert.Throws <ArgumentOutOfRangeException>(() => deque.CopyTo(array, 1));
            Assert.True(array.AllDefault());
        }
Beispiel #4
0
        public void CopyToWithArrayOfWrongTypeThrowsException()
        {
            ICollection deque = new Deque <Int32>(new[] { 1, 2, 3 });
            var         array = new Int32[3][];

            var ex = Assert.Throws <ArgumentException>(() => deque.CopyTo(array, 0));

            Assert.That(ex.Message, Contains.Substring("array type"));

            Assert.True(array.AllDefault());
        }
Beispiel #5
0
        public void CopyToWithMultiDimensionalArrayThrowsException()
        {
            ICollection deque = new Deque <Int32>(new[] { 1, 2, 3 });
            var         array = new Int32[2, 2];

            var ex = Assert.Throws <ArgumentException>(() => deque.CopyTo(array, 0));

            Assert.That(ex.Message, Contains.Substring("dimension"));

            Assert.True(array.AllDefault <Int32>());
        }
        public void CopyToThrowsExceptionIfArrayIsNotLongEnough()
        {
            var deque  = new Deque <Int32>(new[] { 1, 2, 3 });
            var array1 = new Int32[2];
            var array2 = new Int32[3];

            Assert.Throws <ArgumentException>(() => deque.CopyTo(array1, 0));
            Assert.Throws <ArgumentException>(() => deque.CopyTo(array2, 1));

            Assert.True(array1.AllDefault());
            Assert.True(array2.AllDefault());
        }