diff --git a/Microsoft.Azure.Cosmos/src/Json/IJsonBinaryWriterExtensions.cs b/Microsoft.Azure.Cosmos/src/Json/IJsonBinaryWriterExtensions.cs index 877cc90e08..50a0477ea1 100644 --- a/Microsoft.Azure.Cosmos/src/Json/IJsonBinaryWriterExtensions.cs +++ b/Microsoft.Azure.Cosmos/src/Json/IJsonBinaryWriterExtensions.cs @@ -13,6 +13,6 @@ void WriteRawJsonValue( int valueOffset, JsonBinaryEncoding.UniformArrayInfo externalArrayInfo, bool isFieldName, - IJsonReadOnlyStringDictionary jsonStringDictionary = null); + IJsonStringDictionary jsonStringDictionary = null); } } diff --git a/Microsoft.Azure.Cosmos/src/Json/IJsonReadOnlyStringDictionary.cs b/Microsoft.Azure.Cosmos/src/Json/IJsonStringDictionary.cs similarity index 88% rename from Microsoft.Azure.Cosmos/src/Json/IJsonReadOnlyStringDictionary.cs rename to Microsoft.Azure.Cosmos/src/Json/IJsonStringDictionary.cs index 938b106238..c9afc8df97 100644 --- a/Microsoft.Azure.Cosmos/src/Json/IJsonReadOnlyStringDictionary.cs +++ b/Microsoft.Azure.Cosmos/src/Json/IJsonStringDictionary.cs @@ -13,7 +13,7 @@ namespace Microsoft.Azure.Cosmos.Json #else internal #endif - interface IJsonReadOnlyStringDictionary : IEquatable + interface IJsonStringDictionary : IEquatable { bool TryGetString(int stringId, out UtfAllString value); diff --git a/Microsoft.Azure.Cosmos/src/Json/JsonBinaryEncoding.Strings.cs b/Microsoft.Azure.Cosmos/src/Json/JsonBinaryEncoding.Strings.cs index 51c00e673e..108f93e3c1 100644 --- a/Microsoft.Azure.Cosmos/src/Json/JsonBinaryEncoding.Strings.cs +++ b/Microsoft.Azure.Cosmos/src/Json/JsonBinaryEncoding.Strings.cs @@ -175,7 +175,7 @@ internal static partial class JsonBinaryEncoding public static string GetStringValue( ReadOnlyMemory buffer, ReadOnlyMemory stringToken, - IJsonReadOnlyStringDictionary jsonStringDictionary) + IJsonStringDictionary jsonStringDictionary) { // First retrieve the string length GetStringValue(buffer, stringToken, jsonStringDictionary, destinationBuffer: Span.Empty, out int valueLength); @@ -190,7 +190,7 @@ public static string GetStringValue( public static Utf8Span GetUtf8SpanValue( ReadOnlyMemory buffer, ReadOnlyMemory stringToken, - IJsonReadOnlyStringDictionary jsonStringDictionary) + IJsonStringDictionary jsonStringDictionary) { return Utf8Span.UnsafeFromUtf8BytesNoValidation(GetUtf8MemoryValue(buffer, stringToken, jsonStringDictionary).Span); } @@ -199,7 +199,7 @@ public static Utf8Span GetUtf8SpanValue( public static Utf8String GetUtf8StringValue( ReadOnlyMemory buffer, ReadOnlyMemory stringToken, - IJsonReadOnlyStringDictionary jsonStringDictionary) + IJsonStringDictionary jsonStringDictionary) { return Utf8String.UnsafeFromUtf8BytesNoValidation(GetUtf8MemoryValue(buffer, stringToken, jsonStringDictionary)); } @@ -207,7 +207,7 @@ public static Utf8String GetUtf8StringValue( public static bool TryGetBufferedStringValue( ReadOnlyMemory buffer, ReadOnlyMemory stringToken, - IJsonReadOnlyStringDictionary jsonStringDictionary, + IJsonStringDictionary jsonStringDictionary, out Utf8Memory value) { if (stringToken.IsEmpty) @@ -240,7 +240,7 @@ public static bool TryGetBufferedStringValue( public static bool TryGetDictionaryEncodedStringValue( ReadOnlySpan stringToken, - IJsonReadOnlyStringDictionary jsonStringDictionary, + IJsonStringDictionary jsonStringDictionary, out UtfAllString value) { return TryGetEncodedStringValue( @@ -252,7 +252,7 @@ public static bool TryGetDictionaryEncodedStringValue( private static ReadOnlyMemory GetUtf8MemoryValue( ReadOnlyMemory buffer, ReadOnlyMemory stringToken, - IJsonReadOnlyStringDictionary jsonStringDictionary) + IJsonStringDictionary jsonStringDictionary) { byte typeMarker = stringToken.Span[0]; @@ -284,7 +284,7 @@ private static ReadOnlyMemory GetUtf8MemoryValue( private static void GetStringValue( ReadOnlyMemory buffer, ReadOnlyMemory stringToken, - IJsonReadOnlyStringDictionary jsonStringDictionary, + IJsonStringDictionary jsonStringDictionary, Span destinationBuffer, out int valueLength) { @@ -336,7 +336,7 @@ private static void GetStringValue( /// Encoded String Value private static bool TryGetEncodedStringValue( ReadOnlySpan stringToken, - IJsonReadOnlyStringDictionary jsonStringDictionary, + IJsonStringDictionary jsonStringDictionary, out UtfAllString value) { if (JsonBinaryEncoding.TryGetEncodedSystemStringValue(stringToken, out value)) @@ -388,7 +388,7 @@ private static bool TryGetEncodedSystemStringValue( /// Whether or not the Encoded User String Value was found private static bool TryGetEncodedUserStringValue( ReadOnlySpan stringToken, - IJsonReadOnlyStringDictionary jsonStringDictionary, + IJsonStringDictionary jsonStringDictionary, out UtfAllString encodedUserStringValue) { if ((jsonStringDictionary == null) @@ -440,7 +440,7 @@ private static bool TryGetUserStringId(ReadOnlySpan stringToken, out int u private static bool TryGetBufferedLengthPrefixedString( ReadOnlyMemory buffer, ReadOnlyMemory stringToken, - IJsonReadOnlyStringDictionary jsonStringDictionary, + IJsonStringDictionary jsonStringDictionary, out Utf8Memory value) { ReadOnlySpan stringTokenSpan = stringToken.Span; @@ -568,7 +568,7 @@ private static bool TryGetBufferedLengthPrefixedString( /// Whether or not the type marker was found. public static bool TryGetEncodedStringTypeMarker( Utf8Span utf8Span, - IJsonReadOnlyStringDictionary jsonStringDictionary, + IJsonStringDictionary jsonStringDictionary, out MultiByteTypeMarker multiByteTypeMarker) { if (JsonBinaryEncoding.TryGetEncodedSystemStringTypeMarker(utf8Span, out multiByteTypeMarker)) @@ -617,7 +617,7 @@ private static bool TryGetEncodedSystemStringTypeMarker( /// Whether or not the Encoded User String Type Marker was found. private static bool TryGetEncodedUserStringTypeMarker( Utf8Span utf8Span, - IJsonReadOnlyStringDictionary jsonStringDictionary, + IJsonStringDictionary jsonStringDictionary, out MultiByteTypeMarker multiByteTypeMarker) { if (jsonStringDictionary == null) diff --git a/Microsoft.Azure.Cosmos/src/Json/JsonNavigator.JsonBinaryNavigator.cs b/Microsoft.Azure.Cosmos/src/Json/JsonNavigator.JsonBinaryNavigator.cs index 9f3216fcb0..db2dd59bc7 100644 --- a/Microsoft.Azure.Cosmos/src/Json/JsonNavigator.JsonBinaryNavigator.cs +++ b/Microsoft.Azure.Cosmos/src/Json/JsonNavigator.JsonBinaryNavigator.cs @@ -26,7 +26,7 @@ abstract partial class JsonNavigator : IJsonNavigator private sealed class JsonBinaryNavigator : JsonNavigator { private readonly ReadOnlyMemory rootBuffer; - private readonly IJsonReadOnlyStringDictionary jsonStringDictionary; + private readonly IJsonStringDictionary jsonStringDictionary; private readonly IJsonNavigatorNode rootNode; /// @@ -36,7 +36,7 @@ private sealed class JsonBinaryNavigator : JsonNavigator /// The JSON string dictionary. public JsonBinaryNavigator( ReadOnlyMemory buffer, - IJsonReadOnlyStringDictionary jsonStringDictionary) + IJsonStringDictionary jsonStringDictionary) { if (buffer.Length < 2) { diff --git a/Microsoft.Azure.Cosmos/src/Json/JsonNavigator.cs b/Microsoft.Azure.Cosmos/src/Json/JsonNavigator.cs index 209b74a27e..a4473c79f8 100644 --- a/Microsoft.Azure.Cosmos/src/Json/JsonNavigator.cs +++ b/Microsoft.Azure.Cosmos/src/Json/JsonNavigator.cs @@ -36,7 +36,7 @@ protected JsonNavigator() /// A concrete JsonNavigator that can navigate the supplied buffer. public static IJsonNavigator Create( ReadOnlyMemory buffer, - IJsonReadOnlyStringDictionary jsonStringDictionary = null) + IJsonStringDictionary jsonStringDictionary = null) { if (buffer.IsEmpty) { diff --git a/Microsoft.Azure.Cosmos/src/Json/JsonReader.JsonBinaryReader.cs b/Microsoft.Azure.Cosmos/src/Json/JsonReader.JsonBinaryReader.cs index bc5211f735..902a0ca7d5 100644 --- a/Microsoft.Azure.Cosmos/src/Json/JsonReader.JsonBinaryReader.cs +++ b/Microsoft.Azure.Cosmos/src/Json/JsonReader.JsonBinaryReader.cs @@ -175,7 +175,7 @@ private sealed class JsonBinaryReader : JsonReader, ITypedJsonReader /// /// Dictionary used for user string encoding. /// - private readonly IJsonReadOnlyStringDictionary jsonStringDictionary; + private readonly IJsonStringDictionary jsonStringDictionary; /// /// For binary there is no end of token marker in the actual binary, but the JsonReader interface still needs to surface ObjectEndToken and ArrayEndToken. @@ -191,7 +191,7 @@ private sealed class JsonBinaryReader : JsonReader, ITypedJsonReader public JsonBinaryReader( ReadOnlyMemory buffer, - IJsonReadOnlyStringDictionary jsonStringDictionary = null) + IJsonStringDictionary jsonStringDictionary = null) : this(buffer, indexToStartFrom: null, jsonStringDictionary: jsonStringDictionary) { } @@ -199,7 +199,7 @@ public JsonBinaryReader( internal JsonBinaryReader( ReadOnlyMemory rootBuffer, int? indexToStartFrom = null, - IJsonReadOnlyStringDictionary jsonStringDictionary = null) + IJsonStringDictionary jsonStringDictionary = null) { if (rootBuffer.IsEmpty) { diff --git a/Microsoft.Azure.Cosmos/src/Json/JsonReader.cs b/Microsoft.Azure.Cosmos/src/Json/JsonReader.cs index 7f2b9a88a4..a61554dfad 100644 --- a/Microsoft.Azure.Cosmos/src/Json/JsonReader.cs +++ b/Microsoft.Azure.Cosmos/src/Json/JsonReader.cs @@ -46,7 +46,7 @@ protected JsonReader() /// The byte array (with format marker) to read from. /// The dictionary to use for user string encoding. /// A concrete JsonReader that can read the supplied byte array. - public static IJsonReader Create(ReadOnlyMemory buffer, IJsonReadOnlyStringDictionary jsonStringDictionary = null) + public static IJsonReader Create(ReadOnlyMemory buffer, IJsonStringDictionary jsonStringDictionary = null) { if (buffer.IsEmpty) { @@ -70,7 +70,7 @@ public static IJsonReader Create(ReadOnlyMemory buffer, IJsonReadOnlyStrin public static IJsonReader Create( JsonSerializationFormat jsonSerializationFormat, ReadOnlyMemory buffer, - IJsonReadOnlyStringDictionary jsonStringDictionary = null) + IJsonStringDictionary jsonStringDictionary = null) { if (buffer.IsEmpty) { @@ -89,7 +89,7 @@ public static IJsonReader Create( internal static IJsonReader CreateBinaryFromOffset( ReadOnlyMemory buffer, int offset, - IJsonReadOnlyStringDictionary jsonStringDictionary = null) + IJsonStringDictionary jsonStringDictionary = null) { return new JsonBinaryReader(buffer, offset, jsonStringDictionary); } diff --git a/Microsoft.Azure.Cosmos/src/Json/JsonStringDictionary.cs b/Microsoft.Azure.Cosmos/src/Json/JsonStringDictionary.cs index 403dc2dc8e..eac3e1aa20 100644 --- a/Microsoft.Azure.Cosmos/src/Json/JsonStringDictionary.cs +++ b/Microsoft.Azure.Cosmos/src/Json/JsonStringDictionary.cs @@ -18,7 +18,7 @@ namespace Microsoft.Azure.Cosmos.Json #else internal #endif - sealed class JsonStringDictionary : IJsonReadOnlyStringDictionary, IEquatable + sealed class JsonStringDictionary : IJsonStringDictionary, IEquatable { public static readonly int MaxDictionarySize = TypeMarker.UserString1ByteLengthMax - TypeMarker.UserString1ByteLengthMin + ((TypeMarker.UserString2ByteLengthMax - TypeMarker.UserString2ByteLengthMin) * 0xFF); @@ -96,7 +96,7 @@ public bool Equals(JsonStringDictionary other) return this.checksum == other.checksum; } - public bool Equals(IJsonReadOnlyStringDictionary other) + public bool Equals(IJsonStringDictionary other) { if (other == null) { diff --git a/Microsoft.Azure.Cosmos/src/Json/JsonWriter.JsonBinaryWriter.cs b/Microsoft.Azure.Cosmos/src/Json/JsonWriter.JsonBinaryWriter.cs index 18018c0f4a..77a549fb53 100644 --- a/Microsoft.Azure.Cosmos/src/Json/JsonWriter.JsonBinaryWriter.cs +++ b/Microsoft.Azure.Cosmos/src/Json/JsonWriter.JsonBinaryWriter.cs @@ -278,7 +278,7 @@ private enum RawValueType : byte /// /// The string dictionary used for user string encoding. /// - private readonly IJsonReadOnlyStringDictionary jsonStringDictionary; + private readonly IJsonStringDictionary jsonStringDictionary; private readonly List sharedStrings; @@ -302,7 +302,7 @@ public JsonBinaryWriter( bool enableNumberArrays, bool enableUint64Values, bool enableEncodedStrings = true, - IJsonReadOnlyStringDictionary jsonStringDictionary = null) + IJsonStringDictionary jsonStringDictionary = null) { this.enableNumberArrays = enableNumberArrays; this.enableUInt64Values = enableUint64Values; @@ -1615,7 +1615,7 @@ public void WriteRawJsonValue( int valueOffset, UniformArrayInfo externalArrayInfo, bool isFieldName, - IJsonReadOnlyStringDictionary jsonStringDictionary) + IJsonStringDictionary jsonStringDictionary) { this.ForceRewriteRawJsonValue(rootBuffer, valueOffset, externalArrayInfo, isFieldName, jsonStringDictionary); } @@ -1625,7 +1625,7 @@ private void ForceRewriteRawJsonValue( int valueOffset, UniformArrayInfo externalArrayInfo, bool isFieldName, - IJsonReadOnlyStringDictionary jsonStringDictionary) + IJsonStringDictionary jsonStringDictionary) { ReadOnlyMemory rawJsonValue = rootBuffer.Slice(valueOffset); byte typeMarker = rawJsonValue.Span[0]; @@ -1804,7 +1804,7 @@ private void ForceRewriteRawJsonValue( } } - private void WriteRawStringValue(RawValueType rawValueType, ReadOnlyMemory buffer, bool isFieldName, IJsonReadOnlyStringDictionary jsonStringDictionary) + private void WriteRawStringValue(RawValueType rawValueType, ReadOnlyMemory buffer, bool isFieldName, IJsonStringDictionary jsonStringDictionary) { Utf8Span rawStringValue; switch (rawValueType) diff --git a/Microsoft.Azure.Cosmos/src/Json/JsonWriter.cs b/Microsoft.Azure.Cosmos/src/Json/JsonWriter.cs index 3d97bec299..2fda753df2 100644 --- a/Microsoft.Azure.Cosmos/src/Json/JsonWriter.cs +++ b/Microsoft.Azure.Cosmos/src/Json/JsonWriter.cs @@ -55,7 +55,7 @@ public static IJsonWriter Create( JsonSerializationFormat jsonSerializationFormat, JsonWriteOptions writeOptions = JsonWriteOptions.None, int initialCapacity = 256, - IJsonReadOnlyStringDictionary jsonStringDictionary = null) + IJsonStringDictionary jsonStringDictionary = null) { return jsonSerializationFormat switch { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/JsonRoundTripBenchmarks.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/JsonRoundTripBenchmarks.cs index 3defb8e9c3..0c832b14cb 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/JsonRoundTripBenchmarks.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/JsonRoundTripBenchmarks.cs @@ -111,7 +111,7 @@ private CuratedDocsPayload( string name, ReadOnlyMemory text, ReadOnlyMemory binary, - (ReadOnlyMemory binary, IJsonReadOnlyStringDictionary dictionary) binaryWithDictionaryEncoding) + (ReadOnlyMemory binary, IJsonStringDictionary dictionary) binaryWithDictionaryEncoding) { this.Name = name; this.Text = text; @@ -122,7 +122,7 @@ private CuratedDocsPayload( public string Name { get; } public ReadOnlyMemory Text { get; } public ReadOnlyMemory Binary { get; } - internal (ReadOnlyMemory binary, IJsonReadOnlyStringDictionary dictionary) BinaryWithDictionaryEncoding { get; } + internal (ReadOnlyMemory binary, IJsonStringDictionary dictionary) BinaryWithDictionaryEncoding { get; } public static CuratedDocsPayload CreateFromCuratedDocs(string name) { @@ -139,7 +139,7 @@ public static CuratedDocsPayload CreateFromCuratedDocs(string name) ReadOnlyMemory text = Encoding.UTF8.GetBytes(json); ReadOnlyMemory binary = JsonTestUtils.ConvertTextToBinary(json); - ReadOnlyMemory dictionaryEncodedBinary = JsonTestUtils.ConvertTextToBinary(json, out IJsonReadOnlyStringDictionary jsonStringDictionary); + ReadOnlyMemory dictionaryEncodedBinary = JsonTestUtils.ConvertTextToBinary(json, out IJsonStringDictionary jsonStringDictionary); return new CuratedDocsPayload( name: name, diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/PocoDeserializerBenchmark.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/PocoDeserializerBenchmark.cs index fabd0b780a..a9981b6eb0 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/PocoDeserializerBenchmark.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Json/PocoDeserializerBenchmark.cs @@ -95,7 +95,7 @@ private readonly struct Payload private Payload( ReadOnlyMemory text, ReadOnlyMemory binary, - (ReadOnlyMemory binary, IJsonReadOnlyStringDictionary dictionary) binaryWithDictionaryEncoding) + (ReadOnlyMemory binary, IJsonStringDictionary dictionary) binaryWithDictionaryEncoding) { this.Text = text; this.Binary = binary; @@ -104,13 +104,13 @@ private Payload( public ReadOnlyMemory Text { get; } public ReadOnlyMemory Binary { get; } - public (ReadOnlyMemory binary, IJsonReadOnlyStringDictionary dictionary) BinaryWithDictionaryEncoding { get; } + public (ReadOnlyMemory binary, IJsonStringDictionary dictionary) BinaryWithDictionaryEncoding { get; } public static Payload Create(string json) { ReadOnlyMemory text = Encoding.UTF8.GetBytes(json); ReadOnlyMemory binary = JsonTestUtils.ConvertTextToBinary(json); - ReadOnlyMemory dictionaryEncodedBinary = JsonTestUtils.ConvertTextToBinary(json, out IJsonReadOnlyStringDictionary jsonStringDictionary); + ReadOnlyMemory dictionaryEncodedBinary = JsonTestUtils.ConvertTextToBinary(json, out IJsonStringDictionary jsonStringDictionary); return new Payload( text, diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonNavigatorTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonNavigatorTests.cs index 71d9160075..137670de99 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonNavigatorTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonNavigatorTests.cs @@ -518,7 +518,7 @@ private static void VerifyNavigator( IJsonNavigator binaryNavigator = JsonNavigator.Create(binaryInput); // Test binary + empty user string dictionary - IJsonReadOnlyStringDictionary jsonStringDictionary = new JsonStringDictionary(new List()); + IJsonStringDictionary jsonStringDictionary = new JsonStringDictionary(new List()); byte[] binaryWithEmptyUserStringEncodingInput = JsonTestUtils.ConvertTextToBinary(input, jsonStringDictionary); Assert.IsTrue(binaryWithEmptyUserStringEncodingInput.SequenceEqual(binaryInput), "Binary data should be the same with empty readonly JSON dictionary."); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonReaderTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonReaderTests.cs index eb45df659e..072b40c82f 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonReaderTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonReaderTests.cs @@ -2371,7 +2371,7 @@ public void SimpleObjectTest() this.VerifyReader(input, expectedTokens); this.VerifyReader(binaryInput, expectedTokens); - IJsonReadOnlyStringDictionary jsonStringDictionary = new JsonStringDictionary(new List { "GlossDiv", "title" }); + IJsonStringDictionary jsonStringDictionary = new JsonStringDictionary(new List { "GlossDiv", "title" }); this.VerifyReader(binaryInputWithEncoding, expectedTokens, jsonStringDictionary); } @@ -2570,7 +2570,7 @@ public void AllPrimitivesObjectTest() this.VerifyReader(input, expectedTokens); this.VerifyReader(binaryInput, expectedTokens); - IJsonReadOnlyStringDictionary jsonStringDictionary = new JsonStringDictionary(new List { "double", "string", "boolean", "null", "datetime", "spatialPoint", "text" }); + IJsonStringDictionary jsonStringDictionary = new JsonStringDictionary(new List { "double", "string", "boolean", "null", "datetime", "spatialPoint", "text" }); this.VerifyReader(binaryInputWithEncoding, expectedTokens, jsonStringDictionary); } @@ -3213,7 +3213,7 @@ private void VerifyReader(string input, JsonToken[] expectedTokens, Exception ex expectedException); } - private void VerifyReader(ReadOnlyMemory input, JsonToken[] expectedTokens, IJsonReadOnlyStringDictionary jsonStringDictionary = null, Exception expectedException = null) + private void VerifyReader(ReadOnlyMemory input, JsonToken[] expectedTokens, IJsonStringDictionary jsonStringDictionary = null, Exception expectedException = null) { // Test binary reader created with the array API this.VerifyReader(() => JsonReader.Create(input, jsonStringDictionary), expectedTokens, expectedException); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonStringDictionaryTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonStringDictionaryTests.cs index 128148cf42..403db04ee4 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonStringDictionaryTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonStringDictionaryTests.cs @@ -57,27 +57,27 @@ public void TestDictionarySizeLimit() [Owner("mayapainter")] public void TestDictionaryComparison() { - IJsonReadOnlyStringDictionary stringDictionary0 = new JsonStringDictionary(); + IJsonStringDictionary stringDictionary0 = new JsonStringDictionary(); // Null comparison and reference-equals comparison Assert.IsFalse(stringDictionary0.Equals(null)); Assert.IsTrue(stringDictionary0.Equals(stringDictionary0)); // Subset comparison - IJsonReadOnlyStringDictionary stringDictionary1 = new JsonStringDictionary(new List { "test0", "test1", "test2" }); - IJsonReadOnlyStringDictionary stringDictionary2 = new JsonStringDictionary(new List { "test0", "test1" }); + IJsonStringDictionary stringDictionary1 = new JsonStringDictionary(new List { "test0", "test1", "test2" }); + IJsonStringDictionary stringDictionary2 = new JsonStringDictionary(new List { "test0", "test1" }); Assert.IsFalse(stringDictionary1.Equals(stringDictionary2)); // Value-equals comparison - IJsonReadOnlyStringDictionary stringDictionary3 = new JsonStringDictionary(new List { "test0", "test1", "test2" }); + IJsonStringDictionary stringDictionary3 = new JsonStringDictionary(new List { "test0", "test1", "test2" }); Assert.IsTrue(stringDictionary1.Equals(stringDictionary3)); // Superset comparison - IJsonReadOnlyStringDictionary stringDictionary4 = new JsonStringDictionary(new List { "test0", "test1", "test2", "test3" }); + IJsonStringDictionary stringDictionary4 = new JsonStringDictionary(new List { "test0", "test1", "test2", "test3" }); Assert.IsFalse(stringDictionary1.Equals(stringDictionary4)); // Order-sensitive comparison - IJsonReadOnlyStringDictionary stringDictionary5 = new JsonStringDictionary(new List { "test1", "test0", "test2" }); + IJsonStringDictionary stringDictionary5 = new JsonStringDictionary(new List { "test1", "test0", "test2" }); Assert.IsFalse(stringDictionary1.Equals(stringDictionary5)); } } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonTestUtils.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonTestUtils.cs index b9afe9eed6..5203355f74 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonTestUtils.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonTestUtils.cs @@ -13,9 +13,9 @@ internal class JsonTestUtils { - public static byte[] ConvertTextToBinary(string text, out IJsonReadOnlyStringDictionary jsonStringDictionary) + public static byte[] ConvertTextToBinary(string text, out IJsonStringDictionary jsonStringDictionary) { - IJsonReadOnlyStringDictionary stringDictionary = JsonTestUtils.PopulateStringDictionary(text); + IJsonStringDictionary stringDictionary = JsonTestUtils.PopulateStringDictionary(text); IJsonWriter binaryWriter = JsonWriter.Create(JsonSerializationFormat.Binary, jsonStringDictionary: stringDictionary); IJsonReader textReader = JsonReader.Create(Encoding.UTF8.GetBytes(text)); textReader.WriteAll(binaryWriter); @@ -24,7 +24,7 @@ public static byte[] ConvertTextToBinary(string text, out IJsonReadOnlyStringDic return binaryWriter.GetResult().ToArray(); } - public static byte[] ConvertTextToBinary(string text, IJsonReadOnlyStringDictionary jsonStringDictionary = null) + public static byte[] ConvertTextToBinary(string text, IJsonStringDictionary jsonStringDictionary = null) { IJsonWriter binaryWriter = JsonWriter.Create(JsonSerializationFormat.Binary, jsonStringDictionary: jsonStringDictionary); IJsonReader textReader = JsonReader.Create(Encoding.UTF8.GetBytes(text)); @@ -32,7 +32,7 @@ public static byte[] ConvertTextToBinary(string text, IJsonReadOnlyStringDiction return binaryWriter.GetResult().ToArray(); } - public static string ConvertBinaryToText(ReadOnlyMemory binary, IJsonReadOnlyStringDictionary jsonStringDictionary = null) + public static string ConvertBinaryToText(ReadOnlyMemory binary, IJsonStringDictionary jsonStringDictionary = null) { IJsonReader binaryReader = JsonReader.Create(binary, jsonStringDictionary); IJsonWriter textWriter = JsonWriter.Create(JsonSerializationFormat.Text); @@ -40,7 +40,7 @@ public static string ConvertBinaryToText(ReadOnlyMemory binary, IJsonReadO return Encoding.UTF8.GetString(textWriter.GetResult().ToArray()); } - public static IJsonReadOnlyStringDictionary PopulateStringDictionary(string text) + public static IJsonStringDictionary PopulateStringDictionary(string text) { IJsonNavigator navigator = JsonNavigator.Create(Encoding.UTF8.GetBytes(text)); IJsonNavigatorNode rootNode = navigator.GetRootNode(); @@ -375,7 +375,7 @@ public static RoundTripResult VerifyJsonRoundTrip( (newtonsoftNavigatorCreate != null ? newtonsoftNavigatorCreate(inputJson) : null) : JsonNavigator.Create(inputResult); - IJsonReadOnlyStringDictionary jsonStringDictionary = new JsonStringDictionary(); + IJsonStringDictionary jsonStringDictionary = new JsonStringDictionary(); Func createWriter = (SerializationSpec spec) => spec.IsNewtonsoft ? NewtonsoftToCosmosDBWriter.CreateTextWriter() : spec.UserStringEncoded ? @@ -516,7 +516,7 @@ public static bool CompareResults( byte[] resultBuffer1, byte[] resultBuffer2, TextWriter verboseWriter = null, - IJsonReadOnlyStringDictionary jsonStringDictionary = null) + IJsonStringDictionary jsonStringDictionary = null) { Assert.IsNotNull(resultBuffer1); Assert.IsNotNull(resultBuffer2); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonWriterTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonWriterTests.cs index 2f7e08e586..8f546ce37d 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonWriterTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Json/JsonWriterTests.cs @@ -630,7 +630,7 @@ public void SystemStringTest() [Owner("mayapainter")] public void UserStringTest() { - IJsonReadOnlyStringDictionary jsonStringDictionary = + IJsonStringDictionary jsonStringDictionary = new JsonStringDictionary(new List { "double", "string", "boolean", "null", "datetime", "spatialPoint", "text" }); int userStringId = 0; @@ -8141,7 +8141,7 @@ public void SimpleObjectTest() this.VerifyWriter(tokensToWrite, expectedString); this.VerifyWriter(tokensToWrite, binaryOutput); - IJsonReadOnlyStringDictionary jsonStringDictionary = JsonTestUtils.PopulateStringDictionary(expectedString); + IJsonStringDictionary jsonStringDictionary = JsonTestUtils.PopulateStringDictionary(expectedString); this.VerifyWriter(tokensToWrite, binaryOutputWithEncoding, jsonStringDictionary); } @@ -8346,7 +8346,7 @@ public void AllPrimitivesObjectTest() this.VerifyWriter(tokensToWrite, expectedString); this.VerifyWriter(tokensToWrite, binaryOutput); - IJsonReadOnlyStringDictionary jsonStringDictionary = JsonTestUtils.PopulateStringDictionary(expectedString); + IJsonStringDictionary jsonStringDictionary = JsonTestUtils.PopulateStringDictionary(expectedString); this.VerifyWriter(tokensToWrite, binaryOutputWithEncoding, jsonStringDictionary); } #endregion @@ -8771,7 +8771,7 @@ private void VerifyWriter(JsonToken[] tokensToWrite, byte[] binaryOutput, Except } } - private void VerifyWriter(JsonToken[] tokensToWrite, byte[] binaryOutput, IJsonReadOnlyStringDictionary jsonStringDictionary, Exception expectedException = null) + private void VerifyWriter(JsonToken[] tokensToWrite, byte[] binaryOutput, IJsonStringDictionary jsonStringDictionary, Exception expectedException = null) { foreach (bool writeAsUtf8String in new bool[] { false, true }) {