Merge pull request #4899 from jellyfin/nullableguid

Cover all branches in JsonNullableGuidConverter
This commit is contained in:
Bond-009 2021-01-09 17:37:23 +01:00 committed by GitHub
commit 2e33e14bb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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()
{