Skip to content

Commit

Permalink
Add nullable test and fix a thing it caught
Browse files Browse the repository at this point in the history
  • Loading branch information
adambollen committed Oct 17, 2024
1 parent c1b452e commit 22af51a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Fauna.Test/Integration.Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,10 @@ public void ValidateUnwrappedMapOfQueriesError()
public async Task ValidateBytesAcrossTheWire()
{
byte[] byteArray = { 70, 97, 117, 110, 97 };
byte[]? nullArray = null;

var result = await _client.QueryAsync<byte[]>(FQL($"let x:Bytes = {byteArray}; x"));
var result = await _client.QueryAsync<List<object?>>(FQL($"let x:Bytes = {byteArray}; let y:Bytes|Null = {nullArray}; [x,y]"));

Assert.AreEqual(Encoding.UTF8.GetBytes("Fauna"), result.Data);
Assert.AreEqual(new[] { Encoding.UTF8.GetBytes("Fauna"), null }, result.Data);
}
}
1 change: 1 addition & 0 deletions Fauna/Serialization/DynamicSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ private DynamicSerializer()
TokenType.Time => reader.GetTime(),
TokenType.True or TokenType.False => reader.GetBoolean(),
TokenType.Module => reader.GetModule(),
TokenType.Bytes => reader.GetBytes(),
TokenType.Null => null,
_ => throw new SerializationException(
$"Unexpected token while deserializing: {reader.CurrentTokenType}"),
Expand Down

0 comments on commit 22af51a

Please sign in to comment.