Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 2055ca7

Browse files
authored
Fix 60 failures in System.Text.Encoding.Tests on ILC (#19847)
1 parent 5a778be commit 2055ca7

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/System.Text.Encoding/tests/NegativeEncodingTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static IEnumerable<object[]> Encodings_TestData()
3939
public static unsafe void GetByteCount_Invalid(Encoding encoding)
4040
{
4141
// Chars is null
42-
Assert.Throws<ArgumentNullException>(encoding is ASCIIEncoding ? "chars" : "s", () => encoding.GetByteCount((string)null));
42+
AssertExtensions.Throws<ArgumentNullException>(encoding is ASCIIEncoding ? "chars" : "s", () => encoding.GetByteCount((string)null));
4343
AssertExtensions.Throws<ArgumentNullException>("chars", () => encoding.GetByteCount((char[])null));
4444
AssertExtensions.Throws<ArgumentNullException>("chars", () => encoding.GetByteCount((char[])null, 0, 0));
4545

@@ -75,7 +75,7 @@ public static unsafe void GetBytes_Invalid(Encoding encoding)
7575
AssertExtensions.Throws<ArgumentNullException>("s", () => encoding.GetBytes((string)null));
7676
AssertExtensions.Throws<ArgumentNullException>("chars", () => encoding.GetBytes((char[])null));
7777
AssertExtensions.Throws<ArgumentNullException>("chars", () => encoding.GetBytes((char[])null, 0, 0));
78-
Assert.Throws<ArgumentNullException>(expectedStringParamName, () => encoding.GetBytes((string)null, 0, 0, new byte[1], 0));
78+
AssertExtensions.Throws<ArgumentNullException>(expectedStringParamName, () => encoding.GetBytes((string)null, 0, 0, new byte[1], 0));
7979
AssertExtensions.Throws<ArgumentNullException>("chars", () => encoding.GetBytes((char[])null, 0, 0, new byte[1], 0));
8080

8181
// Bytes is null
@@ -94,15 +94,15 @@ public static unsafe void GetBytes_Invalid(Encoding encoding)
9494

9595
// Char index + count > source.Length
9696
AssertExtensions.Throws<ArgumentOutOfRangeException>("chars", () => encoding.GetBytes(new char[1], 2, 0));
97-
Assert.Throws<ArgumentOutOfRangeException>(expectedStringParamName, () => encoding.GetBytes("a", 2, 0, new byte[1], 0));
97+
AssertExtensions.Throws<ArgumentOutOfRangeException>(expectedStringParamName, () => encoding.GetBytes("a", 2, 0, new byte[1], 0));
9898
AssertExtensions.Throws<ArgumentOutOfRangeException>("chars", () => encoding.GetBytes(new char[1], 2, 0, new byte[1], 0));
9999

100100
AssertExtensions.Throws<ArgumentOutOfRangeException>("chars", () => encoding.GetBytes(new char[1], 1, 1));
101-
Assert.Throws<ArgumentOutOfRangeException>(expectedStringParamName, () => encoding.GetBytes("a", 1, 1, new byte[1], 0));
101+
AssertExtensions.Throws<ArgumentOutOfRangeException>(expectedStringParamName, () => encoding.GetBytes("a", 1, 1, new byte[1], 0));
102102
AssertExtensions.Throws<ArgumentOutOfRangeException>("chars", () => encoding.GetBytes(new char[1], 1, 1, new byte[1], 0));
103103

104104
AssertExtensions.Throws<ArgumentOutOfRangeException>("chars", () => encoding.GetBytes(new char[1], 0, 2));
105-
Assert.Throws<ArgumentOutOfRangeException>(expectedStringParamName, () => encoding.GetBytes("a", 0, 2, new byte[1], 0));
105+
AssertExtensions.Throws<ArgumentOutOfRangeException>(expectedStringParamName, () => encoding.GetBytes("a", 0, 2, new byte[1], 0));
106106
AssertExtensions.Throws<ArgumentOutOfRangeException>("chars", () => encoding.GetBytes(new char[1], 0, 2, new byte[1], 0));
107107

108108
// Byte index < 0
@@ -287,8 +287,8 @@ public static void GetString_Invalid(Encoding encoding)
287287
AssertExtensions.Throws<ArgumentNullException>("bytes", () => encoding.GetString(null, 0, 0));
288288

289289
// Index or count < 0
290-
Assert.Throws<ArgumentOutOfRangeException>(encoding is ASCIIEncoding ? "byteIndex" : "index", () => encoding.GetString(new byte[1], -1, 0));
291-
Assert.Throws<ArgumentOutOfRangeException>(encoding is ASCIIEncoding ? "byteCount" : "count", () => encoding.GetString(new byte[1], 0, -1));
290+
AssertExtensions.Throws<ArgumentOutOfRangeException>(encoding is ASCIIEncoding ? "byteIndex" : "index", () => encoding.GetString(new byte[1], -1, 0));
291+
AssertExtensions.Throws<ArgumentOutOfRangeException>(encoding is ASCIIEncoding ? "byteCount" : "count", () => encoding.GetString(new byte[1], 0, -1));
292292

293293
// Index + count > bytes.Length
294294
AssertExtensions.Throws<ArgumentOutOfRangeException>("bytes", () => encoding.GetString(new byte[1], 2, 0));

0 commit comments

Comments
 (0)