mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 11:34:57 +02:00
Add tests for deserializing guids
This commit is contained in:
parent
c7b3d4a90c
commit
8535a718b7
1 changed files with 22 additions and 0 deletions
22
tests/Jellyfin.Common.Tests/Json/JsonGuidConverterTests.cs
Normal file
22
tests/Jellyfin.Common.Tests/Json/JsonGuidConverterTests.cs
Normal file
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue