Fix build errors from new warnings

This commit is contained in:
Cody Robibero 2022-08-14 11:20:01 -06:00
parent 62ef93e2ce
commit 6004060b4e
17 changed files with 34 additions and 19 deletions

View File

@ -746,7 +746,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
} }
} }
internal readonly struct SubtitleInfo public readonly struct SubtitleInfo
{ {
public SubtitleInfo(string path, MediaProtocol protocol, string format, bool isExternal) public SubtitleInfo(string path, MediaProtocol protocol, string format, bool isExternal)
{ {

View File

@ -62,7 +62,7 @@ namespace Jellyfin.Api.Tests.Auth.DefaultAuthorizationPolicy
} }
} }
private static TheoryData<string, Dictionary<string, string>> GetParts_ValidAuthHeader_Success_Data() public static TheoryData<string, Dictionary<string, string>> GetParts_ValidAuthHeader_Success_Data()
{ {
var data = new TheoryData<string, Dictionary<string, string>>(); var data = new TheoryData<string, Dictionary<string, string>>();

View File

@ -192,7 +192,9 @@ namespace Jellyfin.Api.Tests.ModelBinders
await modelBinder.BindModelAsync(bindingContextMock.Object); await modelBinder.BindModelAsync(bindingContextMock.Object);
Assert.True(bindingContextMock.Object.Result.IsModelSet); Assert.True(bindingContextMock.Object.Result.IsModelSet);
Assert.Empty((IReadOnlyList<TestType>?)bindingContextMock.Object.Result.Model); var listResult = (IReadOnlyList<TestType>?)bindingContextMock.Object.Result.Model;
Assert.NotNull(listResult);
Assert.Empty(listResult);
} }
[Fact] [Fact]
@ -220,7 +222,9 @@ namespace Jellyfin.Api.Tests.ModelBinders
await modelBinder.BindModelAsync(bindingContextMock.Object); await modelBinder.BindModelAsync(bindingContextMock.Object);
Assert.True(bindingContextMock.Object.Result.IsModelSet); Assert.True(bindingContextMock.Object.Result.IsModelSet);
Assert.Single((IReadOnlyList<TestType>?)bindingContextMock.Object.Result.Model); var listResult = (IReadOnlyList<TestType>?)bindingContextMock.Object.Result.Model;
Assert.NotNull(listResult);
Assert.Single(listResult);
} }
} }
} }

View File

@ -192,7 +192,9 @@ namespace Jellyfin.Api.Tests.ModelBinders
await modelBinder.BindModelAsync(bindingContextMock.Object); await modelBinder.BindModelAsync(bindingContextMock.Object);
Assert.True(bindingContextMock.Object.Result.IsModelSet); Assert.True(bindingContextMock.Object.Result.IsModelSet);
Assert.Empty((IReadOnlyList<TestType>?)bindingContextMock.Object.Result.Model); var listResult = (IReadOnlyList<TestType>?)bindingContextMock.Object.Result.Model;
Assert.NotNull(listResult);
Assert.Empty(listResult);
} }
[Fact] [Fact]
@ -220,7 +222,9 @@ namespace Jellyfin.Api.Tests.ModelBinders
await modelBinder.BindModelAsync(bindingContextMock.Object); await modelBinder.BindModelAsync(bindingContextMock.Object);
Assert.True(bindingContextMock.Object.Result.IsModelSet); Assert.True(bindingContextMock.Object.Result.IsModelSet);
Assert.Single((IReadOnlyList<TestType>?)bindingContextMock.Object.Result.Model); var listResult = (IReadOnlyList<TestType>?)bindingContextMock.Object.Result.Model;
Assert.NotNull(listResult);
Assert.Single(listResult);
} }
} }
} }

View File

@ -32,7 +32,7 @@ namespace Jellyfin.Extensions.Tests.Json.Converters
const string? input = "123"; const string? input = "123";
const int output = 123; const int output = 123;
var deserialized = JsonSerializer.Deserialize<int>(input, _jsonSerializerOptions); var deserialized = JsonSerializer.Deserialize<int>(input, _jsonSerializerOptions);
Assert.Equal(deserialized, output); Assert.Equal(output, deserialized);
} }
} }
} }

View File

@ -53,7 +53,7 @@ namespace Jellyfin.MediaEncoding.Hls.Tests.Playlist
Assert.False(DynamicHlsPlaylistGenerator.IsExtractionAllowedForFile(filePath, allowedExtensions)); Assert.False(DynamicHlsPlaylistGenerator.IsExtractionAllowedForFile(filePath, allowedExtensions));
} }
private static TheoryData<int, long, double[]> ComputeEqualLengthSegments_Valid_Success_Data() public static TheoryData<int, long, double[]> ComputeEqualLengthSegments_Valid_Success_Data()
{ {
var data = new TheoryData<int, long, double[]> var data = new TheoryData<int, long, double[]>
{ {
@ -67,7 +67,7 @@ namespace Jellyfin.MediaEncoding.Hls.Tests.Playlist
return data; return data;
} }
private static TheoryData<KeyframeData, int, double[]> ComputeSegments_Valid_Success_Data() public static TheoryData<KeyframeData, int, double[]> ComputeSegments_Valid_Success_Data()
{ {
var data = new TheoryData<KeyframeData, int, double[]> var data = new TheoryData<KeyframeData, int, double[]>
{ {

View File

@ -12,7 +12,7 @@ namespace Jellyfin.MediaEncoding.Subtitles.Tests
{ {
public class SubtitleEncoderTests public class SubtitleEncoderTests
{ {
internal static TheoryData<MediaSourceInfo, MediaStream, SubtitleEncoder.SubtitleInfo> GetReadableFile_Valid_TestData() public static TheoryData<MediaSourceInfo, MediaStream, SubtitleEncoder.SubtitleInfo> GetReadableFile_Valid_TestData()
{ {
var data = new TheoryData<MediaSourceInfo, MediaStream, SubtitleEncoder.SubtitleInfo>(); var data = new TheoryData<MediaSourceInfo, MediaStream, SubtitleEncoder.SubtitleInfo>();

View File

@ -7,7 +7,7 @@ namespace Jellyfin.Model.Drawing;
public static class ImageFormatExtensionsTests public static class ImageFormatExtensionsTests
{ {
private static TheoryData<ImageFormat> GetAllImageFormats() public static TheoryData<ImageFormat> GetAllImageFormats()
{ {
var theoryTypes = new TheoryData<ImageFormat>(); var theoryTypes = new TheoryData<ImageFormat>();
foreach (var x in Enum.GetValues<ImageFormat>()) foreach (var x in Enum.GetValues<ImageFormat>())

View File

@ -44,7 +44,7 @@ namespace Jellyfin.Providers.Tests.Manager
ValidateImages_Test(ImageType.Primary, 0, true, 0, false, 0); ValidateImages_Test(ImageType.Primary, 0, true, 0, false, 0);
} }
private static TheoryData<ImageType, int> GetImageTypesWithCount() public static TheoryData<ImageType, int> GetImageTypesWithCount()
{ {
var theoryTypes = new TheoryData<ImageType, int> var theoryTypes = new TheoryData<ImageType, int>
{ {

View File

@ -132,7 +132,7 @@ namespace Jellyfin.Providers.Tests.Manager
Assert.True(TestMergeBaseItemData<Audio, SongInfo>(propName, oldValue, Array.Empty<string>(), null, true, out _)); Assert.True(TestMergeBaseItemData<Audio, SongInfo>(propName, oldValue, Array.Empty<string>(), null, true, out _));
} }
private static TheoryData<string, object, object> MergeBaseItemData_SimpleField_ReplacesAppropriately_TestData() public static TheoryData<string, object, object> MergeBaseItemData_SimpleField_ReplacesAppropriately_TestData()
=> new() => new()
{ {
{ "IndexNumber", 1, 2 }, { "IndexNumber", 1, 2 },

View File

@ -209,7 +209,7 @@ public class MediaInfoResolverTests
Assert.Empty(streams); Assert.Empty(streams);
} }
private static TheoryData<string, MediaStream[], MediaStream[]> GetExternalStreams_MergeMetadata_HandlesOverridesCorrectly_Data() public static TheoryData<string, MediaStream[], MediaStream[]> GetExternalStreams_MergeMetadata_HandlesOverridesCorrectly_Data()
{ {
var data = new TheoryData<string, MediaStream[], MediaStream[]>(); var data = new TheoryData<string, MediaStream[], MediaStream[]>();

View File

@ -19,7 +19,7 @@ namespace Jellyfin.Providers.Tests.MediaInfo
{ {
public class VideoImageProviderTests public class VideoImageProviderTests
{ {
private static TheoryData<Video> GetImage_UnsupportedInput_ReturnsNoImage_TestData() public static TheoryData<Video> GetImage_UnsupportedInput_ReturnsNoImage_TestData()
{ {
return new() return new()
{ {

View File

@ -11,7 +11,7 @@ public class IndexNumberComparerTests
{ {
private readonly IBaseItemComparer _cmp = new IndexNumberComparer(); private readonly IBaseItemComparer _cmp = new IndexNumberComparer();
private static TheoryData<BaseItem?, BaseItem?> Compare_GivenNull_ThrowsArgumentNullException_TestData() public static TheoryData<BaseItem?, BaseItem?> Compare_GivenNull_ThrowsArgumentNullException_TestData()
=> new() => new()
{ {
{ null, new Audio() }, { null, new Audio() },

View File

@ -12,7 +12,7 @@ public class ParentIndexNumberComparerTests
{ {
private readonly IBaseItemComparer _cmp = new ParentIndexNumberComparer(); private readonly IBaseItemComparer _cmp = new ParentIndexNumberComparer();
private static TheoryData<BaseItem?, BaseItem?> Compare_GivenNull_ThrowsArgumentNullException_TestData() public static TheoryData<BaseItem?, BaseItem?> Compare_GivenNull_ThrowsArgumentNullException_TestData()
=> new() => new()
{ {
{ null, new Audio() }, { null, new Audio() },

View File

@ -83,6 +83,7 @@ namespace Jellyfin.Server.Integration.Tests.Controllers
var res = await response.Content.ReadAsStreamAsync(); var res = await response.Content.ReadAsStreamAsync();
var data = await JsonSerializer.DeserializeAsync<ConfigurationPageInfo[]>(res, _jsonOpions); var data = await JsonSerializer.DeserializeAsync<ConfigurationPageInfo[]>(res, _jsonOpions);
Assert.NotNull(data);
Assert.Empty(data); Assert.Empty(data);
} }
} }

View File

@ -62,7 +62,9 @@ namespace Jellyfin.Server.Integration.Tests.Controllers
using var contentStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); using var contentStream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false);
var user = await JsonSerializer.DeserializeAsync<StartupUserDto>(contentStream, _jsonOptions).ConfigureAwait(false); var user = await JsonSerializer.DeserializeAsync<StartupUserDto>(contentStream, _jsonOptions).ConfigureAwait(false);
Assert.NotEmpty(user!.Name); Assert.NotNull(user);
Assert.NotNull(user.Name);
Assert.NotEmpty(user.Name);
Assert.Null(user.Password); Assert.Null(user.Password);
} }
@ -87,7 +89,9 @@ namespace Jellyfin.Server.Integration.Tests.Controllers
var contentStream = await getResponse.Content.ReadAsStreamAsync().ConfigureAwait(false); var contentStream = await getResponse.Content.ReadAsStreamAsync().ConfigureAwait(false);
var newUser = await JsonSerializer.DeserializeAsync<StartupUserDto>(contentStream, _jsonOptions).ConfigureAwait(false); var newUser = await JsonSerializer.DeserializeAsync<StartupUserDto>(contentStream, _jsonOptions).ConfigureAwait(false);
Assert.Equal(user.Name, newUser!.Name); Assert.NotNull(newUser);
Assert.Equal(user.Name, newUser.Name);
Assert.NotNull(newUser.Password);
Assert.NotEmpty(newUser.Password); Assert.NotEmpty(newUser.Password);
Assert.NotEqual(user.Password, newUser.Password); Assert.NotEqual(user.Password, newUser.Password);
} }

View File

@ -46,6 +46,7 @@ namespace Jellyfin.Server.Integration.Tests.Controllers
var users = await JsonSerializer.DeserializeAsync<UserDto[]>( var users = await JsonSerializer.DeserializeAsync<UserDto[]>(
await response.Content.ReadAsStreamAsync().ConfigureAwait(false), _jsonOpions).ConfigureAwait(false); await response.Content.ReadAsStreamAsync().ConfigureAwait(false), _jsonOpions).ConfigureAwait(false);
// User are hidden by default // User are hidden by default
Assert.NotNull(users);
Assert.Empty(users); Assert.Empty(users);
} }
@ -60,6 +61,7 @@ namespace Jellyfin.Server.Integration.Tests.Controllers
Assert.Equal(HttpStatusCode.OK, response.StatusCode); Assert.Equal(HttpStatusCode.OK, response.StatusCode);
var users = await JsonSerializer.DeserializeAsync<UserDto[]>( var users = await JsonSerializer.DeserializeAsync<UserDto[]>(
await response.Content.ReadAsStreamAsync().ConfigureAwait(false), _jsonOpions).ConfigureAwait(false); await response.Content.ReadAsStreamAsync().ConfigureAwait(false), _jsonOpions).ConfigureAwait(false);
Assert.NotNull(users);
Assert.Single(users); Assert.Single(users);
Assert.False(users![0].HasConfiguredPassword); Assert.False(users![0].HasConfiguredPassword);
} }