Skip to content

Commit

Permalink
Assert that the behaviour change of the previous commit is in accorda…
Browse files Browse the repository at this point in the history
…nce with Newtonsoft.Json deserialization behaviour.
  • Loading branch information
danielcweber committed Nov 2, 2024
1 parent 928a328 commit 62117f6
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions test/Support.NewtonsoftJson.Tests/Assertions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using FluentAssertions;

using Newtonsoft.Json;

namespace ExRam.Gremlinq.Support.NewtonsoftJson.Tests
{
public class Assertions
{
public class VertexProperty
{
public string? Value { get; set; }
}

public class Vertex
{
public string? Id { get; set; }

public VertexProperty? Property { get; set; }
}

[Fact]
public void Empty_json_objects_are_deserialized_to_non_null_properties()
{
JsonConvert
.DeserializeObject<Vertex>("{ \"id\": \"Hallo\" }")?
.Property
.Should()
.BeNull();

JsonConvert
.DeserializeObject<Vertex>("{ \"id\": \"Hallo\" }")?
.Id
.Should()
.NotBeNull();

JsonConvert
.DeserializeObject<Vertex>("{ \"id\": \"Hallo\", \"property\": { } }")?
.Property
.Should()
.NotBeNull();
}
}
}

0 comments on commit 62117f6

Please sign in to comment.