Merge pull request #4899 from jellyfin/nullableguid

Cover all branches in JsonNullableGuidConverter
pull/4992/head
Bond-009 4 years ago committed by GitHub
commit 2e33e14bb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -39,17 +39,29 @@ namespace Jellyfin.Common.Tests.Json
}
[Fact]
public void Deserialize_Null_EmptyGuid()
public void Deserialize_Null_Null()
{
Assert.Null(JsonSerializer.Deserialize<Guid?>("null", _options));
}
[Fact]
public void Serialize_EmptyGuid_EmptyGuid()
public void Deserialize_EmptyGuid_EmptyGuid()
{
Assert.Equal(Guid.Empty, JsonSerializer.Deserialize<Guid?>(@"""00000000-0000-0000-0000-000000000000""", _options));
}
[Fact]
public void Serialize_EmptyGuid_Null()
{
Assert.Equal("null", JsonSerializer.Serialize((Guid?)Guid.Empty, _options));
}
[Fact]
public void Serialize_Null_Null()
{
Assert.Equal("null", JsonSerializer.Serialize((Guid?)null, _options));
}
[Fact]
public void Serialize_Valid_NoDash_Success()
{

Loading…
Cancel
Save