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.
50 lines
1.5 KiB
C#
50 lines
1.5 KiB
C#
// <copyright file="JsonBoolNumberTests.cs" company="PlaceholderCompany">
|
|
// Copyright (c) PlaceholderCompany. All rights reserved.
|
|
// </copyright>
|
|
|
|
namespace Jellyfin.Extensions.Tests.Json.Converters
|
|
{
|
|
using System.Text.Json;
|
|
using FsCheck;
|
|
using FsCheck.Fluent;
|
|
using FsCheck.Xunit;
|
|
using Jellyfin.Extensions.Json.Converters;
|
|
using Xunit;
|
|
|
|
public class JsonBoolNumberTests
|
|
{
|
|
private readonly JsonSerializerOptions _jsonOptions = new JsonSerializerOptions()
|
|
{
|
|
Converters =
|
|
{
|
|
new JsonBoolNumberConverter()
|
|
}
|
|
};
|
|
|
|
[Theory]
|
|
[InlineData("1", true)]
|
|
[InlineData("0", false)]
|
|
[InlineData("2", true)]
|
|
[InlineData("true", true)]
|
|
[InlineData("false", false)]
|
|
public void Deserialize_Number_Valid_Success(string input, bool? output)
|
|
{
|
|
var value = JsonSerializer.Deserialize<bool>(input, _jsonOptions);
|
|
Assert.Equal(value, output);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(true, "true")]
|
|
[InlineData(false, "false")]
|
|
public void Serialize_Bool_Success(bool input, string output)
|
|
{
|
|
var value = JsonSerializer.Serialize(input, _jsonOptions);
|
|
Assert.Equal(value, output);
|
|
}
|
|
|
|
[Property]
|
|
public Property Deserialize_NonZeroInt_True(NonZeroInt input)
|
|
=> JsonSerializer.Deserialize<bool>(input.ToString(), _jsonOptions).ToProperty();
|
|
}
|
|
}
|