Fix unit tests after merge from master

Co-authored-by: Bond-009 <bond.009@outlook.com>
pull/7039/head
Joe Rogers 2 years ago committed by GitHub
parent 81b04ddbb5
commit 6252bc399a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -30,7 +30,7 @@ namespace Jellyfin.Providers.Tests.Manager
{ {
private static readonly ILogger<ProviderManager> _logger = new NullLogger<ProviderManager>(); private static readonly ILogger<ProviderManager> _logger = new NullLogger<ProviderManager>();
private static TheoryData<Mock<IMetadataService>[], int> RefreshSingleItemOrderData() public static TheoryData<Mock<IMetadataService>[], int> RefreshSingleItemOrderData()
=> new() => new()
{ {
// no order set, uses provided order // no order set, uses provided order
@ -74,7 +74,7 @@ namespace Jellyfin.Providers.Tests.Manager
[Theory] [Theory]
[MemberData(nameof(RefreshSingleItemOrderData))] [MemberData(nameof(RefreshSingleItemOrderData))]
public void RefreshSingleItem_ServiceOrdering_FollowsPriority(Mock<IMetadataService>[] servicesList, int expectedIndex) public async Task RefreshSingleItem_ServiceOrdering_FollowsPriority(Mock<IMetadataService>[] servicesList, int expectedIndex)
{ {
var item = new Movie(); var item = new Movie();
@ -82,9 +82,9 @@ namespace Jellyfin.Providers.Tests.Manager
AddParts(providerManager, metadataServices: servicesList.Select(s => s.Object).ToArray()); AddParts(providerManager, metadataServices: servicesList.Select(s => s.Object).ToArray());
var refreshOptions = new MetadataRefreshOptions(Mock.Of<IDirectoryService>(MockBehavior.Strict)); var refreshOptions = new MetadataRefreshOptions(Mock.Of<IDirectoryService>(MockBehavior.Strict));
var actual = providerManager.RefreshSingleItem(item, refreshOptions, CancellationToken.None); var actual = await providerManager.RefreshSingleItem(item, refreshOptions, CancellationToken.None).ConfigureAwait(false);
Assert.Equal(ItemUpdateType.MetadataDownload, actual.Result); Assert.Equal(ItemUpdateType.MetadataDownload, actual);
for (var i = 0; i < servicesList.Length; i++) for (var i = 0; i < servicesList.Length; i++)
{ {
var times = i == expectedIndex ? Times.Once() : Times.Never(); var times = i == expectedIndex ? Times.Once() : Times.Never();
@ -95,7 +95,7 @@ namespace Jellyfin.Providers.Tests.Manager
[Theory] [Theory]
[InlineData(true)] [InlineData(true)]
[InlineData(false)] [InlineData(false)]
public void RefreshSingleItem_RefreshMetadata_WhenServiceFound(bool serviceFound) public async Task RefreshSingleItem_RefreshMetadata_WhenServiceFound(bool serviceFound)
{ {
var item = new Movie(); var item = new Movie();
@ -105,13 +105,13 @@ namespace Jellyfin.Providers.Tests.Manager
AddParts(providerManager, metadataServices: servicesList.Select(s => s.Object).ToArray()); AddParts(providerManager, metadataServices: servicesList.Select(s => s.Object).ToArray());
var refreshOptions = new MetadataRefreshOptions(Mock.Of<IDirectoryService>(MockBehavior.Strict)); var refreshOptions = new MetadataRefreshOptions(Mock.Of<IDirectoryService>(MockBehavior.Strict));
var actual = providerManager.RefreshSingleItem(item, refreshOptions, CancellationToken.None); var actual = await providerManager.RefreshSingleItem(item, refreshOptions, CancellationToken.None).ConfigureAwait(false);
var expectedResult = serviceFound ? ItemUpdateType.MetadataDownload : ItemUpdateType.None; var expectedResult = serviceFound ? ItemUpdateType.MetadataDownload : ItemUpdateType.None;
Assert.Equal(expectedResult, actual.Result); Assert.Equal(expectedResult, actual);
} }
private static TheoryData<int, int[]?, int[]?, int?[]?, int[]> GetImageProvidersOrderData() public static TheoryData<int, int[]?, int[]?, int?[]?, int[]> GetImageProvidersOrderData()
=> new() => new()
{ {
{ 3, null, null, null, new[] { 0, 1, 2 } }, // no order options set { 3, null, null, null, new[] { 0, 1, 2 } }, // no order options set
@ -236,7 +236,7 @@ namespace Jellyfin.Providers.Tests.Manager
Assert.Equal(expected ? 1 : 0, actualProviders.Length); Assert.Equal(expected ? 1 : 0, actualProviders.Length);
} }
private static TheoryData<string[], int[]?, int[]?, int[]?, int[]?, int?[]?, int[]> GetMetadataProvidersOrderData() public static TheoryData<string[], int[]?, int[]?, int[]?, int[]?, int?[]?, int[]> GetMetadataProvidersOrderData()
{ {
var l = nameof(ILocalMetadataProvider); var l = nameof(ILocalMetadataProvider);
var r = nameof(IRemoteMetadataProvider); var r = nameof(IRemoteMetadataProvider);

Loading…
Cancel
Save