-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: read feature on MaybeJsonConverter (#539)
* Fix MaybeJsonConverter Read method * Simplify read implementation
- Loading branch information
Showing
3 changed files
with
27 additions
and
7 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
Vonage.Common.Test/Serialization/MaybeJsonConverterTest.cs
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,23 @@ | ||
using System.Text.Json; | ||
using Vonage.Common.Serialization; | ||
using Vonage.Common.Test.Extensions; | ||
|
||
namespace Vonage.Common.Test.Serialization | ||
{ | ||
public class MaybeJsonConverterTest | ||
{ | ||
[Fact] | ||
public void Read_ShouldDeserializeUri_GivenJsonIsUriString() | ||
{ | ||
var reader = | ||
new Utf8JsonReader( | ||
"\"https://api.nexmo.com/v2/verify/c11236f4-00bf-4b89-84ba-88b25df97315/silent-auth/redirect\""u8 | ||
.ToArray().AsSpan()); | ||
reader.Read(); | ||
new MaybeJsonConverter<Uri>().Read(ref reader, typeof(Uri), new JsonSerializerOptions()) | ||
.Should() | ||
.BeSome(new Uri( | ||
"https://api.nexmo.com/v2/verify/c11236f4-00bf-4b89-84ba-88b25df97315/silent-auth/redirect")); | ||
} | ||
} | ||
} |
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
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