-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from criipto/tolerant-enums
future-proof enum values with tolerant enum reading
- Loading branch information
Showing
4 changed files
with
449 additions
and
10 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,38 @@ | ||
using Xunit; | ||
using Newtonsoft.Json; | ||
using Criipto.Signatures.Models; | ||
|
||
namespace Criipto.Signatures.UnitTests; | ||
|
||
public class ConverterTests | ||
{ | ||
[Fact] | ||
public void SignatoryDocumentEdgeIsTolerant() | ||
{ | ||
var json = """ | ||
{ | ||
"status": "SIGNED_IN_THE_FUTURE" | ||
} | ||
""".Trim(); | ||
|
||
var actual = JsonConvert.DeserializeObject<SignatoryDocumentEdge>(json); | ||
|
||
Assert.NotNull(actual); | ||
Assert.Equal(SignatoryDocumentStatus.FUTURE_ADDED_VALUE, actual!.status); | ||
} | ||
|
||
[Fact] | ||
public void SignatoryDocumentEdgeIsCorrect() | ||
{ | ||
var json = """ | ||
{ | ||
"status": "SIGNED" | ||
} | ||
""".Trim(); | ||
|
||
var actual = JsonConvert.DeserializeObject<SignatoryDocumentEdge>(json); | ||
|
||
Assert.NotNull(actual); | ||
Assert.Equal(SignatoryDocumentStatus.SIGNED, actual!.status); | ||
} | ||
} |
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
Oops, something went wrong.