Skip to content

Commit

Permalink
Added test for cd1f67f
Browse files Browse the repository at this point in the history
  • Loading branch information
lbnascimento committed Aug 19, 2020
1 parent cd1f67f commit 086a6e0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions LiteDB.Tests/Document/Json_Tests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Globalization;
using FluentAssertions;
using Xunit;

Expand Down Expand Up @@ -56,5 +57,23 @@ public void JsonWriterTest()
var specialChars = "ÁÀÃÂÄÉÈÊËÉÍÌÎÏÓÒÕÔÖÚÙÛÜÇáàãâäéèêëéíìîïóòõôöúùûüç";
JsonSerializer.Serialize(specialChars).Should().Be('\"' + specialChars + '\"');
}

[Fact]
public void Json_Number_Deserialize_Test()
{
int positiveInt32 = 5000000;
int negativeInt32 = -5000000;
long positiveInt64 = 210000000000L;
long negativeInt64 = -210000000000L;
double positiveDouble = 210000000000D;
double negativeDouble = -210000000000D;

JsonSerializer.Deserialize(positiveInt32.ToString()).Should().Be(positiveInt32);
JsonSerializer.Deserialize(negativeInt32.ToString()).Should().Be(negativeInt32);
JsonSerializer.Deserialize(positiveInt64.ToString()).Should().Be(positiveInt64);
JsonSerializer.Deserialize(negativeInt64.ToString()).Should().Be(negativeInt64);
JsonSerializer.Deserialize(positiveDouble.ToString("F1", CultureInfo.InvariantCulture)).Should().Be(positiveDouble);
JsonSerializer.Deserialize(negativeDouble.ToString("F1", CultureInfo.InvariantCulture)).Should().Be(negativeDouble);
}
}
}

0 comments on commit 086a6e0

Please # to comment.