From 30959769856db6c8d2a6fdbc6ca5b2d230bce316 Mon Sep 17 00:00:00 2001 From: Ahson Khan Date: Sat, 19 Jan 2019 15:49:36 -0800 Subject: [PATCH] Update calls in Json tests from GetStringValue to GetString (dotnet/corefx#34698) Commit migrated from https://github.com/dotnet/corefx/commit/88ec3d985b4879bd77b7821f154663099e7bae29 --- src/libraries/System.Text.Json/tests/JsonTestHelper.cs | 4 ++-- .../System.Text.Json/tests/Utf8JsonReaderTests.TryGet.cs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libraries/System.Text.Json/tests/JsonTestHelper.cs b/src/libraries/System.Text.Json/tests/JsonTestHelper.cs index 7eb4b5b8f4621..c20a6aad34da0 100644 --- a/src/libraries/System.Text.Json/tests/JsonTestHelper.cs +++ b/src/libraries/System.Text.Json/tests/JsonTestHelper.cs @@ -216,7 +216,7 @@ public static byte[] ReaderLoop(int inpuDataLength, out int length, ref Utf8Json if (json.HasValueSequence) { Assert.True(json.ValueSpan == default); - if ((tokenType != JsonTokenType.String && tokenType != JsonTokenType.PropertyName) || json.GetStringValue().Length != 0) + if ((tokenType != JsonTokenType.String && tokenType != JsonTokenType.PropertyName) || json.GetString().Length != 0) { // Empty strings could still make this true, i.e. "" Assert.False(json.ValueSequence.IsEmpty); @@ -225,7 +225,7 @@ public static byte[] ReaderLoop(int inpuDataLength, out int length, ref Utf8Json else { Assert.True(json.ValueSequence.IsEmpty); - if ((tokenType != JsonTokenType.String && tokenType != JsonTokenType.PropertyName) || json.GetStringValue().Length != 0) + if ((tokenType != JsonTokenType.String && tokenType != JsonTokenType.PropertyName) || json.GetString().Length != 0) { // Empty strings could still make this true, i.e. "" Assert.False(json.ValueSpan == default); diff --git a/src/libraries/System.Text.Json/tests/Utf8JsonReaderTests.TryGet.cs b/src/libraries/System.Text.Json/tests/Utf8JsonReaderTests.TryGet.cs index a9db15a1d1377..75f298fdb15be 100644 --- a/src/libraries/System.Text.Json/tests/Utf8JsonReaderTests.TryGet.cs +++ b/src/libraries/System.Text.Json/tests/Utf8JsonReaderTests.TryGet.cs @@ -674,11 +674,11 @@ public static void TestingGetString(string jsonString) { if (json.TokenType == JsonTokenType.String) { - actualValues.Add(json.GetStringValue()); + actualValues.Add(json.GetString()); } else if (json.TokenType == JsonTokenType.PropertyName) { - actualPropertyNames.Add(json.GetStringValue()); + actualPropertyNames.Add(json.GetString()); } } @@ -721,7 +721,7 @@ public static void TestingGetStringInvalidUTF16(string jsonString) Assert.Equal(JsonTokenType.String, json.TokenType); try { - string val = json.GetStringValue(); + string val = json.GetString(); Assert.True(false, "Expected InvalidOperationException when trying to get string value for invalid UTF-16 JSON text."); } catch (InvalidOperationException) { } @@ -754,7 +754,7 @@ public static void TestingGetStringInvalidUTF8(byte[] dataUtf8) { try { - string val = json.GetStringValue(); + string val = json.GetString(); Assert.True(false, "Expected InvalidOperationException when trying to get string value for invalid UTF-8 JSON text."); } catch (InvalidOperationException ex)