af1152b001
Refactored all C# test files to use explicit namespace declarations and moved all using directives inside the namespace block for consistency. Updated assembly info and cache files to reflect the new build. Adjusted MvcTestingAppManifest.json to use fully qualified assembly names. No functional changes; all updates are related to code style, organization, and project metadata.
43 lines
1.3 KiB
C#
43 lines
1.3 KiB
C#
// <copyright file="JsonStringConverterTests.cs" company="PlaceholderCompany">
|
|
// Copyright (c) PlaceholderCompany. All rights reserved.
|
|
// </copyright>
|
|
|
|
namespace Jellyfin.Extensions.Tests.Json.Converters
|
|
{
|
|
using System.Text.Json;
|
|
using Jellyfin.Extensions.Json.Converters;
|
|
using Xunit;
|
|
|
|
public class JsonStringConverterTests
|
|
{
|
|
private readonly JsonSerializerOptions _jsonSerializerOptions = new()
|
|
{
|
|
Converters =
|
|
{
|
|
new JsonStringConverter()
|
|
}
|
|
};
|
|
|
|
[Theory]
|
|
[InlineData("\"test\"", "test")]
|
|
[InlineData("123", "123")]
|
|
[InlineData("123.45", "123.45")]
|
|
[InlineData("true", "true")]
|
|
[InlineData("false", "false")]
|
|
public void Deserialize_String_Valid_Success(string input, string output)
|
|
{
|
|
var deserialized = JsonSerializer.Deserialize<string>(input, _jsonSerializerOptions);
|
|
Assert.Equal(deserialized, output);
|
|
}
|
|
|
|
[Fact]
|
|
public void Deserialize_Int32asInt32_Valid_Success()
|
|
{
|
|
const string? input = "123";
|
|
const int output = 123;
|
|
var deserialized = JsonSerializer.Deserialize<int>(input, _jsonSerializerOptions);
|
|
Assert.Equal(output, deserialized);
|
|
}
|
|
}
|
|
}
|