mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 05:47:14 -04:00
Switch to nameof to simplify theory signatures
This commit is contained in:
parent
a7c009e2eb
commit
6ab64f4930
@ -77,32 +77,32 @@ namespace Jellyfin.Providers.Tests.Manager
|
|||||||
[InlineData(true, true, false)]
|
[InlineData(true, true, false)]
|
||||||
public void GetImageProviders_CanRefreshImagesBasic_WhenSupportsWithoutError(bool supports, bool errorOnSupported, bool expected)
|
public void GetImageProviders_CanRefreshImagesBasic_WhenSupportsWithoutError(bool supports, bool errorOnSupported, bool expected)
|
||||||
{
|
{
|
||||||
GetImageProviders_CanRefreshImages_Tester(typeof(IImageProvider), supports, expected, errorOnSupported: errorOnSupported);
|
GetImageProviders_CanRefreshImages_Tester(nameof(IImageProvider), supports, expected, errorOnSupported: errorOnSupported);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(typeof(ILocalImageProvider), false, true)]
|
[InlineData(nameof(ILocalImageProvider), false, true)]
|
||||||
[InlineData(typeof(ILocalImageProvider), true, true)]
|
[InlineData(nameof(ILocalImageProvider), true, true)]
|
||||||
[InlineData(typeof(IImageProvider), false, false)]
|
[InlineData(nameof(IImageProvider), false, false)]
|
||||||
[InlineData(typeof(IImageProvider), true, true)]
|
[InlineData(nameof(IImageProvider), true, true)]
|
||||||
public void GetImageProviders_CanRefreshImagesLocked_WhenLocalOrFullRefresh(Type providerType, bool fullRefresh, bool expected)
|
public void GetImageProviders_CanRefreshImagesLocked_WhenLocalOrFullRefresh(string providerType, bool fullRefresh, bool expected)
|
||||||
{
|
{
|
||||||
GetImageProviders_CanRefreshImages_Tester(providerType, true, expected, itemLocked: true, fullRefresh: fullRefresh);
|
GetImageProviders_CanRefreshImages_Tester(providerType, true, expected, itemLocked: true, fullRefresh: fullRefresh);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(typeof(ILocalImageProvider), false, true)]
|
[InlineData(nameof(ILocalImageProvider), false, true)]
|
||||||
[InlineData(typeof(IRemoteImageProvider), true, true)]
|
[InlineData(nameof(IRemoteImageProvider), true, true)]
|
||||||
[InlineData(typeof(IDynamicImageProvider), true, true)]
|
[InlineData(nameof(IDynamicImageProvider), true, true)]
|
||||||
[InlineData(typeof(IRemoteImageProvider), false, false)]
|
[InlineData(nameof(IRemoteImageProvider), false, false)]
|
||||||
[InlineData(typeof(IDynamicImageProvider), false, false)]
|
[InlineData(nameof(IDynamicImageProvider), false, false)]
|
||||||
public void GetImageProviders_CanRefreshImagesBaseItemEnabled_WhenLocalOrEnabled(Type providerType, bool enabled, bool expected)
|
public void GetImageProviders_CanRefreshImagesBaseItemEnabled_WhenLocalOrEnabled(string providerType, bool enabled, bool expected)
|
||||||
{
|
{
|
||||||
GetImageProviders_CanRefreshImages_Tester(providerType, true, expected, baseItemEnabled: enabled);
|
GetImageProviders_CanRefreshImages_Tester(providerType, true, expected, baseItemEnabled: enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void GetImageProviders_CanRefreshImages_Tester(
|
private static void GetImageProviders_CanRefreshImages_Tester(
|
||||||
Type providerType,
|
string providerType,
|
||||||
bool supports,
|
bool supports,
|
||||||
bool expected,
|
bool expected,
|
||||||
bool errorOnSupported = false,
|
bool errorOnSupported = false,
|
||||||
@ -116,7 +116,7 @@ namespace Jellyfin.Providers.Tests.Manager
|
|||||||
};
|
};
|
||||||
|
|
||||||
var providerName = "provider";
|
var providerName = "provider";
|
||||||
IImageProvider provider = providerType.Name switch
|
IImageProvider provider = providerType switch
|
||||||
{
|
{
|
||||||
"IImageProvider" => MockIImageProvider<IImageProvider>(providerName, item, supports: supports, errorOnSupported: errorOnSupported),
|
"IImageProvider" => MockIImageProvider<IImageProvider>(providerName, item, supports: supports, errorOnSupported: errorOnSupported),
|
||||||
"ILocalImageProvider" => MockIImageProvider<ILocalImageProvider>(providerName, item, supports: supports, errorOnSupported: errorOnSupported),
|
"ILocalImageProvider" => MockIImageProvider<ILocalImageProvider>(providerName, item, supports: supports, errorOnSupported: errorOnSupported),
|
||||||
@ -233,57 +233,57 @@ namespace Jellyfin.Providers.Tests.Manager
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(typeof(IMetadataProvider))]
|
[InlineData(nameof(IMetadataProvider))]
|
||||||
[InlineData(typeof(ILocalMetadataProvider))]
|
[InlineData(nameof(ILocalMetadataProvider))]
|
||||||
[InlineData(typeof(IRemoteMetadataProvider))]
|
[InlineData(nameof(IRemoteMetadataProvider))]
|
||||||
[InlineData(typeof(ICustomMetadataProvider))]
|
[InlineData(nameof(ICustomMetadataProvider))]
|
||||||
public void GetMetadataProviders_CanRefreshMetadataBasic_ReturnsTrue(Type providerType)
|
public void GetMetadataProviders_CanRefreshMetadataBasic_ReturnsTrue(string providerType)
|
||||||
{
|
{
|
||||||
GetMetadataProviders_CanRefreshMetadata_Tester(providerType, true);
|
GetMetadataProviders_CanRefreshMetadata_Tester(providerType, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(typeof(ILocalMetadataProvider), false, true)]
|
[InlineData(nameof(ILocalMetadataProvider), false, true)]
|
||||||
[InlineData(typeof(IRemoteMetadataProvider), false, false)]
|
[InlineData(nameof(IRemoteMetadataProvider), false, false)]
|
||||||
[InlineData(typeof(ICustomMetadataProvider), false, false)]
|
[InlineData(nameof(ICustomMetadataProvider), false, false)]
|
||||||
[InlineData(typeof(ILocalMetadataProvider), true, true)]
|
[InlineData(nameof(ILocalMetadataProvider), true, true)]
|
||||||
[InlineData(typeof(ICustomMetadataProvider), true, false)]
|
[InlineData(nameof(ICustomMetadataProvider), true, false)]
|
||||||
public void GetMetadataProviders_CanRefreshMetadataLocked_WhenLocalOrForced(Type providerType, bool forced, bool expected)
|
public void GetMetadataProviders_CanRefreshMetadataLocked_WhenLocalOrForced(string providerType, bool forced, bool expected)
|
||||||
{
|
{
|
||||||
GetMetadataProviders_CanRefreshMetadata_Tester(providerType, expected, itemLocked: true, providerForced: forced);
|
GetMetadataProviders_CanRefreshMetadata_Tester(providerType, expected, itemLocked: true, providerForced: forced);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(typeof(ILocalMetadataProvider), false, true)]
|
[InlineData(nameof(ILocalMetadataProvider), false, true)]
|
||||||
[InlineData(typeof(ICustomMetadataProvider), false, true)]
|
[InlineData(nameof(ICustomMetadataProvider), false, true)]
|
||||||
[InlineData(typeof(IRemoteMetadataProvider), false, false)]
|
[InlineData(nameof(IRemoteMetadataProvider), false, false)]
|
||||||
[InlineData(typeof(IRemoteMetadataProvider), true, true)]
|
[InlineData(nameof(IRemoteMetadataProvider), true, true)]
|
||||||
public void GetMetadataProviders_CanRefreshMetadataBaseItemEnabled_WhenEnabledOrNotRemote(Type providerType, bool baseItemEnabled, bool expected)
|
public void GetMetadataProviders_CanRefreshMetadataBaseItemEnabled_WhenEnabledOrNotRemote(string providerType, bool baseItemEnabled, bool expected)
|
||||||
{
|
{
|
||||||
GetMetadataProviders_CanRefreshMetadata_Tester(providerType, expected, baseItemEnabled: baseItemEnabled);
|
GetMetadataProviders_CanRefreshMetadata_Tester(providerType, expected, baseItemEnabled: baseItemEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(typeof(IRemoteMetadataProvider), false, true)]
|
[InlineData(nameof(IRemoteMetadataProvider), false, true)]
|
||||||
[InlineData(typeof(ICustomMetadataProvider), false, true)]
|
[InlineData(nameof(ICustomMetadataProvider), false, true)]
|
||||||
[InlineData(typeof(ILocalMetadataProvider), false, false)]
|
[InlineData(nameof(ILocalMetadataProvider), false, false)]
|
||||||
[InlineData(typeof(ILocalMetadataProvider), true, true)]
|
[InlineData(nameof(ILocalMetadataProvider), true, true)]
|
||||||
public void GetMetadataProviders_CanRefreshMetadataSupportsLocal_WhenSupportsOrNotLocal(Type providerType, bool supportsLocalMetadata, bool expected)
|
public void GetMetadataProviders_CanRefreshMetadataSupportsLocal_WhenSupportsOrNotLocal(string providerType, bool supportsLocalMetadata, bool expected)
|
||||||
{
|
{
|
||||||
GetMetadataProviders_CanRefreshMetadata_Tester(providerType, expected, supportsLocalMetadata: supportsLocalMetadata);
|
GetMetadataProviders_CanRefreshMetadata_Tester(providerType, expected, supportsLocalMetadata: supportsLocalMetadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(typeof(ICustomMetadataProvider), true)]
|
[InlineData(nameof(ICustomMetadataProvider), true)]
|
||||||
[InlineData(typeof(IRemoteMetadataProvider), false)]
|
[InlineData(nameof(IRemoteMetadataProvider), false)]
|
||||||
[InlineData(typeof(ILocalMetadataProvider), false)]
|
[InlineData(nameof(ILocalMetadataProvider), false)]
|
||||||
public void GetMetadataProviders_CanRefreshMetadataOwned_WhenNotLocal(Type providerType, bool expected)
|
public void GetMetadataProviders_CanRefreshMetadataOwned_WhenNotLocal(string providerType, bool expected)
|
||||||
{
|
{
|
||||||
GetMetadataProviders_CanRefreshMetadata_Tester(providerType, expected, ownedItem: true);
|
GetMetadataProviders_CanRefreshMetadata_Tester(providerType, expected, ownedItem: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void GetMetadataProviders_CanRefreshMetadata_Tester(
|
private static void GetMetadataProviders_CanRefreshMetadata_Tester(
|
||||||
Type providerType,
|
string providerType,
|
||||||
bool expected,
|
bool expected,
|
||||||
bool itemLocked = false,
|
bool itemLocked = false,
|
||||||
bool baseItemEnabled = true,
|
bool baseItemEnabled = true,
|
||||||
@ -299,7 +299,7 @@ namespace Jellyfin.Providers.Tests.Manager
|
|||||||
};
|
};
|
||||||
|
|
||||||
var providerName = "provider";
|
var providerName = "provider";
|
||||||
var provider = MockIMetadataProviderMapper<MetadataTestItem, MetadataTestItemInfo>(providerType.Name, providerName, forced: providerForced);
|
var provider = MockIMetadataProviderMapper<MetadataTestItem, MetadataTestItemInfo>(providerType, providerName, forced: providerForced);
|
||||||
|
|
||||||
var baseItemManager = new Mock<IBaseItemManager>(MockBehavior.Strict);
|
var baseItemManager = new Mock<IBaseItemManager>(MockBehavior.Strict);
|
||||||
baseItemManager.Setup(i => i.IsMetadataFetcherEnabled(item, It.IsAny<TypeOptions>(), providerName))
|
baseItemManager.Setup(i => i.IsMetadataFetcherEnabled(item, It.IsAny<TypeOptions>(), providerName))
|
||||||
|
Loading…
Reference in New Issue
Block a user