mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-08-11 08:22:53 +00:00
Fixed bug in bool converter
This commit is contained in:
@@ -25,6 +25,17 @@ namespace CryptoExchange.Net.UnitTests.ConverterTests
|
||||
Assert.That(output!.Value == expected);
|
||||
}
|
||||
|
||||
[TestCase(1, true)]
|
||||
[TestCase(2, true)]
|
||||
[TestCase(0, false)]
|
||||
[TestCase(-1, false)]
|
||||
public void TestBoolConverterInts(int value, bool? expected)
|
||||
{
|
||||
var val = value == null ? "null" : $"{value}";
|
||||
var output = JsonSerializer.Deserialize<STJBoolObject>($"{{ \"Value\": {val} }}", SerializerOptions.WithConverters(new TestSerializerContext()));
|
||||
Assert.That(output!.Value == expected);
|
||||
}
|
||||
|
||||
[TestCase("1", true)]
|
||||
[TestCase("true", true)]
|
||||
[TestCase("yes", true)]
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace CryptoExchange.Net.Converters.SystemTextJson
|
||||
if (reader.TokenType == JsonTokenType.Number)
|
||||
{
|
||||
var number = reader.GetInt16();
|
||||
if (number > 1)
|
||||
if (number >= 1)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user