mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 18:08:53 -07:00
fix HasProviderId and add tests
This commit is contained in:
parent
a49f5d2a44
commit
8b72b902f5
@ -22,7 +22,7 @@ namespace MediaBrowser.Model.Entities
|
||||
throw new ArgumentNullException(nameof(instance));
|
||||
}
|
||||
|
||||
return instance.ProviderIds?.ContainsKey(name) ?? false;
|
||||
return instance.TryGetProviderId(name, out _);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -47,6 +47,15 @@ namespace Jellyfin.Model.Tests.Entities
|
||||
Assert.True(provider.HasProviderId(MetadataProvider.Imdb));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void HasProviderId_FoundNameEmptyValue_False()
|
||||
{
|
||||
var provider = new ProviderIdsExtensionsTestsObject();
|
||||
provider.ProviderIds[MetadataProvider.Imdb.ToString()] = string.Empty;
|
||||
|
||||
Assert.False(provider.HasProviderId(MetadataProvider.Imdb));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetProviderId_NullInstance_ThrowsArgumentNullException()
|
||||
{
|
||||
@ -112,6 +121,16 @@ namespace Jellyfin.Model.Tests.Entities
|
||||
Assert.Equal(ExampleImdbId, id);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TryGetProviderId_FoundNameEmptyValue_False()
|
||||
{
|
||||
var provider = new ProviderIdsExtensionsTestsObject();
|
||||
provider.ProviderIds[MetadataProvider.Imdb.ToString()] = string.Empty;
|
||||
|
||||
Assert.False(provider.TryGetProviderId(MetadataProvider.Imdb, out var id));
|
||||
Assert.Null(id);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SetProviderId_NullInstance_ThrowsArgumentNullException()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user