diff options
| author | Bond_009 <bond.009@outlook.com> | 2020-10-02 19:43:34 +0200 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2020-10-02 19:43:34 +0200 |
| commit | 8535a718b7e9307dfcb2e04d198b0cabbdb15205 (patch) | |
| tree | b4c6e1e71b23dd7d0e2f66e2df9d707727da1b90 | |
| parent | c7b3d4a90c946f9a2438622cc0ca43d19b84bef8 (diff) | |
Add tests for deserializing guids
| -rw-r--r-- | tests/Jellyfin.Common.Tests/Json/JsonGuidConverterTests.cs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/Jellyfin.Common.Tests/Json/JsonGuidConverterTests.cs b/tests/Jellyfin.Common.Tests/Json/JsonGuidConverterTests.cs new file mode 100644 index 000000000..aef5b3a7d --- /dev/null +++ b/tests/Jellyfin.Common.Tests/Json/JsonGuidConverterTests.cs @@ -0,0 +1,22 @@ +using System; +using System.Text.Json; +using MediaBrowser.Common.Json.Converters; +using Xunit; + +namespace Jellyfin.Common.Tests.Extensions +{ + public static class JsonGuidConverterTests + { + [Fact] + public static void Deserialize_Valid_Success() + { + var options = new JsonSerializerOptions(); + options.Converters.Add(new JsonGuidConverter()); + Guid value = JsonSerializer.Deserialize<Guid>(@"""a852a27afe324084ae66db579ee3ee18""", options); + Assert.Equal(new Guid("a852a27afe324084ae66db579ee3ee18"), value); + + value = JsonSerializer.Deserialize<Guid>(@"""e9b2dcaa-529c-426e-9433-5e9981f27f2e""", options); + Assert.Equal(new Guid("e9b2dcaa-529c-426e-9433-5e9981f27f2e"), value); + } + } +} |
