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

IndexOfAny_Invalid() private method

private IndexOfAny_Invalid ( ) : void
return void
        public static void IndexOfAny_Invalid()
        {
            // AnyOf is null
            Assert.Throws<ArgumentNullException>("anyOf", () => "foo".IndexOfAny(null));
            Assert.Throws<ArgumentNullException>("anyOf", () => "foo".IndexOfAny(null, 0));
            Assert.Throws<ArgumentNullException>("anyOf", () => "foo".IndexOfAny(null, 0, 0));

            // Start index < 0
            Assert.Throws<ArgumentOutOfRangeException>("startIndex", () => "foo".IndexOfAny(new char[] { 'o' }, -1));
            Assert.Throws<ArgumentOutOfRangeException>("startIndex", () => "foo".IndexOfAny(new char[] { 'o' }, -1, 0));

            // Start index > string.Length
            Assert.Throws<ArgumentOutOfRangeException>("startIndex", () => "foo".IndexOfAny(new char[] { 'o' }, 4));
            Assert.Throws<ArgumentOutOfRangeException>("startIndex", () => "foo".IndexOfAny(new char[] { 'o' }, 4, 0));

            // Count < 0 or Count > string.Length
            Assert.Throws<ArgumentOutOfRangeException>("count", () => "foo".IndexOfAny(new char[] { 'o' }, 0, -1));
            Assert.Throws<ArgumentOutOfRangeException>("count", () => "foo".IndexOfAny(new char[] { 'o' }, 0, 4));

            // Start index + count > string.Length
            Assert.Throws<ArgumentOutOfRangeException>("count", () => "foo".IndexOfAny(new char[] { 'o' }, 3, 1));
            Assert.Throws<ArgumentOutOfRangeException>("count", () => "foo".IndexOfAny(new char[] { 'o' }, 2, 2));
        }
StringTests