Fix xUnit

This commit is contained in:
Shadowghost 2024-05-28 21:42:42 +02:00
parent 5f1c5009d3
commit cfab4eb2fc
6 changed files with 18 additions and 18 deletions

View File

@ -209,7 +209,7 @@ namespace Jellyfin.Providers.Tests.Manager
[InlineData(ImageType.Backdrop, 2, false)] [InlineData(ImageType.Backdrop, 2, false)]
[InlineData(ImageType.Primary, 1, true)] [InlineData(ImageType.Primary, 1, true)]
[InlineData(ImageType.Backdrop, 2, true)] [InlineData(ImageType.Backdrop, 2, true)]
public async void RefreshImages_PopulatedItemPopulatedProviderDynamic_UpdatesImagesIfForced(ImageType imageType, int imageCount, bool forceRefresh) public async Task RefreshImages_PopulatedItemPopulatedProviderDynamic_UpdatesImagesIfForced(ImageType imageType, int imageCount, bool forceRefresh)
{ {
var item = GetItemWithImages(imageType, imageCount, false); var item = GetItemWithImages(imageType, imageCount, false);
@ -261,7 +261,7 @@ namespace Jellyfin.Providers.Tests.Manager
[InlineData(ImageType.Backdrop, 2, true, MediaProtocol.File)] [InlineData(ImageType.Backdrop, 2, true, MediaProtocol.File)]
[InlineData(ImageType.Primary, 1, false, MediaProtocol.File)] [InlineData(ImageType.Primary, 1, false, MediaProtocol.File)]
[InlineData(ImageType.Backdrop, 2, false, MediaProtocol.File)] [InlineData(ImageType.Backdrop, 2, false, MediaProtocol.File)]
public async void RefreshImages_EmptyItemPopulatedProviderDynamic_AddsImages(ImageType imageType, int imageCount, bool responseHasPath, MediaProtocol protocol) public async Task RefreshImages_EmptyItemPopulatedProviderDynamic_AddsImages(ImageType imageType, int imageCount, bool responseHasPath, MediaProtocol protocol)
{ {
// Has to exist for querying DateModified time on file, results stored but not checked so not populating // Has to exist for querying DateModified time on file, results stored but not checked so not populating
BaseItem.FileSystem = Mock.Of<IFileSystem>(); BaseItem.FileSystem = Mock.Of<IFileSystem>();
@ -311,7 +311,7 @@ namespace Jellyfin.Providers.Tests.Manager
[InlineData(ImageType.Primary, 1, true)] [InlineData(ImageType.Primary, 1, true)]
[InlineData(ImageType.Backdrop, 1, true)] [InlineData(ImageType.Backdrop, 1, true)]
[InlineData(ImageType.Backdrop, 2, true)] [InlineData(ImageType.Backdrop, 2, true)]
public async void RefreshImages_PopulatedItemPopulatedProviderRemote_UpdatesImagesIfForced(ImageType imageType, int imageCount, bool forceRefresh) public async Task RefreshImages_PopulatedItemPopulatedProviderRemote_UpdatesImagesIfForced(ImageType imageType, int imageCount, bool forceRefresh)
{ {
var item = GetItemWithImages(imageType, imageCount, false); var item = GetItemWithImages(imageType, imageCount, false);
@ -366,7 +366,7 @@ namespace Jellyfin.Providers.Tests.Manager
[InlineData(ImageType.Backdrop, 0, false)] // empty item, no cache to check [InlineData(ImageType.Backdrop, 0, false)] // empty item, no cache to check
[InlineData(ImageType.Backdrop, 1, false)] // populated item, cached so no download [InlineData(ImageType.Backdrop, 1, false)] // populated item, cached so no download
[InlineData(ImageType.Backdrop, 1, true)] // populated item, forced to download [InlineData(ImageType.Backdrop, 1, true)] // populated item, forced to download
public async void RefreshImages_NonStubItemPopulatedProviderRemote_DownloadsIfNecessary(ImageType imageType, int initialImageCount, bool fullRefresh) public async Task RefreshImages_NonStubItemPopulatedProviderRemote_DownloadsIfNecessary(ImageType imageType, int initialImageCount, bool fullRefresh)
{ {
var targetImageCount = 1; var targetImageCount = 1;
@ -429,7 +429,7 @@ namespace Jellyfin.Providers.Tests.Manager
[Theory] [Theory]
[MemberData(nameof(GetImageTypesWithCount))] [MemberData(nameof(GetImageTypesWithCount))]
public async void RefreshImages_EmptyItemPopulatedProviderRemoteExtras_LimitsImages(ImageType imageType, int imageCount) public async Task RefreshImages_EmptyItemPopulatedProviderRemoteExtras_LimitsImages(ImageType imageType, int imageCount)
{ {
var item = new Video(); var item = new Video();
@ -473,7 +473,7 @@ namespace Jellyfin.Providers.Tests.Manager
[Theory] [Theory]
[MemberData(nameof(GetImageTypesWithCount))] [MemberData(nameof(GetImageTypesWithCount))]
public async void RefreshImages_PopulatedItemEmptyProviderRemoteFullRefresh_DoesntClearImages(ImageType imageType, int imageCount) public async Task RefreshImages_PopulatedItemEmptyProviderRemoteFullRefresh_DoesntClearImages(ImageType imageType, int imageCount)
{ {
var item = GetItemWithImages(imageType, imageCount, false); var item = GetItemWithImages(imageType, imageCount, false);
@ -501,7 +501,7 @@ namespace Jellyfin.Providers.Tests.Manager
[InlineData(9, false)] [InlineData(9, false)]
[InlineData(10, true)] [InlineData(10, true)]
[InlineData(null, true)] [InlineData(null, true)]
public async void RefreshImages_ProviderRemote_FiltersByWidth(int? remoteImageWidth, bool expectedToUpdate) public async Task RefreshImages_ProviderRemote_FiltersByWidth(int? remoteImageWidth, bool expectedToUpdate)
{ {
var imageType = ImageType.Primary; var imageType = ImageType.Primary;

View File

@ -64,7 +64,7 @@ public class AudioResolverTests
[InlineData("My.Video.mp3", false, true)] [InlineData("My.Video.mp3", false, true)]
[InlineData("My.Video.srt", true, false)] [InlineData("My.Video.srt", true, false)]
[InlineData("My.Video.mp3", true, true)] [InlineData("My.Video.mp3", true, true)]
public async void GetExternalStreams_MixedFilenames_PicksAudio(string file, bool metadataDirectory, bool matches) public async Task GetExternalStreams_MixedFilenames_PicksAudio(string file, bool metadataDirectory, bool matches)
{ {
BaseItem.MediaSourceManager = Mock.Of<IMediaSourceManager>(); BaseItem.MediaSourceManager = Mock.Of<IMediaSourceManager>();

View File

@ -37,7 +37,7 @@ namespace Jellyfin.Providers.Tests.MediaInfo
} }
[Fact] [Fact]
public async void GetImage_NoStreams_ReturnsNoImage() public async Task GetImage_NoStreams_ReturnsNoImage()
{ {
var input = new Movie(); var input = new Movie();
@ -55,7 +55,7 @@ namespace Jellyfin.Providers.Tests.MediaInfo
[InlineData("clearlogo.png", null, 1, ImageType.Logo, ImageFormat.Png)] // extract extension from name [InlineData("clearlogo.png", null, 1, ImageType.Logo, ImageFormat.Png)] // extract extension from name
[InlineData("backdrop", "image/bmp", 2, ImageType.Backdrop, ImageFormat.Bmp)] // extract extension from mimetype [InlineData("backdrop", "image/bmp", 2, ImageType.Backdrop, ImageFormat.Bmp)] // extract extension from mimetype
[InlineData("poster", null, 3, ImageType.Primary, ImageFormat.Jpg)] // default extension to jpg [InlineData("poster", null, 3, ImageType.Primary, ImageFormat.Jpg)] // default extension to jpg
public async void GetImage_Attachment_ReturnsCorrectSelection(string filename, string? mimetype, int targetIndex, ImageType type, ImageFormat? expectedFormat) public async Task GetImage_Attachment_ReturnsCorrectSelection(string filename, string? mimetype, int targetIndex, ImageType type, ImageFormat? expectedFormat)
{ {
var attachments = new List<MediaAttachment>(); var attachments = new List<MediaAttachment>();
string pathPrefix = "path"; string pathPrefix = "path";
@ -103,7 +103,7 @@ namespace Jellyfin.Providers.Tests.MediaInfo
[InlineData(null, "mjpeg", 1, ImageType.Primary, ImageFormat.Jpg)] [InlineData(null, "mjpeg", 1, ImageType.Primary, ImageFormat.Jpg)]
[InlineData(null, "png", 1, ImageType.Primary, ImageFormat.Png)] [InlineData(null, "png", 1, ImageType.Primary, ImageFormat.Png)]
[InlineData(null, "webp", 1, ImageType.Primary, ImageFormat.Webp)] [InlineData(null, "webp", 1, ImageType.Primary, ImageFormat.Webp)]
public async void GetImage_Embedded_ReturnsCorrectSelection(string? label, string? codec, int targetIndex, ImageType type, ImageFormat? expectedFormat) public async Task GetImage_Embedded_ReturnsCorrectSelection(string? label, string? codec, int targetIndex, ImageType type, ImageFormat? expectedFormat)
{ {
var streams = new List<MediaStream>(); var streams = new List<MediaStream>();
for (int i = 1; i <= targetIndex; i++) for (int i = 1; i <= targetIndex; i++)

View File

@ -182,7 +182,7 @@ public class MediaInfoResolverTests
[Theory] [Theory]
[InlineData("https://url.com/My.Video.mkv")] [InlineData("https://url.com/My.Video.mkv")]
[InlineData(VideoDirectoryPath)] // valid but no files found for this test [InlineData(VideoDirectoryPath)] // valid but no files found for this test
public async void GetExternalStreams_BadPaths_ReturnsNoSubtitles(string path) public async Task GetExternalStreams_BadPaths_ReturnsNoSubtitles(string path)
{ {
// need a media source manager capable of returning something other than file protocol // need a media source manager capable of returning something other than file protocol
var mediaSourceManager = new Mock<IMediaSourceManager>(); var mediaSourceManager = new Mock<IMediaSourceManager>();
@ -285,7 +285,7 @@ public class MediaInfoResolverTests
[Theory] [Theory]
[MemberData(nameof(GetExternalStreams_MergeMetadata_HandlesOverridesCorrectly_Data))] [MemberData(nameof(GetExternalStreams_MergeMetadata_HandlesOverridesCorrectly_Data))]
public async void GetExternalStreams_MergeMetadata_HandlesOverridesCorrectly(string file, MediaStream[] inputStreams, MediaStream[] expectedStreams) public async Task GetExternalStreams_MergeMetadata_HandlesOverridesCorrectly(string file, MediaStream[] inputStreams, MediaStream[] expectedStreams)
{ {
BaseItem.MediaSourceManager = Mock.Of<IMediaSourceManager>(); BaseItem.MediaSourceManager = Mock.Of<IMediaSourceManager>();
@ -335,7 +335,7 @@ public class MediaInfoResolverTests
[InlineData(1, 2)] [InlineData(1, 2)]
[InlineData(2, 1)] [InlineData(2, 1)]
[InlineData(2, 2)] [InlineData(2, 2)]
public async void GetExternalStreams_StreamIndex_HandlesFilesAndContainers(int fileCount, int streamCount) public async Task GetExternalStreams_StreamIndex_HandlesFilesAndContainers(int fileCount, int streamCount)
{ {
BaseItem.MediaSourceManager = Mock.Of<IMediaSourceManager>(); BaseItem.MediaSourceManager = Mock.Of<IMediaSourceManager>();

View File

@ -64,7 +64,7 @@ public class SubtitleResolverTests
[InlineData("My.Video.mp3", false, false)] [InlineData("My.Video.mp3", false, false)]
[InlineData("My.Video.srt", true, true)] [InlineData("My.Video.srt", true, true)]
[InlineData("My.Video.mp3", true, false)] [InlineData("My.Video.mp3", true, false)]
public async void GetExternalStreams_MixedFilenames_PicksSubtitles(string file, bool metadataDirectory, bool matches) public async Task GetExternalStreams_MixedFilenames_PicksSubtitles(string file, bool metadataDirectory, bool matches)
{ {
BaseItem.MediaSourceManager = Mock.Of<IMediaSourceManager>(); BaseItem.MediaSourceManager = Mock.Of<IMediaSourceManager>();

View File

@ -34,7 +34,7 @@ namespace Jellyfin.Providers.Tests.MediaInfo
[Theory] [Theory]
[MemberData(nameof(GetImage_UnsupportedInput_ReturnsNoImage_TestData))] [MemberData(nameof(GetImage_UnsupportedInput_ReturnsNoImage_TestData))]
public async void GetImage_UnsupportedInput_ReturnsNoImage(Video input) public async Task GetImage_UnsupportedInput_ReturnsNoImage(Video input)
{ {
var mediaSourceManager = GetMediaSourceManager(input, null, new List<MediaStream>()); var mediaSourceManager = GetMediaSourceManager(input, null, new List<MediaStream>());
var videoImageProvider = new VideoImageProvider(mediaSourceManager, Mock.Of<IMediaEncoder>(), new NullLogger<VideoImageProvider>()); var videoImageProvider = new VideoImageProvider(mediaSourceManager, Mock.Of<IMediaEncoder>(), new NullLogger<VideoImageProvider>());
@ -47,7 +47,7 @@ namespace Jellyfin.Providers.Tests.MediaInfo
[Theory] [Theory]
[InlineData(1, 1)] // default not first stream [InlineData(1, 1)] // default not first stream
[InlineData(5, 0)] // default out of valid range [InlineData(5, 0)] // default out of valid range
public async void GetImage_DefaultVideoStreams_ReturnsCorrectStreamImage(int defaultIndex, int targetIndex) public async Task GetImage_DefaultVideoStreams_ReturnsCorrectStreamImage(int defaultIndex, int targetIndex)
{ {
var input = new Movie { DefaultVideoStreamIndex = defaultIndex }; var input = new Movie { DefaultVideoStreamIndex = defaultIndex };
@ -80,7 +80,7 @@ namespace Jellyfin.Providers.Tests.MediaInfo
[Theory] [Theory]
[InlineData(null, 10)] // default time [InlineData(null, 10)] // default time
[InlineData(500, 50)] // calculated time [InlineData(500, 50)] // calculated time
public async void GetImage_TimeSpan_SelectsCorrectTime(int? runTimeSeconds, long expectedSeconds) public async Task GetImage_TimeSpan_SelectsCorrectTime(int? runTimeSeconds, long expectedSeconds)
{ {
MediaStream targetStream = new() { Type = MediaStreamType.Video, Index = 0 }; MediaStream targetStream = new() { Type = MediaStreamType.Video, Index = 0 };
var input = new Movie var input = new Movie