Skip to content

Commit

Permalink
Merge pull request #124 from tochka-public/feat/bump
Browse files Browse the repository at this point in the history
BREAKING CHANGE: client context item key changed
  • Loading branch information
Rast1234 authored Feb 19, 2025
2 parents d96caa6 + a4e49a0 commit 8f6f8e3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/tests/Tochka.JsonRpc.Common.Tests/UtilsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,27 @@ public void DeserializeErrorData_DataIsNull_ReturnDefault()
}

[Test]
public void DeserializeErrorData_DataJsonSerializerOptionsFailedWithJsonException_UseHeadersJsonSerializerOptions()
public void DeserializeErrorData_DataJsonSerializerOptionsFailedWithNotSupportedException_UseHeadersJsonSerializerOptions()
{
var dataJsonSerializerOptions = new JsonSerializerOptions();
var headersJsonSerializerOptions = new JsonSerializerOptions { Converters = { new ErrorDataConverter() } };
var data = JsonDocument.Parse("\"a\"");
var headersJsonSerializerOptions = new JsonSerializerOptions { Converters = { new IErrorDataConverter() } };
var data = JsonDocument.Parse("{\"A\": \"b\"}");

var deserialized = Utils.DeserializeErrorData<ErrorData>(data, headersJsonSerializerOptions, dataJsonSerializerOptions);
var deserialized = Utils.DeserializeErrorData<IErrorData>(data, headersJsonSerializerOptions, dataJsonSerializerOptions);

deserialized.Should().BeEquivalentTo(new ErrorData("a"));
deserialized.Should().BeEquivalentTo(new ErrorData("b"));
}

[Test]
public void DeserializeErrorData_DataJsonSerializerOptionsFailedWithNotSupportedException_UseHeadersJsonSerializerOptions()
public void DeserializeErrorData_DataJsonSerializerOptionsFailedWithJsonException_UseHeadersJsonSerializerOptions()
{
var dataJsonSerializerOptions = new JsonSerializerOptions();
var headersJsonSerializerOptions = new JsonSerializerOptions { Converters = { new IErrorDataConverter() } };
var data = JsonDocument.Parse("{\"A\": \"b\"}");
var headersJsonSerializerOptions = new JsonSerializerOptions { Converters = { new ErrorDataConverter() } };
var data = JsonDocument.Parse("\"a\"");

var deserialized = Utils.DeserializeErrorData<IErrorData>(data, headersJsonSerializerOptions, dataJsonSerializerOptions);
var deserialized = Utils.DeserializeErrorData<ErrorData>(data, headersJsonSerializerOptions, dataJsonSerializerOptions);

deserialized.Should().BeEquivalentTo(new ErrorData("b"));
deserialized.Should().BeEquivalentTo(new ErrorData("a"));
}

[Test]
Expand Down

0 comments on commit 8f6f8e3

Please sign in to comment.