浏览代码

Add roundtrip test

Bond_009 4 年之前
父节点
当前提交
d7dc15971e
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      tests/Jellyfin.Common.Tests/Json/JsonGuidConverterTests.cs

+ 10 - 0
tests/Jellyfin.Common.Tests/Json/JsonGuidConverterTests.cs

@@ -18,5 +18,15 @@ namespace Jellyfin.Common.Tests.Extensions
             value = JsonSerializer.Deserialize<Guid>(@"""e9b2dcaa-529c-426e-9433-5e9981f27f2e""", options);
             value = JsonSerializer.Deserialize<Guid>(@"""e9b2dcaa-529c-426e-9433-5e9981f27f2e""", options);
             Assert.Equal(new Guid("e9b2dcaa-529c-426e-9433-5e9981f27f2e"), value);
             Assert.Equal(new Guid("e9b2dcaa-529c-426e-9433-5e9981f27f2e"), value);
         }
         }
+
+        [Fact]
+        public static void Roundtrip_Valid_Success()
+        {
+            var options = new JsonSerializerOptions();
+            options.Converters.Add(new JsonGuidConverter());
+            Guid guid = new Guid("a852a27afe324084ae66db579ee3ee18");
+            string value = JsonSerializer.Serialize(guid, options);
+            Assert.Equal(guid, JsonSerializer.Deserialize<Guid>(value, options));
+        }
     }
     }
 }
 }