-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Assert that the behaviour change of the previous commit is in accorda…
…nce with Newtonsoft.Json deserialization behaviour.
- Loading branch information
1 parent
928a328
commit 62117f6
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |