Add music album nfo parser test
This commit is contained in:
parent
ccea02fbb2
commit
d71dce50ca
|
@ -0,0 +1,72 @@
|
|||
#pragma warning disable CA5369
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using MediaBrowser.Common.Configuration;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Providers;
|
||||
using MediaBrowser.XbmcMetadata.Parsers;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using Moq;
|
||||
using Xunit;
|
||||
|
||||
namespace Jellyfin.XbmcMetadata.Tests.Parsers
|
||||
{
|
||||
public class MusicAlbumNfoProviderTests
|
||||
{
|
||||
private readonly BaseNfoParser<MusicAlbum> _parser;
|
||||
|
||||
public MusicAlbumNfoProviderTests()
|
||||
{
|
||||
var providerManager = new Mock<IProviderManager>();
|
||||
providerManager.Setup(x => x.GetExternalIdInfos(It.IsAny<IHasProviderIds>()))
|
||||
.Returns(Enumerable.Empty<ExternalIdInfo>());
|
||||
var config = new Mock<IConfigurationManager>();
|
||||
config.Setup(x => x.GetConfiguration(It.IsAny<string>()))
|
||||
.Returns(new XbmcMetadataOptions());
|
||||
_parser = new BaseNfoParser<MusicAlbum>(new NullLogger<BaseNfoParser<MusicAlbum>>(), config.Object, providerManager.Object);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Fetch_Valid_Succes()
|
||||
{
|
||||
var result = new MetadataResult<MusicAlbum>()
|
||||
{
|
||||
Item = new MusicAlbum()
|
||||
};
|
||||
|
||||
_parser.Fetch(result, "Test Data/The Best of 1980-1990.nfo", CancellationToken.None);
|
||||
var item = result.Item;
|
||||
|
||||
Assert.Equal("The Best of 1980-1990", item.Name);
|
||||
Assert.Equal(1989, item.ProductionYear);
|
||||
Assert.Contains("Pop", item.Genres);
|
||||
Assert.Single(item.Genres);
|
||||
Assert.Contains("Rock/Pop", item.Tags);
|
||||
Assert.Equal("The Best of 1980-1990 is the first greatest hits compilation by Irish rock band U2, released in November 1998. It mostly contains the group's hit singles from the eighties but also mixes in some live staples as well as one new recording, Sweetest Thing. In April 1999, a companion video (featuring music videos and live footage) was released. The album was followed by another compilation, The Best of 1990-2000, in 2002.\nA limited edition version containing a special B-sides disc was released on the same date as the single-disc version. At the time of release, the official word was that the 2-disc album would be available the first week the album went on sale, then pulled from the stores. While this threat never materialized, it did result in the 2-disc version being in very high demand. Both versions charted in the Billboard 200.\nThe boy on the cover is Peter Rowan, brother of Bono's friend Guggi (real name Derek Rowan) of the Virgin Prunes. He also appears on the covers of the early EP Three, two of the band's first three albums (Boy and War), and Early Demos.", item.Overview);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Fetch_WithNullItem_ThrowsArgumentException()
|
||||
{
|
||||
var result = new MetadataResult<MusicAlbum>();
|
||||
|
||||
Assert.Throws<ArgumentException>(() => _parser.Fetch(result, "Test Data/The Best of 1980-1990.nfo", CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Fetch_NullResult_ThrowsArgumentException()
|
||||
{
|
||||
var result = new MetadataResult<MusicAlbum>()
|
||||
{
|
||||
Item = new MusicAlbum()
|
||||
};
|
||||
|
||||
Assert.Throws<ArgumentException>(() => _parser.Fetch(result, string.Empty, CancellationToken.None));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<album>
|
||||
<title>The Best of 1980-1990</title>
|
||||
<musicbrainzalbumid>59b5a40b-e2fd-3f18-a218-e8c9aae12ab5</musicbrainzalbumid>
|
||||
<musicbrainzreleasegroupid>6c301dbd-6ccb-3403-a6c4-6a22240a0297</musicbrainzreleasegroupid>
|
||||
<scrapedmbid>false</scrapedmbid>
|
||||
<artistdesc>U2</artistdesc>
|
||||
<genre>Pop</genre>
|
||||
<style>Rock/Pop</style>
|
||||
<mood>Political</mood>
|
||||
<compilation>false</compilation>
|
||||
<review>The Best of 1980-1990 is the first greatest hits compilation by Irish rock band U2, released in November 1998. It mostly contains the group's hit singles from the eighties but also mixes in some live staples as well as one new recording, Sweetest Thing. In April 1999, a companion video (featuring music videos and live footage) was released. The album was followed by another compilation, The Best of 1990-2000, in 2002.
A limited edition version containing a special B-sides disc was released on the same date as the single-disc version. At the time of release, the official word was that the 2-disc album would be available the first week the album went on sale, then pulled from the stores. While this threat never materialized, it did result in the 2-disc version being in very high demand. Both versions charted in the Billboard 200.
The boy on the cover is Peter Rowan, brother of Bono's friend Guggi (real name Derek Rowan) of the Virgin Prunes. He also appears on the covers of the early EP Three, two of the band's first three albums (Boy and War), and Early Demos.</review>
|
||||
<type>album / compilation</type>
|
||||
<releasedate></releasedate>
|
||||
<label>Island</label>
|
||||
<thumb preview="https://assets.fanart.tv/preview/music/a3cb23fc-acd3-4ce0-8f36-1e5aa6a18432/albumcover/the-best-of-1980-1990-4e43a22cab023.jpg">https://assets.fanart.tv/fanart/music/a3cb23fc-acd3-4ce0-8f36-1e5aa6a18432/albumcover/the-best-of-1980-1990-4e43a22cab023.jpg</thumb>
|
||||
<thumb preview="https://assets.fanart.tv/preview/music/a3cb23fc-acd3-4ce0-8f36-1e5aa6a18432/albumcover/the-best-of-1980-1990-5bc4301068645.jpg">https://assets.fanart.tv/fanart/music/a3cb23fc-acd3-4ce0-8f36-1e5aa6a18432/albumcover/the-best-of-1980-1990-5bc4301068645.jpg</thumb>
|
||||
<thumb preview="https://www.theaudiodb.com/images/media/album/thumb/the-best-of-1980-1990-4e43a22cab023.jpg/preview">https://www.theaudiodb.com/images/media/album/thumb/the-best-of-1980-1990-4e43a22cab023.jpg</thumb>
|
||||
<path>C:\KODI\Test- Music\U2\Best Of 1980-1990, The\</path>
|
||||
<rating max="10">-1.000000</rating>
|
||||
<userrating max="10">-1</userrating>
|
||||
<votes>-1</votes>
|
||||
<year>1989</year>
|
||||
<albumArtistCredits>
|
||||
<artist>U2</artist>
|
||||
<musicBrainzArtistID>a3cb23fc-acd3-4ce0-8f36-1e5aa6a18432</musicBrainzArtistID>
|
||||
</albumArtistCredits>
|
||||
<releasetype>album</releasetype>
|
||||
</album>
|
Loading…
Reference in New Issue
Block a user