diff --git a/CryptoExchange.Net/Converters/SystemTextJson/NumberStringConverter.cs b/CryptoExchange.Net/Converters/SystemTextJson/NumberStringConverter.cs index a45014a..7beafd9 100644 --- a/CryptoExchange.Net/Converters/SystemTextJson/NumberStringConverter.cs +++ b/CryptoExchange.Net/Converters/SystemTextJson/NumberStringConverter.cs @@ -17,7 +17,12 @@ namespace CryptoExchange.Net.Converters.SystemTextJson return null; if (reader.TokenType == JsonTokenType.Number) - return reader.GetInt64().ToString(); + { + if (reader.TryGetInt64(out var value)) + return value.ToString(); + + return reader.GetDecimal().ToString(); + } return reader.GetString(); } diff --git a/CryptoExchange.Net/Testing/Comparers/SystemTextJsonComparer.cs b/CryptoExchange.Net/Testing/Comparers/SystemTextJsonComparer.cs index 465e8c4..9544da4 100644 --- a/CryptoExchange.Net/Testing/Comparers/SystemTextJsonComparer.cs +++ b/CryptoExchange.Net/Testing/Comparers/SystemTextJsonComparer.cs @@ -357,6 +357,13 @@ namespace CryptoExchange.Net.Testing.Comparers if (time != DateTimeConverter.ParseFromString(jsonValue.Value()!)) throw new Exception($"{method}: {property} not equal: {jsonValue.Value()} vs {time}"); } + else if (objectValue is bool bl) + { + if (bl && jsonValue.Value() != "1") + throw new Exception($"{method}: {property} not equal: {jsonValue.Value()} vs {bl}"); + if (!bl && jsonValue.Value() != "0") + throw new Exception($"{method}: {property} not equal: {jsonValue.Value()} vs {bl}"); + } else if (propertyType.IsEnum || Nullable.GetUnderlyingType(propertyType)?.IsEnum == true) { // TODO enum comparing diff --git a/CryptoExchange.Net/Testing/TestHelpers.cs b/CryptoExchange.Net/Testing/TestHelpers.cs index ba699d1..044fa28 100644 --- a/CryptoExchange.Net/Testing/TestHelpers.cs +++ b/CryptoExchange.Net/Testing/TestHelpers.cs @@ -121,8 +121,8 @@ namespace CryptoExchange.Net.Testing if (disableOrdering) client.OrderParameters = false; - var uriParams = client.ParameterPositions[method] == HttpMethodParameterPosition.InUri ? client.CreateParameterDictionary(parameters) : new Dictionary(); - var bodyParams = client.ParameterPositions[method] == HttpMethodParameterPosition.InBody ? client.CreateParameterDictionary(parameters) : new Dictionary(); + var uriParams = client.ParameterPositions[method] == HttpMethodParameterPosition.InUri ? client.CreateParameterDictionary(parameters) : null; + var bodyParams = client.ParameterPositions[method] == HttpMethodParameterPosition.InBody ? client.CreateParameterDictionary(parameters) : null; var headers = new Dictionary();