Files
pgsql-jellyfin/tests/Jellyfin.Extensions.Tests/Json/Converters/JsonVersionConverterTests.cs
T
wjones dbeec2e9f0 Refactor and modernize JSON converter test code
Refactor test code in Jellyfin.Extensions.Tests for clarity and consistency:
- Use explicit object initializers and collection expressions
- Standardize field naming and use of this.
- Add/improve XML doc comments for test methods
- Use new(...) syntax for Guid/Version instantiation
- Convert file-scoped to block-scoped namespaces in key tests
- Nest test classes and use instance methods in enum tests
- Enable XML docs and suppress select warnings in csproj
- No changes to test or converter logic; style and maintainability only
2026-02-22 10:31:23 -05:00

41 lines
1.2 KiB
C#

// <copyright file="JsonVersionConverterTests.cs" company="PlaceholderCompany">
// Copyright (c) PlaceholderCompany. All rights reserved.
// </copyright>
namespace Jellyfin.Extensions.Tests.Json.Converters
{
using System;
using System.Text.Json;
using Jellyfin.Extensions.Json.Converters;
using Xunit;
public class JsonVersionConverterTests
{
private readonly JsonSerializerOptions _options;
public JsonVersionConverterTests()
{
this._options = new JsonSerializerOptions();
this._options.Converters.Add(new JsonVersionConverter());
}
[Fact]
public void Deserialize_Version_Success()
{
string input = "\"1.025.222\"";
Version output = new(1, 25, 222);
Version? deserializedInput = JsonSerializer.Deserialize<Version>(input, this._options);
Assert.Equal(output, deserializedInput);
}
[Fact]
public void Serialize_Version_Success()
{
Version input = new(1, 09, 59);
string output = "\"1.9.59\"";
string serializedInput = JsonSerializer.Serialize(input, this._options);
Assert.Equal(output, serializedInput);
}
}
}