@ -17,14 +17,13 @@ using NzbDrone.Test.Common;
namespace NzbDrone.Core.Test.MediaFiles.AudioTagServiceFixture
namespace NzbDrone.Core.Test.MediaFiles.AudioTagServiceFixture
{
{
[TestFixture]
[TestFixture]
[Ignore("Readarr doesn't currently support audio")]
public class AudioTagServiceFixture : CoreTest < AudioTagService >
public class AudioTagServiceFixture : CoreTest < AudioTagService >
{
{
public static class TestCaseFactory
public static class TestCaseFactory
{
{
private static readonly string [ ] MediaFiles = new [ ] { "nin.mp2" , "nin.mp3" , "nin.flac" , "nin.m4a" , "nin.wma" , "nin.ape" , "nin.opus" } ;
private static readonly string [ ] MediaFiles = new [ ] { "nin.mp2" , "nin.mp3" , "nin.flac" , "nin.m4a" , "nin.wma" , "nin.ape" , "nin.opus" } ;
private static readonly string [ ] SkipProperties = new [ ] { "IsValid" , "Duration" , "Quality" , "MediaInfo" , "ImageFile" } ;
private static readonly string [ ] SkipProperties = new [ ] { "IsValid" , "Duration" , "Quality" , "MediaInfo" , "ImageFile" , "BookAuthors" } ;
private static readonly Dictionary < string , string [ ] > SkipPropertiesByFile = new Dictionary < string , string [ ] >
private static readonly Dictionary < string , string [ ] > SkipPropertiesByFile = new Dictionary < string , string [ ] >
{
{
{ "nin.mp2" , new [ ] { "OriginalReleaseDate" } }
{ "nin.mp2" , new [ ] { "OriginalReleaseDate" } }
@ -194,6 +193,9 @@ namespace NzbDrone.Core.Test.MediaFiles.AudioTagServiceFixture
var writtentags = Subject . ReadAudioTag ( path ) ;
var writtentags = Subject . ReadAudioTag ( path ) ;
VerifySame ( writtentags , _testTags , skipProperties ) ;
VerifySame ( writtentags , _testTags , skipProperties ) ;
writtentags . BookAuthors . Should ( ) . BeEquivalentTo (
_testTags . BookAuthors . Concat ( _testTags . Performers ) ,
options = > options . WithStrictOrdering ( ) ) ;
}
}
[Test]
[Test]
@ -337,12 +339,12 @@ namespace NzbDrone.Core.Test.MediaFiles.AudioTagServiceFixture
[Test]
[Test]
public void should_not_fail_if_media_has_been_omitted ( )
public void should_not_fail_if_media_has_been_omitted ( )
{
{
// make sure that we aren't relying on index of items in
GivenFileCopy ( "nin.mp3" ) ;
// Media being the same as the medium number
var file = GivenPopulatedTrackfile ( 100 ) ;
var file = GivenPopulatedTrackfile ( 100 ) ;
var tag = Subject . GetTrackMetadata ( file ) ;
file . Path = _copiedFile ;
tag. Media . Should ( ) . NotBeNull ( ) ;
Assert. DoesNotThrow ( ( ) = > Subject . GetTrackMetadata ( file ) ) ;
}
}
[TestCase("nin.mp3")]
[TestCase("nin.mp3")]
@ -363,5 +365,18 @@ namespace NzbDrone.Core.Test.MediaFiles.AudioTagServiceFixture
file . Modified . Should ( ) . Be ( fileInfo . LastWriteTimeUtc ) ;
file . Modified . Should ( ) . Be ( fileInfo . LastWriteTimeUtc ) ;
file . Size . Should ( ) . Be ( fileInfo . Length ) ;
file . Size . Should ( ) . Be ( fileInfo . Length ) ;
}
}
[Test]
public void should_not_fail_reading_metadata_with_dates_omitted ( )
{
GivenFileCopy ( "nin.mp3" ) ;
var bookFile = GivenPopulatedTrackfile ( 0 ) ;
bookFile . Path = _copiedFile ;
bookFile . Edition . Value . ReleaseDate = null ;
bookFile . Edition . Value . Book . Value . ReleaseDate = null ;
Assert . DoesNotThrow ( ( ) = > Subject . GetTrackMetadata ( bookFile ) ) ;
}
}
}
}
}