System.Reflection.Tests.ConstructorInfoTests.Invoke_OneDimensionalArray_NegativeLengths_ThrowsOverflowException C# (CSharp) Method

Invoke_OneDimensionalArray_NegativeLengths_ThrowsOverflowException() private method

        public void Invoke_OneDimensionalArray_NegativeLengths_ThrowsOverflowException()
        {
            ConstructorInfo[] constructors = GetConstructors(typeof(object[]));
            int[] arraylength = new int[] { -1, -2, -99 };
            // Try to invoke Array ctors with different lengths
            foreach (int length in arraylength)
            {
                // Create big Array with  elements
                Assert.Throws<OverflowException>(() => (object[])constructors[0].Invoke(new object[] { length }));
            }
        }