mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-06-07 16:06:15 +00:00
Support too large numbers for long value in NumberStringConverter, fall back to string
This commit is contained in:
parent
27597bc994
commit
ca9a711f22
@ -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();
|
||||
}
|
||||
|
@ -357,6 +357,13 @@ namespace CryptoExchange.Net.Testing.Comparers
|
||||
if (time != DateTimeConverter.ParseFromString(jsonValue.Value<string>()!))
|
||||
throw new Exception($"{method}: {property} not equal: {jsonValue.Value<string>()} vs {time}");
|
||||
}
|
||||
else if (objectValue is bool bl)
|
||||
{
|
||||
if (bl && jsonValue.Value<string>() != "1")
|
||||
throw new Exception($"{method}: {property} not equal: {jsonValue.Value<string>()} vs {bl}");
|
||||
if (!bl && jsonValue.Value<string>() != "0")
|
||||
throw new Exception($"{method}: {property} not equal: {jsonValue.Value<string>()} vs {bl}");
|
||||
}
|
||||
else if (propertyType.IsEnum || Nullable.GetUnderlyingType(propertyType)?.IsEnum == true)
|
||||
{
|
||||
// TODO enum comparing
|
||||
|
@ -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<string, object>();
|
||||
var bodyParams = client.ParameterPositions[method] == HttpMethodParameterPosition.InBody ? client.CreateParameterDictionary(parameters) : new Dictionary<string, object>();
|
||||
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<string, string>();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user