mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-25 22:36:59 -04:00
Cleanup Conflicts in Sonarr/Lidarr Pulls
Co-Authored-By: Robin Dadswell <19610103+RobinDadswell@users.noreply.github.com>
This commit is contained in:
@@ -78,7 +78,7 @@ namespace NzbDrone.Core.Test.MediaFiles.AudioTagServiceFixture
|
||||
.With(x => x.OriginalReleaseDate = new DateTime(2009, 4, 1))
|
||||
.With(x => x.OriginalYear = 2009)
|
||||
.With(x => x.Performers = new[] { "Performer1" })
|
||||
.With(x => x.AlbumArtists = new[] { "방탄소년단" })
|
||||
.With(x => x.BookAuthors = new[] { "방탄소년단" })
|
||||
.With(x => x.Genres = new[] { "Genre1", "Genre2" })
|
||||
.With(x => x.ImageFile = imageFile)
|
||||
.With(x => x.ImageSize = imageSize)
|
||||
@@ -209,7 +209,7 @@ namespace NzbDrone.Core.Test.MediaFiles.AudioTagServiceFixture
|
||||
var expected = new AudioTag()
|
||||
{
|
||||
Performers = new string[0],
|
||||
AlbumArtists = new string[0],
|
||||
BookAuthors = new string[0],
|
||||
Genres = new string[0]
|
||||
};
|
||||
|
||||
@@ -307,21 +307,21 @@ namespace NzbDrone.Core.Test.MediaFiles.AudioTagServiceFixture
|
||||
private BookFile GivenPopulatedTrackfile(int mediumOffset)
|
||||
{
|
||||
var meta = Builder<AuthorMetadata>.CreateNew().Build();
|
||||
var artist = Builder<Author>.CreateNew()
|
||||
var author = Builder<Author>.CreateNew()
|
||||
.With(x => x.Metadata = meta)
|
||||
.Build();
|
||||
|
||||
var album = Builder<Book>.CreateNew()
|
||||
.With(x => x.Author = artist)
|
||||
var book = Builder<Book>.CreateNew()
|
||||
.With(x => x.Author = author)
|
||||
.Build();
|
||||
|
||||
var edition = Builder<Edition>.CreateNew()
|
||||
.With(x => x.Book = album)
|
||||
.With(x => x.Book = book)
|
||||
.Build();
|
||||
|
||||
var file = Builder<BookFile>.CreateNew()
|
||||
.With(x => x.Edition = edition)
|
||||
.With(x => x.Author = artist)
|
||||
.With(x => x.Author = author)
|
||||
.Build();
|
||||
|
||||
return file;
|
||||
|
||||
@@ -9,6 +9,7 @@ using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.BookImport;
|
||||
@@ -31,11 +32,11 @@ namespace NzbDrone.Core.Test.MediaFiles.DiskScanServiceTests
|
||||
public void Setup()
|
||||
{
|
||||
_rootFolder = @"C:\Test\Music".AsOsAgnostic();
|
||||
_otherAuthorFolder = @"C:\Test\Music\OtherArtist".AsOsAgnostic();
|
||||
var artistFolder = @"C:\Test\Music\Artist".AsOsAgnostic();
|
||||
_otherAuthorFolder = @"C:\Test\Music\OtherAuthor".AsOsAgnostic();
|
||||
var authorFolder = @"C:\Test\Music\Author".AsOsAgnostic();
|
||||
|
||||
_author = Builder<Author>.CreateNew()
|
||||
.With(s => s.Path = artistFolder)
|
||||
.With(s => s.Path = authorFolder)
|
||||
.Build();
|
||||
|
||||
Mocker.GetMock<IRootFolderService>()
|
||||
@@ -73,7 +74,7 @@ namespace NzbDrone.Core.Test.MediaFiles.DiskScanServiceTests
|
||||
}
|
||||
}
|
||||
|
||||
private void GivenArtistFolder()
|
||||
private void GivenAuthorFolder()
|
||||
{
|
||||
GivenRootFolder(_author.Path);
|
||||
}
|
||||
@@ -161,9 +162,9 @@ namespace NzbDrone.Core.Test.MediaFiles.DiskScanServiceTests
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_find_files_at_root_of_artist_folder()
|
||||
public void should_find_files_at_root_of_author_folder()
|
||||
{
|
||||
GivenArtistFolder();
|
||||
GivenAuthorFolder();
|
||||
|
||||
GivenFiles(new List<string>
|
||||
{
|
||||
@@ -180,7 +181,7 @@ namespace NzbDrone.Core.Test.MediaFiles.DiskScanServiceTests
|
||||
[Test]
|
||||
public void should_not_scan_extras_subfolder()
|
||||
{
|
||||
GivenArtistFolder();
|
||||
GivenAuthorFolder();
|
||||
|
||||
GivenFiles(new List<string>
|
||||
{
|
||||
@@ -200,7 +201,7 @@ namespace NzbDrone.Core.Test.MediaFiles.DiskScanServiceTests
|
||||
[Test]
|
||||
public void should_not_scan_AppleDouble_subfolder()
|
||||
{
|
||||
GivenArtistFolder();
|
||||
GivenAuthorFolder();
|
||||
|
||||
GivenFiles(new List<string>
|
||||
{
|
||||
@@ -216,11 +217,11 @@ namespace NzbDrone.Core.Test.MediaFiles.DiskScanServiceTests
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_scan_extras_artist_and_subfolders()
|
||||
public void should_scan_extras_author_and_subfolders()
|
||||
{
|
||||
_author.Path = @"C:\Test\Music\Extras".AsOsAgnostic();
|
||||
|
||||
GivenArtistFolder();
|
||||
GivenAuthorFolder();
|
||||
|
||||
GivenFiles(new List<string>
|
||||
{
|
||||
@@ -241,11 +242,11 @@ namespace NzbDrone.Core.Test.MediaFiles.DiskScanServiceTests
|
||||
[Test]
|
||||
public void should_scan_files_that_start_with_period()
|
||||
{
|
||||
GivenArtistFolder();
|
||||
GivenAuthorFolder();
|
||||
|
||||
GivenFiles(new List<string>
|
||||
{
|
||||
Path.Combine(_author.Path, "Album 1", ".t01.mobi")
|
||||
Path.Combine(_author.Path, "Book 1", ".t01.mobi")
|
||||
});
|
||||
|
||||
Subject.Scan(new List<string> { _author.Path });
|
||||
@@ -257,7 +258,7 @@ namespace NzbDrone.Core.Test.MediaFiles.DiskScanServiceTests
|
||||
[Test]
|
||||
public void should_not_scan_subfolders_that_start_with_period()
|
||||
{
|
||||
GivenArtistFolder();
|
||||
GivenAuthorFolder();
|
||||
|
||||
GivenFiles(new List<string>
|
||||
{
|
||||
@@ -276,7 +277,7 @@ namespace NzbDrone.Core.Test.MediaFiles.DiskScanServiceTests
|
||||
[Test]
|
||||
public void should_not_scan_subfolder_of_season_folder_that_starts_with_a_period()
|
||||
{
|
||||
GivenArtistFolder();
|
||||
GivenAuthorFolder();
|
||||
|
||||
GivenFiles(new List<string>
|
||||
{
|
||||
@@ -296,7 +297,7 @@ namespace NzbDrone.Core.Test.MediaFiles.DiskScanServiceTests
|
||||
[Test]
|
||||
public void should_not_scan_Synology_eaDir()
|
||||
{
|
||||
GivenArtistFolder();
|
||||
GivenAuthorFolder();
|
||||
|
||||
GivenFiles(new List<string>
|
||||
{
|
||||
@@ -313,7 +314,7 @@ namespace NzbDrone.Core.Test.MediaFiles.DiskScanServiceTests
|
||||
[Test]
|
||||
public void should_not_scan_thumb_folder()
|
||||
{
|
||||
GivenArtistFolder();
|
||||
GivenAuthorFolder();
|
||||
|
||||
GivenFiles(new List<string>
|
||||
{
|
||||
@@ -332,7 +333,7 @@ namespace NzbDrone.Core.Test.MediaFiles.DiskScanServiceTests
|
||||
{
|
||||
_author.Path = @"C:\Test\Music\.hack".AsOsAgnostic();
|
||||
|
||||
GivenArtistFolder();
|
||||
GivenAuthorFolder();
|
||||
|
||||
GivenFiles(new List<string>
|
||||
{
|
||||
@@ -349,7 +350,7 @@ namespace NzbDrone.Core.Test.MediaFiles.DiskScanServiceTests
|
||||
[Test]
|
||||
public void should_exclude_osx_metadata_files()
|
||||
{
|
||||
GivenArtistFolder();
|
||||
GivenAuthorFolder();
|
||||
|
||||
GivenFiles(new List<string>
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ using NzbDrone.Test.Common;
|
||||
namespace NzbDrone.Core.Test.MediaFiles
|
||||
{
|
||||
[TestFixture]
|
||||
public class DownloadedAlbumsCommandServiceFixture : FileSystemTest<DownloadedBooksCommandService>
|
||||
public class DownloadedBooksCommandServiceFixture : FileSystemTest<DownloadedBooksCommandService>
|
||||
{
|
||||
private string _downloadFolder = "c:\\drop_other\\Show.S01E01\\".AsOsAgnostic();
|
||||
private string _downloadFile = "c:\\drop_other\\Show.S01E01.mkv".AsOsAgnostic();
|
||||
|
||||
@@ -69,10 +69,10 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
}
|
||||
}
|
||||
|
||||
private void GivenValidArtist()
|
||||
private void GivenValidAuthor()
|
||||
{
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.GetArtist(It.IsAny<string>()))
|
||||
.Setup(s => s.GetAuthor(It.IsAny<string>()))
|
||||
.Returns(Builder<Author>.CreateNew().Build());
|
||||
}
|
||||
|
||||
@@ -100,17 +100,17 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_search_for_artist_using_folder_name()
|
||||
public void should_search_for_author_using_folder_name()
|
||||
{
|
||||
Subject.ProcessRootFolder(DiskProvider.GetDirectoryInfo(_droneFactory));
|
||||
|
||||
Mocker.GetMock<IParsingService>().Verify(c => c.GetArtist("foldername"), Times.Once());
|
||||
Mocker.GetMock<IParsingService>().Verify(c => c.GetAuthor("foldername"), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_skip_if_file_is_in_use_by_another_process()
|
||||
{
|
||||
GivenValidArtist();
|
||||
GivenValidAuthor();
|
||||
|
||||
foreach (var file in _audioFiles)
|
||||
{
|
||||
@@ -123,9 +123,9 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_skip_if_no_artist_found()
|
||||
public void should_skip_if_no_author_found()
|
||||
{
|
||||
Mocker.GetMock<IParsingService>().Setup(c => c.GetArtist("foldername")).Returns((Author)null);
|
||||
Mocker.GetMock<IParsingService>().Setup(c => c.GetAuthor("foldername")).Returns((Author)null);
|
||||
|
||||
Subject.ProcessRootFolder(DiskProvider.GetDirectoryInfo(_droneFactory));
|
||||
|
||||
@@ -137,9 +137,9 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_import_if_folder_is_a_artist_path()
|
||||
public void should_not_import_if_folder_is_a_author_path()
|
||||
{
|
||||
GivenValidArtist();
|
||||
GivenValidAuthor();
|
||||
|
||||
Mocker.GetMock<IAuthorService>()
|
||||
.Setup(s => s.AuthorPathExists(It.IsAny<string>()))
|
||||
@@ -173,7 +173,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
[Test]
|
||||
public void should_not_delete_folder_if_files_were_imported_and_audio_files_remain()
|
||||
{
|
||||
GivenValidArtist();
|
||||
GivenValidAuthor();
|
||||
|
||||
var localTrack = new LocalBook();
|
||||
|
||||
@@ -206,14 +206,14 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
Subject.ProcessRootFolder(DiskProvider.GetDirectoryInfo(_droneFactory));
|
||||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Verify(v => v.GetArtist(folderName), Times.Once());
|
||||
.Verify(v => v.GetAuthor(folderName), Times.Once());
|
||||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Verify(v => v.GetArtist(It.Is<string>(s => s.StartsWith(prefix))), Times.Never());
|
||||
.Verify(v => v.GetAuthor(It.Is<string>(s => s.StartsWith(prefix))), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_importresult_on_unknown_artist()
|
||||
public void should_return_importresult_on_unknown_author()
|
||||
{
|
||||
var fileName = @"C:\folder\file.mkv".AsOsAgnostic();
|
||||
FileSystem.AddFile(fileName, new MockFileData(string.Empty));
|
||||
@@ -230,7 +230,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
[Test]
|
||||
public void should_not_delete_if_there_is_large_rar_file()
|
||||
{
|
||||
GivenValidArtist();
|
||||
GivenValidAuthor();
|
||||
|
||||
var localTrack = new LocalBook();
|
||||
|
||||
@@ -262,7 +262,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
Subject.ProcessPath(folderName).Should().BeEmpty();
|
||||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Verify(v => v.GetArtist(It.IsAny<string>()), Times.Never());
|
||||
.Verify(v => v.GetAuthor(It.IsAny<string>()), Times.Never());
|
||||
|
||||
ExceptionVerification.ExpectedErrors(1);
|
||||
}
|
||||
@@ -270,7 +270,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
[Test]
|
||||
public void should_not_delete_if_no_files_were_imported()
|
||||
{
|
||||
GivenValidArtist();
|
||||
GivenValidAuthor();
|
||||
|
||||
var localTrack = new LocalBook();
|
||||
|
||||
@@ -296,7 +296,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
[Test]
|
||||
public void should_not_delete_folder_after_import()
|
||||
{
|
||||
GivenValidArtist();
|
||||
GivenValidAuthor();
|
||||
|
||||
GivenSuccessfulImport();
|
||||
|
||||
@@ -310,7 +310,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
[Test]
|
||||
public void should_delete_folder_if_importmode_move()
|
||||
{
|
||||
GivenValidArtist();
|
||||
GivenValidAuthor();
|
||||
|
||||
GivenSuccessfulImport();
|
||||
|
||||
@@ -324,7 +324,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
[Test]
|
||||
public void should_not_delete_folder_if_importmode_copy()
|
||||
{
|
||||
GivenValidArtist();
|
||||
GivenValidAuthor();
|
||||
|
||||
GivenSuccessfulImport();
|
||||
|
||||
|
||||
@@ -36,17 +36,17 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
_rejectedDecisions = new List<ImportDecision<LocalBook>>();
|
||||
_approvedDecisions = new List<ImportDecision<LocalBook>>();
|
||||
|
||||
var artist = Builder<Author>.CreateNew()
|
||||
var author = Builder<Author>.CreateNew()
|
||||
.With(e => e.QualityProfile = new QualityProfile { Items = Qualities.QualityFixture.GetDefaultQualities() })
|
||||
.With(s => s.Path = @"C:\Test\Music\Alien Ant Farm".AsOsAgnostic())
|
||||
.Build();
|
||||
|
||||
var album = Builder<Book>.CreateNew()
|
||||
.With(e => e.Author = artist)
|
||||
var book = Builder<Book>.CreateNew()
|
||||
.With(e => e.Author = author)
|
||||
.Build();
|
||||
|
||||
var edition = Builder<Edition>.CreateNew()
|
||||
.With(e => e.Book = album)
|
||||
.With(e => e.Book = book)
|
||||
.Build();
|
||||
|
||||
var rootFolder = Builder<RootFolder>.CreateNew()
|
||||
@@ -60,10 +60,10 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
_approvedDecisions.Add(new ImportDecision<LocalBook>(
|
||||
new LocalBook
|
||||
{
|
||||
Author = artist,
|
||||
Book = album,
|
||||
Author = author,
|
||||
Book = book,
|
||||
Edition = edition,
|
||||
Path = Path.Combine(artist.Path, "Alien Ant Farm - 01 - Pilot.mp3"),
|
||||
Path = Path.Combine(author.Path, "Alien Ant Farm - 01 - Pilot.mp3"),
|
||||
Quality = new QualityModel(Quality.MP3_320),
|
||||
FileTrackInfo = new ParsedTrackInfo
|
||||
{
|
||||
|
||||
+22
-22
@@ -15,27 +15,27 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaFileDeletionService
|
||||
public class DeleteTrackFileFixture : CoreTest<Core.MediaFiles.MediaFileDeletionService>
|
||||
{
|
||||
private static readonly string RootFolder = @"C:\Test\Music";
|
||||
private Author _artist;
|
||||
private Author _author;
|
||||
private BookFile _trackFile;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_artist = Builder<Author>.CreateNew()
|
||||
.With(s => s.Path = Path.Combine(RootFolder, "Artist Name"))
|
||||
_author = Builder<Author>.CreateNew()
|
||||
.With(s => s.Path = Path.Combine(RootFolder, "Author Name"))
|
||||
.Build();
|
||||
|
||||
_trackFile = Builder<BookFile>.CreateNew()
|
||||
.With(f => f.Path = "/Artist Name - Track01")
|
||||
.With(f => f.Path = "/Author Name - Track01")
|
||||
.Build();
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Setup(s => s.GetParentFolder(_artist.Path))
|
||||
.Setup(s => s.GetParentFolder(_author.Path))
|
||||
.Returns(RootFolder);
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Setup(s => s.GetParentFolder(_trackFile.Path))
|
||||
.Returns(_artist.Path);
|
||||
.Returns(_author.Path);
|
||||
}
|
||||
|
||||
private void GivenRootFolderExists()
|
||||
@@ -49,20 +49,20 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaFileDeletionService
|
||||
{
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Setup(s => s.GetDirectories(RootFolder))
|
||||
.Returns(new[] { _artist.Path });
|
||||
.Returns(new[] { _author.Path });
|
||||
}
|
||||
|
||||
private void GivenArtistFolderExists()
|
||||
private void GivenAuthorFolderExists()
|
||||
{
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Setup(s => s.FolderExists(_artist.Path))
|
||||
.Setup(s => s.FolderExists(_author.Path))
|
||||
.Returns(true);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_throw_if_root_folder_does_not_exist()
|
||||
{
|
||||
Assert.Throws<NzbDroneClientException>(() => Subject.DeleteTrackFile(_artist, _trackFile));
|
||||
Assert.Throws<NzbDroneClientException>(() => Subject.DeleteTrackFile(_author, _trackFile));
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
||||
@@ -70,17 +70,17 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaFileDeletionService
|
||||
public void should_throw_if_root_folder_is_empty()
|
||||
{
|
||||
GivenRootFolderExists();
|
||||
Assert.Throws<NzbDroneClientException>(() => Subject.DeleteTrackFile(_artist, _trackFile));
|
||||
Assert.Throws<NzbDroneClientException>(() => Subject.DeleteTrackFile(_author, _trackFile));
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_delete_from_db_if_artist_folder_does_not_exist()
|
||||
public void should_delete_from_db_if_author_folder_does_not_exist()
|
||||
{
|
||||
GivenRootFolderExists();
|
||||
GivenRootFolderHasFolders();
|
||||
|
||||
Subject.DeleteTrackFile(_artist, _trackFile);
|
||||
Subject.DeleteTrackFile(_author, _trackFile);
|
||||
|
||||
Mocker.GetMock<IMediaFileService>().Verify(v => v.Delete(_trackFile, DeleteMediaFileReason.Manual), Times.Once());
|
||||
Mocker.GetMock<IRecycleBinProvider>().Verify(v => v.DeleteFile(_trackFile.Path, It.IsAny<string>()), Times.Never());
|
||||
@@ -91,9 +91,9 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaFileDeletionService
|
||||
{
|
||||
GivenRootFolderExists();
|
||||
GivenRootFolderHasFolders();
|
||||
GivenArtistFolderExists();
|
||||
GivenAuthorFolderExists();
|
||||
|
||||
Subject.DeleteTrackFile(_artist, _trackFile);
|
||||
Subject.DeleteTrackFile(_author, _trackFile);
|
||||
|
||||
Mocker.GetMock<IMediaFileService>().Verify(v => v.Delete(_trackFile, DeleteMediaFileReason.Manual), Times.Once());
|
||||
Mocker.GetMock<IRecycleBinProvider>().Verify(v => v.DeleteFile(_trackFile.Path, It.IsAny<string>()), Times.Never());
|
||||
@@ -104,15 +104,15 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaFileDeletionService
|
||||
{
|
||||
GivenRootFolderExists();
|
||||
GivenRootFolderHasFolders();
|
||||
GivenArtistFolderExists();
|
||||
GivenAuthorFolderExists();
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Setup(s => s.FileExists(_trackFile.Path))
|
||||
.Returns(true);
|
||||
|
||||
Subject.DeleteTrackFile(_artist, _trackFile);
|
||||
Subject.DeleteTrackFile(_author, _trackFile);
|
||||
|
||||
Mocker.GetMock<IRecycleBinProvider>().Verify(v => v.DeleteFile(_trackFile.Path, "Artist Name"), Times.Once());
|
||||
Mocker.GetMock<IRecycleBinProvider>().Verify(v => v.DeleteFile(_trackFile.Path, "Author Name"), Times.Once());
|
||||
Mocker.GetMock<IMediaFileService>().Verify(v => v.Delete(_trackFile, DeleteMediaFileReason.Manual), Times.Once());
|
||||
}
|
||||
|
||||
@@ -121,20 +121,20 @@ namespace NzbDrone.Core.Test.MediaFiles.MediaFileDeletionService
|
||||
{
|
||||
GivenRootFolderExists();
|
||||
GivenRootFolderHasFolders();
|
||||
GivenArtistFolderExists();
|
||||
GivenAuthorFolderExists();
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Setup(s => s.FileExists(_trackFile.Path))
|
||||
.Returns(true);
|
||||
|
||||
Mocker.GetMock<IRecycleBinProvider>()
|
||||
.Setup(s => s.DeleteFile(_trackFile.Path, "Artist Name"))
|
||||
.Setup(s => s.DeleteFile(_trackFile.Path, "Author Name"))
|
||||
.Throws(new IOException());
|
||||
|
||||
Assert.Throws<NzbDroneClientException>(() => Subject.DeleteTrackFile(_artist, _trackFile));
|
||||
Assert.Throws<NzbDroneClientException>(() => Subject.DeleteTrackFile(_author, _trackFile));
|
||||
|
||||
ExceptionVerification.ExpectedErrors(1);
|
||||
Mocker.GetMock<IRecycleBinProvider>().Verify(v => v.DeleteFile(_trackFile.Path, "Artist Name"), Times.Once());
|
||||
Mocker.GetMock<IRecycleBinProvider>().Verify(v => v.DeleteFile(_trackFile.Path, "Author Name"), Times.Once());
|
||||
Mocker.GetMock<IMediaFileService>().Verify(v => v.Delete(_trackFile, DeleteMediaFileReason.Manual), Times.Never());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
[TestFixture]
|
||||
public class MediaFileRepositoryFixture : DbTest<MediaFileRepository, BookFile>
|
||||
{
|
||||
private Author _artist;
|
||||
private Book _album;
|
||||
private Author _author;
|
||||
private Book _book;
|
||||
private Edition _edition;
|
||||
|
||||
[SetUp]
|
||||
@@ -26,21 +26,21 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
.Build();
|
||||
Db.Insert(meta);
|
||||
|
||||
_artist = Builder<Author>.CreateNew()
|
||||
_author = Builder<Author>.CreateNew()
|
||||
.With(a => a.AuthorMetadataId = meta.Id)
|
||||
.With(a => a.Id = 0)
|
||||
.Build();
|
||||
Db.Insert(_artist);
|
||||
Db.Insert(_author);
|
||||
|
||||
_album = Builder<Book>.CreateNew()
|
||||
_book = Builder<Book>.CreateNew()
|
||||
.With(a => a.Id = 0)
|
||||
.With(a => a.AuthorMetadataId = _artist.AuthorMetadataId)
|
||||
.With(a => a.AuthorMetadataId = _author.AuthorMetadataId)
|
||||
.Build();
|
||||
Db.Insert(_album);
|
||||
Db.Insert(_book);
|
||||
|
||||
_edition = Builder<Edition>.CreateNew()
|
||||
.With(a => a.Id = 0)
|
||||
.With(a => a.BookId = _album.Id)
|
||||
.With(a => a.BookId = _book.Id)
|
||||
.Build();
|
||||
Db.Insert(_edition);
|
||||
|
||||
@@ -53,21 +53,21 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
.TheRest()
|
||||
.With(c => c.EditionId = 0)
|
||||
.TheFirst(1)
|
||||
.With(c => c.Path = @"C:\Test\Path\Artist\somefile1.flac".AsOsAgnostic())
|
||||
.With(c => c.Path = @"C:\Test\Path\Author\somefile1.flac".AsOsAgnostic())
|
||||
.TheNext(1)
|
||||
.With(c => c.Path = @"C:\Test\Path\Artist\somefile2.flac".AsOsAgnostic())
|
||||
.With(c => c.Path = @"C:\Test\Path\Author\somefile2.flac".AsOsAgnostic())
|
||||
.BuildListOfNew();
|
||||
Db.InsertMany(files);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void get_files_by_artist()
|
||||
public void get_files_by_author()
|
||||
{
|
||||
VerifyData();
|
||||
var artistFiles = Subject.GetFilesByAuthor(_artist.Id);
|
||||
VerifyEagerLoaded(artistFiles);
|
||||
var authorFiles = Subject.GetFilesByAuthor(_author.Id);
|
||||
VerifyEagerLoaded(authorFiles);
|
||||
|
||||
artistFiles.Should().OnlyContain(c => c.Author.Value.Id == _artist.Id);
|
||||
authorFiles.Should().OnlyContain(c => c.Author.Value.Id == _author.Id);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -101,9 +101,9 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
.With(c => c.Id = 0)
|
||||
.With(c => c.Quality = new QualityModel(Quality.MP3_320))
|
||||
.TheFirst(1)
|
||||
.With(c => c.Path = @"C:\Test\Path2\Artist\somefile1.flac".AsOsAgnostic())
|
||||
.With(c => c.Path = @"C:\Test\Path2\Author\somefile1.flac".AsOsAgnostic())
|
||||
.TheNext(1)
|
||||
.With(c => c.Path = @"C:\Test\Path2\Artist\somefile2.flac".AsOsAgnostic())
|
||||
.With(c => c.Path = @"C:\Test\Path2\Author\somefile2.flac".AsOsAgnostic())
|
||||
.BuildListOfNew();
|
||||
Db.InsertMany(files);
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
public void get_file_by_path()
|
||||
{
|
||||
VerifyData();
|
||||
var file = Subject.GetFileWithPath(@"C:\Test\Path\Artist\somefile2.flac".AsOsAgnostic());
|
||||
var file = Subject.GetFileWithPath(@"C:\Test\Path\Author\somefile2.flac".AsOsAgnostic());
|
||||
|
||||
file.Should().NotBeNull();
|
||||
file.Edition.IsLoaded.Should().BeTrue();
|
||||
@@ -125,13 +125,13 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void get_files_by_album()
|
||||
public void get_files_by_book()
|
||||
{
|
||||
VerifyData();
|
||||
var files = Subject.GetFilesByBook(_album.Id);
|
||||
var files = Subject.GetFilesByBook(_book.Id);
|
||||
VerifyEagerLoaded(files);
|
||||
|
||||
files.Should().OnlyContain(c => c.EditionId == _album.Id);
|
||||
files.Should().OnlyContain(c => c.EditionId == _book.Id);
|
||||
}
|
||||
|
||||
private void VerifyData()
|
||||
@@ -166,12 +166,12 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void delete_files_by_album_should_work_if_join_fails()
|
||||
public void delete_files_by_book_should_work_if_join_fails()
|
||||
{
|
||||
Db.Delete(_album);
|
||||
Subject.DeleteFilesByBook(_album.Id);
|
||||
Db.Delete(_book);
|
||||
Subject.DeleteFilesByBook(_book.Id);
|
||||
|
||||
Db.All<BookFile>().Where(x => x.EditionId == _album.Id).Should().HaveCount(0);
|
||||
Db.All<BookFile>().Where(x => x.EditionId == _book.Id).Should().HaveCount(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,18 +13,18 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackFileMovingServiceTests
|
||||
[TestFixture]
|
||||
public class MediaFileServiceFixture : CoreTest<MediaFileService>
|
||||
{
|
||||
private Book _album;
|
||||
private Book _book;
|
||||
private List<BookFile> _trackFiles;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_album = Builder<Book>.CreateNew()
|
||||
_book = Builder<Book>.CreateNew()
|
||||
.Build();
|
||||
|
||||
_trackFiles = Builder<BookFile>.CreateListOfSize(3)
|
||||
.TheFirst(2)
|
||||
.With(f => f.EditionId = _album.Id)
|
||||
.With(f => f.EditionId = _book.Id)
|
||||
.TheNext(1)
|
||||
.With(f => f.EditionId = 0)
|
||||
.Build().ToList();
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
{
|
||||
private readonly string _DELETED_PATH = @"c:\ANY FILE STARTING WITH THIS PATH IS CONSIDERED DELETED!".AsOsAgnostic();
|
||||
private List<Book> _tracks;
|
||||
private Author _artist;
|
||||
private Author _author;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
@@ -24,8 +24,8 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
.Build()
|
||||
.ToList();
|
||||
|
||||
_artist = Builder<Author>.CreateNew()
|
||||
.With(s => s.Path = @"C:\Test\Music\Artist".AsOsAgnostic())
|
||||
_author = Builder<Author>.CreateNew()
|
||||
.With(s => s.Path = @"C:\Test\Music\Author".AsOsAgnostic())
|
||||
.Build();
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
|
||||
GivenTrackFiles(trackFiles);
|
||||
|
||||
Subject.Clean(_artist.Path, FilesOnDisk(trackFiles));
|
||||
Subject.Clean(_author.Path, FilesOnDisk(trackFiles));
|
||||
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Verify(c => c.DeleteMany(It.Is<List<BookFile>>(x => x.Count == 0), DeleteMediaFileReason.MissingFromDisk), Times.Once());
|
||||
@@ -73,7 +73,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
|
||||
GivenTrackFiles(trackFiles);
|
||||
|
||||
Subject.Clean(_artist.Path, FilesOnDisk(trackFiles.Where(e => !e.Path.StartsWith(_DELETED_PATH))));
|
||||
Subject.Clean(_author.Path, FilesOnDisk(trackFiles.Where(e => !e.Path.StartsWith(_DELETED_PATH))));
|
||||
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Verify(c => c.DeleteMany(It.Is<List<BookFile>>(e => e.Count == 2 && e.All(y => y.Path.StartsWith(_DELETED_PATH))), DeleteMediaFileReason.MissingFromDisk), Times.Once());
|
||||
@@ -89,7 +89,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
|
||||
GivenTrackFiles(trackFiles);
|
||||
|
||||
Subject.Clean(_artist.Path, new List<string>());
|
||||
Subject.Clean(_author.Path, new List<string>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -102,7 +102,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
|
||||
GivenTrackFiles(trackFiles);
|
||||
|
||||
Subject.Clean(_artist.Path, FilesOnDisk(trackFiles));
|
||||
Subject.Clean(_author.Path, FilesOnDisk(trackFiles));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,24 +14,24 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
{
|
||||
public class RenameTrackFileServiceFixture : CoreTest<RenameBookFileService>
|
||||
{
|
||||
private Author _artist;
|
||||
private Author _author;
|
||||
private List<BookFile> _trackFiles;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_artist = Builder<Author>.CreateNew()
|
||||
_author = Builder<Author>.CreateNew()
|
||||
.Build();
|
||||
|
||||
_trackFiles = Builder<BookFile>.CreateListOfSize(2)
|
||||
.All()
|
||||
.With(e => e.Author = _artist)
|
||||
.With(e => e.Author = _author)
|
||||
.Build()
|
||||
.ToList();
|
||||
|
||||
Mocker.GetMock<IAuthorService>()
|
||||
.Setup(s => s.GetAuthor(_artist.Id))
|
||||
.Returns(_artist);
|
||||
.Setup(s => s.GetAuthor(_author.Id))
|
||||
.Returns(_author);
|
||||
}
|
||||
|
||||
private void GivenNoTrackFiles()
|
||||
@@ -51,7 +51,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
private void GivenMovedFiles()
|
||||
{
|
||||
Mocker.GetMock<IMoveBookFiles>()
|
||||
.Setup(s => s.MoveBookFile(It.IsAny<BookFile>(), _artist));
|
||||
.Setup(s => s.MoveBookFile(It.IsAny<BookFile>(), _author));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -59,7 +59,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
{
|
||||
GivenNoTrackFiles();
|
||||
|
||||
Subject.Execute(new RenameFilesCommand(_artist.Id, new List<int> { 1 }));
|
||||
Subject.Execute(new RenameFilesCommand(_author.Id, new List<int> { 1 }));
|
||||
|
||||
Mocker.GetMock<IEventAggregator>()
|
||||
.Verify(v => v.PublishEvent(It.IsAny<AuthorRenamedEvent>()), Times.Never());
|
||||
@@ -74,7 +74,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
.Setup(s => s.MoveBookFile(It.IsAny<BookFile>(), It.IsAny<Author>()))
|
||||
.Throws(new SameFilenameException("Same file name", "Filename"));
|
||||
|
||||
Subject.Execute(new RenameFilesCommand(_artist.Id, new List<int> { 1 }));
|
||||
Subject.Execute(new RenameFilesCommand(_author.Id, new List<int> { 1 }));
|
||||
|
||||
Mocker.GetMock<IEventAggregator>()
|
||||
.Verify(v => v.PublishEvent(It.IsAny<AuthorRenamedEvent>()), Times.Never());
|
||||
@@ -86,7 +86,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
GivenTrackFiles();
|
||||
GivenMovedFiles();
|
||||
|
||||
Subject.Execute(new RenameFilesCommand(_artist.Id, new List<int> { 1 }));
|
||||
Subject.Execute(new RenameFilesCommand(_author.Id, new List<int> { 1 }));
|
||||
|
||||
Mocker.GetMock<IEventAggregator>()
|
||||
.Verify(v => v.PublishEvent(It.IsAny<AuthorRenamedEvent>()), Times.Once());
|
||||
@@ -98,7 +98,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
GivenTrackFiles();
|
||||
GivenMovedFiles();
|
||||
|
||||
Subject.Execute(new RenameFilesCommand(_artist.Id, new List<int> { 1 }));
|
||||
Subject.Execute(new RenameFilesCommand(_author.Id, new List<int> { 1 }));
|
||||
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Verify(v => v.Update(It.IsAny<BookFile>()), Times.Exactly(2));
|
||||
@@ -112,7 +112,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
|
||||
var files = new List<int> { 1 };
|
||||
|
||||
Subject.Execute(new RenameFilesCommand(_artist.Id, files));
|
||||
Subject.Execute(new RenameFilesCommand(_author.Id, files));
|
||||
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Verify(v => v.Get(files), Times.Once());
|
||||
|
||||
+11
-11
@@ -21,24 +21,24 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackFileMovingServiceTests
|
||||
[TestFixture]
|
||||
public class MoveTrackFileFixture : CoreTest<BookFileMovingService>
|
||||
{
|
||||
private Author _artist;
|
||||
private Author _author;
|
||||
private BookFile _trackFile;
|
||||
private LocalBook _localtrack;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_artist = Builder<Author>.CreateNew()
|
||||
.With(s => s.Path = @"C:\Test\Music\Artist".AsOsAgnostic())
|
||||
_author = Builder<Author>.CreateNew()
|
||||
.With(s => s.Path = @"C:\Test\Music\Author".AsOsAgnostic())
|
||||
.Build();
|
||||
|
||||
_trackFile = Builder<BookFile>.CreateNew()
|
||||
.With(f => f.Path = null)
|
||||
.With(f => f.Path = Path.Combine(_artist.Path, @"Album\File.mp3"))
|
||||
.With(f => f.Path = Path.Combine(_author.Path, @"Book\File.mp3"))
|
||||
.Build();
|
||||
|
||||
_localtrack = Builder<LocalBook>.CreateNew()
|
||||
.With(l => l.Author = _artist)
|
||||
.With(l => l.Author = _author)
|
||||
.With(l => l.Book = Builder<Book>.CreateNew().Build())
|
||||
.Build();
|
||||
|
||||
@@ -48,11 +48,11 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackFileMovingServiceTests
|
||||
|
||||
Mocker.GetMock<IBuildFileNames>()
|
||||
.Setup(s => s.BuildBookFilePath(It.IsAny<Author>(), It.IsAny<Edition>(), It.IsAny<string>(), It.IsAny<string>()))
|
||||
.Returns(@"C:\Test\Music\Artist\Album\File Name.mp3".AsOsAgnostic());
|
||||
.Returns(@"C:\Test\Music\Author\Book\File Name.mp3".AsOsAgnostic());
|
||||
|
||||
Mocker.GetMock<IBuildFileNames>()
|
||||
.Setup(s => s.BuildBookPath(It.IsAny<Author>()))
|
||||
.Returns(@"C:\Test\Music\Artist\Album".AsOsAgnostic());
|
||||
.Returns(@"C:\Test\Music\Author\Book".AsOsAgnostic());
|
||||
|
||||
var rootFolder = @"C:\Test\Music\".AsOsAgnostic();
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
@@ -89,7 +89,7 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackFileMovingServiceTests
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_notify_on_artist_folder_creation()
|
||||
public void should_notify_on_author_folder_creation()
|
||||
{
|
||||
Subject.MoveBookFile(_trackFile, _localtrack);
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackFileMovingServiceTests
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_notify_on_album_folder_creation()
|
||||
public void should_notify_on_book_folder_creation()
|
||||
{
|
||||
Subject.MoveBookFile(_trackFile, _localtrack);
|
||||
|
||||
@@ -109,10 +109,10 @@ namespace NzbDrone.Core.Test.MediaFiles.TrackFileMovingServiceTests
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_notify_if_artist_folder_already_exists()
|
||||
public void should_not_notify_if_author_folder_already_exists()
|
||||
{
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Setup(s => s.FolderExists(_artist.Path))
|
||||
.Setup(s => s.FolderExists(_author.Path))
|
||||
.Returns(true);
|
||||
|
||||
Subject.MoveBookFile(_trackFile, _localtrack);
|
||||
|
||||
+21
-21
@@ -28,9 +28,9 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Aggregation.Aggregators
|
||||
return new LocalEdition(tracks);
|
||||
}
|
||||
|
||||
private void VerifyData(LocalBook track, string artist, string title, int trackNum, int disc)
|
||||
private void VerifyData(LocalBook track, string author, string title, int trackNum, int disc)
|
||||
{
|
||||
track.FileTrackInfo.ArtistTitle.Should().Be(artist);
|
||||
track.FileTrackInfo.AuthorTitle.Should().Be(author);
|
||||
track.FileTrackInfo.Title.Should().Be(title);
|
||||
track.FileTrackInfo.TrackNumbers[0].Should().Be(trackNum);
|
||||
track.FileTrackInfo.DiscNumber.Should().Be(disc);
|
||||
@@ -59,23 +59,23 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Aggregation.Aggregators
|
||||
{
|
||||
private static List<string[]> tokenList = new List<string[]>
|
||||
{
|
||||
new[] { "trackNum2", "artist", "title", "tag" },
|
||||
new[] { "trackNum3", "artist", "title", "tag" },
|
||||
new[] { "trackNum2", "artist", "tag", "title" },
|
||||
new[] { "trackNum3", "artist", "tag", "title" },
|
||||
new[] { "trackNum2", "artist", "title" },
|
||||
new[] { "trackNum3", "artist", "title" },
|
||||
new[] { "trackNum2", "author", "title", "tag" },
|
||||
new[] { "trackNum3", "author", "title", "tag" },
|
||||
new[] { "trackNum2", "author", "tag", "title" },
|
||||
new[] { "trackNum3", "author", "tag", "title" },
|
||||
new[] { "trackNum2", "author", "title" },
|
||||
new[] { "trackNum3", "author", "title" },
|
||||
|
||||
new[] { "artist", "tag", "trackNum2", "title" },
|
||||
new[] { "artist", "tag", "trackNum3", "title" },
|
||||
new[] { "artist", "trackNum2", "title", "tag" },
|
||||
new[] { "artist", "trackNum3", "title", "tag" },
|
||||
new[] { "artist", "trackNum2", "title" },
|
||||
new[] { "artist", "trackNum3", "title" },
|
||||
new[] { "author", "tag", "trackNum2", "title" },
|
||||
new[] { "author", "tag", "trackNum3", "title" },
|
||||
new[] { "author", "trackNum2", "title", "tag" },
|
||||
new[] { "author", "trackNum3", "title", "tag" },
|
||||
new[] { "author", "trackNum2", "title" },
|
||||
new[] { "author", "trackNum3", "title" },
|
||||
|
||||
new[] { "artist", "title", "tag" },
|
||||
new[] { "artist", "tag", "title" },
|
||||
new[] { "artist", "title" },
|
||||
new[] { "author", "title", "tag" },
|
||||
new[] { "author", "tag", "title" },
|
||||
new[] { "author", "title" },
|
||||
|
||||
new[] { "trackNum2", "title" },
|
||||
new[] { "trackNum3", "title" },
|
||||
@@ -135,8 +135,8 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Aggregation.Aggregators
|
||||
{
|
||||
switch (field)
|
||||
{
|
||||
case "artist":
|
||||
components.Add("artist name".Replace(" ", whitespace));
|
||||
case "author":
|
||||
components.Add("author name".Replace(" ", whitespace));
|
||||
break;
|
||||
case "tag":
|
||||
components.Add("tag string ignore".Replace(" ", whitespace));
|
||||
@@ -165,9 +165,9 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Aggregation.Aggregators
|
||||
{
|
||||
var info = tracks[i - 1].FileTrackInfo;
|
||||
|
||||
if (tokens.Contains("artist"))
|
||||
if (tokens.Contains("author"))
|
||||
{
|
||||
info.ArtistTitle.Should().Be("artist name".Replace(" ", whitespace));
|
||||
info.AuthorTitle.Should().Be("author name".Replace(" ", whitespace));
|
||||
}
|
||||
|
||||
if (tokens.Contains("title"))
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
public void test_distance()
|
||||
{
|
||||
var dist = new Distance();
|
||||
dist.Add("album", 0.5);
|
||||
dist.Add("book", 0.5);
|
||||
dist.Add("media_count", 0.25);
|
||||
dist.Add("media_count", 0.75);
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
public void test_max_distance()
|
||||
{
|
||||
var dist = new Distance();
|
||||
dist.Add("album", 0.5);
|
||||
dist.Add("book", 0.5);
|
||||
dist.Add("media_count", 0.0);
|
||||
dist.Add("media_count", 0.0);
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
public void test_raw_distance()
|
||||
{
|
||||
var dist = new Distance();
|
||||
dist.Add("album", 0.5);
|
||||
dist.Add("book", 0.5);
|
||||
dist.Add("media_count", 0.25);
|
||||
dist.Add("media_count", 0.5);
|
||||
|
||||
|
||||
+15
-15
@@ -33,7 +33,7 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
{
|
||||
private AuthorService _authorService;
|
||||
private AddAuthorService _addAuthorService;
|
||||
private RefreshAuthorService _refreshArtistService;
|
||||
private RefreshAuthorService _refreshAuthorService;
|
||||
|
||||
private IdentificationService _Subject;
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
_addAuthorService = Mocker.Resolve<AddAuthorService>();
|
||||
|
||||
Mocker.SetConstant<IRefreshBookService>(Mocker.Resolve<RefreshBookService>());
|
||||
_refreshArtistService = Mocker.Resolve<RefreshAuthorService>();
|
||||
_refreshAuthorService = Mocker.Resolve<RefreshAuthorService>();
|
||||
|
||||
Mocker.GetMock<IAddAuthorValidator>().Setup(x => x.Validate(It.IsAny<Author>())).Returns(new ValidationResult());
|
||||
|
||||
@@ -88,23 +88,23 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
Mocker.GetMock<IMetadataProfileService>().Setup(x => x.Get(profile.Id)).Returns(profile);
|
||||
}
|
||||
|
||||
private List<Author> GivenArtists(List<AuthorTestCase> artists)
|
||||
private List<Author> GivenAuthors(List<AuthorTestCase> authors)
|
||||
{
|
||||
var outp = new List<Author>();
|
||||
for (int i = 0; i < artists.Count; i++)
|
||||
for (int i = 0; i < authors.Count; i++)
|
||||
{
|
||||
var meta = artists[i].MetadataProfile;
|
||||
var meta = authors[i].MetadataProfile;
|
||||
meta.Id = i + 1;
|
||||
GivenMetadataProfile(meta);
|
||||
outp.Add(GivenArtist(artists[i].Author, meta.Id));
|
||||
outp.Add(GivenAuthor(authors[i].Author, meta.Id));
|
||||
}
|
||||
|
||||
return outp;
|
||||
}
|
||||
|
||||
private Author GivenArtist(string foreignAuthorId, int metadataProfileId)
|
||||
private Author GivenAuthor(string foreignAuthorId, int metadataProfileId)
|
||||
{
|
||||
var artist = _addAuthorService.AddAuthor(new Author
|
||||
var author = _addAuthorService.AddAuthor(new Author
|
||||
{
|
||||
Metadata = new AuthorMetadata
|
||||
{
|
||||
@@ -116,11 +116,11 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
|
||||
var command = new RefreshAuthorCommand
|
||||
{
|
||||
AuthorId = artist.Id,
|
||||
AuthorId = author.Id,
|
||||
Trigger = CommandTrigger.Unspecified
|
||||
};
|
||||
|
||||
_refreshArtistService.Execute(command);
|
||||
_refreshAuthorService.Execute(command);
|
||||
|
||||
return _authorService.FindById(foreignAuthorId);
|
||||
}
|
||||
@@ -145,8 +145,8 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
{
|
||||
"FilesWithMBIds.json",
|
||||
"PreferMissingToBadMatch.json",
|
||||
"InconsistentTyposInAlbum.json",
|
||||
"SucceedWhenManyAlbumsHaveSameTitle.json",
|
||||
"InconsistentTyposInBook.json",
|
||||
"SucceedWhenManyBooksHaveSameTitle.json",
|
||||
"PenalizeUnknownMedia.json",
|
||||
"CorruptFile.json",
|
||||
"FilesWithoutTags.json"
|
||||
@@ -172,9 +172,9 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
var path = Path.Combine(TestContext.CurrentContext.TestDirectory, "Files", "Identification", file);
|
||||
var testcase = JsonConvert.DeserializeObject<IdTestCase>(File.ReadAllText(path));
|
||||
|
||||
var artists = GivenArtists(testcase.LibraryAuthors);
|
||||
var specifiedArtist = artists.SingleOrDefault(x => x.Metadata.Value.ForeignAuthorId == testcase.Author);
|
||||
var idOverrides = new IdentificationOverrides { Author = specifiedArtist };
|
||||
var authors = GivenAuthors(testcase.LibraryAuthors);
|
||||
var specifiedAuthor = authors.SingleOrDefault(x => x.Metadata.Value.ForeignAuthorId == testcase.Author);
|
||||
var idOverrides = new IdentificationOverrides { Author = specifiedAuthor };
|
||||
|
||||
var tracks = testcase.Tracks.Select(x => new LocalBook
|
||||
{
|
||||
|
||||
+72
-72
@@ -14,7 +14,7 @@ using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
{
|
||||
// we need to use random strings to test the va (so we don't just get artist1, artist2 etc which are too similar)
|
||||
// we need to use random strings to test the va (so we don't just get author1, author2 etc which are too similar)
|
||||
// but the standard random value namer would give paths that are too long on windows
|
||||
public class RandomValueNamerShortStrings : RandomValuePropertyNamer
|
||||
{
|
||||
@@ -66,14 +66,14 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
[TestFixture]
|
||||
public class TrackGroupingServiceFixture : CoreTest<TrackGroupingService>
|
||||
{
|
||||
private List<LocalBook> GivenTracks(string root, string artist, string album, int count)
|
||||
private List<LocalBook> GivenTracks(string root, string author, string book, int count)
|
||||
{
|
||||
var fileInfos = Builder<ParsedTrackInfo>
|
||||
.CreateListOfSize(count)
|
||||
.All()
|
||||
.With(f => f.ArtistTitle = artist)
|
||||
.With(f => f.AlbumTitle = album)
|
||||
.With(f => f.AlbumMBId = null)
|
||||
.With(f => f.AuthorTitle = author)
|
||||
.With(f => f.BookTitle = book)
|
||||
.With(f => f.BookMBId = null)
|
||||
.With(f => f.ReleaseMBId = null)
|
||||
.Build();
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
}
|
||||
|
||||
[Repeat(100)]
|
||||
private List<LocalBook> GivenVaTracks(string root, string album, int count)
|
||||
private List<LocalBook> GivenVaTracks(string root, string book, int count)
|
||||
{
|
||||
var settings = new BuilderSettings();
|
||||
settings.SetPropertyNamerFor<ParsedTrackInfo>(new RandomValueNamerShortStrings(settings));
|
||||
@@ -114,8 +114,8 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
var fileInfos = builder
|
||||
.CreateListOfSize<ParsedTrackInfo>(count)
|
||||
.All()
|
||||
.With(f => f.AlbumTitle = "album")
|
||||
.With(f => f.AlbumMBId = null)
|
||||
.With(f => f.BookTitle = "book")
|
||||
.With(f => f.BookMBId = null)
|
||||
.With(f => f.ReleaseMBId = null)
|
||||
.Build();
|
||||
|
||||
@@ -131,71 +131,71 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
[TestCase(1)]
|
||||
[TestCase(2)]
|
||||
[TestCase(10)]
|
||||
public void single_artist_is_not_various_artists(int count)
|
||||
public void single_author_is_not_various_authors(int count)
|
||||
{
|
||||
var tracks = GivenTracks(@"C:\music\incoming".AsOsAgnostic(), "artist", "album", count);
|
||||
TrackGroupingService.IsVariousArtists(tracks).Should().Be(false);
|
||||
var tracks = GivenTracks(@"C:\music\incoming".AsOsAgnostic(), "author", "book", count);
|
||||
TrackGroupingService.IsVariousAuthors(tracks).Should().Be(false);
|
||||
}
|
||||
|
||||
// GivenVaTracks uses random names so repeat multiple times to try to prompt any intermittent failures
|
||||
[Test]
|
||||
[Repeat(100)]
|
||||
public void all_different_artists_is_various_artists()
|
||||
public void all_different_authors_is_various_authors()
|
||||
{
|
||||
var tracks = GivenVaTracks(@"C:\music\incoming".AsOsAgnostic(), "album", 10);
|
||||
TrackGroupingService.IsVariousArtists(tracks).Should().Be(true);
|
||||
var tracks = GivenVaTracks(@"C:\music\incoming".AsOsAgnostic(), "book", 10);
|
||||
TrackGroupingService.IsVariousAuthors(tracks).Should().Be(true);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void two_artists_is_not_various_artists()
|
||||
public void two_authors_is_not_various_authors()
|
||||
{
|
||||
var dir = @"C:\music\incoming".AsOsAgnostic();
|
||||
var tracks = GivenTracks(dir, "artist1", "album", 10);
|
||||
tracks.AddRange(GivenTracks(dir, "artist2", "album", 10));
|
||||
var tracks = GivenTracks(dir, "author1", "book", 10);
|
||||
tracks.AddRange(GivenTracks(dir, "author2", "book", 10));
|
||||
|
||||
TrackGroupingService.IsVariousArtists(tracks).Should().Be(false);
|
||||
TrackGroupingService.IsVariousAuthors(tracks).Should().Be(false);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Repeat(100)]
|
||||
public void mostly_different_artists_is_various_artists()
|
||||
public void mostly_different_authors_is_various_authors()
|
||||
{
|
||||
var dir = @"C:\music\incoming".AsOsAgnostic();
|
||||
var tracks = GivenVaTracks(dir, "album", 10);
|
||||
tracks.AddRange(GivenTracks(dir, "single_artist", "album", 2));
|
||||
TrackGroupingService.IsVariousArtists(tracks).Should().Be(true);
|
||||
var tracks = GivenVaTracks(dir, "book", 10);
|
||||
tracks.AddRange(GivenTracks(dir, "single_author", "book", 2));
|
||||
TrackGroupingService.IsVariousAuthors(tracks).Should().Be(true);
|
||||
}
|
||||
|
||||
[TestCase("")]
|
||||
[TestCase("Various Artists")]
|
||||
[TestCase("Various Authors")]
|
||||
[TestCase("Various")]
|
||||
[TestCase("VA")]
|
||||
[TestCase("Unknown")]
|
||||
public void va_artist_title_is_various_artists(string artist)
|
||||
public void va_author_title_is_various_authors(string author)
|
||||
{
|
||||
var tracks = GivenTracks(@"C:\music\incoming".AsOsAgnostic(), artist, "album", 10);
|
||||
TrackGroupingService.IsVariousArtists(tracks).Should().Be(true);
|
||||
var tracks = GivenTracks(@"C:\music\incoming".AsOsAgnostic(), author, "book", 10);
|
||||
TrackGroupingService.IsVariousAuthors(tracks).Should().Be(true);
|
||||
}
|
||||
|
||||
[TestCase("Va?!")]
|
||||
[TestCase("Va Va Voom")]
|
||||
[TestCase("V.A. Jr.")]
|
||||
[TestCase("Ca Va")]
|
||||
public void va_in_artist_name_is_not_various_artists(string artist)
|
||||
public void va_in_author_name_is_not_various_authors(string author)
|
||||
{
|
||||
var tracks = GivenTracks(@"C:\music\incoming".AsOsAgnostic(), artist, "album", 10);
|
||||
TrackGroupingService.IsVariousArtists(tracks).Should().Be(false);
|
||||
var tracks = GivenTracks(@"C:\music\incoming".AsOsAgnostic(), author, "book", 10);
|
||||
TrackGroupingService.IsVariousAuthors(tracks).Should().Be(false);
|
||||
}
|
||||
|
||||
[TestCase(1)]
|
||||
[TestCase(2)]
|
||||
[TestCase(10)]
|
||||
public void should_group_single_artist_album(int count)
|
||||
public void should_group_single_author_book(int count)
|
||||
{
|
||||
var tracks = GivenTracks(@"C:\music\incoming".AsOsAgnostic(), "artist", "album", count);
|
||||
var tracks = GivenTracks(@"C:\music\incoming".AsOsAgnostic(), "author", "book", count);
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
|
||||
TrackGroupingService.IsVariousArtists(tracks).Should().Be(false);
|
||||
TrackGroupingService.IsVariousAuthors(tracks).Should().Be(false);
|
||||
TrackGroupingService.LooksLikeSingleRelease(tracks).Should().Be(true);
|
||||
|
||||
output.Count.Should().Be(1);
|
||||
@@ -207,10 +207,10 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
[TestCase("disk")]
|
||||
public void should_group_multi_disc_release(string mediaName)
|
||||
{
|
||||
var tracks = GivenTracks($"C:\\music\\incoming\\artist - album\\{mediaName} 1".AsOsAgnostic(), "artist", "album", 10);
|
||||
tracks.AddRange(GivenTracks($"C:\\music\\incoming\\artist - album\\{mediaName} 2".AsOsAgnostic(), "artist", "album", 5));
|
||||
var tracks = GivenTracks($"C:\\music\\incoming\\author - book\\{mediaName} 1".AsOsAgnostic(), "author", "book", 10);
|
||||
tracks.AddRange(GivenTracks($"C:\\music\\incoming\\author - book\\{mediaName} 2".AsOsAgnostic(), "author", "book", 5));
|
||||
|
||||
TrackGroupingService.IsVariousArtists(tracks).Should().Be(false);
|
||||
TrackGroupingService.IsVariousAuthors(tracks).Should().Be(false);
|
||||
TrackGroupingService.LooksLikeSingleRelease(tracks).Should().Be(true);
|
||||
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
@@ -219,12 +219,12 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_group_two_different_albums_by_same_artist()
|
||||
public void should_not_group_two_different_books_by_same_author()
|
||||
{
|
||||
var tracks = GivenTracks($"C:\\music\\incoming\\artist - album1".AsOsAgnostic(), "artist", "album1", 10);
|
||||
tracks.AddRange(GivenTracks($"C:\\music\\incoming\\artist - album2".AsOsAgnostic(), "artist", "album2", 5));
|
||||
var tracks = GivenTracks($"C:\\music\\incoming\\author - book1".AsOsAgnostic(), "author", "book1", 10);
|
||||
tracks.AddRange(GivenTracks($"C:\\music\\incoming\\author - book2".AsOsAgnostic(), "author", "book2", 5));
|
||||
|
||||
TrackGroupingService.IsVariousArtists(tracks).Should().Be(false);
|
||||
TrackGroupingService.IsVariousAuthors(tracks).Should().Be(false);
|
||||
TrackGroupingService.LooksLikeSingleRelease(tracks).Should().Be(false);
|
||||
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
@@ -234,12 +234,12 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_group_albums_with_typos()
|
||||
public void should_group_books_with_typos()
|
||||
{
|
||||
var tracks = GivenTracks($"C:\\music\\incoming\\artist - album".AsOsAgnostic(), "artist", "Rastaman Vibration (Remastered)", 10);
|
||||
tracks.AddRange(GivenTracks($"C:\\music\\incoming\\artist - album".AsOsAgnostic(), "artist", "Rastaman Vibration (Remastered", 5));
|
||||
var tracks = GivenTracks($"C:\\music\\incoming\\author - book".AsOsAgnostic(), "author", "Rastaman Vibration (Remastered)", 10);
|
||||
tracks.AddRange(GivenTracks($"C:\\music\\incoming\\author - book".AsOsAgnostic(), "author", "Rastaman Vibration (Remastered", 5));
|
||||
|
||||
TrackGroupingService.IsVariousArtists(tracks).Should().Be(false);
|
||||
TrackGroupingService.IsVariousAuthors(tracks).Should().Be(false);
|
||||
TrackGroupingService.LooksLikeSingleRelease(tracks).Should().Be(true);
|
||||
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
@@ -250,10 +250,10 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
[Test]
|
||||
public void should_not_group_two_different_tracks_in_same_directory()
|
||||
{
|
||||
var tracks = GivenTracks($"C:\\music\\incoming".AsOsAgnostic(), "artist", "album1", 1);
|
||||
tracks.AddRange(GivenTracks($"C:\\music\\incoming".AsOsAgnostic(), "artist", "album2", 1));
|
||||
var tracks = GivenTracks($"C:\\music\\incoming".AsOsAgnostic(), "author", "book1", 1);
|
||||
tracks.AddRange(GivenTracks($"C:\\music\\incoming".AsOsAgnostic(), "author", "book2", 1));
|
||||
|
||||
TrackGroupingService.IsVariousArtists(tracks).Should().Be(false);
|
||||
TrackGroupingService.IsVariousAuthors(tracks).Should().Be(false);
|
||||
TrackGroupingService.LooksLikeSingleRelease(tracks).Should().Be(false);
|
||||
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
@@ -263,12 +263,12 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_separate_two_albums_in_same_directory()
|
||||
public void should_separate_two_books_in_same_directory()
|
||||
{
|
||||
var tracks = GivenTracks($"C:\\music\\incoming\\artist discog".AsOsAgnostic(), "artist", "album1", 10);
|
||||
tracks.AddRange(GivenTracks($"C:\\music\\incoming\\artist disog".AsOsAgnostic(), "artist", "album2", 5));
|
||||
var tracks = GivenTracks($"C:\\music\\incoming\\author discog".AsOsAgnostic(), "author", "book1", 10);
|
||||
tracks.AddRange(GivenTracks($"C:\\music\\incoming\\author disog".AsOsAgnostic(), "author", "book2", 5));
|
||||
|
||||
TrackGroupingService.IsVariousArtists(tracks).Should().Be(false);
|
||||
TrackGroupingService.IsVariousAuthors(tracks).Should().Be(false);
|
||||
TrackGroupingService.LooksLikeSingleRelease(tracks).Should().Be(false);
|
||||
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
@@ -278,15 +278,15 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_separate_many_albums_in_same_directory()
|
||||
public void should_separate_many_books_in_same_directory()
|
||||
{
|
||||
var tracks = new List<LocalBook>();
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
tracks.AddRange(GivenTracks($"C:\\music".AsOsAgnostic(), "artist" + i, "album" + i, 10));
|
||||
tracks.AddRange(GivenTracks($"C:\\music".AsOsAgnostic(), "author" + i, "book" + i, 10));
|
||||
}
|
||||
|
||||
// don't test various artists here because it's designed to only work if there's a common album
|
||||
// don't test various authors here because it's designed to only work if there's a common book
|
||||
TrackGroupingService.LooksLikeSingleRelease(tracks).Should().Be(false);
|
||||
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
@@ -295,12 +295,12 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_separate_two_albums_by_different_artists_in_same_directory()
|
||||
public void should_separate_two_books_by_different_authors_in_same_directory()
|
||||
{
|
||||
var tracks = GivenTracks($"C:\\music\\incoming".AsOsAgnostic(), "artist1", "album1", 10);
|
||||
tracks.AddRange(GivenTracks($"C:\\music\\incoming".AsOsAgnostic(), "artist2", "album2", 5));
|
||||
var tracks = GivenTracks($"C:\\music\\incoming".AsOsAgnostic(), "author1", "book1", 10);
|
||||
tracks.AddRange(GivenTracks($"C:\\music\\incoming".AsOsAgnostic(), "author2", "book2", 5));
|
||||
|
||||
TrackGroupingService.IsVariousArtists(tracks).Should().Be(false);
|
||||
TrackGroupingService.IsVariousAuthors(tracks).Should().Be(false);
|
||||
TrackGroupingService.LooksLikeSingleRelease(tracks).Should().Be(false);
|
||||
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
@@ -313,9 +313,9 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
[Repeat(100)]
|
||||
public void should_group_va_release()
|
||||
{
|
||||
var tracks = GivenVaTracks(@"C:\music\incoming".AsOsAgnostic(), "album", 10);
|
||||
var tracks = GivenVaTracks(@"C:\music\incoming".AsOsAgnostic(), "book", 10);
|
||||
|
||||
TrackGroupingService.IsVariousArtists(tracks).Should().Be(true);
|
||||
TrackGroupingService.IsVariousAuthors(tracks).Should().Be(true);
|
||||
TrackGroupingService.LooksLikeSingleRelease(tracks).Should().Be(true);
|
||||
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
@@ -324,12 +324,12 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_group_two_albums_by_different_artists_with_same_title()
|
||||
public void should_not_group_two_books_by_different_authors_with_same_title()
|
||||
{
|
||||
var tracks = GivenTracks($"C:\\music\\incoming\\album".AsOsAgnostic(), "artist1", "album", 10);
|
||||
tracks.AddRange(GivenTracks($"C:\\music\\incoming\\album".AsOsAgnostic(), "artist2", "album", 5));
|
||||
var tracks = GivenTracks($"C:\\music\\incoming\\book".AsOsAgnostic(), "author1", "book", 10);
|
||||
tracks.AddRange(GivenTracks($"C:\\music\\incoming\\book".AsOsAgnostic(), "author2", "book", 5));
|
||||
|
||||
TrackGroupingService.IsVariousArtists(tracks).Should().Be(false);
|
||||
TrackGroupingService.IsVariousAuthors(tracks).Should().Be(false);
|
||||
TrackGroupingService.LooksLikeSingleRelease(tracks).Should().Be(false);
|
||||
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
@@ -342,9 +342,9 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
[Test]
|
||||
public void should_not_fail_if_all_tags_null()
|
||||
{
|
||||
var tracks = GivenTracksWithNoTags($"C:\\music\\incoming\\album".AsOsAgnostic(), 10);
|
||||
var tracks = GivenTracksWithNoTags($"C:\\music\\incoming\\book".AsOsAgnostic(), 10);
|
||||
|
||||
TrackGroupingService.IsVariousArtists(tracks).Should().Be(false);
|
||||
TrackGroupingService.IsVariousAuthors(tracks).Should().Be(false);
|
||||
TrackGroupingService.LooksLikeSingleRelease(tracks).Should().Be(true);
|
||||
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
@@ -355,10 +355,10 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
[Test]
|
||||
public void should_not_fail_if_some_tags_null()
|
||||
{
|
||||
var tracks = GivenTracks($"C:\\music\\incoming\\album".AsOsAgnostic(), "artist1", "album", 10);
|
||||
tracks.AddRange(GivenTracksWithNoTags($"C:\\music\\incoming\\album".AsOsAgnostic(), 2));
|
||||
var tracks = GivenTracks($"C:\\music\\incoming\\book".AsOsAgnostic(), "author1", "book", 10);
|
||||
tracks.AddRange(GivenTracksWithNoTags($"C:\\music\\incoming\\book".AsOsAgnostic(), 2));
|
||||
|
||||
TrackGroupingService.IsVariousArtists(tracks).Should().Be(false);
|
||||
TrackGroupingService.IsVariousAuthors(tracks).Should().Be(false);
|
||||
TrackGroupingService.LooksLikeSingleRelease(tracks).Should().Be(true);
|
||||
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
@@ -367,12 +367,12 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_cope_with_one_album_in_subfolder_of_another()
|
||||
public void should_cope_with_one_book_in_subfolder_of_another()
|
||||
{
|
||||
var tracks = GivenTracks($"C:\\music\\incoming\\album".AsOsAgnostic(), "artist1", "album", 10);
|
||||
tracks.AddRange(GivenTracks($"C:\\music\\incoming\\album\\anotheralbum".AsOsAgnostic(), "artist2", "album2", 10));
|
||||
var tracks = GivenTracks($"C:\\music\\incoming\\book".AsOsAgnostic(), "author1", "book", 10);
|
||||
tracks.AddRange(GivenTracks($"C:\\music\\incoming\\book\\anotherbook".AsOsAgnostic(), "author2", "book2", 10));
|
||||
|
||||
TrackGroupingService.IsVariousArtists(tracks).Should().Be(false);
|
||||
TrackGroupingService.IsVariousAuthors(tracks).Should().Be(false);
|
||||
TrackGroupingService.LooksLikeSingleRelease(tracks).Should().Be(false);
|
||||
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
|
||||
@@ -26,21 +26,21 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport
|
||||
{
|
||||
private List<IFileInfo> _fileInfos;
|
||||
private LocalBook _localTrack;
|
||||
private Author _artist;
|
||||
private Book _album;
|
||||
private Author _author;
|
||||
private Book _book;
|
||||
private Edition _edition;
|
||||
private QualityModel _quality;
|
||||
|
||||
private IdentificationOverrides _idOverrides;
|
||||
private ImportDecisionMakerConfig _idConfig;
|
||||
|
||||
private Mock<IImportDecisionEngineSpecification<LocalEdition>> _albumpass1;
|
||||
private Mock<IImportDecisionEngineSpecification<LocalEdition>> _albumpass2;
|
||||
private Mock<IImportDecisionEngineSpecification<LocalEdition>> _albumpass3;
|
||||
private Mock<IImportDecisionEngineSpecification<LocalEdition>> _bookpass1;
|
||||
private Mock<IImportDecisionEngineSpecification<LocalEdition>> _bookpass2;
|
||||
private Mock<IImportDecisionEngineSpecification<LocalEdition>> _bookpass3;
|
||||
|
||||
private Mock<IImportDecisionEngineSpecification<LocalEdition>> _albumfail1;
|
||||
private Mock<IImportDecisionEngineSpecification<LocalEdition>> _albumfail2;
|
||||
private Mock<IImportDecisionEngineSpecification<LocalEdition>> _albumfail3;
|
||||
private Mock<IImportDecisionEngineSpecification<LocalEdition>> _bookfail1;
|
||||
private Mock<IImportDecisionEngineSpecification<LocalEdition>> _bookfail2;
|
||||
private Mock<IImportDecisionEngineSpecification<LocalEdition>> _bookfail3;
|
||||
|
||||
private Mock<IImportDecisionEngineSpecification<LocalBook>> _pass1;
|
||||
private Mock<IImportDecisionEngineSpecification<LocalBook>> _pass2;
|
||||
@@ -53,13 +53,13 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_albumpass1 = new Mock<IImportDecisionEngineSpecification<LocalEdition>>();
|
||||
_albumpass2 = new Mock<IImportDecisionEngineSpecification<LocalEdition>>();
|
||||
_albumpass3 = new Mock<IImportDecisionEngineSpecification<LocalEdition>>();
|
||||
_bookpass1 = new Mock<IImportDecisionEngineSpecification<LocalEdition>>();
|
||||
_bookpass2 = new Mock<IImportDecisionEngineSpecification<LocalEdition>>();
|
||||
_bookpass3 = new Mock<IImportDecisionEngineSpecification<LocalEdition>>();
|
||||
|
||||
_albumfail1 = new Mock<IImportDecisionEngineSpecification<LocalEdition>>();
|
||||
_albumfail2 = new Mock<IImportDecisionEngineSpecification<LocalEdition>>();
|
||||
_albumfail3 = new Mock<IImportDecisionEngineSpecification<LocalEdition>>();
|
||||
_bookfail1 = new Mock<IImportDecisionEngineSpecification<LocalEdition>>();
|
||||
_bookfail2 = new Mock<IImportDecisionEngineSpecification<LocalEdition>>();
|
||||
_bookfail3 = new Mock<IImportDecisionEngineSpecification<LocalEdition>>();
|
||||
|
||||
_pass1 = new Mock<IImportDecisionEngineSpecification<LocalBook>>();
|
||||
_pass2 = new Mock<IImportDecisionEngineSpecification<LocalBook>>();
|
||||
@@ -69,13 +69,13 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport
|
||||
_fail2 = new Mock<IImportDecisionEngineSpecification<LocalBook>>();
|
||||
_fail3 = new Mock<IImportDecisionEngineSpecification<LocalBook>>();
|
||||
|
||||
_albumpass1.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Accept());
|
||||
_albumpass2.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Accept());
|
||||
_albumpass3.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Accept());
|
||||
_bookpass1.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Accept());
|
||||
_bookpass2.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Accept());
|
||||
_bookpass3.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Accept());
|
||||
|
||||
_albumfail1.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Reject("_albumfail1"));
|
||||
_albumfail2.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Reject("_albumfail2"));
|
||||
_albumfail3.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Reject("_albumfail3"));
|
||||
_bookfail1.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Reject("_bookfail1"));
|
||||
_bookfail2.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Reject("_bookfail2"));
|
||||
_bookfail3.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Reject("_bookfail3"));
|
||||
|
||||
_pass1.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalBook>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Accept());
|
||||
_pass2.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalBook>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Accept());
|
||||
@@ -85,24 +85,24 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport
|
||||
_fail2.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalBook>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Reject("_fail2"));
|
||||
_fail3.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalBook>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Reject("_fail3"));
|
||||
|
||||
_artist = Builder<Author>.CreateNew()
|
||||
_author = Builder<Author>.CreateNew()
|
||||
.With(e => e.QualityProfileId = 1)
|
||||
.With(e => e.QualityProfile = new QualityProfile { Items = Qualities.QualityFixture.GetDefaultQualities() })
|
||||
.Build();
|
||||
|
||||
_album = Builder<Book>.CreateNew()
|
||||
.With(x => x.Author = _artist)
|
||||
_book = Builder<Book>.CreateNew()
|
||||
.With(x => x.Author = _author)
|
||||
.Build();
|
||||
|
||||
_edition = Builder<Edition>.CreateNew()
|
||||
.With(x => x.Book = _album)
|
||||
.With(x => x.Book = _book)
|
||||
.Build();
|
||||
|
||||
_quality = new QualityModel(Quality.MP3_320);
|
||||
|
||||
_localTrack = new LocalBook
|
||||
{
|
||||
Author = _artist,
|
||||
Author = _author,
|
||||
Quality = _quality,
|
||||
Book = new Book(),
|
||||
Path = @"C:\Test\Unsorted\The.Office.S03E115.DVDRip.XviD-OSiTV.avi".AsOsAgnostic()
|
||||
@@ -110,7 +110,7 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport
|
||||
|
||||
_idOverrides = new IdentificationOverrides
|
||||
{
|
||||
Author = _artist
|
||||
Author = _author
|
||||
};
|
||||
|
||||
_idConfig = new ImportDecisionMakerConfig();
|
||||
@@ -130,7 +130,7 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport
|
||||
.Setup(c => c.FilterUnchangedFiles(It.IsAny<List<IFileInfo>>(), It.IsAny<FilterFilesType>()))
|
||||
.Returns((List<IFileInfo> files, FilterFilesType filter) => files);
|
||||
|
||||
GivenSpecifications(_albumpass1);
|
||||
GivenSpecifications(_bookpass1);
|
||||
}
|
||||
|
||||
private void GivenSpecifications<T>(params Mock<IImportDecisionEngineSpecification<T>>[] mocks)
|
||||
@@ -159,26 +159,26 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_call_all_album_specifications()
|
||||
public void should_call_all_book_specifications()
|
||||
{
|
||||
var downloadClientItem = Builder<DownloadClientItem>.CreateNew().Build();
|
||||
var itemInfo = new ImportDecisionMakerInfo { DownloadClientItem = downloadClientItem };
|
||||
|
||||
GivenAugmentationSuccess();
|
||||
GivenSpecifications(_albumpass1, _albumpass2, _albumpass3, _albumfail1, _albumfail2, _albumfail3);
|
||||
GivenSpecifications(_bookpass1, _bookpass2, _bookpass3, _bookfail1, _bookfail2, _bookfail3);
|
||||
|
||||
Subject.GetImportDecisions(_fileInfos, null, itemInfo, _idConfig);
|
||||
|
||||
_albumfail1.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
_albumfail2.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
_albumfail3.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
_albumpass1.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
_albumpass2.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
_albumpass3.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
_bookfail1.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
_bookfail2.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
_bookfail3.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
_bookpass1.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
_bookpass2.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
_bookpass3.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalEdition>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_call_all_track_specifications_if_album_accepted()
|
||||
public void should_call_all_track_specifications_if_book_accepted()
|
||||
{
|
||||
var downloadClientItem = Builder<DownloadClientItem>.CreateNew().Build();
|
||||
var itemInfo = new ImportDecisionMakerInfo { DownloadClientItem = downloadClientItem };
|
||||
@@ -197,13 +197,13 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_call_no_track_specifications_if_album_rejected()
|
||||
public void should_call_no_track_specifications_if_book_rejected()
|
||||
{
|
||||
var downloadClientItem = Builder<DownloadClientItem>.CreateNew().Build();
|
||||
var itemInfo = new ImportDecisionMakerInfo { DownloadClientItem = downloadClientItem };
|
||||
|
||||
GivenAugmentationSuccess();
|
||||
GivenSpecifications(_albumpass1, _albumpass2, _albumpass3, _albumfail1, _albumfail2, _albumfail3);
|
||||
GivenSpecifications(_bookpass1, _bookpass2, _bookpass3, _bookfail1, _bookfail2, _bookfail3);
|
||||
GivenSpecifications(_pass1, _pass2, _pass3, _fail1, _fail2, _fail3);
|
||||
|
||||
Subject.GetImportDecisions(_fileInfos, null, itemInfo, _idConfig);
|
||||
@@ -217,9 +217,9 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_rejected_if_only_album_spec_fails()
|
||||
public void should_return_rejected_if_only_book_spec_fails()
|
||||
{
|
||||
GivenSpecifications(_albumfail1);
|
||||
GivenSpecifications(_bookfail1);
|
||||
GivenSpecifications(_pass1);
|
||||
|
||||
var result = Subject.GetImportDecisions(_fileInfos, null, null, _idConfig);
|
||||
@@ -230,7 +230,7 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport
|
||||
[Test]
|
||||
public void should_return_rejected_if_only_track_spec_fails()
|
||||
{
|
||||
GivenSpecifications(_albumpass1);
|
||||
GivenSpecifications(_bookpass1);
|
||||
GivenSpecifications(_fail1);
|
||||
|
||||
var result = Subject.GetImportDecisions(_fileInfos, null, null, _idConfig);
|
||||
@@ -239,9 +239,9 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_rejected_if_one_album_spec_fails()
|
||||
public void should_return_rejected_if_one_book_spec_fails()
|
||||
{
|
||||
GivenSpecifications(_albumpass1, _albumfail1, _albumpass2, _albumpass3);
|
||||
GivenSpecifications(_bookpass1, _bookfail1, _bookpass2, _bookpass3);
|
||||
GivenSpecifications(_pass1, _pass2, _pass3);
|
||||
|
||||
var result = Subject.GetImportDecisions(_fileInfos, null, null, _idConfig);
|
||||
@@ -252,7 +252,7 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport
|
||||
[Test]
|
||||
public void should_return_rejected_if_one_track_spec_fails()
|
||||
{
|
||||
GivenSpecifications(_albumpass1, _albumpass2, _albumpass3);
|
||||
GivenSpecifications(_bookpass1, _bookpass2, _bookpass3);
|
||||
GivenSpecifications(_pass1, _fail1, _pass2, _pass3);
|
||||
|
||||
var result = Subject.GetImportDecisions(_fileInfos, null, null, _idConfig);
|
||||
@@ -264,7 +264,7 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport
|
||||
public void should_return_approved_if_all_specs_pass()
|
||||
{
|
||||
GivenAugmentationSuccess();
|
||||
GivenSpecifications(_albumpass1, _albumpass2, _albumpass3);
|
||||
GivenSpecifications(_bookpass1, _bookpass2, _bookpass3);
|
||||
GivenSpecifications(_pass1, _pass2, _pass3);
|
||||
|
||||
var result = Subject.GetImportDecisions(_fileInfos, null, null, _idConfig);
|
||||
|
||||
+5
-5
@@ -16,7 +16,7 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Specifications
|
||||
[TestFixture]
|
||||
public class FreeSpaceSpecificationFixture : CoreTest<FreeSpaceSpecification>
|
||||
{
|
||||
private Author _artist;
|
||||
private Author _author;
|
||||
private LocalBook _localTrack;
|
||||
private string _rootFolder;
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Specifications
|
||||
{
|
||||
_rootFolder = @"C:\Test\Music".AsOsAgnostic();
|
||||
|
||||
_artist = Builder<Author>.CreateNew()
|
||||
_author = Builder<Author>.CreateNew()
|
||||
.With(s => s.Path = Path.Combine(_rootFolder, "Alice in Chains"))
|
||||
.Build();
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Specifications
|
||||
{
|
||||
Path = @"C:\Test\Unsorted\Alice in Chains\Alice in Chains - track1.mp3".AsOsAgnostic(),
|
||||
Book = new Book(),
|
||||
Author = _artist
|
||||
Author = _author
|
||||
};
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Specifications
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_use_artist_paths_parent_for_free_space_check()
|
||||
public void should_use_author_paths_parent_for_free_space_check()
|
||||
{
|
||||
GivenFileSize(100.Megabytes());
|
||||
GivenFreeSpace(1.Gigabytes());
|
||||
@@ -117,7 +117,7 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Specifications
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_skip_check_for_files_under_artist_folder()
|
||||
public void should_skip_check_for_files_under_author_folder()
|
||||
{
|
||||
_localTrack.ExistingFile = true;
|
||||
|
||||
|
||||
+4
-6
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
@@ -95,12 +96,9 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Specifications
|
||||
[Test]
|
||||
public void should_be_accepted_if_file_cannot_be_fetched()
|
||||
{
|
||||
_localTrack.Tracks = Builder<Track>.CreateListOfSize(1)
|
||||
.TheFirst(1)
|
||||
.With(e => e.TrackFileId = 1)
|
||||
.With(e => e.TrackFile = new LazyLoaded<TrackFile>((TrackFile)null))
|
||||
.Build()
|
||||
.ToList();
|
||||
_localTrack.Book = Builder<Book>.CreateNew()
|
||||
.With(e => e.BookFiles = new LazyLoaded<List<BookFile>>((List<BookFile>)null))
|
||||
.Build();
|
||||
|
||||
Subject.IsSatisfiedBy(_localTrack, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
+6
-6
@@ -18,27 +18,27 @@ namespace NzbDrone.Core.Test.MediaFiles.BookImport.Specifications
|
||||
public class UpgradeSpecificationFixture : CoreTest<UpgradeSpecification>
|
||||
{
|
||||
/*
|
||||
private Author _artist;
|
||||
private Book _album;
|
||||
private Author _author;
|
||||
private Book _book;
|
||||
private LocalTrack _localTrack;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_artist = Builder<Author>.CreateNew()
|
||||
_author = Builder<Author>.CreateNew()
|
||||
.With(e => e.QualityProfile = new QualityProfile
|
||||
{
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||
}).Build();
|
||||
|
||||
_album = Builder<Book>.CreateNew().Build();
|
||||
_book = Builder<Book>.CreateNew().Build();
|
||||
|
||||
_localTrack = new LocalTrack
|
||||
{
|
||||
Path = @"C:\Test\Imagine Dragons\Imagine.Dragons.Song.1.mp3",
|
||||
Quality = new QualityModel(Quality.MP3_320, new Revision(version: 1)),
|
||||
Artist = _artist,
|
||||
Album = _album
|
||||
Author = _author,
|
||||
Book = _book
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
{
|
||||
private BookFile _trackFile;
|
||||
private LocalBook _localTrack;
|
||||
private string _rootPath = @"C:\Test\Music\Artist".AsOsAgnostic();
|
||||
private string _rootPath = @"C:\Test\Music\Author".AsOsAgnostic();
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
@@ -97,7 +97,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
|
||||
Subject.UpgradeBookFile(_trackFile, _localTrack);
|
||||
|
||||
// Mocker.GetMock<IMediaFileService>().Verify(v => v.Delete(_localTrack.Album.BookFiles.Value, DeleteMediaFileReason.Upgrade), Times.Once());
|
||||
// Mocker.GetMock<IMediaFileService>().Verify(v => v.Delete(_localTrack.Book.BookFiles.Value, DeleteMediaFileReason.Upgrade), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -132,7 +132,7 @@ namespace NzbDrone.Core.Test.MediaFiles
|
||||
|
||||
Subject.UpgradeBookFile(_trackFile, _localTrack);
|
||||
|
||||
// Mocker.GetMock<IMediaFileService>().Verify(v => v.Delete(_localTrack.Album.BookFiles.Value, It.IsAny<DeleteMediaFileReason>()), Times.Never());
|
||||
// Mocker.GetMock<IMediaFileService>().Verify(v => v.Delete(_localTrack.Book.BookFiles.Value, It.IsAny<DeleteMediaFileReason>()), Times.Never());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user