@@ -1346,6 +1346,35 @@ public static void ImplicitCast_NullString_ReturnsDefaultSpan()
13461346 Assert . True ( span == default ) ;
13471347 }
13481348
1349+ [ Fact ]
1350+ public static void IndexOf_Char_OrdinalIgnoreCase_ThrowsArgumentOutOfRangeException ( )
1351+ {
1352+ AssertExtensions . Throws < ArgumentOutOfRangeException > ( "startIndex" , ( ) => "Hello" . IndexOf ( 'o' , - 1 , 0 , StringComparison . OrdinalIgnoreCase ) ) ;
1353+ AssertExtensions . Throws < ArgumentOutOfRangeException > ( "startIndex" , ( ) => "Hello" . IndexOf ( 'o' , 6 , 0 , StringComparison . OrdinalIgnoreCase ) ) ;
1354+ AssertExtensions . Throws < ArgumentOutOfRangeException > ( "count" , ( ) => "Hello" . IndexOf ( 'o' , 0 , - 1 , StringComparison . OrdinalIgnoreCase ) ) ;
1355+ AssertExtensions . Throws < ArgumentOutOfRangeException > ( "count" , ( ) => "Hello" . IndexOf ( 'o' , 0 , 6 , StringComparison . OrdinalIgnoreCase ) ) ;
1356+ AssertExtensions . Throws < ArgumentOutOfRangeException > ( "count" , ( ) => "Hello" . IndexOf ( 'o' , 3 , 3 , StringComparison . OrdinalIgnoreCase ) ) ;
1357+ AssertExtensions . Throws < ArgumentOutOfRangeException > ( "count" , ( ) => "Hello" . IndexOf ( 'o' , 1 , int . MaxValue , StringComparison . OrdinalIgnoreCase ) ) ;
1358+ }
1359+
1360+ [ Fact ]
1361+ public static void IndexOf_Rune_StartIndexCount_ThrowsArgumentOutOfRangeException ( )
1362+ {
1363+ AssertExtensions . Throws < ArgumentOutOfRangeException > ( "startIndex" , ( ) => "Hello" . IndexOf ( new Rune ( 'o' ) , - 1 , 0 ) ) ;
1364+ AssertExtensions . Throws < ArgumentOutOfRangeException > ( "startIndex" , ( ) => "Hello" . IndexOf ( new Rune ( 'o' ) , 6 , 0 ) ) ;
1365+ AssertExtensions . Throws < ArgumentOutOfRangeException > ( "count" , ( ) => "Hello" . IndexOf ( new Rune ( 'o' ) , 0 , - 1 ) ) ;
1366+ AssertExtensions . Throws < ArgumentOutOfRangeException > ( "count" , ( ) => "Hello" . IndexOf ( new Rune ( 'o' ) , 0 , 6 ) ) ;
1367+ AssertExtensions . Throws < ArgumentOutOfRangeException > ( "count" , ( ) => "Hello" . IndexOf ( new Rune ( 'o' ) , 3 , 3 ) ) ;
1368+ AssertExtensions . Throws < ArgumentOutOfRangeException > ( "count" , ( ) => "Hello" . IndexOf ( new Rune ( 'o' ) , 1 , int . MaxValue ) ) ;
1369+
1370+ AssertExtensions . Throws < ArgumentOutOfRangeException > ( "startIndex" , ( ) => "Hello" . IndexOf ( new Rune ( 'o' ) , - 1 , 0 , StringComparison . OrdinalIgnoreCase ) ) ;
1371+ AssertExtensions . Throws < ArgumentOutOfRangeException > ( "startIndex" , ( ) => "Hello" . IndexOf ( new Rune ( 'o' ) , 6 , 0 , StringComparison . OrdinalIgnoreCase ) ) ;
1372+ AssertExtensions . Throws < ArgumentOutOfRangeException > ( "count" , ( ) => "Hello" . IndexOf ( new Rune ( 'o' ) , 0 , - 1 , StringComparison . OrdinalIgnoreCase ) ) ;
1373+ AssertExtensions . Throws < ArgumentOutOfRangeException > ( "count" , ( ) => "Hello" . IndexOf ( new Rune ( 'o' ) , 0 , 6 , StringComparison . OrdinalIgnoreCase ) ) ;
1374+ AssertExtensions . Throws < ArgumentOutOfRangeException > ( "count" , ( ) => "Hello" . IndexOf ( new Rune ( 'o' ) , 3 , 3 , StringComparison . OrdinalIgnoreCase ) ) ;
1375+ AssertExtensions . Throws < ArgumentOutOfRangeException > ( "count" , ( ) => "Hello" . IndexOf ( new Rune ( 'o' ) , 1 , int . MaxValue , StringComparison . OrdinalIgnoreCase ) ) ;
1376+ }
1377+
13491378 public static IEnumerable < object [ ] > IndexOf_SingleLetter_StringComparison_TestData ( )
13501379 {
13511380 yield return new object [ ] { "Hello" , 'l' , 0 , int . MaxValue , StringComparison . Ordinal , null , 2 } ;
0 commit comments