File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
tests/MongoDB.Bson.Tests/IO Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -1559,6 +1559,10 @@ private BsonValue ParseNumberIntExtendedJson()
1559
1559
{
1560
1560
value = valueToken . Int32Value ;
1561
1561
}
1562
+ else if ( valueToken . Type == JsonTokenType . String )
1563
+ {
1564
+ value = JsonConvert . ToInt32 ( valueToken . StringValue ) ;
1565
+ }
1562
1566
else
1563
1567
{
1564
1568
var message = string . Format ( "JSON reader expected an integer but found '{0}'." , valueToken . Lexeme ) ;
Original file line number Diff line number Diff line change @@ -529,6 +529,9 @@ public void TestInt32()
529
529
[ InlineData ( "{ $numberInt : 1 }" , 1 ) ]
530
530
[ InlineData ( "{ $numberInt : -2147483648 }" , - 2147483648 ) ]
531
531
[ InlineData ( "{ $numberInt : 2147483647 }" , 2147483647 ) ]
532
+ [ InlineData ( "{ $numberInt : \" 1\" }" , 1 ) ]
533
+ [ InlineData ( "{ $numberInt : \" -2147483648\" }" , - 2147483648 ) ]
534
+ [ InlineData ( "{ $numberInt : \" 2147483647\" }" , 2147483647 ) ]
532
535
public void TestInt32ExtendedJson ( string json , int expectedResult )
533
536
{
534
537
using ( var reader = new JsonReader ( json ) )
You can’t perform that action at this time.
0 commit comments