System.Tests.StringTests.Item_Get_InvalidIndex_ThrowsIndexOutOfRangeException C# (CSharp) Method

Item_Get_InvalidIndex_ThrowsIndexOutOfRangeException() private method

        public static void Item_Get_InvalidIndex_ThrowsIndexOutOfRangeException()
        {
            Assert.Throws<IndexOutOfRangeException>(() => "Hello"[-1]); // Index < 0
            Assert.Throws<IndexOutOfRangeException>(() => "Hello"[5]); // Index >= string.Length
            Assert.Throws<IndexOutOfRangeException>(() => ""[0]); // Index >= string.Length
        }
StringTests