mirror of
https://github.com/Readarr/Readarr
synced 2025-12-29 11:47:12 +01:00
Method, Variable, Class Renames in Readarr.Core
Co-Authored-By: ta264 <ta264@users.noreply.github.com>
This commit is contained in:
parent
56aedcc467
commit
8547af9fae
572 changed files with 6584 additions and 6597 deletions
|
|
@ -3,21 +3,21 @@ export const BACKUP = 'Backup';
|
|||
export const REFRESH_MONITORED_DOWNLOADS = 'RefreshMonitoredDownloads';
|
||||
export const CLEAR_BLACKLIST = 'ClearBlacklist';
|
||||
export const CLEAR_LOGS = 'ClearLog';
|
||||
export const CUTOFF_UNMET_ALBUM_SEARCH = 'CutoffUnmetAlbumSearch';
|
||||
export const CUTOFF_UNMET_ALBUM_SEARCH = 'CutoffUnmetBookSearch';
|
||||
export const DELETE_LOG_FILES = 'DeleteLogFiles';
|
||||
export const DELETE_UPDATE_LOG_FILES = 'DeleteUpdateLogFiles';
|
||||
export const DOWNLOADED_ALBUMS_SCAN = 'DownloadedAlbumsScan';
|
||||
export const DOWNLOADED_ALBUMS_SCAN = 'DownloadedBooksScan';
|
||||
export const ALBUM_SEARCH = 'AlbumSearch';
|
||||
export const INTERACTIVE_IMPORT = 'ManualImport';
|
||||
export const MISSING_ALBUM_SEARCH = 'MissingAlbumSearch';
|
||||
export const MOVE_ARTIST = 'MoveArtist';
|
||||
export const REFRESH_ARTIST = 'RefreshArtist';
|
||||
export const MISSING_ALBUM_SEARCH = 'MissingBookSearch';
|
||||
export const MOVE_ARTIST = 'MoveAuthor';
|
||||
export const REFRESH_ARTIST = 'RefreshAuthor';
|
||||
export const RENAME_FILES = 'RenameFiles';
|
||||
export const RENAME_ARTIST = 'RenameArtist';
|
||||
export const RENAME_ARTIST = 'RenameAuthor';
|
||||
export const RESCAN_FOLDERS = 'RescanFolders';
|
||||
export const RETAG_FILES = 'RetagFiles';
|
||||
export const RETAG_ARTIST = 'RetagArtist';
|
||||
export const RETAG_ARTIST = 'RetagAuthor';
|
||||
export const RESET_API_KEY = 'ResetApiKey';
|
||||
export const RSS_SYNC = 'RssSync';
|
||||
export const SEASON_SEARCH = 'AlbumSearch';
|
||||
export const ARTIST_SEARCH = 'ArtistSearch';
|
||||
export const SEASON_SEARCH = 'BookSearch';
|
||||
export const ARTIST_SEARCH = 'AuthorSearch';
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ function createMapStateToProps() {
|
|||
props.isFetching = organizePreview.isFetching || naming.isFetching;
|
||||
props.isPopulated = organizePreview.isPopulated && naming.isPopulated;
|
||||
props.error = organizePreview.error || naming.error;
|
||||
props.trackFormat = naming.item.standardTrackFormat;
|
||||
props.trackFormat = naming.item.standardBookFormat;
|
||||
props.path = artist.path;
|
||||
|
||||
return props;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class Naming extends Component {
|
|||
this.setState({
|
||||
isNamingModalOpen: true,
|
||||
namingModalOptions: {
|
||||
name: 'standardTrackFormat',
|
||||
name: 'standardBookFormat',
|
||||
album: true,
|
||||
track: true,
|
||||
additional: true
|
||||
|
|
@ -40,11 +40,11 @@ class Naming extends Component {
|
|||
});
|
||||
}
|
||||
|
||||
onArtistFolderNamingModalOpenClick = () => {
|
||||
onAuthorFolderNamingModalOpenClick = () => {
|
||||
this.setState({
|
||||
isNamingModalOpen: true,
|
||||
namingModalOptions: {
|
||||
name: 'artistFolderFormat'
|
||||
name: 'authorFolderFormat'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -73,24 +73,24 @@ class Naming extends Component {
|
|||
namingModalOptions
|
||||
} = this.state;
|
||||
|
||||
const renameTracks = hasSettings && settings.renameTracks.value;
|
||||
const renameBooks = hasSettings && settings.renameBooks.value;
|
||||
|
||||
const standardTrackFormatHelpTexts = [];
|
||||
const standardTrackFormatErrors = [];
|
||||
const artistFolderFormatHelpTexts = [];
|
||||
const artistFolderFormatErrors = [];
|
||||
const standardBookFormatHelpTexts = [];
|
||||
const standardBookFormatErrors = [];
|
||||
const authorFolderFormatHelpTexts = [];
|
||||
const authorFolderFormatErrors = [];
|
||||
|
||||
if (examplesPopulated) {
|
||||
if (examples.singleTrackExample) {
|
||||
standardTrackFormatHelpTexts.push(`Single Track: ${examples.singleTrackExample}`);
|
||||
standardBookFormatHelpTexts.push(`Single Track: ${examples.singleTrackExample}`);
|
||||
} else {
|
||||
standardTrackFormatErrors.push({ message: 'Single Track: Invalid Format' });
|
||||
standardBookFormatErrors.push({ message: 'Single Track: Invalid Format' });
|
||||
}
|
||||
|
||||
if (examples.artistFolderExample) {
|
||||
artistFolderFormatHelpTexts.push(`Example: ${examples.artistFolderExample}`);
|
||||
authorFolderFormatHelpTexts.push(`Example: ${examples.artistFolderExample}`);
|
||||
} else {
|
||||
artistFolderFormatErrors.push({ message: 'Invalid Format' });
|
||||
authorFolderFormatErrors.push({ message: 'Invalid Format' });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -114,10 +114,10 @@ class Naming extends Component {
|
|||
|
||||
<FormInputGroup
|
||||
type={inputTypes.CHECK}
|
||||
name="renameTracks"
|
||||
name="renameBooks"
|
||||
helpText="Readarr will use the existing file name if renaming is disabled"
|
||||
onChange={onInputChange}
|
||||
{...settings.renameTracks}
|
||||
{...settings.renameBooks}
|
||||
/>
|
||||
</FormGroup>
|
||||
|
||||
|
|
@ -134,20 +134,20 @@ class Naming extends Component {
|
|||
</FormGroup>
|
||||
|
||||
{
|
||||
renameTracks &&
|
||||
renameBooks &&
|
||||
<div>
|
||||
<FormGroup size={sizes.LARGE}>
|
||||
<FormLabel>Standard Track Format</FormLabel>
|
||||
<FormLabel>Standard Book Format</FormLabel>
|
||||
|
||||
<FormInputGroup
|
||||
inputClassName={styles.namingInput}
|
||||
type={inputTypes.TEXT}
|
||||
name="standardTrackFormat"
|
||||
name="standardBookFormat"
|
||||
buttons={<FormInputButton onPress={this.onStandardNamingModalOpenClick}>?</FormInputButton>}
|
||||
onChange={onInputChange}
|
||||
{...settings.standardTrackFormat}
|
||||
helpTexts={standardTrackFormatHelpTexts}
|
||||
errors={[...standardTrackFormatErrors, ...settings.standardTrackFormat.errors]}
|
||||
{...settings.standardBookFormat}
|
||||
helpTexts={standardBookFormatHelpTexts}
|
||||
errors={[...standardBookFormatErrors, ...settings.standardBookFormat.errors]}
|
||||
/>
|
||||
</FormGroup>
|
||||
</div>
|
||||
|
|
@ -162,12 +162,12 @@ class Naming extends Component {
|
|||
<FormInputGroup
|
||||
inputClassName={styles.namingInput}
|
||||
type={inputTypes.TEXT}
|
||||
name="artistFolderFormat"
|
||||
buttons={<FormInputButton onPress={this.onArtistFolderNamingModalOpenClick}>?</FormInputButton>}
|
||||
name="authorFolderFormat"
|
||||
buttons={<FormInputButton onPress={this.onAuthorFolderNamingModalOpenClick}>?</FormInputButton>}
|
||||
onChange={onInputChange}
|
||||
{...settings.artistFolderFormat}
|
||||
helpTexts={['Used when adding a new artist or moving an artist via the artist editor', ...artistFolderFormatHelpTexts]}
|
||||
errors={[...artistFolderFormatErrors, ...settings.artistFolderFormat.errors]}
|
||||
{...settings.authorFolderFormat}
|
||||
helpTexts={['Used when adding a new artist or moving an author via the author editor', ...authorFolderFormatHelpTexts]}
|
||||
errors={[...authorFolderFormatErrors, ...settings.authorFolderFormat.errors]}
|
||||
/>
|
||||
</FormGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -28,35 +28,35 @@ const caseOptions = [
|
|||
|
||||
const fileNameTokens = [
|
||||
{
|
||||
token: '{Artist Name} - {Album Title} - {track:00} - {Track Title} {Quality Full}',
|
||||
example: 'Artist Name - Album Title - 01 - Track Title MP3-320 Proper'
|
||||
token: '{Author Name} - {Book Title} - {track:00} - {Track Title} {Quality Full}',
|
||||
example: 'Author Name - Book Title - 01 - Track Title MP3-320 Proper'
|
||||
},
|
||||
{
|
||||
token: '{Artist.Name}.{Album.Title}.{track:00}.{TrackClean.Title}.{Quality.Full}',
|
||||
example: 'Artist.Name.Album.Title.01.Track.Title.MP3-320'
|
||||
token: '{Author.Name}.{Book.Title}.{track:00}.{TrackClean.Title}.{Quality.Full}',
|
||||
example: 'Author.Name.Book.Title.01.Track.Title.MP3-320'
|
||||
}
|
||||
];
|
||||
|
||||
const artistTokens = [
|
||||
{ token: '{Artist Name}', example: 'Artist Name' },
|
||||
{ token: '{Author Name}', example: 'Author Name' },
|
||||
|
||||
{ token: '{Artist NameThe}', example: 'Artist Name, The' },
|
||||
{ token: '{Author NameThe}', example: 'Author Name, The' },
|
||||
|
||||
{ token: '{Artist CleanName}', example: 'Artist Name' },
|
||||
{ token: '{Author CleanName}', example: 'Author Name' },
|
||||
|
||||
{ token: '{Artist Disambiguation}', example: 'Disambiguation' }
|
||||
{ token: '{Author Disambiguation}', example: 'Disambiguation' }
|
||||
];
|
||||
|
||||
const albumTokens = [
|
||||
{ token: '{Album Title}', example: 'Album Title' },
|
||||
{ token: '{Book Title}', example: 'Book Title' },
|
||||
|
||||
{ token: '{Album TitleThe}', example: 'Album Title, The' },
|
||||
{ token: '{Book TitleThe}', example: 'Book Title, The' },
|
||||
|
||||
{ token: '{Album CleanTitle}', example: 'Album Title' },
|
||||
{ token: '{Book CleanTitle}', example: 'Book Title' },
|
||||
|
||||
{ token: '{Album Type}', example: 'Album Type' },
|
||||
{ token: '{Book Type}', example: 'Book Type' },
|
||||
|
||||
{ token: '{Album Disambiguation}', example: 'Disambiguation' }
|
||||
{ token: '{Book Disambiguation}', example: 'Disambiguation' }
|
||||
];
|
||||
|
||||
const mediumTokens = [
|
||||
|
|
@ -101,7 +101,7 @@ const otherTokens = [
|
|||
];
|
||||
|
||||
const originalTokens = [
|
||||
{ token: '{Original Title}', example: 'Artist.Name.Album.Name.2018.FLAC-EVOLVE' },
|
||||
{ token: '{Original Title}', example: 'Author.Name.Book.Name.2018.FLAC-EVOLVE' },
|
||||
{ token: '{Original Filename}', example: '01 - track name' }
|
||||
];
|
||||
|
||||
|
|
@ -243,7 +243,7 @@ class NamingModal extends Component {
|
|||
</FieldSet>
|
||||
}
|
||||
|
||||
<FieldSet legend="Artist">
|
||||
<FieldSet legend="Author">
|
||||
<div className={styles.groups}>
|
||||
{
|
||||
artistTokens.map(({ token, example }) => {
|
||||
|
|
@ -268,7 +268,7 @@ class NamingModal extends Component {
|
|||
{
|
||||
album &&
|
||||
<div>
|
||||
<FieldSet legend="Album">
|
||||
<FieldSet legend="Book">
|
||||
<div className={styles.groups}>
|
||||
{
|
||||
albumTokens.map(({ token, example }) => {
|
||||
|
|
|
|||
|
|
@ -3,16 +3,16 @@
|
|||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.ArtistStats;
|
||||
using NzbDrone.Core.AuthorStats;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.ArtistStatsTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class ArtistStatisticsFixture : DbTest<ArtistStatisticsRepository, Author>
|
||||
public class ArtistStatisticsFixture : DbTest<AuthorStatisticsRepository, Author>
|
||||
{
|
||||
private Author _artist;
|
||||
private Book _album;
|
||||
|
|
@ -33,8 +33,8 @@ public void Setup()
|
|||
Db.Insert(_album);
|
||||
|
||||
_trackFile = Builder<BookFile>.CreateNew()
|
||||
.With(e => e.Artist = _artist)
|
||||
.With(e => e.Album = _album)
|
||||
.With(e => e.Author = _artist)
|
||||
.With(e => e.Book = _album)
|
||||
.With(e => e.BookId == _album.Id)
|
||||
.With(e => e.Quality = new QualityModel(Quality.MP3_320))
|
||||
.BuildNew();
|
||||
|
|
@ -48,7 +48,7 @@ private void GivenTrackFile()
|
|||
[Test]
|
||||
public void should_get_stats_for_artist()
|
||||
{
|
||||
var stats = Subject.ArtistStatistics();
|
||||
var stats = Subject.AuthorStatistics();
|
||||
|
||||
stats.Should().HaveCount(1);
|
||||
}
|
||||
|
|
@ -56,10 +56,10 @@ public void should_get_stats_for_artist()
|
|||
[Test]
|
||||
public void should_not_include_unmonitored_track_in_track_count()
|
||||
{
|
||||
var stats = Subject.ArtistStatistics();
|
||||
var stats = Subject.AuthorStatistics();
|
||||
|
||||
stats.Should().HaveCount(1);
|
||||
stats.First().TrackCount.Should().Be(0);
|
||||
stats.First().BookCount.Should().Be(0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -67,16 +67,16 @@ public void should_include_unmonitored_track_with_file_in_track_count()
|
|||
{
|
||||
GivenTrackFile();
|
||||
|
||||
var stats = Subject.ArtistStatistics();
|
||||
var stats = Subject.AuthorStatistics();
|
||||
|
||||
stats.Should().HaveCount(1);
|
||||
stats.First().TrackCount.Should().Be(1);
|
||||
stats.First().BookCount.Should().Be(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_have_size_on_disk_of_zero_when_no_track_file()
|
||||
{
|
||||
var stats = Subject.ArtistStatistics();
|
||||
var stats = Subject.AuthorStatistics();
|
||||
|
||||
stats.Should().HaveCount(1);
|
||||
stats.First().SizeOnDisk.Should().Be(0);
|
||||
|
|
@ -87,7 +87,7 @@ public void should_have_size_on_disk_when_track_file_exists()
|
|||
{
|
||||
GivenTrackFile();
|
||||
|
||||
var stats = Subject.ArtistStatistics();
|
||||
var stats = Subject.AuthorStatistics();
|
||||
|
||||
stats.Should().HaveCount(1);
|
||||
stats.First().SizeOnDisk.Should().Be(_trackFile.Size);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
using System.Data.SQLite;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books.Commands;
|
||||
using NzbDrone.Core.Datastore.Converters;
|
||||
using NzbDrone.Core.Music.Commands;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.Datastore.Converters
|
||||
|
|
@ -21,7 +21,7 @@ public void Setup()
|
|||
[Test]
|
||||
public void should_return_json_string_when_saving_boolean_to_db()
|
||||
{
|
||||
var command = new RefreshArtistCommand();
|
||||
var command = new RefreshAuthorCommand();
|
||||
|
||||
Subject.SetValue(_param, command);
|
||||
_param.Value.Should().BeOfType<string>();
|
||||
|
|
@ -37,9 +37,9 @@ public void should_return_null_for_null_value_when_saving_to_db()
|
|||
[Test]
|
||||
public void should_return_command_when_getting_json_from_db()
|
||||
{
|
||||
var data = "{\"name\": \"RefreshArtist\"}";
|
||||
var data = "{\"name\": \"RefreshAuthor\"}";
|
||||
|
||||
Subject.Parse(data).Should().BeOfType<RefreshArtistCommand>();
|
||||
Subject.Parse(data).Should().BeOfType<RefreshAuthorCommand>();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
using Dapper;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.Datastore
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
using Dapper;
|
||||
using FizzWare.NBuilder;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
|
@ -70,10 +70,10 @@ public void should_lazy_load_artist_for_trackfile()
|
|||
Assert.IsNotEmpty(tracks);
|
||||
foreach (var track in tracks)
|
||||
{
|
||||
Assert.IsFalse(track.Artist.IsLoaded);
|
||||
Assert.IsNotNull(track.Artist.Value);
|
||||
Assert.IsTrue(track.Artist.IsLoaded);
|
||||
Assert.IsTrue(track.Artist.Value.Metadata.IsLoaded);
|
||||
Assert.IsFalse(track.Author.IsLoaded);
|
||||
Assert.IsNotNull(track.Author.Value);
|
||||
Assert.IsTrue(track.Author.IsLoaded);
|
||||
Assert.IsTrue(track.Author.Value.Metadata.IsLoaded);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -104,9 +104,9 @@ public void should_explicit_load_everything_if_joined()
|
|||
Assert.IsNotEmpty(files);
|
||||
foreach (var file in files)
|
||||
{
|
||||
Assert.IsTrue(file.Album.IsLoaded);
|
||||
Assert.IsTrue(file.Artist.IsLoaded);
|
||||
Assert.IsTrue(file.Artist.Value.Metadata.IsLoaded);
|
||||
Assert.IsTrue(file.Book.IsLoaded);
|
||||
Assert.IsTrue(file.Author.IsLoaded);
|
||||
Assert.IsTrue(file.Author.Value.Metadata.IsLoaded);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -121,18 +121,18 @@ public void should_lazy_load_tracks_if_not_joined_to_trackfile()
|
|||
.Join<Author, AuthorMetadata>((a, m) => a.AuthorMetadataId == m.Id),
|
||||
(file, album, artist, metadata) =>
|
||||
{
|
||||
file.Album = album;
|
||||
file.Artist = artist;
|
||||
file.Artist.Value.Metadata = metadata;
|
||||
file.Book = album;
|
||||
file.Author = artist;
|
||||
file.Author.Value.Metadata = metadata;
|
||||
return file;
|
||||
});
|
||||
|
||||
Assert.IsNotEmpty(files);
|
||||
foreach (var file in files)
|
||||
{
|
||||
Assert.IsTrue(file.Album.IsLoaded);
|
||||
Assert.IsTrue(file.Artist.IsLoaded);
|
||||
Assert.IsTrue(file.Artist.Value.Metadata.IsLoaded);
|
||||
Assert.IsTrue(file.Book.IsLoaded);
|
||||
Assert.IsTrue(file.Author.IsLoaded);
|
||||
Assert.IsTrue(file.Author.Value.Metadata.IsLoaded);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
using Dapper;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Datastore.Converters;
|
||||
using NzbDrone.Core.Music;
|
||||
|
||||
namespace NzbDrone.Core.Test.Datastore
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
using System.Linq.Expressions;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.Datastore
|
||||
|
|
@ -177,7 +177,7 @@ public void where_in_list_2()
|
|||
[Test]
|
||||
public void enum_as_int()
|
||||
{
|
||||
_subject = WhereMetadata(x => x.Status == ArtistStatusType.Continuing);
|
||||
_subject = WhereMetadata(x => x.Status == AuthorStatusType.Continuing);
|
||||
|
||||
_subject.ToString().Should().Be($"(\"AuthorMetadata\".\"Status\" = @Clause1_P1)");
|
||||
}
|
||||
|
|
@ -185,7 +185,7 @@ public void enum_as_int()
|
|||
[Test]
|
||||
public void enum_in_list()
|
||||
{
|
||||
var allowed = new List<ArtistStatusType> { ArtistStatusType.Continuing, ArtistStatusType.Ended };
|
||||
var allowed = new List<AuthorStatusType> { AuthorStatusType.Continuing, AuthorStatusType.Ended };
|
||||
_subject = WhereMetadata(x => allowed.Contains(x.Status));
|
||||
|
||||
_subject.ToString().Should().Be($"(\"AuthorMetadata\".\"Status\" IN @Clause1_P1)");
|
||||
|
|
@ -194,7 +194,7 @@ public void enum_in_list()
|
|||
[Test]
|
||||
public void enum_in_array()
|
||||
{
|
||||
var allowed = new ArtistStatusType[] { ArtistStatusType.Continuing, ArtistStatusType.Ended };
|
||||
var allowed = new AuthorStatusType[] { AuthorStatusType.Continuing, AuthorStatusType.Ended };
|
||||
_subject = WhereMetadata(x => allowed.Contains(x.Status));
|
||||
|
||||
_subject.ToString().Should().Be($"(\"AuthorMetadata\".\"Status\" IN @Clause1_P1)");
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@
|
|||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.History;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
|
@ -25,7 +25,7 @@ public class AlreadyImportedSpecificationFixture : CoreTest<AlreadyImportedSpeci
|
|||
private Author _artist;
|
||||
private QualityModel _mp3;
|
||||
private QualityModel _flac;
|
||||
private RemoteAlbum _remoteAlbum;
|
||||
private RemoteBook _remoteAlbum;
|
||||
private List<History.History> _history;
|
||||
private BookFile _firstFile;
|
||||
|
||||
|
|
@ -49,11 +49,11 @@ public void Setup()
|
|||
_mp3 = new QualityModel(Quality.MP3_320, new Revision(version: 1));
|
||||
_flac = new QualityModel(Quality.FLAC, new Revision(version: 1));
|
||||
|
||||
_remoteAlbum = new RemoteAlbum
|
||||
_remoteAlbum = new RemoteBook
|
||||
{
|
||||
Artist = _artist,
|
||||
ParsedAlbumInfo = new ParsedAlbumInfo { Quality = _mp3 },
|
||||
Albums = singleAlbumList,
|
||||
Author = _artist,
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = _mp3 },
|
||||
Books = singleAlbumList,
|
||||
Release = Builder<ReleaseInfo>.CreateNew()
|
||||
.Build()
|
||||
};
|
||||
|
|
@ -65,11 +65,11 @@ public void Setup()
|
|||
.Returns(true);
|
||||
|
||||
Mocker.GetMock<IHistoryService>()
|
||||
.Setup(s => s.GetByAlbum(It.IsAny<int>(), null))
|
||||
.Setup(s => s.GetByBook(It.IsAny<int>(), null))
|
||||
.Returns(_history);
|
||||
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Setup(c => c.GetFilesByAlbum(It.IsAny<int>()))
|
||||
.Setup(c => c.GetFilesByBook(It.IsAny<int>()))
|
||||
.Returns(new List<BookFile> { _firstFile });
|
||||
}
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ public void should_be_accepted_if_CDH_is_disabled()
|
|||
public void should_be_accepted_if_album_does_not_have_a_file()
|
||||
{
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Setup(c => c.GetFilesByAlbum(It.IsAny<int>()))
|
||||
.Setup(c => c.GetFilesByBook(It.IsAny<int>()))
|
||||
.Returns(new List<BookFile> { });
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue();
|
||||
|
|
|
|||
|
|
@ -14,12 +14,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
|
||||
public class BlockedIndexerSpecificationFixture : CoreTest<BlockedIndexerSpecification>
|
||||
{
|
||||
private RemoteAlbum _remoteAlbum;
|
||||
private RemoteBook _remoteAlbum;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_remoteAlbum = new RemoteAlbum
|
||||
_remoteAlbum = new RemoteBook
|
||||
{
|
||||
Release = new ReleaseInfo { IndexerId = 1 }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
|
|
@ -15,39 +15,39 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
[TestFixture]
|
||||
public class DiscographySpecificationFixture : CoreTest<DiscographySpecification>
|
||||
{
|
||||
private RemoteAlbum _remoteAlbum;
|
||||
private RemoteBook _remoteAlbum;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
var artist = Builder<Author>.CreateNew().With(s => s.Id = 1234).Build();
|
||||
_remoteAlbum = new RemoteAlbum
|
||||
_remoteAlbum = new RemoteBook
|
||||
{
|
||||
ParsedAlbumInfo = new ParsedAlbumInfo
|
||||
ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Discography = true
|
||||
},
|
||||
Albums = Builder<Book>.CreateListOfSize(3)
|
||||
Books = Builder<Book>.CreateListOfSize(3)
|
||||
.All()
|
||||
.With(e => e.ReleaseDate = DateTime.UtcNow.AddDays(-8))
|
||||
.With(s => s.AuthorId = artist.Id)
|
||||
.BuildList(),
|
||||
Artist = artist,
|
||||
Author = artist,
|
||||
Release = new ReleaseInfo
|
||||
{
|
||||
Title = "Artist.Discography.1978.2005.FLAC-RlsGrp"
|
||||
}
|
||||
};
|
||||
|
||||
Mocker.GetMock<IAlbumService>().Setup(s => s.AlbumsBetweenDates(It.IsAny<DateTime>(), It.IsAny<DateTime>(), false))
|
||||
Mocker.GetMock<IBookService>().Setup(s => s.BooksBetweenDates(It.IsAny<DateTime>(), It.IsAny<DateTime>(), false))
|
||||
.Returns(new List<Book>());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_true_if_is_not_a_discography()
|
||||
{
|
||||
_remoteAlbum.ParsedAlbumInfo.Discography = false;
|
||||
_remoteAlbum.Albums.Last().ReleaseDate = DateTime.UtcNow.AddDays(+2);
|
||||
_remoteAlbum.ParsedBookInfo.Discography = false;
|
||||
_remoteAlbum.Books.Last().ReleaseDate = DateTime.UtcNow.AddDays(+2);
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
|
|
@ -60,14 +60,14 @@ public void should_return_true_if_all_albums_have_released()
|
|||
[Test]
|
||||
public void should_return_false_if_one_album_has_not_released()
|
||||
{
|
||||
_remoteAlbum.Albums.Last().ReleaseDate = DateTime.UtcNow.AddDays(+2);
|
||||
_remoteAlbum.Books.Last().ReleaseDate = DateTime.UtcNow.AddDays(+2);
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_false_if_an_album_does_not_have_an_release_date()
|
||||
{
|
||||
_remoteAlbum.Albums.Last().ReleaseDate = null;
|
||||
_remoteAlbum.Books.Last().ReleaseDate = null;
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
|
@ -20,7 +20,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
public class DownloadDecisionMakerFixture : CoreTest<DownloadDecisionMaker>
|
||||
{
|
||||
private List<ReleaseInfo> _reports;
|
||||
private RemoteAlbum _remoteAlbum;
|
||||
private RemoteBook _remoteAlbum;
|
||||
|
||||
private Mock<IDecisionEngineSpecification> _pass1;
|
||||
private Mock<IDecisionEngineSpecification> _pass2;
|
||||
|
|
@ -45,26 +45,26 @@ public void Setup()
|
|||
|
||||
_failDelayed1 = new Mock<IDecisionEngineSpecification>();
|
||||
|
||||
_pass1.Setup(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null)).Returns(Decision.Accept);
|
||||
_pass2.Setup(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null)).Returns(Decision.Accept);
|
||||
_pass3.Setup(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null)).Returns(Decision.Accept);
|
||||
_pass1.Setup(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null)).Returns(Decision.Accept);
|
||||
_pass2.Setup(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null)).Returns(Decision.Accept);
|
||||
_pass3.Setup(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null)).Returns(Decision.Accept);
|
||||
|
||||
_fail1.Setup(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null)).Returns(Decision.Reject("fail1"));
|
||||
_fail2.Setup(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null)).Returns(Decision.Reject("fail2"));
|
||||
_fail3.Setup(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null)).Returns(Decision.Reject("fail3"));
|
||||
_fail1.Setup(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null)).Returns(Decision.Reject("fail1"));
|
||||
_fail2.Setup(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null)).Returns(Decision.Reject("fail2"));
|
||||
_fail3.Setup(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null)).Returns(Decision.Reject("fail3"));
|
||||
|
||||
_failDelayed1.Setup(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null)).Returns(Decision.Reject("failDelayed1"));
|
||||
_failDelayed1.Setup(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null)).Returns(Decision.Reject("failDelayed1"));
|
||||
_failDelayed1.SetupGet(c => c.Priority).Returns(SpecificationPriority.Disk);
|
||||
|
||||
_reports = new List<ReleaseInfo> { new ReleaseInfo { Title = "Coldplay-A Head Full Of Dreams-CD-FLAC-2015-PERFECT" } };
|
||||
_remoteAlbum = new RemoteAlbum
|
||||
_remoteAlbum = new RemoteBook
|
||||
{
|
||||
Artist = new Author(),
|
||||
Albums = new List<Book> { new Book() }
|
||||
Author = new Author(),
|
||||
Books = new List<Book> { new Book() }
|
||||
};
|
||||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(c => c.Map(It.IsAny<ParsedAlbumInfo>(), It.IsAny<SearchCriteriaBase>()))
|
||||
.Setup(c => c.Map(It.IsAny<ParsedBookInfo>(), It.IsAny<SearchCriteriaBase>()))
|
||||
.Returns(_remoteAlbum);
|
||||
}
|
||||
|
||||
|
|
@ -154,11 +154,11 @@ public void should_not_attempt_to_map_album_if_not_parsable()
|
|||
|
||||
var results = Subject.GetRssDecision(_reports).ToList();
|
||||
|
||||
Mocker.GetMock<IParsingService>().Verify(c => c.Map(It.IsAny<ParsedAlbumInfo>(), It.IsAny<SearchCriteriaBase>()), Times.Never());
|
||||
Mocker.GetMock<IParsingService>().Verify(c => c.Map(It.IsAny<ParsedBookInfo>(), It.IsAny<SearchCriteriaBase>()), Times.Never());
|
||||
|
||||
_pass1.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null), Times.Never());
|
||||
_pass2.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null), Times.Never());
|
||||
_pass3.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null), Times.Never());
|
||||
_pass1.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null), Times.Never());
|
||||
_pass2.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null), Times.Never());
|
||||
_pass3.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null), Times.Never());
|
||||
|
||||
results.Should().BeEmpty();
|
||||
}
|
||||
|
|
@ -171,11 +171,11 @@ public void should_not_attempt_to_map_album_artist_title_is_blank()
|
|||
|
||||
var results = Subject.GetRssDecision(_reports).ToList();
|
||||
|
||||
Mocker.GetMock<IParsingService>().Verify(c => c.Map(It.IsAny<ParsedAlbumInfo>(), It.IsAny<SearchCriteriaBase>()), Times.Never());
|
||||
Mocker.GetMock<IParsingService>().Verify(c => c.Map(It.IsAny<ParsedBookInfo>(), It.IsAny<SearchCriteriaBase>()), Times.Never());
|
||||
|
||||
_pass1.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null), Times.Never());
|
||||
_pass2.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null), Times.Never());
|
||||
_pass3.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null), Times.Never());
|
||||
_pass1.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null), Times.Never());
|
||||
_pass2.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null), Times.Never());
|
||||
_pass3.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null), Times.Never());
|
||||
|
||||
results.Should().BeEmpty();
|
||||
}
|
||||
|
|
@ -185,13 +185,13 @@ public void should_not_attempt_to_make_decision_if_artist_is_unknown()
|
|||
{
|
||||
GivenSpecifications(_pass1, _pass2, _pass3);
|
||||
|
||||
_remoteAlbum.Artist = null;
|
||||
_remoteAlbum.Author = null;
|
||||
|
||||
Subject.GetRssDecision(_reports);
|
||||
|
||||
_pass1.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null), Times.Never());
|
||||
_pass2.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null), Times.Never());
|
||||
_pass3.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteAlbum>(), null), Times.Never());
|
||||
_pass1.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null), Times.Never());
|
||||
_pass2.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null), Times.Never());
|
||||
_pass3.Verify(c => c.IsSatisfiedBy(It.IsAny<RemoteBook>(), null), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -199,7 +199,7 @@ public void broken_report_shouldnt_blowup_the_process()
|
|||
{
|
||||
GivenSpecifications(_pass1);
|
||||
|
||||
Mocker.GetMock<IParsingService>().Setup(c => c.Map(It.IsAny<ParsedAlbumInfo>(), It.IsAny<SearchCriteriaBase>()))
|
||||
Mocker.GetMock<IParsingService>().Setup(c => c.Map(It.IsAny<ParsedBookInfo>(), It.IsAny<SearchCriteriaBase>()))
|
||||
.Throws<TestException>();
|
||||
|
||||
_reports = new List<ReleaseInfo>
|
||||
|
|
@ -211,7 +211,7 @@ public void broken_report_shouldnt_blowup_the_process()
|
|||
|
||||
Subject.GetRssDecision(_reports);
|
||||
|
||||
Mocker.GetMock<IParsingService>().Verify(c => c.Map(It.IsAny<ParsedAlbumInfo>(), It.IsAny<SearchCriteriaBase>()), Times.Exactly(_reports.Count));
|
||||
Mocker.GetMock<IParsingService>().Verify(c => c.Map(It.IsAny<ParsedBookInfo>(), It.IsAny<SearchCriteriaBase>()), Times.Exactly(_reports.Count));
|
||||
|
||||
ExceptionVerification.ExpectedErrors(3);
|
||||
}
|
||||
|
|
@ -221,7 +221,7 @@ public void should_return_unknown_artist_rejection_if_artist_is_unknown()
|
|||
{
|
||||
GivenSpecifications(_pass1, _pass2, _pass3);
|
||||
|
||||
_remoteAlbum.Artist = null;
|
||||
_remoteAlbum.Author = null;
|
||||
|
||||
var result = Subject.GetRssDecision(_reports);
|
||||
|
||||
|
|
@ -239,7 +239,7 @@ public void should_only_include_reports_for_requested_albums()
|
|||
.With(v => v.Author, new LazyLoaded<Author>(artist))
|
||||
.BuildList();
|
||||
|
||||
var criteria = new ArtistSearchCriteria { Albums = albums.Take(1).ToList() };
|
||||
var criteria = new AuthorSearchCriteria { Books = albums.Take(1).ToList() };
|
||||
|
||||
var reports = albums.Select(v =>
|
||||
new ReleaseInfo()
|
||||
|
|
@ -248,14 +248,14 @@ public void should_only_include_reports_for_requested_albums()
|
|||
}).ToList();
|
||||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(v => v.Map(It.IsAny<ParsedAlbumInfo>(), It.IsAny<SearchCriteriaBase>()))
|
||||
.Returns<ParsedAlbumInfo, SearchCriteriaBase>((p, c) =>
|
||||
new RemoteAlbum
|
||||
.Setup(v => v.Map(It.IsAny<ParsedBookInfo>(), It.IsAny<SearchCriteriaBase>()))
|
||||
.Returns<ParsedBookInfo, SearchCriteriaBase>((p, c) =>
|
||||
new RemoteBook
|
||||
{
|
||||
DownloadAllowed = true,
|
||||
ParsedAlbumInfo = p,
|
||||
Artist = artist,
|
||||
Albums = albums.Where(v => v.Title == p.AlbumTitle).ToList()
|
||||
ParsedBookInfo = p,
|
||||
Author = artist,
|
||||
Books = albums.Where(v => v.Title == p.BookTitle).ToList()
|
||||
});
|
||||
|
||||
Mocker.SetConstant<IEnumerable<IDecisionEngineSpecification>>(new List<IDecisionEngineSpecification>
|
||||
|
|
@ -275,13 +275,13 @@ public void should_not_allow_download_if_artist_is_unknown()
|
|||
{
|
||||
GivenSpecifications(_pass1, _pass2, _pass3);
|
||||
|
||||
_remoteAlbum.Artist = null;
|
||||
_remoteAlbum.Author = null;
|
||||
|
||||
var result = Subject.GetRssDecision(_reports);
|
||||
|
||||
result.Should().HaveCount(1);
|
||||
|
||||
result.First().RemoteAlbum.DownloadAllowed.Should().BeFalse();
|
||||
result.First().RemoteBook.DownloadAllowed.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -289,13 +289,13 @@ public void should_not_allow_download_if_no_albums_found()
|
|||
{
|
||||
GivenSpecifications(_pass1, _pass2, _pass3);
|
||||
|
||||
_remoteAlbum.Albums = new List<Book>();
|
||||
_remoteAlbum.Books = new List<Book>();
|
||||
|
||||
var result = Subject.GetRssDecision(_reports);
|
||||
|
||||
result.Should().HaveCount(1);
|
||||
|
||||
result.First().RemoteAlbum.DownloadAllowed.Should().BeFalse();
|
||||
result.First().RemoteBook.DownloadAllowed.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -303,7 +303,7 @@ public void should_return_a_decision_when_exception_is_caught()
|
|||
{
|
||||
GivenSpecifications(_pass1);
|
||||
|
||||
Mocker.GetMock<IParsingService>().Setup(c => c.Map(It.IsAny<ParsedAlbumInfo>(), It.IsAny<SearchCriteriaBase>()))
|
||||
Mocker.GetMock<IParsingService>().Setup(c => c.Map(It.IsAny<ParsedBookInfo>(), It.IsAny<SearchCriteriaBase>()))
|
||||
.Throws<TestException>();
|
||||
|
||||
_reports = new List<ReleaseInfo>
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Indexers.TorrentRss;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ public class EarlyReleaseSpecificationFixture : TestBase<EarlyReleaseSpecificati
|
|||
private Author _artist;
|
||||
private Book _album1;
|
||||
private Book _album2;
|
||||
private RemoteAlbum _remoteAlbum;
|
||||
private RemoteBook _remoteAlbum;
|
||||
private IndexerDefinition _indexerDefinition;
|
||||
|
||||
[SetUp]
|
||||
|
|
@ -30,10 +30,10 @@ public void Setup()
|
|||
_album1 = Builder<Book>.CreateNew().With(s => s.ReleaseDate = DateTime.Today).Build();
|
||||
_album2 = Builder<Book>.CreateNew().With(s => s.ReleaseDate = DateTime.Today).Build();
|
||||
|
||||
_remoteAlbum = new RemoteAlbum
|
||||
_remoteAlbum = new RemoteBook
|
||||
{
|
||||
Artist = _artist,
|
||||
Albums = new List<Book> { _album1 },
|
||||
Author = _artist,
|
||||
Books = new List<Book> { _album1 },
|
||||
Release = new TorrentInfo
|
||||
{
|
||||
IndexerId = 1,
|
||||
|
|
@ -68,7 +68,7 @@ public void should_return_true_if_indexer_not_specified()
|
|||
[Test]
|
||||
public void should_return_true_if_release_contains_multiple_albums()
|
||||
{
|
||||
_remoteAlbum.Albums.Add(_album2);
|
||||
_remoteAlbum.Books.Add(_album2);
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@
|
|||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications.RssSync;
|
||||
using NzbDrone.Core.History;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
|
@ -25,8 +25,8 @@ public class HistorySpecificationFixture : CoreTest<HistorySpecification>
|
|||
|
||||
private HistorySpecification _upgradeHistory;
|
||||
|
||||
private RemoteAlbum _parseResultMulti;
|
||||
private RemoteAlbum _parseResultSingle;
|
||||
private RemoteBook _parseResultMulti;
|
||||
private RemoteBook _parseResultSingle;
|
||||
private QualityModel _upgradableQuality;
|
||||
private QualityModel _notupgradableQuality;
|
||||
private Author _fakeArtist;
|
||||
|
|
@ -54,18 +54,18 @@ public void Setup()
|
|||
})
|
||||
.Build();
|
||||
|
||||
_parseResultMulti = new RemoteAlbum
|
||||
_parseResultMulti = new RemoteBook
|
||||
{
|
||||
Artist = _fakeArtist,
|
||||
ParsedAlbumInfo = new ParsedAlbumInfo { Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
Albums = doubleAlbumList
|
||||
Author = _fakeArtist,
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
Books = doubleAlbumList
|
||||
};
|
||||
|
||||
_parseResultSingle = new RemoteAlbum
|
||||
_parseResultSingle = new RemoteBook
|
||||
{
|
||||
Artist = _fakeArtist,
|
||||
ParsedAlbumInfo = new ParsedAlbumInfo { Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
Albums = singleAlbumList
|
||||
Author = _fakeArtist,
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
Books = singleAlbumList
|
||||
};
|
||||
|
||||
_upgradableQuality = new QualityModel(Quality.MP3_320, new Revision(version: 1));
|
||||
|
|
@ -78,7 +78,7 @@ public void Setup()
|
|||
|
||||
private void GivenMostRecentForAlbum(int bookId, string downloadId, QualityModel quality, DateTime date, HistoryEventType eventType)
|
||||
{
|
||||
Mocker.GetMock<IHistoryService>().Setup(s => s.MostRecentForAlbum(bookId))
|
||||
Mocker.GetMock<IHistoryService>().Setup(s => s.MostRecentForBook(bookId))
|
||||
.Returns(new History.History { DownloadId = downloadId, Quality = quality, Date = date, EventType = eventType });
|
||||
}
|
||||
|
||||
|
|
@ -92,13 +92,13 @@ private void GivenCdhDisabled()
|
|||
[Test]
|
||||
public void should_return_true_if_it_is_a_search()
|
||||
{
|
||||
_upgradeHistory.IsSatisfiedBy(_parseResultMulti, new AlbumSearchCriteria()).Accepted.Should().BeTrue();
|
||||
_upgradeHistory.IsSatisfiedBy(_parseResultMulti, new BookSearchCriteria()).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_true_if_latest_history_item_is_null()
|
||||
{
|
||||
Mocker.GetMock<IHistoryService>().Setup(s => s.MostRecentForAlbum(It.IsAny<int>())).Returns((History.History)null);
|
||||
Mocker.GetMock<IHistoryService>().Setup(s => s.MostRecentForBook(It.IsAny<int>())).Returns((History.History)null);
|
||||
_upgradeHistory.IsSatisfiedBy(_parseResultMulti, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
|
|
@ -165,7 +165,7 @@ public void should_be_not_upgradable_if_only_second_albums_is_upgradable()
|
|||
public void should_not_be_upgradable_if_album_is_of_same_quality_as_existing()
|
||||
{
|
||||
_fakeArtist.QualityProfile = new QualityProfile { Cutoff = Quality.MP3_320.Id, Items = Qualities.QualityFixture.GetDefaultQualities() };
|
||||
_parseResultSingle.ParsedAlbumInfo.Quality = new QualityModel(Quality.MP3_320, new Revision(version: 1));
|
||||
_parseResultSingle.ParsedBookInfo.Quality = new QualityModel(Quality.MP3_320, new Revision(version: 1));
|
||||
_upgradableQuality = new QualityModel(Quality.MP3_320, new Revision(version: 1));
|
||||
|
||||
GivenMostRecentForAlbum(FIRST_ALBUM_ID, string.Empty, _upgradableQuality, DateTime.UtcNow, HistoryEventType.Grabbed);
|
||||
|
|
@ -177,7 +177,7 @@ public void should_not_be_upgradable_if_album_is_of_same_quality_as_existing()
|
|||
public void should_not_be_upgradable_if_cutoff_already_met()
|
||||
{
|
||||
_fakeArtist.QualityProfile = new QualityProfile { Cutoff = Quality.MP3_320.Id, Items = Qualities.QualityFixture.GetDefaultQualities() };
|
||||
_parseResultSingle.ParsedAlbumInfo.Quality = new QualityModel(Quality.MP3_320, new Revision(version: 1));
|
||||
_parseResultSingle.ParsedBookInfo.Quality = new QualityModel(Quality.MP3_320, new Revision(version: 1));
|
||||
_upgradableQuality = new QualityModel(Quality.MP3_320, new Revision(version: 1));
|
||||
|
||||
GivenMostRecentForAlbum(FIRST_ALBUM_ID, string.Empty, _upgradableQuality, DateTime.UtcNow, HistoryEventType.Grabbed);
|
||||
|
|
@ -205,7 +205,7 @@ public void should_return_false_if_cutoff_already_met_and_cdh_is_disabled()
|
|||
{
|
||||
GivenCdhDisabled();
|
||||
_fakeArtist.QualityProfile = new QualityProfile { Cutoff = Quality.MP3_320.Id, Items = Qualities.QualityFixture.GetDefaultQualities() };
|
||||
_parseResultSingle.ParsedAlbumInfo.Quality = new QualityModel(Quality.MP3_320, new Revision(version: 1));
|
||||
_parseResultSingle.ParsedBookInfo.Quality = new QualityModel(Quality.MP3_320, new Revision(version: 1));
|
||||
_upgradableQuality = new QualityModel(Quality.MP3_320, new Revision(version: 1));
|
||||
|
||||
GivenMostRecentForAlbum(FIRST_ALBUM_ID, "test", _upgradableQuality, DateTime.UtcNow.AddDays(-100), HistoryEventType.Grabbed);
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
{
|
||||
public class MaximumSizeSpecificationFixture : CoreTest<MaximumSizeSpecification>
|
||||
{
|
||||
private RemoteAlbum _remoteAlbum;
|
||||
private RemoteBook _remoteAlbum;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_remoteAlbum = new RemoteAlbum() { Release = new ReleaseInfo() };
|
||||
_remoteAlbum = new RemoteBook() { Release = new ReleaseInfo() };
|
||||
}
|
||||
|
||||
private void WithMaximumSize(int size)
|
||||
|
|
|
|||
|
|
@ -13,12 +13,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
|
||||
public class MinimumAgeSpecificationFixture : CoreTest<MinimumAgeSpecification>
|
||||
{
|
||||
private RemoteAlbum _remoteAlbum;
|
||||
private RemoteBook _remoteAlbum;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_remoteAlbum = new RemoteAlbum
|
||||
_remoteAlbum = new RemoteBook
|
||||
{
|
||||
Release = new ReleaseInfo() { DownloadProtocol = DownloadProtocol.Usenet }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications.RssSync;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
|
|
@ -16,8 +16,8 @@ public class MonitoredAlbumSpecificationFixture : CoreTest<MonitoredAlbumSpecifi
|
|||
{
|
||||
private MonitoredAlbumSpecification _monitoredAlbumSpecification;
|
||||
|
||||
private RemoteAlbum _parseResultMulti;
|
||||
private RemoteAlbum _parseResultSingle;
|
||||
private RemoteBook _parseResultMulti;
|
||||
private RemoteBook _parseResultSingle;
|
||||
private Author _fakeArtist;
|
||||
private Book _firstAlbum;
|
||||
private Book _secondAlbum;
|
||||
|
|
@ -37,16 +37,16 @@ public void Setup()
|
|||
var singleAlbumList = new List<Book> { _firstAlbum };
|
||||
var doubleAlbumList = new List<Book> { _firstAlbum, _secondAlbum };
|
||||
|
||||
_parseResultMulti = new RemoteAlbum
|
||||
_parseResultMulti = new RemoteBook
|
||||
{
|
||||
Artist = _fakeArtist,
|
||||
Albums = doubleAlbumList
|
||||
Author = _fakeArtist,
|
||||
Books = doubleAlbumList
|
||||
};
|
||||
|
||||
_parseResultSingle = new RemoteAlbum
|
||||
_parseResultSingle = new RemoteBook
|
||||
{
|
||||
Artist = _fakeArtist,
|
||||
Albums = singleAlbumList
|
||||
Author = _fakeArtist,
|
||||
Books = singleAlbumList
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -107,28 +107,28 @@ public void only_second_album_not_monitored_should_return_false()
|
|||
public void should_return_true_for_single_album_search()
|
||||
{
|
||||
_fakeArtist.Monitored = false;
|
||||
_monitoredAlbumSpecification.IsSatisfiedBy(_parseResultSingle, new AlbumSearchCriteria()).Accepted.Should().BeTrue();
|
||||
_monitoredAlbumSpecification.IsSatisfiedBy(_parseResultSingle, new BookSearchCriteria()).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_true_if_album_is_not_monitored_and_monitoredEpisodesOnly_flag_is_false()
|
||||
{
|
||||
WithFirstAlbumUnmonitored();
|
||||
_monitoredAlbumSpecification.IsSatisfiedBy(_parseResultSingle, new AlbumSearchCriteria { MonitoredEpisodesOnly = false }).Accepted.Should().BeTrue();
|
||||
_monitoredAlbumSpecification.IsSatisfiedBy(_parseResultSingle, new BookSearchCriteria { MonitoredBooksOnly = false }).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_false_if_album_is_not_monitored_and_monitoredEpisodesOnly_flag_is_true()
|
||||
{
|
||||
WithFirstAlbumUnmonitored();
|
||||
_monitoredAlbumSpecification.IsSatisfiedBy(_parseResultSingle, new AlbumSearchCriteria { MonitoredEpisodesOnly = true }).Accepted.Should().BeFalse();
|
||||
_monitoredAlbumSpecification.IsSatisfiedBy(_parseResultSingle, new BookSearchCriteria { MonitoredBooksOnly = true }).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_false_if_all_albums_are_not_monitored_for_discography_pack_release()
|
||||
{
|
||||
WithSecondAlbumUnmonitored();
|
||||
_parseResultMulti.ParsedAlbumInfo = new ParsedAlbumInfo()
|
||||
_parseResultMulti.ParsedBookInfo = new ParsedBookInfo()
|
||||
{
|
||||
Discography = true
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@
|
|||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles.Delay;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
|
|
@ -34,21 +34,21 @@ private Book GivenAlbum(int id)
|
|||
.Build();
|
||||
}
|
||||
|
||||
private RemoteAlbum GivenRemoteAlbum(List<Book> albums, QualityModel quality, int age = 0, long size = 0, DownloadProtocol downloadProtocol = DownloadProtocol.Usenet)
|
||||
private RemoteBook GivenRemoteAlbum(List<Book> albums, QualityModel quality, int age = 0, long size = 0, DownloadProtocol downloadProtocol = DownloadProtocol.Usenet)
|
||||
{
|
||||
var remoteAlbum = new RemoteAlbum();
|
||||
remoteAlbum.ParsedAlbumInfo = new ParsedAlbumInfo();
|
||||
remoteAlbum.ParsedAlbumInfo.Quality = quality;
|
||||
var remoteAlbum = new RemoteBook();
|
||||
remoteAlbum.ParsedBookInfo = new ParsedBookInfo();
|
||||
remoteAlbum.ParsedBookInfo.Quality = quality;
|
||||
|
||||
remoteAlbum.Albums = new List<Book>();
|
||||
remoteAlbum.Albums.AddRange(albums);
|
||||
remoteAlbum.Books = new List<Book>();
|
||||
remoteAlbum.Books.AddRange(albums);
|
||||
|
||||
remoteAlbum.Release = new ReleaseInfo();
|
||||
remoteAlbum.Release.PublishDate = DateTime.Now.AddDays(-age);
|
||||
remoteAlbum.Release.Size = size;
|
||||
remoteAlbum.Release.DownloadProtocol = downloadProtocol;
|
||||
|
||||
remoteAlbum.Artist = Builder<Author>.CreateNew()
|
||||
remoteAlbum.Author = Builder<Author>.CreateNew()
|
||||
.With(e => e.QualityProfile = new QualityProfile
|
||||
{
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities()
|
||||
|
|
@ -80,7 +80,7 @@ public void should_put_propers_before_non_propers()
|
|||
decisions.Add(new DownloadDecision(remoteAlbum2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
qualifiedReports.First().RemoteAlbum.ParsedAlbumInfo.Quality.Revision.Version.Should().Be(2);
|
||||
qualifiedReports.First().RemoteBook.ParsedBookInfo.Quality.Revision.Version.Should().Be(2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -94,7 +94,7 @@ public void should_put_higher_quality_before_lower()
|
|||
decisions.Add(new DownloadDecision(remoteAlbum2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
qualifiedReports.First().RemoteAlbum.ParsedAlbumInfo.Quality.Quality.Should().Be(Quality.MP3_320);
|
||||
qualifiedReports.First().RemoteBook.ParsedBookInfo.Quality.Quality.Should().Be(Quality.MP3_320);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -112,7 +112,7 @@ public void should_order_by_age_then_largest_rounded_to_200mb()
|
|||
decisions.Add(new DownloadDecision(remoteAlbumHdLargeYoung));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
qualifiedReports.First().RemoteAlbum.Should().Be(remoteAlbumHdLargeYoung);
|
||||
qualifiedReports.First().RemoteBook.Should().Be(remoteAlbumHdLargeYoung);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -126,7 +126,7 @@ public void should_order_by_youngest()
|
|||
decisions.Add(new DownloadDecision(remoteAlbum2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
qualifiedReports.First().RemoteAlbum.Should().Be(remoteAlbum2);
|
||||
qualifiedReports.First().RemoteBook.Should().Be(remoteAlbum2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -135,7 +135,7 @@ public void should_not_throw_if_no_albums_are_found()
|
|||
var remoteAlbum1 = GivenRemoteAlbum(new List<Book> { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), size: 500.Megabytes());
|
||||
var remoteAlbum2 = GivenRemoteAlbum(new List<Book> { GivenAlbum(1) }, new QualityModel(Quality.MP3_320), size: 500.Megabytes());
|
||||
|
||||
remoteAlbum1.Albums = new List<Book>();
|
||||
remoteAlbum1.Books = new List<Book>();
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteAlbum1));
|
||||
|
|
@ -157,7 +157,7 @@ public void should_put_usenet_above_torrent_when_usenet_is_preferred()
|
|||
decisions.Add(new DownloadDecision(remoteAlbum2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
qualifiedReports.First().RemoteAlbum.Release.DownloadProtocol.Should().Be(DownloadProtocol.Usenet);
|
||||
qualifiedReports.First().RemoteBook.Release.DownloadProtocol.Should().Be(DownloadProtocol.Usenet);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -173,7 +173,7 @@ public void should_put_torrent_above_usenet_when_torrent_is_preferred()
|
|||
decisions.Add(new DownloadDecision(remoteAlbum2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
qualifiedReports.First().RemoteAlbum.Release.DownloadProtocol.Should().Be(DownloadProtocol.Torrent);
|
||||
qualifiedReports.First().RemoteBook.Release.DownloadProtocol.Should().Be(DownloadProtocol.Torrent);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -182,14 +182,14 @@ public void should_prefer_discography_pack_above_single_album()
|
|||
var remoteAlbum1 = GivenRemoteAlbum(new List<Book> { GivenAlbum(1), GivenAlbum(2) }, new QualityModel(Quality.FLAC));
|
||||
var remoteAlbum2 = GivenRemoteAlbum(new List<Book> { GivenAlbum(1) }, new QualityModel(Quality.FLAC));
|
||||
|
||||
remoteAlbum1.ParsedAlbumInfo.Discography = true;
|
||||
remoteAlbum1.ParsedBookInfo.Discography = true;
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteAlbum1));
|
||||
decisions.Add(new DownloadDecision(remoteAlbum2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
qualifiedReports.First().RemoteAlbum.ParsedAlbumInfo.Discography.Should().BeTrue();
|
||||
qualifiedReports.First().RemoteBook.ParsedBookInfo.Discography.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -198,14 +198,14 @@ public void should_prefer_quality_over_discography_pack()
|
|||
var remoteAlbum1 = GivenRemoteAlbum(new List<Book> { GivenAlbum(1), GivenAlbum(2) }, new QualityModel(Quality.MP3_320));
|
||||
var remoteAlbum2 = GivenRemoteAlbum(new List<Book> { GivenAlbum(1) }, new QualityModel(Quality.FLAC));
|
||||
|
||||
remoteAlbum1.ParsedAlbumInfo.Discography = true;
|
||||
remoteAlbum1.ParsedBookInfo.Discography = true;
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteAlbum1));
|
||||
decisions.Add(new DownloadDecision(remoteAlbum2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
qualifiedReports.First().RemoteAlbum.ParsedAlbumInfo.Discography.Should().BeFalse();
|
||||
qualifiedReports.First().RemoteBook.ParsedBookInfo.Discography.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -219,7 +219,7 @@ public void should_prefer_single_album_over_multi_album()
|
|||
decisions.Add(new DownloadDecision(remoteAlbum2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
qualifiedReports.First().RemoteAlbum.Albums.Count.Should().Be(remoteAlbum2.Albums.Count);
|
||||
qualifiedReports.First().RemoteBook.Books.Count.Should().Be(remoteAlbum2.Books.Count);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -245,7 +245,7 @@ public void should_prefer_releases_with_more_seeders()
|
|||
decisions.Add(new DownloadDecision(remoteAlbum2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
((TorrentInfo)qualifiedReports.First().RemoteAlbum.Release).Seeders.Should().Be(torrentInfo2.Seeders);
|
||||
((TorrentInfo)qualifiedReports.First().RemoteBook.Release).Seeders.Should().Be(torrentInfo2.Seeders);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -272,7 +272,7 @@ public void should_prefer_releases_with_more_peers_given_equal_number_of_seeds()
|
|||
decisions.Add(new DownloadDecision(remoteAlbum2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
((TorrentInfo)qualifiedReports.First().RemoteAlbum.Release).Peers.Should().Be(torrentInfo2.Peers);
|
||||
((TorrentInfo)qualifiedReports.First().RemoteBook.Release).Peers.Should().Be(torrentInfo2.Peers);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -300,7 +300,7 @@ public void should_prefer_releases_with_more_peers_no_seeds()
|
|||
decisions.Add(new DownloadDecision(remoteAlbum2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
((TorrentInfo)qualifiedReports.First().RemoteAlbum.Release).Peers.Should().Be(torrentInfo2.Peers);
|
||||
((TorrentInfo)qualifiedReports.First().RemoteBook.Release).Peers.Should().Be(torrentInfo2.Peers);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -329,7 +329,7 @@ public void should_prefer_first_release_if_peers_and_size_are_too_similar()
|
|||
decisions.Add(new DownloadDecision(remoteAlbum2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
((TorrentInfo)qualifiedReports.First().RemoteAlbum.Release).Should().Be(torrentInfo1);
|
||||
((TorrentInfo)qualifiedReports.First().RemoteBook.Release).Should().Be(torrentInfo1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -349,7 +349,7 @@ public void should_prefer_first_release_if_age_and_size_are_too_similar()
|
|||
decisions.Add(new DownloadDecision(remoteAlbum2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
qualifiedReports.First().RemoteAlbum.Release.Should().Be(remoteAlbum1.Release);
|
||||
qualifiedReports.First().RemoteBook.Release.Should().Be(remoteAlbum1.Release);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -378,7 +378,7 @@ public void should_prefer_quality_over_the_number_of_peers()
|
|||
decisions.Add(new DownloadDecision(remoteAlbum2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
((TorrentInfo)qualifiedReports.First().RemoteAlbum.Release).Should().Be(torrentInfo1);
|
||||
((TorrentInfo)qualifiedReports.First().RemoteBook.Release).Should().Be(torrentInfo1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -392,7 +392,7 @@ public void should_put_higher_quality_before_lower_always()
|
|||
decisions.Add(new DownloadDecision(remoteAlbum2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
qualifiedReports.First().RemoteAlbum.ParsedAlbumInfo.Quality.Quality.Should().Be(Quality.MP3_320);
|
||||
qualifiedReports.First().RemoteBook.ParsedBookInfo.Quality.Quality.Should().Be(Quality.MP3_320);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -409,7 +409,7 @@ public void should_prefer_higher_score_over_lower_score()
|
|||
decisions.Add(new DownloadDecision(remoteAlbum2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
qualifiedReports.First().RemoteAlbum.PreferredWordScore.Should().Be(10);
|
||||
qualifiedReports.First().RemoteBook.PreferredWordScore.Should().Be(10);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -430,7 +430,7 @@ public void should_prefer_proper_over_score_when_download_propers_is_prefer_and_
|
|||
decisions.Add(new DownloadDecision(remoteAlbum2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
qualifiedReports.First().RemoteAlbum.ParsedAlbumInfo.Quality.Revision.Version.Should().Be(2);
|
||||
qualifiedReports.First().RemoteBook.ParsedBookInfo.Quality.Revision.Version.Should().Be(2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -451,7 +451,7 @@ public void should_prefer_proper_over_score_when_download_propers_is_do_not_upgr
|
|||
decisions.Add(new DownloadDecision(remoteAlbum2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
qualifiedReports.First().RemoteAlbum.ParsedAlbumInfo.Quality.Revision.Version.Should().Be(2);
|
||||
qualifiedReports.First().RemoteBook.ParsedBookInfo.Quality.Revision.Version.Should().Be(2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -472,9 +472,9 @@ public void should_prefer_score_over_proper_when_download_propers_is_do_not_pref
|
|||
decisions.Add(new DownloadDecision(remoteAlbum2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
qualifiedReports.First().RemoteAlbum.ParsedAlbumInfo.Quality.Quality.Should().Be(Quality.FLAC);
|
||||
qualifiedReports.First().RemoteAlbum.ParsedAlbumInfo.Quality.Revision.Version.Should().Be(1);
|
||||
qualifiedReports.First().RemoteAlbum.PreferredWordScore.Should().Be(10);
|
||||
qualifiedReports.First().RemoteBook.ParsedBookInfo.Quality.Quality.Should().Be(Quality.FLAC);
|
||||
qualifiedReports.First().RemoteBook.ParsedBookInfo.Quality.Revision.Version.Should().Be(1);
|
||||
qualifiedReports.First().RemoteBook.PreferredWordScore.Should().Be(10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles.Delay;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
|
@ -14,15 +14,15 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
[TestFixture]
|
||||
public class ProtocolSpecificationFixture : CoreTest<ProtocolSpecification>
|
||||
{
|
||||
private RemoteAlbum _remoteAlbum;
|
||||
private RemoteBook _remoteAlbum;
|
||||
private DelayProfile _delayProfile;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_remoteAlbum = new RemoteAlbum();
|
||||
_remoteAlbum = new RemoteBook();
|
||||
_remoteAlbum.Release = new ReleaseInfo();
|
||||
_remoteAlbum.Artist = new Author();
|
||||
_remoteAlbum.Author = new Author();
|
||||
|
||||
_delayProfile = new DelayProfile();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
|
@ -14,7 +14,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
|
||||
public class QualityAllowedByProfileSpecificationFixture : CoreTest<QualityAllowedByProfileSpecification>
|
||||
{
|
||||
private RemoteAlbum _remoteAlbum;
|
||||
private RemoteBook _remoteAlbum;
|
||||
|
||||
public static object[] AllowedTestCases =
|
||||
{
|
||||
|
|
@ -36,10 +36,10 @@ public void Setup()
|
|||
.With(c => c.QualityProfile = new QualityProfile { Cutoff = Quality.MP3_320.Id })
|
||||
.Build();
|
||||
|
||||
_remoteAlbum = new RemoteAlbum
|
||||
_remoteAlbum = new RemoteBook
|
||||
{
|
||||
Artist = fakeArtist,
|
||||
ParsedAlbumInfo = new ParsedAlbumInfo { Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
Author = fakeArtist,
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -47,8 +47,8 @@ public void Setup()
|
|||
[TestCaseSource(nameof(AllowedTestCases))]
|
||||
public void should_allow_if_quality_is_defined_in_profile(Quality qualityType)
|
||||
{
|
||||
_remoteAlbum.ParsedAlbumInfo.Quality.Quality = qualityType;
|
||||
_remoteAlbum.Artist.QualityProfile.Value.Items = Qualities.QualityFixture.GetDefaultQualities(Quality.MP3_320, Quality.MP3_320, Quality.MP3_320);
|
||||
_remoteAlbum.ParsedBookInfo.Quality.Quality = qualityType;
|
||||
_remoteAlbum.Author.QualityProfile.Value.Items = Qualities.QualityFixture.GetDefaultQualities(Quality.MP3_320, Quality.MP3_320, Quality.MP3_320);
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
|
@ -57,8 +57,8 @@ public void should_allow_if_quality_is_defined_in_profile(Quality qualityType)
|
|||
[TestCaseSource(nameof(DeniedTestCases))]
|
||||
public void should_not_allow_if_quality_is_not_defined_in_profile(Quality qualityType)
|
||||
{
|
||||
_remoteAlbum.ParsedAlbumInfo.Quality.Quality = qualityType;
|
||||
_remoteAlbum.Artist.QualityProfile.Value.Items = Qualities.QualityFixture.GetDefaultQualities(Quality.MP3_320, Quality.MP3_320, Quality.MP3_320);
|
||||
_remoteAlbum.ParsedBookInfo.Quality.Quality = qualityType;
|
||||
_remoteAlbum.Author.QualityProfile.Value.Items = Qualities.QualityFixture.GetDefaultQualities(Quality.MP3_320, Quality.MP3_320, Quality.MP3_320);
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.Download.TrackedDownloads;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
|
@ -19,7 +19,7 @@ public class QueueSpecificationFixture : CoreTest<QueueSpecification>
|
|||
{
|
||||
private Author _artist;
|
||||
private Book _album;
|
||||
private RemoteAlbum _remoteAlbum;
|
||||
private RemoteBook _remoteAlbum;
|
||||
|
||||
private Author _otherArtist;
|
||||
private Book _otherAlbum;
|
||||
|
|
@ -55,10 +55,10 @@ public void Setup()
|
|||
_releaseInfo = Builder<ReleaseInfo>.CreateNew()
|
||||
.Build();
|
||||
|
||||
_remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(r => r.Artist = _artist)
|
||||
.With(r => r.Albums = new List<Book> { _album })
|
||||
.With(r => r.ParsedAlbumInfo = new ParsedAlbumInfo { Quality = new QualityModel(Quality.MP3_320) })
|
||||
_remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(r => r.Author = _artist)
|
||||
.With(r => r.Books = new List<Book> { _album })
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3_320) })
|
||||
.With(r => r.PreferredWordScore = 0)
|
||||
.Build();
|
||||
}
|
||||
|
|
@ -70,11 +70,11 @@ private void GivenEmptyQueue()
|
|||
.Returns(new List<Queue.Queue>());
|
||||
}
|
||||
|
||||
private void GivenQueue(IEnumerable<RemoteAlbum> remoteAlbums, TrackedDownloadState trackedDownloadState = TrackedDownloadState.Downloading)
|
||||
private void GivenQueue(IEnumerable<RemoteBook> remoteAlbums, TrackedDownloadState trackedDownloadState = TrackedDownloadState.Downloading)
|
||||
{
|
||||
var queue = remoteAlbums.Select(remoteAlbum => new Queue.Queue
|
||||
{
|
||||
RemoteAlbum = remoteAlbum,
|
||||
RemoteBook = remoteAlbum,
|
||||
TrackedDownloadState = trackedDownloadState
|
||||
});
|
||||
|
||||
|
|
@ -93,13 +93,13 @@ public void should_return_true_when_queue_is_empty()
|
|||
[Test]
|
||||
public void should_return_true_when_artist_doesnt_match()
|
||||
{
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(r => r.Artist = _otherArtist)
|
||||
.With(r => r.Albums = new List<Book> { _album })
|
||||
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(r => r.Author = _otherArtist)
|
||||
.With(r => r.Books = new List<Book> { _album })
|
||||
.With(r => r.Release = _releaseInfo)
|
||||
.Build();
|
||||
|
||||
GivenQueue(new List<RemoteAlbum> { remoteAlbum });
|
||||
GivenQueue(new List<RemoteBook> { remoteAlbum });
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
|
|
@ -108,17 +108,17 @@ public void should_return_false_if_everything_is_the_same()
|
|||
{
|
||||
_artist.QualityProfile.Value.Cutoff = Quality.FLAC.Id;
|
||||
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(r => r.Artist = _artist)
|
||||
.With(r => r.Albums = new List<Book> { _album })
|
||||
.With(r => r.ParsedAlbumInfo = new ParsedAlbumInfo
|
||||
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(r => r.Author = _artist)
|
||||
.With(r => r.Books = new List<Book> { _album })
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320)
|
||||
})
|
||||
.With(r => r.Release = _releaseInfo)
|
||||
.Build();
|
||||
|
||||
GivenQueue(new List<RemoteAlbum> { remoteAlbum });
|
||||
GivenQueue(new List<RemoteBook> { remoteAlbum });
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
|
@ -128,34 +128,34 @@ public void should_return_true_when_quality_in_queue_is_lower()
|
|||
{
|
||||
_artist.QualityProfile.Value.Cutoff = Quality.MP3_320.Id;
|
||||
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(r => r.Artist = _artist)
|
||||
.With(r => r.Albums = new List<Book> { _album })
|
||||
.With(r => r.ParsedAlbumInfo = new ParsedAlbumInfo
|
||||
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(r => r.Author = _artist)
|
||||
.With(r => r.Books = new List<Book> { _album })
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Quality = new QualityModel(Quality.AZW3)
|
||||
})
|
||||
.With(r => r.Release = _releaseInfo)
|
||||
.Build();
|
||||
|
||||
GivenQueue(new List<RemoteAlbum> { remoteAlbum });
|
||||
GivenQueue(new List<RemoteBook> { remoteAlbum });
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_true_when_album_doesnt_match()
|
||||
{
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(r => r.Artist = _artist)
|
||||
.With(r => r.Albums = new List<Book> { _otherAlbum })
|
||||
.With(r => r.ParsedAlbumInfo = new ParsedAlbumInfo
|
||||
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(r => r.Author = _artist)
|
||||
.With(r => r.Books = new List<Book> { _otherAlbum })
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320)
|
||||
})
|
||||
.With(r => r.Release = _releaseInfo)
|
||||
.Build();
|
||||
|
||||
GivenQueue(new List<RemoteAlbum> { remoteAlbum });
|
||||
GivenQueue(new List<RemoteBook> { remoteAlbum });
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
|
|
@ -164,34 +164,34 @@ public void should_return_true_when_qualities_are_the_same_with_higher_preferred
|
|||
{
|
||||
_remoteAlbum.PreferredWordScore = 1;
|
||||
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(r => r.Artist = _artist)
|
||||
.With(r => r.Albums = new List<Book> { _album })
|
||||
.With(r => r.ParsedAlbumInfo = new ParsedAlbumInfo
|
||||
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(r => r.Author = _artist)
|
||||
.With(r => r.Books = new List<Book> { _album })
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320)
|
||||
})
|
||||
.With(r => r.Release = _releaseInfo)
|
||||
.Build();
|
||||
|
||||
GivenQueue(new List<RemoteAlbum> { remoteAlbum });
|
||||
GivenQueue(new List<RemoteBook> { remoteAlbum });
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_false_when_qualities_are_the_same()
|
||||
{
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(r => r.Artist = _artist)
|
||||
.With(r => r.Albums = new List<Book> { _album })
|
||||
.With(r => r.ParsedAlbumInfo = new ParsedAlbumInfo
|
||||
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(r => r.Author = _artist)
|
||||
.With(r => r.Books = new List<Book> { _album })
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320)
|
||||
})
|
||||
.With(r => r.Release = _releaseInfo)
|
||||
.Build();
|
||||
|
||||
GivenQueue(new List<RemoteAlbum> { remoteAlbum });
|
||||
GivenQueue(new List<RemoteBook> { remoteAlbum });
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
||||
|
|
@ -200,93 +200,93 @@ public void should_return_false_when_quality_in_queue_is_better()
|
|||
{
|
||||
_artist.QualityProfile.Value.Cutoff = Quality.FLAC.Id;
|
||||
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(r => r.Artist = _artist)
|
||||
.With(r => r.Albums = new List<Book> { _album })
|
||||
.With(r => r.ParsedAlbumInfo = new ParsedAlbumInfo
|
||||
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(r => r.Author = _artist)
|
||||
.With(r => r.Books = new List<Book> { _album })
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320)
|
||||
})
|
||||
.With(r => r.Release = _releaseInfo)
|
||||
.Build();
|
||||
|
||||
GivenQueue(new List<RemoteAlbum> { remoteAlbum });
|
||||
GivenQueue(new List<RemoteBook> { remoteAlbum });
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_false_if_matching_multi_album_is_in_queue()
|
||||
{
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(r => r.Artist = _artist)
|
||||
.With(r => r.Albums = new List<Book> { _album, _otherAlbum })
|
||||
.With(r => r.ParsedAlbumInfo = new ParsedAlbumInfo
|
||||
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(r => r.Author = _artist)
|
||||
.With(r => r.Books = new List<Book> { _album, _otherAlbum })
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320)
|
||||
})
|
||||
.With(r => r.Release = _releaseInfo)
|
||||
.Build();
|
||||
|
||||
GivenQueue(new List<RemoteAlbum> { remoteAlbum });
|
||||
GivenQueue(new List<RemoteBook> { remoteAlbum });
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_false_if_multi_album_has_one_album_in_queue()
|
||||
{
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(r => r.Artist = _artist)
|
||||
.With(r => r.Albums = new List<Book> { _album })
|
||||
.With(r => r.ParsedAlbumInfo = new ParsedAlbumInfo
|
||||
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(r => r.Author = _artist)
|
||||
.With(r => r.Books = new List<Book> { _album })
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320)
|
||||
})
|
||||
.With(r => r.Release = _releaseInfo)
|
||||
.Build();
|
||||
|
||||
_remoteAlbum.Albums.Add(_otherAlbum);
|
||||
_remoteAlbum.Books.Add(_otherAlbum);
|
||||
|
||||
GivenQueue(new List<RemoteAlbum> { remoteAlbum });
|
||||
GivenQueue(new List<RemoteBook> { remoteAlbum });
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_false_if_multi_part_album_is_already_in_queue()
|
||||
{
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(r => r.Artist = _artist)
|
||||
.With(r => r.Albums = new List<Book> { _album, _otherAlbum })
|
||||
.With(r => r.ParsedAlbumInfo = new ParsedAlbumInfo
|
||||
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(r => r.Author = _artist)
|
||||
.With(r => r.Books = new List<Book> { _album, _otherAlbum })
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320)
|
||||
})
|
||||
.With(r => r.Release = _releaseInfo)
|
||||
.Build();
|
||||
|
||||
_remoteAlbum.Albums.Add(_otherAlbum);
|
||||
_remoteAlbum.Books.Add(_otherAlbum);
|
||||
|
||||
GivenQueue(new List<RemoteAlbum> { remoteAlbum });
|
||||
GivenQueue(new List<RemoteBook> { remoteAlbum });
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_false_if_multi_part_album_has_two_albums_in_queue()
|
||||
{
|
||||
var remoteAlbums = Builder<RemoteAlbum>.CreateListOfSize(2)
|
||||
var remoteAlbums = Builder<RemoteBook>.CreateListOfSize(2)
|
||||
.All()
|
||||
.With(r => r.Artist = _artist)
|
||||
.With(r => r.ParsedAlbumInfo = new ParsedAlbumInfo
|
||||
.With(r => r.Author = _artist)
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320)
|
||||
})
|
||||
.With(r => r.Release = _releaseInfo)
|
||||
.TheFirst(1)
|
||||
.With(r => r.Albums = new List<Book> { _album })
|
||||
.With(r => r.Books = new List<Book> { _album })
|
||||
.TheNext(1)
|
||||
.With(r => r.Albums = new List<Book> { _otherAlbum })
|
||||
.With(r => r.Books = new List<Book> { _otherAlbum })
|
||||
.Build();
|
||||
|
||||
_remoteAlbum.Albums.Add(_otherAlbum);
|
||||
_remoteAlbum.Books.Add(_otherAlbum);
|
||||
GivenQueue(remoteAlbums);
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
|
@ -297,17 +297,17 @@ public void should_return_false_when_quality_is_better_and_upgrade_allowed_is_fa
|
|||
_artist.QualityProfile.Value.Cutoff = Quality.FLAC.Id;
|
||||
_artist.QualityProfile.Value.UpgradeAllowed = false;
|
||||
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(r => r.Artist = _artist)
|
||||
.With(r => r.Albums = new List<Book> { _album })
|
||||
.With(r => r.ParsedAlbumInfo = new ParsedAlbumInfo
|
||||
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(r => r.Author = _artist)
|
||||
.With(r => r.Books = new List<Book> { _album })
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Quality = new QualityModel(Quality.FLAC)
|
||||
})
|
||||
.With(r => r.Release = _releaseInfo)
|
||||
.Build();
|
||||
|
||||
GivenQueue(new List<RemoteAlbum> { remoteAlbum });
|
||||
GivenQueue(new List<RemoteBook> { remoteAlbum });
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
||||
|
|
@ -316,17 +316,17 @@ public void should_return_true_if_everything_is_the_same_for_failed_pending()
|
|||
{
|
||||
_artist.QualityProfile.Value.Cutoff = Quality.FLAC.Id;
|
||||
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(r => r.Artist = _artist)
|
||||
.With(r => r.Albums = new List<Book> { _album })
|
||||
.With(r => r.ParsedAlbumInfo = new ParsedAlbumInfo
|
||||
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(r => r.Author = _artist)
|
||||
.With(r => r.Books = new List<Book> { _album })
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320)
|
||||
})
|
||||
.With(r => r.Release = _releaseInfo)
|
||||
.Build();
|
||||
|
||||
GivenQueue(new List<RemoteAlbum> { remoteAlbum }, TrackedDownloadState.DownloadFailedPending);
|
||||
GivenQueue(new List<RemoteBook> { remoteAlbum }, TrackedDownloadState.DownloadFailedPending);
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
|
||||
public class RawDiskSpecificationFixture : CoreTest<RawDiskSpecification>
|
||||
{
|
||||
private RemoteAlbum _remoteAlbum;
|
||||
private RemoteBook _remoteAlbum;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_remoteAlbum = new RemoteAlbum
|
||||
_remoteAlbum = new RemoteBook
|
||||
{
|
||||
Release = new ReleaseInfo() { DownloadProtocol = DownloadProtocol.Torrent }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles.Releases;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
|
@ -13,14 +13,14 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
[TestFixture]
|
||||
public class ReleaseRestrictionsSpecificationFixture : CoreTest<ReleaseRestrictionsSpecification>
|
||||
{
|
||||
private RemoteAlbum _remoteAlbum;
|
||||
private RemoteBook _remoteAlbum;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_remoteAlbum = new RemoteAlbum
|
||||
_remoteAlbum = new RemoteBook
|
||||
{
|
||||
Artist = new Author
|
||||
Author = new Author
|
||||
{
|
||||
Tags = new HashSet<int>()
|
||||
},
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
|
@ -16,7 +16,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
[TestFixture]
|
||||
public class RepackSpecificationFixture : CoreTest<RepackSpecification>
|
||||
{
|
||||
private ParsedAlbumInfo _parsedAlbumInfo;
|
||||
private ParsedBookInfo _parsedAlbumInfo;
|
||||
private List<Book> _albums;
|
||||
private List<BookFile> _trackFiles;
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ public void Setup()
|
|||
{
|
||||
Mocker.Resolve<UpgradableSpecification>();
|
||||
|
||||
_parsedAlbumInfo = Builder<ParsedAlbumInfo>.CreateNew()
|
||||
_parsedAlbumInfo = Builder<ParsedBookInfo>.CreateNew()
|
||||
.With(p => p.Quality = new QualityModel(Quality.FLAC,
|
||||
new Revision(2, 0, false)))
|
||||
.With(p => p.ReleaseGroup = "Readarr")
|
||||
|
|
@ -41,16 +41,16 @@ public void Setup()
|
|||
.BuildList();
|
||||
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Setup(c => c.GetFilesByAlbum(It.IsAny<int>()))
|
||||
.Setup(c => c.GetFilesByBook(It.IsAny<int>()))
|
||||
.Returns(_trackFiles);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_true_if_it_is_not_a_repack()
|
||||
{
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(e => e.ParsedAlbumInfo = _parsedAlbumInfo)
|
||||
.With(e => e.Albums = _albums)
|
||||
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(e => e.ParsedBookInfo = _parsedAlbumInfo)
|
||||
.With(e => e.Books = _albums)
|
||||
.Build();
|
||||
|
||||
Subject.IsSatisfiedBy(remoteAlbum, null)
|
||||
|
|
@ -63,14 +63,14 @@ public void should_return_true_if_it_is_not_a_repack()
|
|||
public void should_return_true_if_there_are_is_no_track_files()
|
||||
{
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Setup(c => c.GetFilesByAlbum(It.IsAny<int>()))
|
||||
.Setup(c => c.GetFilesByBook(It.IsAny<int>()))
|
||||
.Returns(new List<BookFile>());
|
||||
|
||||
_parsedAlbumInfo.Quality.Revision.IsRepack = true;
|
||||
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(e => e.ParsedAlbumInfo = _parsedAlbumInfo)
|
||||
.With(e => e.Albums = _albums)
|
||||
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(e => e.ParsedBookInfo = _parsedAlbumInfo)
|
||||
.With(e => e.Books = _albums)
|
||||
.Build();
|
||||
|
||||
Subject.IsSatisfiedBy(remoteAlbum, null)
|
||||
|
|
@ -95,9 +95,9 @@ public void should_return_true_if_is_a_repack_for_a_different_quality()
|
|||
return c;
|
||||
}).ToList();
|
||||
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(e => e.ParsedAlbumInfo = _parsedAlbumInfo)
|
||||
.With(e => e.Albums = _albums)
|
||||
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(e => e.ParsedBookInfo = _parsedAlbumInfo)
|
||||
.With(e => e.Books = _albums)
|
||||
.Build();
|
||||
|
||||
Subject.IsSatisfiedBy(remoteAlbum, null)
|
||||
|
|
@ -122,9 +122,9 @@ public void should_return_true_if_is_a_repack_for_all_existing_files()
|
|||
return c;
|
||||
}).ToList();
|
||||
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(e => e.ParsedAlbumInfo = _parsedAlbumInfo)
|
||||
.With(e => e.Albums = _albums)
|
||||
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(e => e.ParsedBookInfo = _parsedAlbumInfo)
|
||||
.With(e => e.Books = _albums)
|
||||
.Build();
|
||||
|
||||
Subject.IsSatisfiedBy(remoteAlbum, null)
|
||||
|
|
@ -151,9 +151,9 @@ public void should_return_false_if_is_a_repack_for_some_but_not_all_trackfiles()
|
|||
|
||||
_trackFiles.First().ReleaseGroup = "NotReadarr";
|
||||
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(e => e.ParsedAlbumInfo = _parsedAlbumInfo)
|
||||
.With(e => e.Albums = _albums)
|
||||
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(e => e.ParsedBookInfo = _parsedAlbumInfo)
|
||||
.With(e => e.Books = _albums)
|
||||
.Build();
|
||||
|
||||
Subject.IsSatisfiedBy(remoteAlbum, null)
|
||||
|
|
@ -178,9 +178,9 @@ public void should_return_false_if_is_a_repack_for_different_group()
|
|||
return c;
|
||||
}).ToList();
|
||||
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(e => e.ParsedAlbumInfo = _parsedAlbumInfo)
|
||||
.With(e => e.Albums = _albums)
|
||||
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(e => e.ParsedBookInfo = _parsedAlbumInfo)
|
||||
.With(e => e.Books = _albums)
|
||||
.Build();
|
||||
|
||||
Subject.IsSatisfiedBy(remoteAlbum, null)
|
||||
|
|
@ -205,9 +205,9 @@ public void should_return_false_if_release_group_for_existing_file_is_unknown()
|
|||
return c;
|
||||
}).ToList();
|
||||
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(e => e.ParsedAlbumInfo = _parsedAlbumInfo)
|
||||
.With(e => e.Albums = _albums)
|
||||
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(e => e.ParsedBookInfo = _parsedAlbumInfo)
|
||||
.With(e => e.Books = _albums)
|
||||
.Build();
|
||||
|
||||
Subject.IsSatisfiedBy(remoteAlbum, null)
|
||||
|
|
@ -234,9 +234,9 @@ public void should_return_false_if_release_group_for_release_is_unknown()
|
|||
return c;
|
||||
}).ToList();
|
||||
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(e => e.ParsedAlbumInfo = _parsedAlbumInfo)
|
||||
.With(e => e.Albums = _albums)
|
||||
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(e => e.ParsedBookInfo = _parsedAlbumInfo)
|
||||
.With(e => e.Books = _albums)
|
||||
.Build();
|
||||
|
||||
Subject.IsSatisfiedBy(remoteAlbum, null)
|
||||
|
|
|
|||
|
|
@ -13,12 +13,12 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
|
||||
public class RetentionSpecificationFixture : CoreTest<RetentionSpecification>
|
||||
{
|
||||
private RemoteAlbum _remoteAlbum;
|
||||
private RemoteBook _remoteAlbum;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_remoteAlbum = new RemoteAlbum
|
||||
_remoteAlbum = new RemoteBook
|
||||
{
|
||||
Release = new ReleaseInfo() { DownloadProtocol = DownloadProtocol.Usenet }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@
|
|||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications.RssSync;
|
||||
using NzbDrone.Core.Download.Pending;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles.Delay;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
|
|
@ -25,7 +25,7 @@ public class DelaySpecificationFixture : CoreTest<DelaySpecification>
|
|||
{
|
||||
private QualityProfile _profile;
|
||||
private DelayProfile _delayProfile;
|
||||
private RemoteAlbum _remoteAlbum;
|
||||
private RemoteBook _remoteAlbum;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
|
|
@ -41,8 +41,8 @@ public void Setup()
|
|||
.With(s => s.QualityProfile = _profile)
|
||||
.Build();
|
||||
|
||||
_remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(r => r.Artist = artist)
|
||||
_remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(r => r.Author = artist)
|
||||
.Build();
|
||||
|
||||
_profile.Items = new List<QualityProfileQualityItem>();
|
||||
|
|
@ -52,14 +52,14 @@ public void Setup()
|
|||
|
||||
_profile.Cutoff = Quality.AZW3.Id;
|
||||
|
||||
_remoteAlbum.ParsedAlbumInfo = new ParsedAlbumInfo();
|
||||
_remoteAlbum.ParsedBookInfo = new ParsedBookInfo();
|
||||
_remoteAlbum.Release = new ReleaseInfo();
|
||||
_remoteAlbum.Release.DownloadProtocol = DownloadProtocol.Usenet;
|
||||
|
||||
_remoteAlbum.Albums = Builder<Book>.CreateListOfSize(1).Build().ToList();
|
||||
_remoteAlbum.Books = Builder<Book>.CreateListOfSize(1).Build().ToList();
|
||||
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Setup(s => s.GetFilesByAlbum(It.IsAny<int>()))
|
||||
.Setup(s => s.GetFilesByBook(It.IsAny<int>()))
|
||||
.Returns(new List<BookFile> { });
|
||||
|
||||
Mocker.GetMock<IDelayProfileService>()
|
||||
|
|
@ -67,14 +67,14 @@ public void Setup()
|
|||
.Returns(_delayProfile);
|
||||
|
||||
Mocker.GetMock<IPendingReleaseService>()
|
||||
.Setup(s => s.GetPendingRemoteAlbums(It.IsAny<int>()))
|
||||
.Returns(new List<RemoteAlbum>());
|
||||
.Setup(s => s.GetPendingRemoteBooks(It.IsAny<int>()))
|
||||
.Returns(new List<RemoteBook>());
|
||||
}
|
||||
|
||||
private void GivenExistingFile(QualityModel quality)
|
||||
{
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Setup(s => s.GetFilesByAlbum(It.IsAny<int>()))
|
||||
.Setup(s => s.GetFilesByBook(It.IsAny<int>()))
|
||||
.Returns(new List<BookFile>
|
||||
{
|
||||
new BookFile
|
||||
|
|
@ -94,18 +94,18 @@ private void GivenUpgradeForExistingFile()
|
|||
[Test]
|
||||
public void should_be_true_when_user_invoked_search()
|
||||
{
|
||||
Subject.IsSatisfiedBy(new RemoteAlbum(), new AlbumSearchCriteria { UserInvokedSearch = true }).Accepted.Should().BeTrue();
|
||||
Subject.IsSatisfiedBy(new RemoteBook(), new BookSearchCriteria { UserInvokedSearch = true }).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_be_false_when_system_invoked_search_and_release_is_younger_than_delay()
|
||||
{
|
||||
_remoteAlbum.ParsedAlbumInfo.Quality = new QualityModel(Quality.MOBI);
|
||||
_remoteAlbum.ParsedBookInfo.Quality = new QualityModel(Quality.MOBI);
|
||||
_remoteAlbum.Release.PublishDate = DateTime.UtcNow;
|
||||
|
||||
_delayProfile.UsenetDelay = 720;
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, new AlbumSearchCriteria()).Accepted.Should().BeFalse();
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, new BookSearchCriteria()).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -119,7 +119,7 @@ public void should_be_true_when_profile_does_not_have_a_delay()
|
|||
[Test]
|
||||
public void should_be_true_when_quality_is_last_allowed_in_profile()
|
||||
{
|
||||
_remoteAlbum.ParsedAlbumInfo.Quality = new QualityModel(Quality.MP3_320);
|
||||
_remoteAlbum.ParsedBookInfo.Quality = new QualityModel(Quality.MP3_320);
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
|
@ -127,7 +127,7 @@ public void should_be_true_when_quality_is_last_allowed_in_profile()
|
|||
[Test]
|
||||
public void should_be_true_when_release_is_older_than_delay()
|
||||
{
|
||||
_remoteAlbum.ParsedAlbumInfo.Quality = new QualityModel(Quality.MOBI);
|
||||
_remoteAlbum.ParsedBookInfo.Quality = new QualityModel(Quality.MOBI);
|
||||
_remoteAlbum.Release.PublishDate = DateTime.UtcNow.AddHours(-10);
|
||||
|
||||
_delayProfile.UsenetDelay = 60;
|
||||
|
|
@ -138,7 +138,7 @@ public void should_be_true_when_release_is_older_than_delay()
|
|||
[Test]
|
||||
public void should_be_false_when_release_is_younger_than_delay()
|
||||
{
|
||||
_remoteAlbum.ParsedAlbumInfo.Quality = new QualityModel(Quality.MOBI);
|
||||
_remoteAlbum.ParsedBookInfo.Quality = new QualityModel(Quality.MOBI);
|
||||
_remoteAlbum.Release.PublishDate = DateTime.UtcNow;
|
||||
|
||||
_delayProfile.UsenetDelay = 720;
|
||||
|
|
@ -149,7 +149,7 @@ public void should_be_false_when_release_is_younger_than_delay()
|
|||
[Test]
|
||||
public void should_be_true_when_release_is_a_proper_for_existing_album()
|
||||
{
|
||||
_remoteAlbum.ParsedAlbumInfo.Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2));
|
||||
_remoteAlbum.ParsedBookInfo.Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2));
|
||||
_remoteAlbum.Release.PublishDate = DateTime.UtcNow;
|
||||
|
||||
GivenExistingFile(new QualityModel(Quality.MP3_320));
|
||||
|
|
@ -167,7 +167,7 @@ public void should_be_true_when_release_is_a_proper_for_existing_album()
|
|||
[Test]
|
||||
public void should_be_true_when_release_is_a_real_for_existing_album()
|
||||
{
|
||||
_remoteAlbum.ParsedAlbumInfo.Quality = new QualityModel(Quality.MP3_320, new Revision(real: 1));
|
||||
_remoteAlbum.ParsedBookInfo.Quality = new QualityModel(Quality.MP3_320, new Revision(real: 1));
|
||||
_remoteAlbum.Release.PublishDate = DateTime.UtcNow;
|
||||
|
||||
GivenExistingFile(new QualityModel(Quality.MP3_320));
|
||||
|
|
@ -185,7 +185,7 @@ public void should_be_true_when_release_is_a_real_for_existing_album()
|
|||
[Test]
|
||||
public void should_be_false_when_release_is_proper_for_existing_album_of_different_quality()
|
||||
{
|
||||
_remoteAlbum.ParsedAlbumInfo.Quality = new QualityModel(Quality.AZW3, new Revision(version: 2));
|
||||
_remoteAlbum.ParsedBookInfo.Quality = new QualityModel(Quality.AZW3, new Revision(version: 2));
|
||||
_remoteAlbum.Release.PublishDate = DateTime.UtcNow;
|
||||
|
||||
GivenExistingFile(new QualityModel(Quality.PDF));
|
||||
|
|
|
|||
|
|
@ -5,11 +5,11 @@
|
|||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications.RssSync;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
|
@ -19,10 +19,10 @@
|
|||
namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
|
||||
{
|
||||
[TestFixture]
|
||||
public class DeletedTrackFileSpecificationFixture : CoreTest<DeletedTrackFileSpecification>
|
||||
public class DeletedTrackFileSpecificationFixture : CoreTest<DeletedBookFileSpecification>
|
||||
{
|
||||
private RemoteAlbum _parseResultMulti;
|
||||
private RemoteAlbum _parseResultSingle;
|
||||
private RemoteBook _parseResultMulti;
|
||||
private RemoteBook _parseResultSingle;
|
||||
private BookFile _firstFile;
|
||||
private BookFile _secondFile;
|
||||
|
||||
|
|
@ -60,18 +60,18 @@ public void Setup()
|
|||
.With(c => c.Path = @"C:\Music\My.Artist".AsOsAgnostic())
|
||||
.Build();
|
||||
|
||||
_parseResultMulti = new RemoteAlbum
|
||||
_parseResultMulti = new RemoteBook
|
||||
{
|
||||
Artist = fakeArtist,
|
||||
ParsedAlbumInfo = new ParsedAlbumInfo { Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
Albums = doubleAlbumList
|
||||
Author = fakeArtist,
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
Books = doubleAlbumList
|
||||
};
|
||||
|
||||
_parseResultSingle = new RemoteAlbum
|
||||
_parseResultSingle = new RemoteBook
|
||||
{
|
||||
Artist = fakeArtist,
|
||||
ParsedAlbumInfo = new ParsedAlbumInfo { Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
Albums = singleAlbumList
|
||||
Author = fakeArtist,
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
Books = singleAlbumList
|
||||
};
|
||||
|
||||
GivenUnmonitorDeletedTracks(true);
|
||||
|
|
@ -87,7 +87,7 @@ private void GivenUnmonitorDeletedTracks(bool enabled)
|
|||
private void SetupMediaFile(List<BookFile> files)
|
||||
{
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Setup(v => v.GetFilesByAlbum(It.IsAny<int>()))
|
||||
.Setup(v => v.GetFilesByBook(It.IsAny<int>()))
|
||||
.Returns(files);
|
||||
}
|
||||
|
||||
|
|
@ -111,7 +111,7 @@ public void should_return_true_when_unmonitor_deleted_tracks_is_off()
|
|||
[Test]
|
||||
public void should_return_true_when_searching()
|
||||
{
|
||||
Subject.IsSatisfiedBy(_parseResultSingle, new ArtistSearchCriteria()).Accepted.Should().BeTrue();
|
||||
Subject.IsSatisfiedBy(_parseResultSingle, new AuthorSearchCriteria()).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@
|
|||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications.RssSync;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
|
@ -21,8 +21,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.RssSync
|
|||
|
||||
public class ProperSpecificationFixture : CoreTest<ProperSpecification>
|
||||
{
|
||||
private RemoteAlbum _parseResultMulti;
|
||||
private RemoteAlbum _parseResultSingle;
|
||||
private RemoteBook _parseResultMulti;
|
||||
private RemoteBook _parseResultSingle;
|
||||
private BookFile _firstFile;
|
||||
private BookFile _secondFile;
|
||||
|
||||
|
|
@ -42,21 +42,21 @@ public void Setup()
|
|||
.Build();
|
||||
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Setup(c => c.GetFilesByAlbum(It.IsAny<int>()))
|
||||
.Setup(c => c.GetFilesByBook(It.IsAny<int>()))
|
||||
.Returns(new List<BookFile> { _firstFile, _secondFile });
|
||||
|
||||
_parseResultMulti = new RemoteAlbum
|
||||
_parseResultMulti = new RemoteBook
|
||||
{
|
||||
Artist = fakeArtist,
|
||||
ParsedAlbumInfo = new ParsedAlbumInfo { Quality = new QualityModel(Quality.MOBI, new Revision(version: 2)) },
|
||||
Albums = doubleAlbumList
|
||||
Author = fakeArtist,
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MOBI, new Revision(version: 2)) },
|
||||
Books = doubleAlbumList
|
||||
};
|
||||
|
||||
_parseResultSingle = new RemoteAlbum
|
||||
_parseResultSingle = new RemoteBook
|
||||
{
|
||||
Artist = fakeArtist,
|
||||
ParsedAlbumInfo = new ParsedAlbumInfo { Quality = new QualityModel(Quality.MOBI, new Revision(version: 2)) },
|
||||
Albums = singleAlbumList
|
||||
Author = fakeArtist,
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MOBI, new Revision(version: 2)) },
|
||||
Books = singleAlbumList
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ public void should_return_true_when_trackFile_was_added_more_than_7_days_ago_but
|
|||
WithFirstFileUpgradable();
|
||||
|
||||
_firstFile.DateAdded = DateTime.Today.AddDays(-30);
|
||||
Subject.IsSatisfiedBy(_parseResultSingle, new AlbumSearchCriteria()).Accepted.Should().BeTrue();
|
||||
Subject.IsSatisfiedBy(_parseResultSingle, new BookSearchCriteria()).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications.Search;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.DecisionEngineTests.Search
|
||||
{
|
||||
[TestFixture]
|
||||
public class ArtistSpecificationFixture : TestBase<ArtistSpecification>
|
||||
public class ArtistSpecificationFixture : TestBase<AuthorSpecification>
|
||||
{
|
||||
private Author _artist1;
|
||||
private Author _artist2;
|
||||
private RemoteAlbum _remoteAlbum = new RemoteAlbum();
|
||||
private SearchCriteriaBase _searchCriteria = new AlbumSearchCriteria();
|
||||
private RemoteBook _remoteAlbum = new RemoteBook();
|
||||
private SearchCriteriaBase _searchCriteria = new BookSearchCriteria();
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
|
|
@ -23,13 +23,13 @@ public void Setup()
|
|||
_artist1 = Builder<Author>.CreateNew().With(s => s.Id = 1).Build();
|
||||
_artist2 = Builder<Author>.CreateNew().With(s => s.Id = 2).Build();
|
||||
|
||||
_remoteAlbum.Artist = _artist1;
|
||||
_remoteAlbum.Author = _artist1;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_false_if_artist_doesnt_match()
|
||||
{
|
||||
_searchCriteria.Artist = _artist2;
|
||||
_searchCriteria.Author = _artist2;
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, _searchCriteria).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
|
@ -37,7 +37,7 @@ public void should_return_false_if_artist_doesnt_match()
|
|||
[Test]
|
||||
public void should_return_true_when_artist_ids_match()
|
||||
{
|
||||
_searchCriteria.Artist = _artist1;
|
||||
_searchCriteria.Author = _artist1;
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteAlbum, _searchCriteria).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Indexers.TorrentRss;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ namespace NzbDrone.Core.Test.DecisionEngineTests.Search
|
|||
public class TorrentSeedingSpecificationFixture : TestBase<TorrentSeedingSpecification>
|
||||
{
|
||||
private Author _artist;
|
||||
private RemoteAlbum _remoteAlbum;
|
||||
private RemoteBook _remoteAlbum;
|
||||
private IndexerDefinition _indexerDefinition;
|
||||
|
||||
[SetUp]
|
||||
|
|
@ -24,9 +24,9 @@ public void Setup()
|
|||
{
|
||||
_artist = Builder<Author>.CreateNew().With(s => s.Id = 1).Build();
|
||||
|
||||
_remoteAlbum = new RemoteAlbum
|
||||
_remoteAlbum = new RemoteBook
|
||||
{
|
||||
Artist = _artist,
|
||||
Author = _artist,
|
||||
Release = new TorrentInfo
|
||||
{
|
||||
IndexerId = 1,
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.DecisionEngine.Specifications;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
|
@ -19,8 +19,8 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
[Ignore("Pending Readarr fixes")]
|
||||
public class UpgradeDiskSpecificationFixture : CoreTest<UpgradeDiskSpecification>
|
||||
{
|
||||
private RemoteAlbum _parseResultMulti;
|
||||
private RemoteAlbum _parseResultSingle;
|
||||
private RemoteBook _parseResultMulti;
|
||||
private RemoteBook _parseResultSingle;
|
||||
private BookFile _firstFile;
|
||||
private BookFile _secondFile;
|
||||
|
||||
|
|
@ -45,21 +45,21 @@ public void Setup()
|
|||
.Build();
|
||||
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Setup(c => c.GetFilesByAlbum(It.IsAny<int>()))
|
||||
.Setup(c => c.GetFilesByBook(It.IsAny<int>()))
|
||||
.Returns(new List<BookFile> { _firstFile, _secondFile });
|
||||
|
||||
_parseResultMulti = new RemoteAlbum
|
||||
_parseResultMulti = new RemoteBook
|
||||
{
|
||||
Artist = fakeArtist,
|
||||
ParsedAlbumInfo = new ParsedAlbumInfo { Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
Albums = doubleAlbumList
|
||||
Author = fakeArtist,
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
Books = doubleAlbumList
|
||||
};
|
||||
|
||||
_parseResultSingle = new RemoteAlbum
|
||||
_parseResultSingle = new RemoteBook
|
||||
{
|
||||
Artist = fakeArtist,
|
||||
ParsedAlbumInfo = new ParsedAlbumInfo { Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
Albums = singleAlbumList
|
||||
Author = fakeArtist,
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
Books = singleAlbumList
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ private void WithSecondFileUpgradable()
|
|||
[Test]
|
||||
public void should_return_true_if_album_has_no_existing_file()
|
||||
{
|
||||
_parseResultSingle.Albums.First().BookFiles = new List<BookFile>();
|
||||
_parseResultSingle.Books.First().BookFiles = new List<BookFile>();
|
||||
|
||||
Subject.IsSatisfiedBy(_parseResultSingle, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
|
@ -97,7 +97,7 @@ public void should_only_query_db_for_missing_tracks_once()
|
|||
[Test]
|
||||
public void should_return_true_if_single_album_doesnt_exist_on_disk()
|
||||
{
|
||||
_parseResultSingle.Albums = new List<Book>();
|
||||
_parseResultSingle.Books = new List<Book>();
|
||||
|
||||
Subject.IsSatisfiedBy(_parseResultSingle, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
|
@ -115,7 +115,7 @@ public void should_not_be_upgradable_if_qualities_are_the_same()
|
|||
{
|
||||
_firstFile.Quality = new QualityModel(Quality.MP3_320);
|
||||
_secondFile.Quality = new QualityModel(Quality.MP3_320);
|
||||
_parseResultSingle.ParsedAlbumInfo.Quality = new QualityModel(Quality.MP3_320);
|
||||
_parseResultSingle.ParsedBookInfo.Quality = new QualityModel(Quality.MP3_320);
|
||||
Subject.IsSatisfiedBy(_parseResultSingle, null).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
||||
|
|
@ -129,7 +129,7 @@ public void should_not_be_upgradable_if_all_tracks_are_not_upgradable()
|
|||
public void should_be_true_if_some_tracks_are_upgradable_and_none_are_downgrades()
|
||||
{
|
||||
WithFirstFileUpgradable();
|
||||
_parseResultSingle.ParsedAlbumInfo.Quality = _secondFile.Quality;
|
||||
_parseResultSingle.ParsedBookInfo.Quality = _secondFile.Quality;
|
||||
Subject.IsSatisfiedBy(_parseResultSingle, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ public void should_be_true_if_some_tracks_are_upgradable_and_none_are_downgrades
|
|||
public void should_be_false_if_some_tracks_are_upgradable_and_some_are_downgrades()
|
||||
{
|
||||
WithFirstFileUpgradable();
|
||||
_parseResultSingle.ParsedAlbumInfo.Quality = new QualityModel(Quality.MP3_320);
|
||||
_parseResultSingle.ParsedBookInfo.Quality = new QualityModel(Quality.MP3_320);
|
||||
Subject.IsSatisfiedBy(_parseResultSingle, null).Accepted.Should().BeFalse();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.DiskSpace;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.RootFolders;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
|
@ -52,8 +52,8 @@ public void SetUp()
|
|||
|
||||
private void GivenArtist(params Author[] artist)
|
||||
{
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(v => v.GetAllArtists())
|
||||
Mocker.GetMock<IAuthorService>()
|
||||
.Setup(v => v.GetAllAuthors())
|
||||
.Returns(artist.ToList());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@
|
|||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.TrackedDownloads;
|
||||
using NzbDrone.Core.History;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport;
|
||||
using NzbDrone.Core.MediaFiles.BookImport;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
|
@ -38,7 +38,7 @@ public void Setup()
|
|||
_trackedDownload = Builder<TrackedDownload>.CreateNew()
|
||||
.With(c => c.State = TrackedDownloadState.Downloading)
|
||||
.With(c => c.DownloadItem = completed)
|
||||
.With(c => c.RemoteAlbum = remoteAlbum)
|
||||
.With(c => c.RemoteBook = remoteAlbum)
|
||||
.Build();
|
||||
|
||||
Mocker.GetMock<IDownloadClient>()
|
||||
|
|
@ -55,7 +55,7 @@ public void Setup()
|
|||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.GetArtist("Drone.S01E01.HDTV"))
|
||||
.Returns(remoteAlbum.Artist);
|
||||
.Returns(remoteAlbum.Author);
|
||||
}
|
||||
|
||||
private Book CreateAlbum(int id)
|
||||
|
|
@ -66,18 +66,18 @@ private Book CreateAlbum(int id)
|
|||
};
|
||||
}
|
||||
|
||||
private RemoteAlbum BuildRemoteAlbum()
|
||||
private RemoteBook BuildRemoteAlbum()
|
||||
{
|
||||
return new RemoteAlbum
|
||||
return new RemoteBook
|
||||
{
|
||||
Artist = new Author(),
|
||||
Albums = new List<Book> { CreateAlbum(1) }
|
||||
Author = new Author(),
|
||||
Books = new List<Book> { CreateAlbum(1) }
|
||||
};
|
||||
}
|
||||
|
||||
private void GivenABadlyNamedDownload()
|
||||
{
|
||||
_trackedDownload.RemoteAlbum.Artist = null;
|
||||
_trackedDownload.RemoteBook.Author = null;
|
||||
_trackedDownload.DownloadItem.DownloadId = "1234";
|
||||
_trackedDownload.DownloadItem.Title = "Droned Pilot"; // Set a badly named download
|
||||
Mocker.GetMock<IHistoryService>()
|
||||
|
|
@ -90,30 +90,30 @@ private void GivenABadlyNamedDownload()
|
|||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.GetArtist("Droned S01E01"))
|
||||
.Returns(BuildRemoteAlbum().Artist);
|
||||
.Returns(BuildRemoteAlbum().Author);
|
||||
}
|
||||
|
||||
private void GivenArtistMatch()
|
||||
{
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.GetArtist(It.IsAny<string>()))
|
||||
.Returns(_trackedDownload.RemoteAlbum.Artist);
|
||||
.Returns(_trackedDownload.RemoteBook.Author);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_mark_as_imported_if_all_files_were_rejected()
|
||||
{
|
||||
Mocker.GetMock<IDownloadedTracksImportService>()
|
||||
Mocker.GetMock<IDownloadedBooksImportService>()
|
||||
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Author>(), It.IsAny<DownloadClientItem>()))
|
||||
.Returns(new List<ImportResult>
|
||||
{
|
||||
new ImportResult(
|
||||
new ImportDecision<LocalTrack>(
|
||||
new LocalTrack { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() }, new Rejection("Rejected!")), "Test Failure"),
|
||||
new ImportDecision<LocalBook>(
|
||||
new LocalBook { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() }, new Rejection("Rejected!")), "Test Failure"),
|
||||
|
||||
new ImportResult(
|
||||
new ImportDecision<LocalTrack>(
|
||||
new LocalTrack { Path = @"C:\TestPath\Droned.S01E02.mkv".AsOsAgnostic() }, new Rejection("Rejected!")), "Test Failure")
|
||||
new ImportDecision<LocalBook>(
|
||||
new LocalBook { Path = @"C:\TestPath\Droned.S01E02.mkv".AsOsAgnostic() }, new Rejection("Rejected!")), "Test Failure")
|
||||
});
|
||||
|
||||
Subject.Import(_trackedDownload);
|
||||
|
|
@ -127,20 +127,20 @@ public void should_not_mark_as_imported_if_all_files_were_rejected()
|
|||
[Test]
|
||||
public void should_not_mark_as_imported_if_no_tracks_were_parsed()
|
||||
{
|
||||
Mocker.GetMock<IDownloadedTracksImportService>()
|
||||
Mocker.GetMock<IDownloadedBooksImportService>()
|
||||
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Author>(), It.IsAny<DownloadClientItem>()))
|
||||
.Returns(new List<ImportResult>
|
||||
{
|
||||
new ImportResult(
|
||||
new ImportDecision<LocalTrack>(
|
||||
new LocalTrack { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() }, new Rejection("Rejected!")), "Test Failure"),
|
||||
new ImportDecision<LocalBook>(
|
||||
new LocalBook { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() }, new Rejection("Rejected!")), "Test Failure"),
|
||||
|
||||
new ImportResult(
|
||||
new ImportDecision<LocalTrack>(
|
||||
new LocalTrack { Path = @"C:\TestPath\Droned.S01E02.mkv".AsOsAgnostic() }, new Rejection("Rejected!")), "Test Failure")
|
||||
new ImportDecision<LocalBook>(
|
||||
new LocalBook { Path = @"C:\TestPath\Droned.S01E02.mkv".AsOsAgnostic() }, new Rejection("Rejected!")), "Test Failure")
|
||||
});
|
||||
|
||||
_trackedDownload.RemoteAlbum.Albums.Clear();
|
||||
_trackedDownload.RemoteBook.Books.Clear();
|
||||
|
||||
Subject.Import(_trackedDownload);
|
||||
|
||||
|
|
@ -150,12 +150,12 @@ public void should_not_mark_as_imported_if_no_tracks_were_parsed()
|
|||
[Test]
|
||||
public void should_not_mark_as_imported_if_all_files_were_skipped()
|
||||
{
|
||||
Mocker.GetMock<IDownloadedTracksImportService>()
|
||||
Mocker.GetMock<IDownloadedBooksImportService>()
|
||||
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Author>(), It.IsAny<DownloadClientItem>()))
|
||||
.Returns(new List<ImportResult>
|
||||
{
|
||||
new ImportResult(new ImportDecision<LocalTrack>(new LocalTrack { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() }), "Test Failure"),
|
||||
new ImportResult(new ImportDecision<LocalTrack>(new LocalTrack { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() }), "Test Failure")
|
||||
new ImportResult(new ImportDecision<LocalBook>(new LocalBook { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() }), "Test Failure"),
|
||||
new ImportResult(new ImportDecision<LocalBook>(new LocalBook { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() }), "Test Failure")
|
||||
});
|
||||
|
||||
Subject.Import(_trackedDownload);
|
||||
|
|
@ -168,17 +168,17 @@ public void should_mark_as_imported_if_all_tracks_were_imported_but_extra_files_
|
|||
{
|
||||
GivenArtistMatch();
|
||||
|
||||
_trackedDownload.RemoteAlbum.Albums = new List<Book>
|
||||
_trackedDownload.RemoteBook.Books = new List<Book>
|
||||
{
|
||||
CreateAlbum(1)
|
||||
};
|
||||
|
||||
Mocker.GetMock<IDownloadedTracksImportService>()
|
||||
Mocker.GetMock<IDownloadedBooksImportService>()
|
||||
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Author>(), It.IsAny<DownloadClientItem>()))
|
||||
.Returns(new List<ImportResult>
|
||||
{
|
||||
new ImportResult(new ImportDecision<LocalTrack>(new LocalTrack { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() })),
|
||||
new ImportResult(new ImportDecision<LocalTrack>(new LocalTrack { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() }), "Test Failure")
|
||||
new ImportResult(new ImportDecision<LocalBook>(new LocalBook { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() })),
|
||||
new ImportResult(new ImportDecision<LocalBook>(new LocalBook { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() }), "Test Failure")
|
||||
});
|
||||
|
||||
Subject.Import(_trackedDownload);
|
||||
|
|
@ -189,22 +189,22 @@ public void should_mark_as_imported_if_all_tracks_were_imported_but_extra_files_
|
|||
[Test]
|
||||
public void should_not_mark_as_imported_if_some_tracks_were_not_imported()
|
||||
{
|
||||
_trackedDownload.RemoteAlbum.Albums = new List<Book>
|
||||
_trackedDownload.RemoteBook.Books = new List<Book>
|
||||
{
|
||||
CreateAlbum(1),
|
||||
CreateAlbum(1),
|
||||
CreateAlbum(1)
|
||||
};
|
||||
|
||||
Mocker.GetMock<IDownloadedTracksImportService>()
|
||||
Mocker.GetMock<IDownloadedBooksImportService>()
|
||||
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Author>(), It.IsAny<DownloadClientItem>()))
|
||||
.Returns(new List<ImportResult>
|
||||
{
|
||||
new ImportResult(new ImportDecision<LocalTrack>(new LocalTrack { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() })),
|
||||
new ImportResult(new ImportDecision<LocalTrack>(new LocalTrack { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() })),
|
||||
new ImportResult(new ImportDecision<LocalTrack>(new LocalTrack { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() }), "Test Failure"),
|
||||
new ImportResult(new ImportDecision<LocalTrack>(new LocalTrack { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() }), "Test Failure"),
|
||||
new ImportResult(new ImportDecision<LocalTrack>(new LocalTrack { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() }), "Test Failure")
|
||||
new ImportResult(new ImportDecision<LocalBook>(new LocalBook { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() })),
|
||||
new ImportResult(new ImportDecision<LocalBook>(new LocalBook { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() })),
|
||||
new ImportResult(new ImportDecision<LocalBook>(new LocalBook { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() }), "Test Failure"),
|
||||
new ImportResult(new ImportDecision<LocalBook>(new LocalBook { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() }), "Test Failure"),
|
||||
new ImportResult(new ImportDecision<LocalBook>(new LocalBook { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() }), "Test Failure")
|
||||
});
|
||||
|
||||
var history = Builder<History.History>.CreateListOfSize(2)
|
||||
|
|
@ -228,15 +228,15 @@ public void should_not_mark_as_imported_if_some_of_episodes_were_not_imported_in
|
|||
{
|
||||
var albums = Builder<Book>.CreateListOfSize(3).BuildList();
|
||||
|
||||
_trackedDownload.RemoteAlbum.Albums = albums;
|
||||
_trackedDownload.RemoteBook.Books = albums;
|
||||
|
||||
Mocker.GetMock<IDownloadedTracksImportService>()
|
||||
Mocker.GetMock<IDownloadedBooksImportService>()
|
||||
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Author>(), It.IsAny<DownloadClientItem>()))
|
||||
.Returns(new List<ImportResult>
|
||||
{
|
||||
new ImportResult(new ImportDecision<LocalTrack>(new LocalTrack { Path = @"C:\TestPath\Droned.S01E01.mkv" })),
|
||||
new ImportResult(new ImportDecision<LocalTrack>(new LocalTrack { Path = @"C:\TestPath\Droned.S01E01.mkv" }), "Test Failure"),
|
||||
new ImportResult(new ImportDecision<LocalTrack>(new LocalTrack { Path = @"C:\TestPath\Droned.S01E01.mkv" }), "Test Failure")
|
||||
new ImportResult(new ImportDecision<LocalBook>(new LocalBook { Path = @"C:\TestPath\Droned.S01E01.mkv" })),
|
||||
new ImportResult(new ImportDecision<LocalBook>(new LocalBook { Path = @"C:\TestPath\Droned.S01E01.mkv" }), "Test Failure"),
|
||||
new ImportResult(new ImportDecision<LocalBook>(new LocalBook { Path = @"C:\TestPath\Droned.S01E01.mkv" }), "Test Failure")
|
||||
});
|
||||
|
||||
var history = Builder<History.History>.CreateListOfSize(2)
|
||||
|
|
@ -258,22 +258,22 @@ public void should_not_mark_as_imported_if_some_of_episodes_were_not_imported_in
|
|||
[Test]
|
||||
public void should_mark_as_imported_if_all_tracks_were_imported()
|
||||
{
|
||||
_trackedDownload.RemoteAlbum.Albums = new List<Book>
|
||||
_trackedDownload.RemoteBook.Books = new List<Book>
|
||||
{
|
||||
CreateAlbum(1)
|
||||
};
|
||||
|
||||
Mocker.GetMock<IDownloadedTracksImportService>()
|
||||
Mocker.GetMock<IDownloadedBooksImportService>()
|
||||
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Author>(), It.IsAny<DownloadClientItem>()))
|
||||
.Returns(new List<ImportResult>
|
||||
{
|
||||
new ImportResult(
|
||||
new ImportDecision<LocalTrack>(
|
||||
new LocalTrack { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() })),
|
||||
new ImportDecision<LocalBook>(
|
||||
new LocalBook { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() })),
|
||||
|
||||
new ImportResult(
|
||||
new ImportDecision<LocalTrack>(
|
||||
new LocalTrack { Path = @"C:\TestPath\Droned.S01E02.mkv".AsOsAgnostic() }))
|
||||
new ImportDecision<LocalBook>(
|
||||
new LocalBook { Path = @"C:\TestPath\Droned.S01E02.mkv".AsOsAgnostic() }))
|
||||
});
|
||||
|
||||
Subject.Import(_trackedDownload);
|
||||
|
|
@ -286,19 +286,19 @@ public void should_mark_as_imported_if_all_episodes_were_imported_including_hist
|
|||
{
|
||||
var albums = Builder<Book>.CreateListOfSize(2).BuildList();
|
||||
|
||||
_trackedDownload.RemoteAlbum.Albums = albums;
|
||||
_trackedDownload.RemoteBook.Books = albums;
|
||||
|
||||
Mocker.GetMock<IDownloadedTracksImportService>()
|
||||
Mocker.GetMock<IDownloadedBooksImportService>()
|
||||
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Author>(), It.IsAny<DownloadClientItem>()))
|
||||
.Returns(new List<ImportResult>
|
||||
{
|
||||
new ImportResult(
|
||||
new ImportDecision<LocalTrack>(
|
||||
new LocalTrack { Path = @"C:\TestPath\Droned.S01E01.mkv", Album = albums[0] })),
|
||||
new ImportDecision<LocalBook>(
|
||||
new LocalBook { Path = @"C:\TestPath\Droned.S01E01.mkv", Book = albums[0] })),
|
||||
|
||||
new ImportResult(
|
||||
new ImportDecision<LocalTrack>(
|
||||
new LocalTrack { Path = @"C:\TestPath\Droned.S01E02.mkv", Album = albums[1] }), "Test Failure")
|
||||
new ImportDecision<LocalBook>(
|
||||
new LocalBook { Path = @"C:\TestPath\Droned.S01E02.mkv", Book = albums[1] }), "Test Failure")
|
||||
});
|
||||
|
||||
var history = Builder<History.History>.CreateListOfSize(2)
|
||||
|
|
@ -322,11 +322,11 @@ public void should_mark_as_imported_if_the_download_can_be_tracked_using_the_sou
|
|||
{
|
||||
GivenABadlyNamedDownload();
|
||||
|
||||
Mocker.GetMock<IDownloadedTracksImportService>()
|
||||
Mocker.GetMock<IDownloadedBooksImportService>()
|
||||
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Author>(), It.IsAny<DownloadClientItem>()))
|
||||
.Returns(new List<ImportResult>
|
||||
{
|
||||
new ImportResult(new ImportDecision<LocalTrack>(new LocalTrack { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() }))
|
||||
new ImportResult(new ImportDecision<LocalBook>(new LocalBook { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() }))
|
||||
});
|
||||
|
||||
Subject.Import(_trackedDownload);
|
||||
|
|
@ -344,8 +344,8 @@ private void AssertNotImported()
|
|||
|
||||
private void AssertImported()
|
||||
{
|
||||
Mocker.GetMock<IDownloadedTracksImportService>()
|
||||
.Verify(v => v.ProcessPath(_trackedDownload.DownloadItem.OutputPath.FullPath, ImportMode.Auto, _trackedDownload.RemoteAlbum.Artist, _trackedDownload.DownloadItem), Times.Once());
|
||||
Mocker.GetMock<IDownloadedBooksImportService>()
|
||||
.Verify(v => v.ProcessPath(_trackedDownload.DownloadItem.OutputPath.FullPath, ImportMode.Auto, _trackedDownload.RemoteBook.Author, _trackedDownload.DownloadItem), Times.Once());
|
||||
|
||||
Mocker.GetMock<IEventAggregator>()
|
||||
.Verify(v => v.PublishEvent(It.IsAny<DownloadCompletedEvent>()), Times.Once());
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.TrackedDownloads;
|
||||
using NzbDrone.Core.History;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
|
@ -34,7 +34,7 @@ public void Setup()
|
|||
_trackedDownload = Builder<TrackedDownload>.CreateNew()
|
||||
.With(c => c.State = TrackedDownloadState.Downloading)
|
||||
.With(c => c.DownloadItem = completed)
|
||||
.With(c => c.RemoteAlbum = remoteAlbum)
|
||||
.With(c => c.RemoteBook = remoteAlbum)
|
||||
.Build();
|
||||
|
||||
Mocker.GetMock<IDownloadClient>()
|
||||
|
|
@ -51,15 +51,15 @@ public void Setup()
|
|||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.GetArtist("Drone.S01E01.HDTV"))
|
||||
.Returns(remoteAlbum.Artist);
|
||||
.Returns(remoteAlbum.Author);
|
||||
}
|
||||
|
||||
private RemoteAlbum BuildRemoteAlbum()
|
||||
private RemoteBook BuildRemoteAlbum()
|
||||
{
|
||||
return new RemoteAlbum
|
||||
return new RemoteBook
|
||||
{
|
||||
Artist = new Author(),
|
||||
Albums = new List<Book> { new Book { Id = 1 } }
|
||||
Author = new Author(),
|
||||
Books = new List<Book> { new Book { Id = 1 } }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ private void GivenArtistMatch()
|
|||
{
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.GetArtist(It.IsAny<string>()))
|
||||
.Returns(_trackedDownload.RemoteAlbum.Artist);
|
||||
.Returns(_trackedDownload.RemoteBook.Author);
|
||||
}
|
||||
|
||||
private void GivenABadlyNamedDownload()
|
||||
|
|
@ -91,7 +91,7 @@ private void GivenABadlyNamedDownload()
|
|||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.GetArtist("Droned S01E01"))
|
||||
.Returns(BuildRemoteAlbum().Artist);
|
||||
.Returns(BuildRemoteAlbum().Author);
|
||||
}
|
||||
|
||||
[TestCase(DownloadItemStatus.Downloading)]
|
||||
|
|
@ -145,7 +145,7 @@ public void should_not_process_if_output_path_is_empty()
|
|||
public void should_not_process_if_the_download_cannot_be_tracked_using_the_source_title_as_it_was_initiated_externally()
|
||||
{
|
||||
GivenABadlyNamedDownload();
|
||||
_trackedDownload.RemoteAlbum.Artist = null;
|
||||
_trackedDownload.RemoteBook.Author = null;
|
||||
|
||||
Mocker.GetMock<IHistoryService>()
|
||||
.Setup(s => s.MostRecentForDownloadId(It.Is<string>(i => i == "1234")));
|
||||
|
|
@ -158,7 +158,7 @@ public void should_not_process_if_the_download_cannot_be_tracked_using_the_sourc
|
|||
[Test]
|
||||
public void should_not_process_when_there_is_a_title_mismatch()
|
||||
{
|
||||
_trackedDownload.RemoteAlbum.Artist = null;
|
||||
_trackedDownload.RemoteBook.Author = null;
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.GetArtist("Drone.S01E01.HDTV"))
|
||||
.Returns((Author)null);
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@
|
|||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Clients;
|
||||
using NzbDrone.Core.Download.Pending;
|
||||
using NzbDrone.Core.Exceptions;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
|
@ -37,20 +37,20 @@ private Book GetAlbum(int id)
|
|||
.Build();
|
||||
}
|
||||
|
||||
private RemoteAlbum GetRemoteAlbum(List<Book> albums, QualityModel quality, DownloadProtocol downloadProtocol = DownloadProtocol.Usenet)
|
||||
private RemoteBook GetRemoteAlbum(List<Book> albums, QualityModel quality, DownloadProtocol downloadProtocol = DownloadProtocol.Usenet)
|
||||
{
|
||||
var remoteAlbum = new RemoteAlbum();
|
||||
remoteAlbum.ParsedAlbumInfo = new ParsedAlbumInfo();
|
||||
remoteAlbum.ParsedAlbumInfo.Quality = quality;
|
||||
var remoteAlbum = new RemoteBook();
|
||||
remoteAlbum.ParsedBookInfo = new ParsedBookInfo();
|
||||
remoteAlbum.ParsedBookInfo.Quality = quality;
|
||||
|
||||
remoteAlbum.Albums = new List<Book>();
|
||||
remoteAlbum.Albums.AddRange(albums);
|
||||
remoteAlbum.Books = new List<Book>();
|
||||
remoteAlbum.Books.AddRange(albums);
|
||||
|
||||
remoteAlbum.Release = new ReleaseInfo();
|
||||
remoteAlbum.Release.DownloadProtocol = downloadProtocol;
|
||||
remoteAlbum.Release.PublishDate = DateTime.UtcNow;
|
||||
|
||||
remoteAlbum.Artist = Builder<Author>.CreateNew()
|
||||
remoteAlbum.Author = Builder<Author>.CreateNew()
|
||||
.With(e => e.QualityProfile = new QualityProfile { Items = Qualities.QualityFixture.GetDefaultQualities() })
|
||||
.Build();
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ public void should_download_report_if_album_was_not_already_downloaded()
|
|||
decisions.Add(new DownloadDecision(remoteAlbum));
|
||||
|
||||
Subject.ProcessDecisions(decisions);
|
||||
Mocker.GetMock<IDownloadService>().Verify(v => v.DownloadReport(It.IsAny<RemoteAlbum>()), Times.Once());
|
||||
Mocker.GetMock<IDownloadService>().Verify(v => v.DownloadReport(It.IsAny<RemoteBook>()), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -81,7 +81,7 @@ public void should_only_download_album_once()
|
|||
decisions.Add(new DownloadDecision(remoteAlbum));
|
||||
|
||||
Subject.ProcessDecisions(decisions);
|
||||
Mocker.GetMock<IDownloadService>().Verify(v => v.DownloadReport(It.IsAny<RemoteAlbum>()), Times.Once());
|
||||
Mocker.GetMock<IDownloadService>().Verify(v => v.DownloadReport(It.IsAny<RemoteBook>()), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -100,7 +100,7 @@ public void should_not_download_if_any_album_was_already_downloaded()
|
|||
decisions.Add(new DownloadDecision(remoteAlbum2));
|
||||
|
||||
Subject.ProcessDecisions(decisions);
|
||||
Mocker.GetMock<IDownloadService>().Verify(v => v.DownloadReport(It.IsAny<RemoteAlbum>()), Times.Once());
|
||||
Mocker.GetMock<IDownloadService>().Verify(v => v.DownloadReport(It.IsAny<RemoteBook>()), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -165,7 +165,7 @@ public void should_not_add_to_downloaded_list_when_download_fails()
|
|||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteAlbum));
|
||||
|
||||
Mocker.GetMock<IDownloadService>().Setup(s => s.DownloadReport(It.IsAny<RemoteAlbum>())).Throws(new Exception());
|
||||
Mocker.GetMock<IDownloadService>().Setup(s => s.DownloadReport(It.IsAny<RemoteBook>())).Throws(new Exception());
|
||||
Subject.ProcessDecisions(decisions).Grabbed.Should().BeEmpty();
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
|
@ -174,8 +174,8 @@ public void should_not_add_to_downloaded_list_when_download_fails()
|
|||
public void should_return_an_empty_list_when_none_are_appproved()
|
||||
{
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(new RemoteAlbum(), new Rejection("Failure!")));
|
||||
decisions.Add(new DownloadDecision(new RemoteAlbum(), new Rejection("Failure!")));
|
||||
decisions.Add(new DownloadDecision(new RemoteBook(), new Rejection("Failure!")));
|
||||
decisions.Add(new DownloadDecision(new RemoteBook(), new Rejection("Failure!")));
|
||||
|
||||
Subject.GetQualifiedReports(decisions).Should().BeEmpty();
|
||||
}
|
||||
|
|
@ -190,7 +190,7 @@ public void should_not_grab_if_pending()
|
|||
decisions.Add(new DownloadDecision(remoteAlbum, new Rejection("Failure!", RejectionType.Temporary)));
|
||||
|
||||
Subject.ProcessDecisions(decisions);
|
||||
Mocker.GetMock<IDownloadService>().Verify(v => v.DownloadReport(It.IsAny<RemoteAlbum>()), Times.Never());
|
||||
Mocker.GetMock<IDownloadService>().Verify(v => v.DownloadReport(It.IsAny<RemoteBook>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -231,11 +231,11 @@ public void should_add_to_failed_if_already_failed_for_that_protocol()
|
|||
decisions.Add(new DownloadDecision(remoteAlbum));
|
||||
decisions.Add(new DownloadDecision(remoteAlbum));
|
||||
|
||||
Mocker.GetMock<IDownloadService>().Setup(s => s.DownloadReport(It.IsAny<RemoteAlbum>()))
|
||||
Mocker.GetMock<IDownloadService>().Setup(s => s.DownloadReport(It.IsAny<RemoteBook>()))
|
||||
.Throws(new DownloadClientUnavailableException("Download client failed"));
|
||||
|
||||
Subject.ProcessDecisions(decisions);
|
||||
Mocker.GetMock<IDownloadService>().Verify(v => v.DownloadReport(It.IsAny<RemoteAlbum>()), Times.Once());
|
||||
Mocker.GetMock<IDownloadService>().Verify(v => v.DownloadReport(It.IsAny<RemoteBook>()), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -249,12 +249,12 @@ public void should_not_add_to_failed_if_failed_for_a_different_protocol()
|
|||
decisions.Add(new DownloadDecision(remoteAlbum));
|
||||
decisions.Add(new DownloadDecision(remoteAlbum2));
|
||||
|
||||
Mocker.GetMock<IDownloadService>().Setup(s => s.DownloadReport(It.Is<RemoteAlbum>(r => r.Release.DownloadProtocol == DownloadProtocol.Usenet)))
|
||||
Mocker.GetMock<IDownloadService>().Setup(s => s.DownloadReport(It.Is<RemoteBook>(r => r.Release.DownloadProtocol == DownloadProtocol.Usenet)))
|
||||
.Throws(new DownloadClientUnavailableException("Download client failed"));
|
||||
|
||||
Subject.ProcessDecisions(decisions);
|
||||
Mocker.GetMock<IDownloadService>().Verify(v => v.DownloadReport(It.Is<RemoteAlbum>(r => r.Release.DownloadProtocol == DownloadProtocol.Usenet)), Times.Once());
|
||||
Mocker.GetMock<IDownloadService>().Verify(v => v.DownloadReport(It.Is<RemoteAlbum>(r => r.Release.DownloadProtocol == DownloadProtocol.Torrent)), Times.Once());
|
||||
Mocker.GetMock<IDownloadService>().Verify(v => v.DownloadReport(It.Is<RemoteBook>(r => r.Release.DownloadProtocol == DownloadProtocol.Usenet)), Times.Once());
|
||||
Mocker.GetMock<IDownloadService>().Verify(v => v.DownloadReport(It.Is<RemoteBook>(r => r.Release.DownloadProtocol == DownloadProtocol.Torrent)), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -267,7 +267,7 @@ public void should_add_to_rejected_if_release_unavailable_on_indexer()
|
|||
decisions.Add(new DownloadDecision(remoteAlbum));
|
||||
|
||||
Mocker.GetMock<IDownloadService>()
|
||||
.Setup(s => s.DownloadReport(It.IsAny<RemoteAlbum>()))
|
||||
.Setup(s => s.DownloadReport(It.IsAny<RemoteBook>()))
|
||||
.Throws(new ReleaseUnavailableException(remoteAlbum.Release, "That 404 Error is not just a Quirk"));
|
||||
|
||||
var result = Subject.ProcessDecisions(decisions);
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ protected void GivenMagnetFilePath(string extension = ".magnet")
|
|||
_magnetFilePath = Path.ChangeExtension(_filePath, extension);
|
||||
}
|
||||
|
||||
protected override RemoteAlbum CreateRemoteAlbum()
|
||||
protected override RemoteBook CreateRemoteAlbum()
|
||||
{
|
||||
var remoteAlbum = base.CreateRemoteAlbum();
|
||||
var torrentInfo = new TorrentInfo();
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@
|
|||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.RemotePathMappings;
|
||||
|
|
@ -30,7 +30,7 @@ public void SetupBase()
|
|||
.Returns(30);
|
||||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.Map(It.IsAny<ParsedAlbumInfo>(), null))
|
||||
.Setup(s => s.Map(It.IsAny<ParsedBookInfo>(), null))
|
||||
.Returns(() => CreateRemoteAlbum());
|
||||
|
||||
Mocker.GetMock<IHttpClient>()
|
||||
|
|
@ -42,19 +42,19 @@ public void SetupBase()
|
|||
.Returns<string, OsPath>((h, r) => r);
|
||||
}
|
||||
|
||||
protected virtual RemoteAlbum CreateRemoteAlbum()
|
||||
protected virtual RemoteBook CreateRemoteAlbum()
|
||||
{
|
||||
var remoteAlbum = new RemoteAlbum();
|
||||
var remoteAlbum = new RemoteBook();
|
||||
remoteAlbum.Release = new ReleaseInfo();
|
||||
remoteAlbum.Release.Title = _title;
|
||||
remoteAlbum.Release.DownloadUrl = _downloadUrl;
|
||||
remoteAlbum.Release.DownloadProtocol = Subject.Protocol;
|
||||
|
||||
remoteAlbum.ParsedAlbumInfo = new ParsedAlbumInfo();
|
||||
remoteAlbum.ParsedBookInfo = new ParsedBookInfo();
|
||||
|
||||
remoteAlbum.Albums = new List<Book>();
|
||||
remoteAlbum.Books = new List<Book>();
|
||||
|
||||
remoteAlbum.Artist = new Author();
|
||||
remoteAlbum.Author = new Author();
|
||||
|
||||
return remoteAlbum;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -360,7 +360,7 @@ protected void GivenSuccessfulDownload()
|
|||
.Callback(PrepareClientToReturnQueuedItem);
|
||||
}
|
||||
|
||||
protected override RemoteAlbum CreateRemoteAlbum()
|
||||
protected override RemoteBook CreateRemoteAlbum()
|
||||
{
|
||||
var album = base.CreateRemoteAlbum();
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class UsenetDownloadStationFixture : DownloadClientFixtureBase<UsenetDown
|
|||
protected string _defaultDestination = "somepath";
|
||||
protected OsPath _physicalPath = new OsPath("/mnt/sdb1/mydata");
|
||||
|
||||
protected RemoteAlbum _remoteAlbum;
|
||||
protected RemoteBook _remoteAlbum;
|
||||
|
||||
protected Dictionary<string, object> _downloadStationConfigItems;
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class PneumaticProviderFixture : CoreTest<Pneumatic>
|
|||
private string _pneumaticFolder;
|
||||
private string _strmFolder;
|
||||
private string _nzbPath;
|
||||
private RemoteAlbum _remoteAlbum;
|
||||
private RemoteBook _remoteAlbum;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
|
|
@ -30,12 +30,12 @@ public void Setup()
|
|||
_nzbPath = Path.Combine(_pneumaticFolder, _title + ".nzb").AsOsAgnostic();
|
||||
_strmFolder = @"d:\unsorted tv\".AsOsAgnostic();
|
||||
|
||||
_remoteAlbum = new RemoteAlbum();
|
||||
_remoteAlbum = new RemoteBook();
|
||||
_remoteAlbum.Release = new ReleaseInfo();
|
||||
_remoteAlbum.Release.Title = _title;
|
||||
_remoteAlbum.Release.DownloadUrl = _nzbUrl;
|
||||
|
||||
_remoteAlbum.ParsedAlbumInfo = new ParsedAlbumInfo();
|
||||
_remoteAlbum.ParsedBookInfo = new ParsedBookInfo();
|
||||
|
||||
Subject.Definition = new DownloadClientDefinition();
|
||||
Subject.Definition.Settings = new PneumaticSettings
|
||||
|
|
@ -70,7 +70,7 @@ public void should_throw_on_failed_download()
|
|||
public void should_throw_if_discography_download()
|
||||
{
|
||||
_remoteAlbum.Release.Title = "Alien Ant Farm - Discography";
|
||||
_remoteAlbum.ParsedAlbumInfo.Discography = true;
|
||||
_remoteAlbum.ParsedBookInfo.Discography = true;
|
||||
|
||||
Assert.Throws<NotSupportedException>(() => Subject.Download(_remoteAlbum));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@
|
|||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Clients.Sabnzbd;
|
||||
using NzbDrone.Core.Download.Clients.Sabnzbd.Responses;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.RemotePathMappings;
|
||||
using NzbDrone.Core.Validation;
|
||||
using NzbDrone.Test.Common;
|
||||
|
|
@ -354,7 +354,7 @@ public void Download_should_use_sabRecentTvPriority_when_recentEpisode_is_true()
|
|||
.Returns(new SabnzbdAddResponse { Ids = new List<string> { "readarrtest" } });
|
||||
|
||||
var remoteAlbum = CreateRemoteAlbum();
|
||||
remoteAlbum.Albums = Builder<Book>.CreateListOfSize(1)
|
||||
remoteAlbum.Books = Builder<Book>.CreateListOfSize(1)
|
||||
.All()
|
||||
.With(e => e.ReleaseDate = DateTime.Today)
|
||||
.Build()
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@
|
|||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Clients;
|
||||
using NzbDrone.Core.Exceptions;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
|
|
@ -19,7 +19,7 @@ namespace NzbDrone.Core.Test.Download
|
|||
[TestFixture]
|
||||
public class DownloadServiceFixture : CoreTest<DownloadService>
|
||||
{
|
||||
private RemoteAlbum _parseResult;
|
||||
private RemoteBook _parseResult;
|
||||
private List<IDownloadClient> _downloadClients;
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
|
|
@ -45,10 +45,10 @@ public void Setup()
|
|||
.With(v => v.DownloadUrl = "http://test.site/download1.ext")
|
||||
.Build();
|
||||
|
||||
_parseResult = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(c => c.Artist = Builder<Author>.CreateNew().Build())
|
||||
_parseResult = Builder<RemoteBook>.CreateNew()
|
||||
.With(c => c.Author = Builder<Author>.CreateNew().Build())
|
||||
.With(c => c.Release = releaseInfo)
|
||||
.With(c => c.Albums = episodes)
|
||||
.With(c => c.Books = episodes)
|
||||
.Build();
|
||||
}
|
||||
|
||||
|
|
@ -80,42 +80,42 @@ private Mock<IDownloadClient> WithTorrentClient()
|
|||
public void Download_report_should_publish_on_grab_event()
|
||||
{
|
||||
var mock = WithUsenetClient();
|
||||
mock.Setup(s => s.Download(It.IsAny<RemoteAlbum>()));
|
||||
mock.Setup(s => s.Download(It.IsAny<RemoteBook>()));
|
||||
|
||||
Subject.DownloadReport(_parseResult);
|
||||
|
||||
VerifyEventPublished<AlbumGrabbedEvent>();
|
||||
VerifyEventPublished<BookGrabbedEvent>();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Download_report_should_grab_using_client()
|
||||
{
|
||||
var mock = WithUsenetClient();
|
||||
mock.Setup(s => s.Download(It.IsAny<RemoteAlbum>()));
|
||||
mock.Setup(s => s.Download(It.IsAny<RemoteBook>()));
|
||||
|
||||
Subject.DownloadReport(_parseResult);
|
||||
|
||||
mock.Verify(s => s.Download(It.IsAny<RemoteAlbum>()), Times.Once());
|
||||
mock.Verify(s => s.Download(It.IsAny<RemoteBook>()), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Download_report_should_not_publish_on_failed_grab_event()
|
||||
{
|
||||
var mock = WithUsenetClient();
|
||||
mock.Setup(s => s.Download(It.IsAny<RemoteAlbum>()))
|
||||
mock.Setup(s => s.Download(It.IsAny<RemoteBook>()))
|
||||
.Throws(new WebException());
|
||||
|
||||
Assert.Throws<WebException>(() => Subject.DownloadReport(_parseResult));
|
||||
|
||||
VerifyEventNotPublished<AlbumGrabbedEvent>();
|
||||
VerifyEventNotPublished<BookGrabbedEvent>();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Download_report_should_trigger_indexer_backoff_on_indexer_error()
|
||||
{
|
||||
var mock = WithUsenetClient();
|
||||
mock.Setup(s => s.Download(It.IsAny<RemoteAlbum>()))
|
||||
.Callback<RemoteAlbum>(v =>
|
||||
mock.Setup(s => s.Download(It.IsAny<RemoteBook>()))
|
||||
.Callback<RemoteBook>(v =>
|
||||
{
|
||||
throw new ReleaseDownloadException(v.Release, "Error", new WebException());
|
||||
});
|
||||
|
|
@ -134,8 +134,8 @@ public void Download_report_should_trigger_indexer_backoff_on_http429_with_long_
|
|||
response.Headers["Retry-After"] = "300";
|
||||
|
||||
var mock = WithUsenetClient();
|
||||
mock.Setup(s => s.Download(It.IsAny<RemoteAlbum>()))
|
||||
.Callback<RemoteAlbum>(v =>
|
||||
mock.Setup(s => s.Download(It.IsAny<RemoteBook>()))
|
||||
.Callback<RemoteBook>(v =>
|
||||
{
|
||||
throw new ReleaseDownloadException(v.Release, "Error", new TooManyRequestsException(request, response));
|
||||
});
|
||||
|
|
@ -154,8 +154,8 @@ public void Download_report_should_trigger_indexer_backoff_on_http429_based_on_d
|
|||
response.Headers["Retry-After"] = DateTime.UtcNow.AddSeconds(300).ToString("r");
|
||||
|
||||
var mock = WithUsenetClient();
|
||||
mock.Setup(s => s.Download(It.IsAny<RemoteAlbum>()))
|
||||
.Callback<RemoteAlbum>(v =>
|
||||
mock.Setup(s => s.Download(It.IsAny<RemoteBook>()))
|
||||
.Callback<RemoteBook>(v =>
|
||||
{
|
||||
throw new ReleaseDownloadException(v.Release, "Error", new TooManyRequestsException(request, response));
|
||||
});
|
||||
|
|
@ -171,7 +171,7 @@ public void Download_report_should_trigger_indexer_backoff_on_http429_based_on_d
|
|||
public void Download_report_should_not_trigger_indexer_backoff_on_downloadclient_error()
|
||||
{
|
||||
var mock = WithUsenetClient();
|
||||
mock.Setup(s => s.Download(It.IsAny<RemoteAlbum>()))
|
||||
mock.Setup(s => s.Download(It.IsAny<RemoteBook>()))
|
||||
.Throws(new DownloadClientException("Some Error"));
|
||||
|
||||
Assert.Throws<DownloadClientException>(() => Subject.DownloadReport(_parseResult));
|
||||
|
|
@ -184,8 +184,8 @@ public void Download_report_should_not_trigger_indexer_backoff_on_downloadclient
|
|||
public void Download_report_should_not_trigger_indexer_backoff_on_indexer_404_error()
|
||||
{
|
||||
var mock = WithUsenetClient();
|
||||
mock.Setup(s => s.Download(It.IsAny<RemoteAlbum>()))
|
||||
.Callback<RemoteAlbum>(v =>
|
||||
mock.Setup(s => s.Download(It.IsAny<RemoteBook>()))
|
||||
.Callback<RemoteBook>(v =>
|
||||
{
|
||||
throw new ReleaseUnavailableException(v.Release, "Error", new WebException());
|
||||
});
|
||||
|
|
@ -201,8 +201,8 @@ public void should_not_attempt_download_if_client_isnt_configured()
|
|||
{
|
||||
Assert.Throws<DownloadClientUnavailableException>(() => Subject.DownloadReport(_parseResult));
|
||||
|
||||
Mocker.GetMock<IDownloadClient>().Verify(c => c.Download(It.IsAny<RemoteAlbum>()), Times.Never());
|
||||
VerifyEventNotPublished<AlbumGrabbedEvent>();
|
||||
Mocker.GetMock<IDownloadClient>().Verify(c => c.Download(It.IsAny<RemoteBook>()), Times.Never());
|
||||
VerifyEventNotPublished<BookGrabbedEvent>();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -224,8 +224,8 @@ public void should_attempt_download_even_if_client_is_disabled()
|
|||
Subject.DownloadReport(_parseResult);
|
||||
|
||||
Mocker.GetMock<IDownloadClientStatusService>().Verify(c => c.GetBlockedProviders(), Times.Never());
|
||||
mockUsenet.Verify(c => c.Download(It.IsAny<RemoteAlbum>()), Times.Once());
|
||||
VerifyEventPublished<AlbumGrabbedEvent>();
|
||||
mockUsenet.Verify(c => c.Download(It.IsAny<RemoteBook>()), Times.Once());
|
||||
VerifyEventPublished<BookGrabbedEvent>();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -236,8 +236,8 @@ public void should_send_download_to_correct_usenet_client()
|
|||
|
||||
Subject.DownloadReport(_parseResult);
|
||||
|
||||
mockTorrent.Verify(c => c.Download(It.IsAny<RemoteAlbum>()), Times.Never());
|
||||
mockUsenet.Verify(c => c.Download(It.IsAny<RemoteAlbum>()), Times.Once());
|
||||
mockTorrent.Verify(c => c.Download(It.IsAny<RemoteBook>()), Times.Never());
|
||||
mockUsenet.Verify(c => c.Download(It.IsAny<RemoteBook>()), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -250,8 +250,8 @@ public void should_send_download_to_correct_torrent_client()
|
|||
|
||||
Subject.DownloadReport(_parseResult);
|
||||
|
||||
mockTorrent.Verify(c => c.Download(It.IsAny<RemoteAlbum>()), Times.Once());
|
||||
mockUsenet.Verify(c => c.Download(It.IsAny<RemoteAlbum>()), Times.Never());
|
||||
mockTorrent.Verify(c => c.Download(It.IsAny<RemoteBook>()), Times.Once());
|
||||
mockUsenet.Verify(c => c.Download(It.IsAny<RemoteBook>()), Times.Never());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.TrackedDownloads;
|
||||
using NzbDrone.Core.History;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
|
@ -32,16 +32,16 @@ public void Setup()
|
|||
|
||||
_grabHistory = Builder<History.History>.CreateListOfSize(2).BuildList();
|
||||
|
||||
var remoteAlbum = new RemoteAlbum
|
||||
var remoteAlbum = new RemoteBook
|
||||
{
|
||||
Artist = new Author(),
|
||||
Albums = new List<Book> { new Book { Id = 1 } }
|
||||
Author = new Author(),
|
||||
Books = new List<Book> { new Book { Id = 1 } }
|
||||
};
|
||||
|
||||
_trackedDownload = Builder<TrackedDownload>.CreateNew()
|
||||
.With(c => c.State = TrackedDownloadState.DownloadFailedPending)
|
||||
.With(c => c.DownloadItem = completed)
|
||||
.With(c => c.RemoteAlbum = remoteAlbum)
|
||||
.With(c => c.RemoteBook = remoteAlbum)
|
||||
.Build();
|
||||
|
||||
Mocker.GetMock<IHistoryService>()
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.TrackedDownloads;
|
||||
using NzbDrone.Core.History;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
|
@ -32,16 +32,16 @@ public void Setup()
|
|||
|
||||
_grabHistory = Builder<History.History>.CreateListOfSize(2).BuildList();
|
||||
|
||||
var remoteAlbum = new RemoteAlbum
|
||||
var remoteAlbum = new RemoteBook
|
||||
{
|
||||
Artist = new Author(),
|
||||
Albums = new List<Book> { new Book { Id = 1 } }
|
||||
Author = new Author(),
|
||||
Books = new List<Book> { new Book { Id = 1 } }
|
||||
};
|
||||
|
||||
_trackedDownload = Builder<TrackedDownload>.CreateNew()
|
||||
.With(c => c.State = TrackedDownloadState.Downloading)
|
||||
.With(c => c.DownloadItem = completed)
|
||||
.With(c => c.RemoteAlbum = remoteAlbum)
|
||||
.With(c => c.RemoteBook = remoteAlbum)
|
||||
.Build();
|
||||
|
||||
Mocker.GetMock<IHistoryService>()
|
||||
|
|
|
|||
|
|
@ -5,10 +5,10 @@
|
|||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.Download.Pending;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
|
|
@ -25,8 +25,8 @@ public class AddFixture : CoreTest<PendingReleaseService>
|
|||
private Book _album;
|
||||
private QualityProfile _profile;
|
||||
private ReleaseInfo _release;
|
||||
private ParsedAlbumInfo _parsedAlbumInfo;
|
||||
private RemoteAlbum _remoteAlbum;
|
||||
private ParsedBookInfo _parsedAlbumInfo;
|
||||
private RemoteBook _remoteAlbum;
|
||||
private List<PendingRelease> _heldReleases;
|
||||
|
||||
[SetUp]
|
||||
|
|
@ -54,13 +54,13 @@ public void Setup()
|
|||
|
||||
_release = Builder<ReleaseInfo>.CreateNew().Build();
|
||||
|
||||
_parsedAlbumInfo = Builder<ParsedAlbumInfo>.CreateNew().Build();
|
||||
_parsedAlbumInfo = Builder<ParsedBookInfo>.CreateNew().Build();
|
||||
_parsedAlbumInfo.Quality = new QualityModel(Quality.MP3_320);
|
||||
|
||||
_remoteAlbum = new RemoteAlbum();
|
||||
_remoteAlbum.Albums = new List<Book> { _album };
|
||||
_remoteAlbum.Artist = _artist;
|
||||
_remoteAlbum.ParsedAlbumInfo = _parsedAlbumInfo;
|
||||
_remoteAlbum = new RemoteBook();
|
||||
_remoteAlbum.Books = new List<Book> { _album };
|
||||
_remoteAlbum.Author = _artist;
|
||||
_remoteAlbum.ParsedBookInfo = _parsedAlbumInfo;
|
||||
_remoteAlbum.Release = _release;
|
||||
|
||||
_temporarilyRejected = new DownloadDecision(_remoteAlbum, new Rejection("Temp Rejected", RejectionType.Temporary));
|
||||
|
|
@ -75,16 +75,16 @@ public void Setup()
|
|||
.Setup(s => s.AllByAuthorId(It.IsAny<int>()))
|
||||
.Returns<int>(i => _heldReleases.Where(v => v.AuthorId == i).ToList());
|
||||
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(s => s.GetArtist(It.IsAny<int>()))
|
||||
Mocker.GetMock<IAuthorService>()
|
||||
.Setup(s => s.GetAuthor(It.IsAny<int>()))
|
||||
.Returns(_artist);
|
||||
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(s => s.GetArtists(It.IsAny<IEnumerable<int>>()))
|
||||
Mocker.GetMock<IAuthorService>()
|
||||
.Setup(s => s.GetAuthors(It.IsAny<IEnumerable<int>>()))
|
||||
.Returns(new List<Author> { _artist });
|
||||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.GetAlbums(It.IsAny<ParsedAlbumInfo>(), _artist, null))
|
||||
.Setup(s => s.GetAlbums(It.IsAny<ParsedBookInfo>(), _artist, null))
|
||||
.Returns(new List<Book> { _album });
|
||||
|
||||
Mocker.GetMock<IPrioritizeDownloadDecision>()
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Pending;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
|
|
@ -25,8 +25,8 @@ public class RemoveGrabbedFixture : CoreTest<PendingReleaseService>
|
|||
private Book _album;
|
||||
private QualityProfile _profile;
|
||||
private ReleaseInfo _release;
|
||||
private ParsedAlbumInfo _parsedAlbumInfo;
|
||||
private RemoteAlbum _remoteAlbum;
|
||||
private ParsedBookInfo _parsedAlbumInfo;
|
||||
private RemoteBook _remoteAlbum;
|
||||
private List<PendingRelease> _heldReleases;
|
||||
|
||||
[SetUp]
|
||||
|
|
@ -54,13 +54,13 @@ public void Setup()
|
|||
|
||||
_release = Builder<ReleaseInfo>.CreateNew().Build();
|
||||
|
||||
_parsedAlbumInfo = Builder<ParsedAlbumInfo>.CreateNew().Build();
|
||||
_parsedAlbumInfo = Builder<ParsedBookInfo>.CreateNew().Build();
|
||||
_parsedAlbumInfo.Quality = new QualityModel(Quality.MP3_320);
|
||||
|
||||
_remoteAlbum = new RemoteAlbum();
|
||||
_remoteAlbum.Albums = new List<Book> { _album };
|
||||
_remoteAlbum.Artist = _artist;
|
||||
_remoteAlbum.ParsedAlbumInfo = _parsedAlbumInfo;
|
||||
_remoteAlbum = new RemoteBook();
|
||||
_remoteAlbum.Books = new List<Book> { _album };
|
||||
_remoteAlbum.Author = _artist;
|
||||
_remoteAlbum.ParsedBookInfo = _parsedAlbumInfo;
|
||||
_remoteAlbum.Release = _release;
|
||||
|
||||
_temporarilyRejected = new DownloadDecision(_remoteAlbum, new Rejection("Temp Rejected", RejectionType.Temporary));
|
||||
|
|
@ -75,16 +75,16 @@ public void Setup()
|
|||
.Setup(s => s.AllByAuthorId(It.IsAny<int>()))
|
||||
.Returns<int>(i => _heldReleases.Where(v => v.AuthorId == i).ToList());
|
||||
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(s => s.GetArtist(It.IsAny<int>()))
|
||||
Mocker.GetMock<IAuthorService>()
|
||||
.Setup(s => s.GetAuthor(It.IsAny<int>()))
|
||||
.Returns(_artist);
|
||||
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(s => s.GetArtists(It.IsAny<IEnumerable<int>>()))
|
||||
Mocker.GetMock<IAuthorService>()
|
||||
.Setup(s => s.GetAuthors(It.IsAny<IEnumerable<int>>()))
|
||||
.Returns(new List<Author> { _artist });
|
||||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.GetAlbums(It.IsAny<ParsedAlbumInfo>(), _artist, null))
|
||||
.Setup(s => s.GetAlbums(It.IsAny<ParsedBookInfo>(), _artist, null))
|
||||
.Returns(new List<Book> { _album });
|
||||
|
||||
Mocker.GetMock<IPrioritizeDownloadDecision>()
|
||||
|
|
@ -101,7 +101,7 @@ private void GivenHeldRelease(QualityModel quality)
|
|||
.All()
|
||||
.With(h => h.AuthorId = _artist.Id)
|
||||
.With(h => h.Release = _release.JsonClone())
|
||||
.With(h => h.ParsedAlbumInfo = parsedEpisodeInfo)
|
||||
.With(h => h.ParsedBookInfo = parsedEpisodeInfo)
|
||||
.Build();
|
||||
|
||||
_heldReleases.AddRange(heldReleases);
|
||||
|
|
@ -112,7 +112,7 @@ public void should_delete_if_the_grabbed_quality_is_the_same()
|
|||
{
|
||||
GivenHeldRelease(_parsedAlbumInfo.Quality);
|
||||
|
||||
Subject.Handle(new AlbumGrabbedEvent(_remoteAlbum));
|
||||
Subject.Handle(new BookGrabbedEvent(_remoteAlbum));
|
||||
|
||||
VerifyDelete();
|
||||
}
|
||||
|
|
@ -122,7 +122,7 @@ public void should_delete_if_the_grabbed_quality_is_the_higher()
|
|||
{
|
||||
GivenHeldRelease(new QualityModel(Quality.MP3_320));
|
||||
|
||||
Subject.Handle(new AlbumGrabbedEvent(_remoteAlbum));
|
||||
Subject.Handle(new BookGrabbedEvent(_remoteAlbum));
|
||||
|
||||
VerifyDelete();
|
||||
}
|
||||
|
|
@ -132,7 +132,7 @@ public void should_not_delete_if_the_grabbed_quality_is_the_lower()
|
|||
{
|
||||
GivenHeldRelease(new QualityModel(Quality.FLAC));
|
||||
|
||||
Subject.Handle(new AlbumGrabbedEvent(_remoteAlbum));
|
||||
Subject.Handle(new BookGrabbedEvent(_remoteAlbum));
|
||||
|
||||
VerifyNoDelete();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Crypto;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Download.Pending;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
|
@ -34,16 +34,16 @@ public void Setup()
|
|||
.Setup(s => s.All())
|
||||
.Returns(_pending);
|
||||
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(s => s.GetArtist(It.IsAny<int>()))
|
||||
Mocker.GetMock<IAuthorService>()
|
||||
.Setup(s => s.GetAuthor(It.IsAny<int>()))
|
||||
.Returns(new Author());
|
||||
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(s => s.GetArtists(It.IsAny<IEnumerable<int>>()))
|
||||
Mocker.GetMock<IAuthorService>()
|
||||
.Setup(s => s.GetAuthors(It.IsAny<IEnumerable<int>>()))
|
||||
.Returns(new List<Author> { new Author() });
|
||||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.GetAlbums(It.IsAny<ParsedAlbumInfo>(), It.IsAny<Author>(), null))
|
||||
.Setup(s => s.GetAlbums(It.IsAny<ParsedBookInfo>(), It.IsAny<Author>(), null))
|
||||
.Returns(new List<Book> { _album });
|
||||
}
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ private void AddPending(int id, string album)
|
|||
_pending.Add(new PendingRelease
|
||||
{
|
||||
Id = id,
|
||||
ParsedAlbumInfo = new ParsedAlbumInfo { AlbumTitle = album }
|
||||
ParsedBookInfo = new ParsedBookInfo { BookTitle = album }
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ public void should_remove_same_release()
|
|||
{
|
||||
AddPending(id: 1, album: "Album");
|
||||
|
||||
var queueId = HashConverter.GetHashInt31(string.Format("pending-{0}-album{1}", 1, _album.Id));
|
||||
var queueId = HashConverter.GetHashInt31(string.Format("pending-{0}-book{1}", 1, _album.Id));
|
||||
|
||||
Subject.RemovePendingQueueItems(queueId);
|
||||
|
||||
|
|
@ -76,7 +76,7 @@ public void should_remove_multiple_releases_release()
|
|||
AddPending(id: 3, album: "Album 3");
|
||||
AddPending(id: 4, album: "Album 3");
|
||||
|
||||
var queueId = HashConverter.GetHashInt31(string.Format("pending-{0}-album{1}", 3, _album.Id));
|
||||
var queueId = HashConverter.GetHashInt31(string.Format("pending-{0}-book{1}", 3, _album.Id));
|
||||
|
||||
Subject.RemovePendingQueueItems(queueId);
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ public void should_not_remove_diffrent_albums()
|
|||
AddPending(id: 3, album: "Album 2");
|
||||
AddPending(id: 4, album: "Album 3");
|
||||
|
||||
var queueId = HashConverter.GetHashInt31(string.Format("pending-{0}-album{1}", 1, _album.Id));
|
||||
var queueId = HashConverter.GetHashInt31(string.Format("pending-{0}-book{1}", 1, _album.Id));
|
||||
|
||||
Subject.RemovePendingQueueItems(queueId);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@
|
|||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Pending;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
|
|
@ -26,8 +26,8 @@ public class RemoveRejectedFixture : CoreTest<PendingReleaseService>
|
|||
private Book _album;
|
||||
private QualityProfile _profile;
|
||||
private ReleaseInfo _release;
|
||||
private ParsedAlbumInfo _parsedAlbumInfo;
|
||||
private RemoteAlbum _remoteAlbum;
|
||||
private ParsedBookInfo _parsedAlbumInfo;
|
||||
private RemoteBook _remoteAlbum;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
|
|
@ -54,13 +54,13 @@ public void Setup()
|
|||
|
||||
_release = Builder<ReleaseInfo>.CreateNew().Build();
|
||||
|
||||
_parsedAlbumInfo = Builder<ParsedAlbumInfo>.CreateNew().Build();
|
||||
_parsedAlbumInfo = Builder<ParsedBookInfo>.CreateNew().Build();
|
||||
_parsedAlbumInfo.Quality = new QualityModel(Quality.MP3_320);
|
||||
|
||||
_remoteAlbum = new RemoteAlbum();
|
||||
_remoteAlbum.Albums = new List<Book> { _album };
|
||||
_remoteAlbum.Artist = _artist;
|
||||
_remoteAlbum.ParsedAlbumInfo = _parsedAlbumInfo;
|
||||
_remoteAlbum = new RemoteBook();
|
||||
_remoteAlbum.Books = new List<Book> { _album };
|
||||
_remoteAlbum.Author = _artist;
|
||||
_remoteAlbum.ParsedBookInfo = _parsedAlbumInfo;
|
||||
_remoteAlbum.Release = _release;
|
||||
|
||||
_temporarilyRejected = new DownloadDecision(_remoteAlbum, new Rejection("Temp Rejected", RejectionType.Temporary));
|
||||
|
|
@ -69,16 +69,16 @@ public void Setup()
|
|||
.Setup(s => s.All())
|
||||
.Returns(new List<PendingRelease>());
|
||||
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(s => s.GetArtist(It.IsAny<int>()))
|
||||
Mocker.GetMock<IAuthorService>()
|
||||
.Setup(s => s.GetAuthor(It.IsAny<int>()))
|
||||
.Returns(_artist);
|
||||
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(s => s.GetArtists(It.IsAny<IEnumerable<int>>()))
|
||||
Mocker.GetMock<IAuthorService>()
|
||||
.Setup(s => s.GetAuthors(It.IsAny<IEnumerable<int>>()))
|
||||
.Returns(new List<Author> { _artist });
|
||||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.GetAlbums(It.IsAny<ParsedAlbumInfo>(), _artist, null))
|
||||
.Setup(s => s.GetAlbums(It.IsAny<ParsedBookInfo>(), _artist, null))
|
||||
.Returns(new List<Book> { _album });
|
||||
|
||||
Mocker.GetMock<IPrioritizeDownloadDecision>()
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
using FizzWare.NBuilder;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.IndexerSearch;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.Download
|
||||
|
|
@ -21,8 +21,8 @@ public void Setup()
|
|||
.Setup(x => x.AutoRedownloadFailed)
|
||||
.Returns(true);
|
||||
|
||||
Mocker.GetMock<IAlbumService>()
|
||||
.Setup(x => x.GetAlbumsByArtist(It.IsAny<int>()))
|
||||
Mocker.GetMock<IBookService>()
|
||||
.Setup(x => x.GetBooksByAuthor(It.IsAny<int>()))
|
||||
.Returns(Builder<Book>.CreateListOfSize(3).Build() as List<Book>);
|
||||
}
|
||||
|
||||
|
|
@ -75,14 +75,14 @@ public void should_redownload_album_on_failure()
|
|||
Subject.Handle(failedEvent);
|
||||
|
||||
Mocker.GetMock<IManageCommandQueue>()
|
||||
.Verify(x => x.Push(It.Is<AlbumSearchCommand>(c => c.BookIds.Count == 1 &&
|
||||
.Verify(x => x.Push(It.Is<BookSearchCommand>(c => c.BookIds.Count == 1 &&
|
||||
c.BookIds[0] == 2),
|
||||
It.IsAny<CommandPriority>(),
|
||||
It.IsAny<CommandTrigger>()),
|
||||
Times.Once());
|
||||
|
||||
Mocker.GetMock<IManageCommandQueue>()
|
||||
.Verify(x => x.Push(It.IsAny<ArtistSearchCommand>(), It.IsAny<CommandPriority>(), It.IsAny<CommandTrigger>()),
|
||||
.Verify(x => x.Push(It.IsAny<AuthorSearchCommand>(), It.IsAny<CommandPriority>(), It.IsAny<CommandTrigger>()),
|
||||
Times.Never());
|
||||
}
|
||||
|
||||
|
|
@ -98,7 +98,7 @@ public void should_redownload_multiple_albums_on_failure()
|
|||
Subject.Handle(failedEvent);
|
||||
|
||||
Mocker.GetMock<IManageCommandQueue>()
|
||||
.Verify(x => x.Push(It.Is<AlbumSearchCommand>(c => c.BookIds.Count == 2 &&
|
||||
.Verify(x => x.Push(It.Is<BookSearchCommand>(c => c.BookIds.Count == 2 &&
|
||||
c.BookIds[0] == 2 &&
|
||||
c.BookIds[1] == 3),
|
||||
It.IsAny<CommandPriority>(),
|
||||
|
|
@ -106,7 +106,7 @@ public void should_redownload_multiple_albums_on_failure()
|
|||
Times.Once());
|
||||
|
||||
Mocker.GetMock<IManageCommandQueue>()
|
||||
.Verify(x => x.Push(It.IsAny<ArtistSearchCommand>(), It.IsAny<CommandPriority>(), It.IsAny<CommandTrigger>()),
|
||||
.Verify(x => x.Push(It.IsAny<AuthorSearchCommand>(), It.IsAny<CommandPriority>(), It.IsAny<CommandTrigger>()),
|
||||
Times.Never());
|
||||
}
|
||||
|
||||
|
|
@ -123,13 +123,13 @@ public void should_redownload_artist_on_failure()
|
|||
Subject.Handle(failedEvent);
|
||||
|
||||
Mocker.GetMock<IManageCommandQueue>()
|
||||
.Verify(x => x.Push(It.Is<ArtistSearchCommand>(c => c.AuthorId == failedEvent.AuthorId),
|
||||
.Verify(x => x.Push(It.Is<AuthorSearchCommand>(c => c.AuthorId == failedEvent.AuthorId),
|
||||
It.IsAny<CommandPriority>(),
|
||||
It.IsAny<CommandTrigger>()),
|
||||
Times.Once());
|
||||
|
||||
Mocker.GetMock<IManageCommandQueue>()
|
||||
.Verify(x => x.Push(It.IsAny<AlbumSearchCommand>(), It.IsAny<CommandPriority>(), It.IsAny<CommandTrigger>()),
|
||||
.Verify(x => x.Push(It.IsAny<BookSearchCommand>(), It.IsAny<CommandPriority>(), It.IsAny<CommandTrigger>()),
|
||||
Times.Never());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Download.TrackedDownloads;
|
||||
using NzbDrone.Core.History;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
|
|
@ -22,12 +22,12 @@ public void Setup()
|
|||
{
|
||||
_albums = new List<Book>();
|
||||
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(r => r.Albums = _albums)
|
||||
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(r => r.Books = _albums)
|
||||
.Build();
|
||||
|
||||
_trackedDownload = Builder<TrackedDownload>.CreateNew()
|
||||
.With(t => t.RemoteAlbum = remoteAlbum)
|
||||
.With(t => t.RemoteBook = remoteAlbum)
|
||||
.Build();
|
||||
|
||||
_historyItems = new List<History.History>();
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@
|
|||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Books.Events;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.TrackedDownloads;
|
||||
using NzbDrone.Core.History;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Music.Events;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
|
@ -39,19 +39,19 @@ public void should_track_downloads_using_the_source_title_if_it_cannot_be_found_
|
|||
{
|
||||
GivenDownloadHistory();
|
||||
|
||||
var remoteAlbum = new RemoteAlbum
|
||||
var remoteAlbum = new RemoteBook
|
||||
{
|
||||
Artist = new Author() { Id = 5 },
|
||||
Albums = new List<Book> { new Book { Id = 4 } },
|
||||
ParsedAlbumInfo = new ParsedAlbumInfo()
|
||||
Author = new Author() { Id = 5 },
|
||||
Books = new List<Book> { new Book { Id = 4 } },
|
||||
ParsedBookInfo = new ParsedBookInfo()
|
||||
{
|
||||
AlbumTitle = "Audio Album",
|
||||
ArtistName = "Audio Artist"
|
||||
BookTitle = "Audio Album",
|
||||
AuthorName = "Audio Artist"
|
||||
}
|
||||
};
|
||||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.Map(It.Is<ParsedAlbumInfo>(i => i.AlbumTitle == "Audio Album" && i.ArtistName == "Audio Artist"), It.IsAny<int>(), It.IsAny<IEnumerable<int>>()))
|
||||
.Setup(s => s.Map(It.Is<ParsedBookInfo>(i => i.BookTitle == "Audio Album" && i.AuthorName == "Audio Artist"), It.IsAny<int>(), It.IsAny<IEnumerable<int>>()))
|
||||
.Returns(remoteAlbum);
|
||||
|
||||
var client = new DownloadClientDefinition()
|
||||
|
|
@ -69,10 +69,10 @@ public void should_track_downloads_using_the_source_title_if_it_cannot_be_found_
|
|||
var trackedDownload = Subject.TrackDownload(client, item);
|
||||
|
||||
trackedDownload.Should().NotBeNull();
|
||||
trackedDownload.RemoteAlbum.Should().NotBeNull();
|
||||
trackedDownload.RemoteAlbum.Artist.Should().NotBeNull();
|
||||
trackedDownload.RemoteAlbum.Artist.Id.Should().Be(5);
|
||||
trackedDownload.RemoteAlbum.Albums.First().Id.Should().Be(4);
|
||||
trackedDownload.RemoteBook.Should().NotBeNull();
|
||||
trackedDownload.RemoteBook.Author.Should().NotBeNull();
|
||||
trackedDownload.RemoteBook.Author.Id.Should().Be(5);
|
||||
trackedDownload.RemoteBook.Books.First().Id.Should().Be(4);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -80,19 +80,19 @@ public void should_unmap_tracked_download_if_album_deleted()
|
|||
{
|
||||
GivenDownloadHistory();
|
||||
|
||||
var remoteAlbum = new RemoteAlbum
|
||||
var remoteAlbum = new RemoteBook
|
||||
{
|
||||
Artist = new Author() { Id = 5 },
|
||||
Albums = new List<Book> { new Book { Id = 4 } },
|
||||
ParsedAlbumInfo = new ParsedAlbumInfo()
|
||||
Author = new Author() { Id = 5 },
|
||||
Books = new List<Book> { new Book { Id = 4 } },
|
||||
ParsedBookInfo = new ParsedBookInfo()
|
||||
{
|
||||
AlbumTitle = "Audio Album",
|
||||
ArtistName = "Audio Artist"
|
||||
BookTitle = "Audio Album",
|
||||
AuthorName = "Audio Artist"
|
||||
}
|
||||
};
|
||||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.Map(It.Is<ParsedAlbumInfo>(i => i.AlbumTitle == "Audio Album" && i.ArtistName == "Audio Artist"), It.IsAny<int>(), It.IsAny<IEnumerable<int>>()))
|
||||
.Setup(s => s.Map(It.Is<ParsedBookInfo>(i => i.BookTitle == "Audio Album" && i.AuthorName == "Audio Artist"), It.IsAny<int>(), It.IsAny<IEnumerable<int>>()))
|
||||
.Returns(remoteAlbum);
|
||||
|
||||
var client = new DownloadClientDefinition()
|
||||
|
|
@ -113,16 +113,16 @@ public void should_unmap_tracked_download_if_album_deleted()
|
|||
|
||||
// simulate deletion - album no longer maps
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.Map(It.Is<ParsedAlbumInfo>(i => i.AlbumTitle == "Audio Album" && i.ArtistName == "Audio Artist"), It.IsAny<int>(), It.IsAny<IEnumerable<int>>()))
|
||||
.Returns(default(RemoteAlbum));
|
||||
.Setup(s => s.Map(It.Is<ParsedBookInfo>(i => i.BookTitle == "Audio Album" && i.AuthorName == "Audio Artist"), It.IsAny<int>(), It.IsAny<IEnumerable<int>>()))
|
||||
.Returns(default(RemoteBook));
|
||||
|
||||
// handle deletion event
|
||||
Subject.Handle(new AlbumDeletedEvent(remoteAlbum.Albums.First(), false, false));
|
||||
Subject.Handle(new BookDeletedEvent(remoteAlbum.Books.First(), false, false));
|
||||
|
||||
// verify download has null remote album
|
||||
var trackedDownloads = Subject.GetTrackedDownloads();
|
||||
trackedDownloads.Should().HaveCount(1);
|
||||
trackedDownloads.First().RemoteAlbum.Should().BeNull();
|
||||
trackedDownloads.First().RemoteBook.Should().BeNull();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@
|
|||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Extras.Metadata;
|
||||
using NzbDrone.Core.Extras.Metadata.Files;
|
||||
using NzbDrone.Core.Housekeeping.Housekeepers;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
|
|
@ -33,8 +33,8 @@ public void Setup()
|
|||
_metadata = Builder<MetadataFile>.CreateListOfSize(1)
|
||||
.Build().ToList();
|
||||
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(c => c.GetAllArtists())
|
||||
Mocker.GetMock<IAuthorService>()
|
||||
.Setup(c => c.GetAllAuthors())
|
||||
.Returns(_artist);
|
||||
|
||||
Mocker.GetMock<IMetadataFileService>()
|
||||
|
|
@ -73,7 +73,7 @@ public void should_not_run_if_flag_is_false()
|
|||
Subject.Clean();
|
||||
|
||||
Mocker.GetMock<IConfigService>().VerifySet(c => c.CleanupMetadataImages = true, Times.Never());
|
||||
Mocker.GetMock<IArtistService>().Verify(c => c.GetAllArtists(), Times.Never());
|
||||
Mocker.GetMock<IAuthorService>().Verify(c => c.GetAllAuthors(), Times.Never());
|
||||
|
||||
AssertImageWasNotRemoved();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ public void should_return_docker_path_mapping_error_if_on_docker_and_root_missin
|
|||
public void should_return_ok_on_track_imported_event()
|
||||
{
|
||||
GivenFolderExists(_downloadRootPath);
|
||||
var importEvent = new TrackImportedEvent(new LocalTrack(), new BookFile(), new List<BookFile>(), true, new DownloadClientItem());
|
||||
var importEvent = new TrackImportedEvent(new LocalBook(), new BookFile(), new List<BookFile>(), true, new DownloadClientItem());
|
||||
|
||||
Subject.Check(importEvent).ShouldBeOk();
|
||||
}
|
||||
|
|
@ -174,7 +174,7 @@ public void should_return_ok_on_track_imported_event()
|
|||
[Test]
|
||||
public void should_return_permissions_error_on_track_import_failed_event_if_file_exists()
|
||||
{
|
||||
var localTrack = new LocalTrack
|
||||
var localTrack = new LocalBook
|
||||
{
|
||||
Path = Path.Combine(_downloadItemPath, "file.mp3")
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.HealthCheck.Checks;
|
||||
using NzbDrone.Core.ImportLists;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.HealthCheck.Checks
|
||||
|
|
@ -24,8 +24,8 @@ private void GivenMissingRootFolder()
|
|||
.Build()
|
||||
.ToList();
|
||||
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(s => s.GetAllArtists())
|
||||
Mocker.GetMock<IAuthorService>()
|
||||
.Setup(s => s.GetAllAuthors())
|
||||
.Returns(artist);
|
||||
|
||||
Mocker.GetMock<IImportListFactory>()
|
||||
|
|
@ -44,8 +44,8 @@ private void GivenMissingRootFolder()
|
|||
[Test]
|
||||
public void should_not_return_error_when_no_artist()
|
||||
{
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(s => s.GetAllArtists())
|
||||
Mocker.GetMock<IAuthorService>()
|
||||
.Setup(s => s.GetAllAuthors())
|
||||
.Returns(new List<Author>());
|
||||
|
||||
Mocker.GetMock<IImportListFactory>()
|
||||
|
|
|
|||
|
|
@ -4,11 +4,11 @@
|
|||
using FizzWare.NBuilder;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.History;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
|
@ -44,13 +44,13 @@ public void should_use_file_name_for_source_title_if_scene_name_is_null()
|
|||
var artist = Builder<Author>.CreateNew().Build();
|
||||
var trackFile = Builder<BookFile>.CreateNew()
|
||||
.With(f => f.SceneName = null)
|
||||
.With(f => f.Artist = artist)
|
||||
.With(f => f.Author = artist)
|
||||
.Build();
|
||||
|
||||
var localTrack = new LocalTrack
|
||||
var localTrack = new LocalBook
|
||||
{
|
||||
Artist = artist,
|
||||
Album = new Book(),
|
||||
Author = artist,
|
||||
Book = new Book(),
|
||||
Path = @"C:\Test\Unsorted\Artist.01.Hymn.mp3"
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public void should_delete_old_DownloadClientUnavailable_pending_items()
|
|||
var pendingRelease = Builder<PendingRelease>.CreateNew()
|
||||
.With(h => h.Reason = PendingReleaseReason.DownloadClientUnavailable)
|
||||
.With(h => h.Added = DateTime.UtcNow.AddDays(-21))
|
||||
.With(h => h.ParsedAlbumInfo = new ParsedAlbumInfo())
|
||||
.With(h => h.ParsedBookInfo = new ParsedBookInfo())
|
||||
.With(h => h.Release = new ReleaseInfo())
|
||||
.BuildNew();
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ public void should_delete_old_Fallback_pending_items()
|
|||
var pendingRelease = Builder<PendingRelease>.CreateNew()
|
||||
.With(h => h.Reason = PendingReleaseReason.Fallback)
|
||||
.With(h => h.Added = DateTime.UtcNow.AddDays(-21))
|
||||
.With(h => h.ParsedAlbumInfo = new ParsedAlbumInfo())
|
||||
.With(h => h.ParsedBookInfo = new ParsedBookInfo())
|
||||
.With(h => h.Release = new ReleaseInfo())
|
||||
.BuildNew();
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ public void should_not_delete_old_Delay_pending_items()
|
|||
var pendingRelease = Builder<PendingRelease>.CreateNew()
|
||||
.With(h => h.Reason = PendingReleaseReason.Delay)
|
||||
.With(h => h.Added = DateTime.UtcNow.AddDays(-21))
|
||||
.With(h => h.ParsedAlbumInfo = new ParsedAlbumInfo())
|
||||
.With(h => h.ParsedBookInfo = new ParsedBookInfo())
|
||||
.With(h => h.Release = new ReleaseInfo())
|
||||
.BuildNew();
|
||||
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ public void should_not_delete_metadata_files_when_they_are_for_the_same_track_bu
|
|||
var files = Builder<MetadataFile>.CreateListOfSize(2)
|
||||
.All()
|
||||
.With(m => m.Type = MetadataType.TrackMetadata)
|
||||
.With(m => m.TrackFileId = 1)
|
||||
.With(m => m.BookFileId = 1)
|
||||
.BuildListOfNew();
|
||||
|
||||
Db.InsertMany(files);
|
||||
|
|
@ -156,7 +156,7 @@ public void should_delete_metadata_files_when_they_are_for_the_same_track_and_co
|
|||
var files = Builder<MetadataFile>.CreateListOfSize(2)
|
||||
.All()
|
||||
.With(m => m.Type = MetadataType.TrackMetadata)
|
||||
.With(m => m.TrackFileId = 1)
|
||||
.With(m => m.BookFileId = 1)
|
||||
.With(m => m.Consumer = "XbmcMetadata")
|
||||
.BuildListOfNew();
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Blacklisting;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Housekeeping.Housekeepers;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,16 +2,16 @@
|
|||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Housekeeping.Housekeepers;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.Housekeeping.Housekeepers
|
||||
{
|
||||
[TestFixture]
|
||||
public class CleanupOrphanedTrackFilesFixture : DbTest<CleanupOrphanedBookFiles, BookFile>
|
||||
public class CleanupOrphanedBookFilesFixture : DbTest<CleanupOrphanedBookFiles, BookFile>
|
||||
{
|
||||
[Test]
|
||||
public void should_unlink_orphaned_track_files()
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Housekeeping.Housekeepers;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.Housekeeping.Housekeepers
|
||||
{
|
||||
[TestFixture]
|
||||
public class CleanupOrphanedAlbumsFixture : DbTest<CleanupOrphanedBooks, Book>
|
||||
public class CleanupOrphanedBooksFixture : DbTest<CleanupOrphanedBooks, Book>
|
||||
{
|
||||
[Test]
|
||||
public void should_delete_orphaned_albums()
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Housekeeping.Housekeepers;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Extras.Metadata;
|
||||
using NzbDrone.Core.Extras.Metadata.Files;
|
||||
using NzbDrone.Core.Housekeeping.Housekeepers;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ public class CleanupOrphanedMetadataFilesFixture : DbTest<CleanupOrphanedMetadat
|
|||
public void should_delete_metadata_files_that_dont_have_a_coresponding_artist()
|
||||
{
|
||||
var metadataFile = Builder<MetadataFile>.CreateNew()
|
||||
.With(m => m.TrackFileId = null)
|
||||
.With(m => m.BookFileId = null)
|
||||
.BuildNew();
|
||||
|
||||
Db.Insert(metadataFile);
|
||||
|
|
@ -36,7 +36,7 @@ public void should_delete_metadata_files_that_dont_have_a_coresponding_album()
|
|||
|
||||
var metadataFile = Builder<MetadataFile>.CreateNew()
|
||||
.With(m => m.AuthorId = artist.Id)
|
||||
.With(m => m.TrackFileId = null)
|
||||
.With(m => m.BookFileId = null)
|
||||
.BuildNew();
|
||||
|
||||
Db.Insert(metadataFile);
|
||||
|
|
@ -55,7 +55,7 @@ public void should_not_delete_metadata_files_that_have_a_coresponding_artist()
|
|||
var metadataFile = Builder<MetadataFile>.CreateNew()
|
||||
.With(m => m.AuthorId = artist.Id)
|
||||
.With(m => m.BookId = null)
|
||||
.With(m => m.TrackFileId = null)
|
||||
.With(m => m.BookFileId = null)
|
||||
.BuildNew();
|
||||
|
||||
Db.Insert(metadataFile);
|
||||
|
|
@ -79,7 +79,7 @@ public void should_not_delete_metadata_files_that_have_a_coresponding_album()
|
|||
var metadataFile = Builder<MetadataFile>.CreateNew()
|
||||
.With(m => m.AuthorId = artist.Id)
|
||||
.With(m => m.BookId = album.Id)
|
||||
.With(m => m.TrackFileId = null)
|
||||
.With(m => m.BookFileId = null)
|
||||
.BuildNew();
|
||||
|
||||
Db.Insert(metadataFile);
|
||||
|
|
@ -102,7 +102,7 @@ public void should_delete_metadata_files_that_dont_have_a_coresponding_track_fil
|
|||
var metadataFile = Builder<MetadataFile>.CreateNew()
|
||||
.With(m => m.AuthorId = artist.Id)
|
||||
.With(m => m.BookId = album.Id)
|
||||
.With(m => m.TrackFileId = 10)
|
||||
.With(m => m.BookFileId = 10)
|
||||
.BuildNew();
|
||||
|
||||
Db.Insert(metadataFile);
|
||||
|
|
@ -130,7 +130,7 @@ public void should_not_delete_metadata_files_that_have_a_coresponding_track_file
|
|||
var metadataFile = Builder<MetadataFile>.CreateNew()
|
||||
.With(m => m.AuthorId = artist.Id)
|
||||
.With(m => m.BookId = album.Id)
|
||||
.With(m => m.TrackFileId = trackFile.Id)
|
||||
.With(m => m.BookFileId = trackFile.Id)
|
||||
.BuildNew();
|
||||
|
||||
Db.Insert(metadataFile);
|
||||
|
|
@ -150,7 +150,7 @@ public void should_delete_album_metadata_files_that_have_albumid_of_zero()
|
|||
.With(m => m.AuthorId = artist.Id)
|
||||
.With(m => m.Type = MetadataType.AlbumMetadata)
|
||||
.With(m => m.BookId = 0)
|
||||
.With(m => m.TrackFileId = null)
|
||||
.With(m => m.BookFileId = null)
|
||||
.BuildNew();
|
||||
|
||||
Db.Insert(metadataFile);
|
||||
|
|
@ -170,7 +170,7 @@ public void should_delete_album_image_files_that_have_albumid_of_zero()
|
|||
.With(m => m.AuthorId = artist.Id)
|
||||
.With(m => m.Type = MetadataType.AlbumImage)
|
||||
.With(m => m.BookId = 0)
|
||||
.With(m => m.TrackFileId = null)
|
||||
.With(m => m.BookFileId = null)
|
||||
.BuildNew();
|
||||
|
||||
Db.Insert(metadataFile);
|
||||
|
|
@ -189,7 +189,7 @@ public void should_delete_track_metadata_files_that_have_trackfileid_of_zero()
|
|||
var metadataFile = Builder<MetadataFile>.CreateNew()
|
||||
.With(m => m.AuthorId = artist.Id)
|
||||
.With(m => m.Type = MetadataType.TrackMetadata)
|
||||
.With(m => m.TrackFileId = 0)
|
||||
.With(m => m.BookFileId = 0)
|
||||
.BuildNew();
|
||||
|
||||
Db.Insert(metadataFile);
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Download.Pending;
|
||||
using NzbDrone.Core.Housekeeping.Housekeepers;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ public class CleanupOrphanedPendingReleasesFixture : DbTest<CleanupOrphanedPendi
|
|||
public void should_delete_orphaned_pending_items()
|
||||
{
|
||||
var pendingRelease = Builder<PendingRelease>.CreateNew()
|
||||
.With(h => h.ParsedAlbumInfo = new ParsedAlbumInfo())
|
||||
.With(h => h.ParsedBookInfo = new ParsedBookInfo())
|
||||
.With(h => h.Release = new ReleaseInfo())
|
||||
.BuildNew();
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ public void should_not_delete_unorphaned_pending_items()
|
|||
|
||||
var pendingRelease = Builder<PendingRelease>.CreateNew()
|
||||
.With(h => h.AuthorId = artist.Id)
|
||||
.With(h => h.ParsedAlbumInfo = new ParsedAlbumInfo())
|
||||
.With(h => h.ParsedBookInfo = new ParsedBookInfo())
|
||||
.With(h => h.Release = new ReleaseInfo())
|
||||
.BuildNew();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
using FizzWare.NBuilder;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Housekeeping.Housekeepers;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.Housekeeping.Housekeepers
|
||||
{
|
||||
[TestFixture]
|
||||
public class UpdateCleanTitleForArtistFixture : CoreTest<UpdateCleanTitleForArtist>
|
||||
public class UpdateCleanTitleForAuthorFixture : CoreTest<UpdateCleanTitleForAuthor>
|
||||
{
|
||||
[Test]
|
||||
public void should_update_clean_title()
|
||||
|
|
@ -18,13 +18,13 @@ public void should_update_clean_title()
|
|||
.With(s => s.CleanName = "unclean")
|
||||
.Build();
|
||||
|
||||
Mocker.GetMock<IArtistRepository>()
|
||||
Mocker.GetMock<IAuthorRepository>()
|
||||
.Setup(s => s.All())
|
||||
.Returns(new[] { artist });
|
||||
|
||||
Subject.Clean();
|
||||
|
||||
Mocker.GetMock<IArtistRepository>()
|
||||
Mocker.GetMock<IAuthorRepository>()
|
||||
.Verify(v => v.Update(It.Is<Author>(s => s.CleanName == "fullname")), Times.Once());
|
||||
}
|
||||
|
||||
|
|
@ -36,13 +36,13 @@ public void should_not_update_unchanged_title()
|
|||
.With(s => s.CleanName = "fullname")
|
||||
.Build();
|
||||
|
||||
Mocker.GetMock<IArtistRepository>()
|
||||
Mocker.GetMock<IAuthorRepository>()
|
||||
.Setup(s => s.All())
|
||||
.Returns(new[] { artist });
|
||||
|
||||
Subject.Clean();
|
||||
|
||||
Mocker.GetMock<IArtistRepository>()
|
||||
Mocker.GetMock<IAuthorRepository>()
|
||||
.Verify(v => v.Update(It.Is<Author>(s => s.CleanName == "fullname")), Times.Never());
|
||||
}
|
||||
}
|
||||
|
|
@ -3,10 +3,10 @@
|
|||
using FizzWare.NBuilder;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.ImportLists;
|
||||
using NzbDrone.Core.ImportLists.Exclusions;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
|
|
@ -21,7 +21,7 @@ public void SetUp()
|
|||
{
|
||||
var importListItem1 = new ImportListItemInfo
|
||||
{
|
||||
Artist = "Linkin Park"
|
||||
Author = "Linkin Park"
|
||||
};
|
||||
|
||||
_importListReports = new List<ImportListItemInfo> { importListItem1 };
|
||||
|
|
@ -59,18 +59,18 @@ public void SetUp()
|
|||
.Setup(v => v.All())
|
||||
.Returns(new List<ImportListExclusion>());
|
||||
|
||||
Mocker.GetMock<IAddAlbumService>()
|
||||
.Setup(v => v.AddAlbums(It.IsAny<List<Book>>(), false))
|
||||
Mocker.GetMock<IAddBookService>()
|
||||
.Setup(v => v.AddBooks(It.IsAny<List<Book>>(), false))
|
||||
.Returns<List<Book>, bool>((x, y) => x);
|
||||
|
||||
Mocker.GetMock<IAddArtistService>()
|
||||
.Setup(v => v.AddArtists(It.IsAny<List<Author>>(), false))
|
||||
Mocker.GetMock<IAddAuthorService>()
|
||||
.Setup(v => v.AddAuthors(It.IsAny<List<Author>>(), false))
|
||||
.Returns<List<Author>, bool>((x, y) => x);
|
||||
}
|
||||
|
||||
private void WithAlbum()
|
||||
{
|
||||
_importListReports.First().Album = "Meteora";
|
||||
_importListReports.First().Book = "Meteora";
|
||||
}
|
||||
|
||||
private void WithAuthorId()
|
||||
|
|
@ -85,14 +85,14 @@ private void WithBookId()
|
|||
|
||||
private void WithExistingArtist()
|
||||
{
|
||||
Mocker.GetMock<IArtistService>()
|
||||
Mocker.GetMock<IAuthorService>()
|
||||
.Setup(v => v.FindById(_importListReports.First().ArtistMusicBrainzId))
|
||||
.Returns(new Author { ForeignAuthorId = _importListReports.First().ArtistMusicBrainzId });
|
||||
}
|
||||
|
||||
private void WithExistingAlbum()
|
||||
{
|
||||
Mocker.GetMock<IAlbumService>()
|
||||
Mocker.GetMock<IBookService>()
|
||||
.Setup(v => v.FindById(_importListReports.First().AlbumMusicBrainzId))
|
||||
.Returns(new Book { ForeignBookId = _importListReports.First().AlbumMusicBrainzId });
|
||||
}
|
||||
|
|
@ -193,8 +193,8 @@ public void should_not_add_if_existing_artist()
|
|||
|
||||
Subject.Execute(new ImportListSyncCommand());
|
||||
|
||||
Mocker.GetMock<IAddArtistService>()
|
||||
.Verify(v => v.AddArtists(It.Is<List<Author>>(t => t.Count == 0), false));
|
||||
Mocker.GetMock<IAddAuthorService>()
|
||||
.Verify(v => v.AddAuthors(It.Is<List<Author>>(t => t.Count == 0), false));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -205,8 +205,8 @@ public void should_not_add_if_existing_album()
|
|||
|
||||
Subject.Execute(new ImportListSyncCommand());
|
||||
|
||||
Mocker.GetMock<IAddArtistService>()
|
||||
.Verify(v => v.AddArtists(It.Is<List<Author>>(t => t.Count == 0), false));
|
||||
Mocker.GetMock<IAddAuthorService>()
|
||||
.Verify(v => v.AddAuthors(It.Is<List<Author>>(t => t.Count == 0), false));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -217,8 +217,8 @@ public void should_add_if_existing_artist_but_new_album()
|
|||
|
||||
Subject.Execute(new ImportListSyncCommand());
|
||||
|
||||
Mocker.GetMock<IAddAlbumService>()
|
||||
.Verify(v => v.AddAlbums(It.Is<List<Book>>(t => t.Count == 1), false));
|
||||
Mocker.GetMock<IAddBookService>()
|
||||
.Verify(v => v.AddBooks(It.Is<List<Book>>(t => t.Count == 1), false));
|
||||
}
|
||||
|
||||
[TestCase(ImportListMonitorType.None, false)]
|
||||
|
|
@ -231,8 +231,8 @@ public void should_add_if_not_existing_artist(ImportListMonitorType monitor, boo
|
|||
|
||||
Subject.Execute(new ImportListSyncCommand());
|
||||
|
||||
Mocker.GetMock<IAddArtistService>()
|
||||
.Verify(v => v.AddArtists(It.Is<List<Author>>(t => t.Count == 1 && t.First().Monitored == expectedArtistMonitored), false));
|
||||
Mocker.GetMock<IAddAuthorService>()
|
||||
.Verify(v => v.AddAuthors(It.Is<List<Author>>(t => t.Count == 1 && t.First().Monitored == expectedArtistMonitored), false));
|
||||
}
|
||||
|
||||
[TestCase(ImportListMonitorType.None, false)]
|
||||
|
|
@ -245,8 +245,8 @@ public void should_add_if_not_existing_album(ImportListMonitorType monitor, bool
|
|||
|
||||
Subject.Execute(new ImportListSyncCommand());
|
||||
|
||||
Mocker.GetMock<IAddAlbumService>()
|
||||
.Verify(v => v.AddAlbums(It.Is<List<Book>>(t => t.Count == 1 && t.First().Monitored == expectedAlbumMonitored), false));
|
||||
Mocker.GetMock<IAddBookService>()
|
||||
.Verify(v => v.AddBooks(It.Is<List<Book>>(t => t.Count == 1 && t.First().Monitored == expectedAlbumMonitored), false));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -257,8 +257,8 @@ public void should_not_add_artist_if_excluded_artist()
|
|||
|
||||
Subject.Execute(new ImportListSyncCommand());
|
||||
|
||||
Mocker.GetMock<IAddArtistService>()
|
||||
.Verify(v => v.AddArtists(It.Is<List<Author>>(t => t.Count == 0), false));
|
||||
Mocker.GetMock<IAddAuthorService>()
|
||||
.Verify(v => v.AddAuthors(It.Is<List<Author>>(t => t.Count == 0), false));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -269,8 +269,8 @@ public void should_not_add_album_if_excluded_album()
|
|||
|
||||
Subject.Execute(new ImportListSyncCommand());
|
||||
|
||||
Mocker.GetMock<IAddAlbumService>()
|
||||
.Verify(v => v.AddAlbums(It.Is<List<Book>>(t => t.Count == 0), false));
|
||||
Mocker.GetMock<IAddBookService>()
|
||||
.Verify(v => v.AddBooks(It.Is<List<Book>>(t => t.Count == 0), false));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -282,8 +282,8 @@ public void should_not_add_album_if_excluded_artist()
|
|||
|
||||
Subject.Execute(new ImportListSyncCommand());
|
||||
|
||||
Mocker.GetMock<IAddAlbumService>()
|
||||
.Verify(v => v.AddAlbums(It.Is<List<Book>>(t => t.Count == 0), false));
|
||||
Mocker.GetMock<IAddBookService>()
|
||||
.Verify(v => v.AddBooks(It.Is<List<Book>>(t => t.Count == 0), false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
using System.Linq;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.IndexerSearch;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class ArtistSearchServiceFixture : CoreTest<ArtistSearchService>
|
||||
public class ArtistSearchServiceFixture : CoreTest<AuthorSearchService>
|
||||
{
|
||||
private Author _artist;
|
||||
|
||||
|
|
@ -21,8 +21,8 @@ public void Setup()
|
|||
{
|
||||
_artist = new Author();
|
||||
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(s => s.GetArtist(It.IsAny<int>()))
|
||||
Mocker.GetMock<IAuthorService>()
|
||||
.Setup(s => s.GetAuthor(It.IsAny<int>()))
|
||||
.Returns(_artist);
|
||||
|
||||
Mocker.GetMock<ISearchForNzb>()
|
||||
|
|
@ -43,7 +43,7 @@ public void should_only_include_monitored_albums()
|
|||
new Book { Monitored = true }
|
||||
};
|
||||
|
||||
Subject.Execute(new ArtistSearchCommand { AuthorId = _artist.Id, Trigger = CommandTrigger.Manual });
|
||||
Subject.Execute(new AuthorSearchCommand { AuthorId = _artist.Id, Trigger = CommandTrigger.Manual });
|
||||
|
||||
Mocker.GetMock<ISearchForNzb>()
|
||||
.Verify(v => v.ArtistSearch(_artist.Id, false, true, false),
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||
{
|
||||
public class AlbumSearchDefinitionFixture : CoreTest<AlbumSearchCriteria>
|
||||
public class AlbumSearchDefinitionFixture : CoreTest<BookSearchCriteria>
|
||||
{
|
||||
[TestCase("Mötley Crüe", "Motley+Crue")]
|
||||
[TestCase("방탄소년단", "방탄소년단")]
|
||||
public void should_replace_some_special_characters_artist(string artist, string expected)
|
||||
{
|
||||
Subject.Artist = new Author { Name = artist };
|
||||
Subject.Author = new Author { Name = artist };
|
||||
Subject.ArtistQuery.Should().Be(expected);
|
||||
}
|
||||
|
||||
|
|
@ -24,14 +24,14 @@ public void should_replace_some_special_characters_artist(string artist, string
|
|||
[TestCase("Section.80", "Section+80")]
|
||||
public void should_replace_some_special_characters(string album, string expected)
|
||||
{
|
||||
Subject.AlbumTitle = album;
|
||||
Subject.BookTitle = album;
|
||||
Subject.AlbumQuery.Should().Be(expected);
|
||||
}
|
||||
|
||||
[TestCase("+", "+")]
|
||||
public void should_not_replace_some_special_characters_if_result_empty_string(string album, string expected)
|
||||
{
|
||||
Subject.AlbumTitle = album;
|
||||
Subject.BookTitle = album;
|
||||
Subject.AlbumQuery.Should().Be(expected);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,14 +14,14 @@ namespace NzbDrone.Core.Test.IndexerTests.IntegrationTests
|
|||
[IntegrationTest]
|
||||
public class IndexerIntegrationTests : CoreTest
|
||||
{
|
||||
private AlbumSearchCriteria _albumSearchCriteria;
|
||||
private BookSearchCriteria _albumSearchCriteria;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
UseRealHttp();
|
||||
|
||||
_albumSearchCriteria = new AlbumSearchCriteria()
|
||||
_albumSearchCriteria = new BookSearchCriteria()
|
||||
{
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ namespace NzbDrone.Core.Test.IndexerTests.NewznabTests
|
|||
{
|
||||
public class NewznabRequestGeneratorFixture : CoreTest<NewznabRequestGenerator>
|
||||
{
|
||||
private AlbumSearchCriteria _singleAlbumSearchCriteria;
|
||||
private BookSearchCriteria _singleAlbumSearchCriteria;
|
||||
private NewznabCapabilities _capabilities;
|
||||
|
||||
[SetUp]
|
||||
|
|
@ -23,10 +23,10 @@ public void SetUp()
|
|||
ApiKey = "abcd",
|
||||
};
|
||||
|
||||
_singleAlbumSearchCriteria = new AlbumSearchCriteria
|
||||
_singleAlbumSearchCriteria = new BookSearchCriteria
|
||||
{
|
||||
Artist = new Music.Author { Name = "Alien Ant Farm" },
|
||||
AlbumTitle = "TruANT"
|
||||
Author = new Books.Author { Name = "Alien Ant Farm" },
|
||||
BookTitle = "TruANT"
|
||||
};
|
||||
|
||||
_capabilities = new NewznabCapabilities();
|
||||
|
|
@ -51,15 +51,15 @@ public void should_use_all_categories_for_feed()
|
|||
[Test]
|
||||
public void should_search_by_artist_and_album_if_supported()
|
||||
{
|
||||
_capabilities.SupportedAudioSearchParameters = new[] { "q", "artist", "album" };
|
||||
_capabilities.SupportedAudioSearchParameters = new[] { "q", "author", "book" };
|
||||
|
||||
var results = Subject.GetSearchRequests(_singleAlbumSearchCriteria);
|
||||
results.GetTier(0).Should().HaveCount(1);
|
||||
|
||||
var page = results.GetAllTiers().First().First();
|
||||
|
||||
page.Url.Query.Should().Contain("artist=Alien%20Ant%20Farm");
|
||||
page.Url.Query.Should().Contain("album=TruANT");
|
||||
page.Url.Query.Should().Contain("author=Alien%20Ant%20Farm");
|
||||
page.Url.Query.Should().Contain("book=TruANT");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public void should_not_return_config_for_non_existent_indexer()
|
|||
.Setup(v => v.Get(It.IsAny<int>()))
|
||||
.Throws(new ModelNotFoundException(typeof(IndexerDefinition), 0));
|
||||
|
||||
var result = Subject.GetSeedConfiguration(new RemoteAlbum
|
||||
var result = Subject.GetSeedConfiguration(new RemoteBook
|
||||
{
|
||||
Release = new ReleaseInfo
|
||||
{
|
||||
|
|
@ -45,14 +45,14 @@ public void should_return_discography_time_for_discography_packs()
|
|||
Settings = settings
|
||||
});
|
||||
|
||||
var result = Subject.GetSeedConfiguration(new RemoteAlbum
|
||||
var result = Subject.GetSeedConfiguration(new RemoteBook
|
||||
{
|
||||
Release = new ReleaseInfo()
|
||||
{
|
||||
DownloadProtocol = DownloadProtocol.Torrent,
|
||||
IndexerId = 1
|
||||
},
|
||||
ParsedAlbumInfo = new ParsedAlbumInfo
|
||||
ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Discography = true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Books.Events;
|
||||
using NzbDrone.Core.MediaCover;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Music.Events;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.MediaCoverTests
|
||||
|
|
@ -60,7 +60,7 @@ public void should_convert_cover_urls_to_local(string extension)
|
|||
Mocker.GetMock<IDiskProvider>().Setup(c => c.FileExists(It.IsAny<string>()))
|
||||
.Returns(true);
|
||||
|
||||
Subject.ConvertToLocalUrls(12, MediaCoverEntity.Artist, covers);
|
||||
Subject.ConvertToLocalUrls(12, MediaCoverEntity.Author, covers);
|
||||
|
||||
covers.Single().Url.Should().Be("/MediaCover/12/banner" + extension + "?lastWrite=1234");
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ public void convert_to_local_url_should_not_change_extension(string extension)
|
|||
Mocker.GetMock<IDiskProvider>().Setup(c => c.FileExists(It.IsAny<string>()))
|
||||
.Returns(true);
|
||||
|
||||
Subject.ConvertToLocalUrls(12, MediaCoverEntity.Artist, covers);
|
||||
Subject.ConvertToLocalUrls(12, MediaCoverEntity.Author, covers);
|
||||
|
||||
covers.Single().Extension.Should().Be(extension);
|
||||
}
|
||||
|
|
@ -108,7 +108,7 @@ public void should_convert_album_cover_urls_to_local(string extension)
|
|||
Mocker.GetMock<IDiskProvider>().Setup(c => c.FileExists(It.IsAny<string>()))
|
||||
.Returns(true);
|
||||
|
||||
Subject.ConvertToLocalUrls(6, MediaCoverEntity.Album, covers);
|
||||
Subject.ConvertToLocalUrls(6, MediaCoverEntity.Book, covers);
|
||||
|
||||
covers.Single().Url.Should().Be("/MediaCover/Albums/6/disc" + extension + "?lastWrite=1234");
|
||||
}
|
||||
|
|
@ -126,7 +126,7 @@ public void should_convert_media_urls_to_local_without_time_if_file_doesnt_exist
|
|||
}
|
||||
};
|
||||
|
||||
Subject.ConvertToLocalUrls(12, MediaCoverEntity.Artist, covers);
|
||||
Subject.ConvertToLocalUrls(12, MediaCoverEntity.Author, covers);
|
||||
|
||||
covers.Single().Url.Should().Be("/MediaCover/12/banner" + extension);
|
||||
}
|
||||
|
|
@ -138,15 +138,15 @@ public void should_resize_covers_if_main_downloaded()
|
|||
.Setup(v => v.AlreadyExists(It.IsAny<DateTime?>(), It.IsAny<long?>(), It.IsAny<string>()))
|
||||
.Returns(false);
|
||||
|
||||
Mocker.GetMock<IAlbumService>()
|
||||
.Setup(v => v.GetAlbumsByArtist(It.IsAny<int>()))
|
||||
Mocker.GetMock<IBookService>()
|
||||
.Setup(v => v.GetBooksByAuthor(It.IsAny<int>()))
|
||||
.Returns(new List<Book> { _album });
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Setup(v => v.FileExists(It.IsAny<string>()))
|
||||
.Returns(true);
|
||||
|
||||
Subject.HandleAsync(new ArtistRefreshCompleteEvent(_artist));
|
||||
Subject.HandleAsync(new AuthorRefreshCompleteEvent(_artist));
|
||||
|
||||
Mocker.GetMock<IImageResizer>()
|
||||
.Verify(v => v.Resize(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<int>()), Times.Exactly(2));
|
||||
|
|
@ -159,15 +159,15 @@ public void should_resize_covers_if_missing()
|
|||
.Setup(v => v.AlreadyExists(It.IsAny<DateTime?>(), It.IsAny<long?>(), It.IsAny<string>()))
|
||||
.Returns(true);
|
||||
|
||||
Mocker.GetMock<IAlbumService>()
|
||||
.Setup(v => v.GetAlbumsByArtist(It.IsAny<int>()))
|
||||
Mocker.GetMock<IBookService>()
|
||||
.Setup(v => v.GetBooksByAuthor(It.IsAny<int>()))
|
||||
.Returns(new List<Book> { _album });
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Setup(v => v.FileExists(It.IsAny<string>()))
|
||||
.Returns(false);
|
||||
|
||||
Subject.HandleAsync(new ArtistRefreshCompleteEvent(_artist));
|
||||
Subject.HandleAsync(new AuthorRefreshCompleteEvent(_artist));
|
||||
|
||||
Mocker.GetMock<IImageResizer>()
|
||||
.Verify(v => v.Resize(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<int>()), Times.Exactly(2));
|
||||
|
|
@ -184,15 +184,15 @@ public void should_not_resize_covers_if_exists()
|
|||
.Setup(v => v.FileExists(It.IsAny<string>()))
|
||||
.Returns(true);
|
||||
|
||||
Mocker.GetMock<IAlbumService>()
|
||||
.Setup(v => v.GetAlbumsByArtist(It.IsAny<int>()))
|
||||
Mocker.GetMock<IBookService>()
|
||||
.Setup(v => v.GetBooksByAuthor(It.IsAny<int>()))
|
||||
.Returns(new List<Book> { _album });
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Setup(v => v.GetFileSize(It.IsAny<string>()))
|
||||
.Returns(1000);
|
||||
|
||||
Subject.HandleAsync(new ArtistRefreshCompleteEvent(_artist));
|
||||
Subject.HandleAsync(new AuthorRefreshCompleteEvent(_artist));
|
||||
|
||||
Mocker.GetMock<IImageResizer>()
|
||||
.Verify(v => v.Resize(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<int>()), Times.Never());
|
||||
|
|
@ -209,15 +209,15 @@ public void should_resize_covers_if_existing_is_empty()
|
|||
.Setup(v => v.FileExists(It.IsAny<string>()))
|
||||
.Returns(true);
|
||||
|
||||
Mocker.GetMock<IAlbumService>()
|
||||
.Setup(v => v.GetAlbumsByArtist(It.IsAny<int>()))
|
||||
Mocker.GetMock<IBookService>()
|
||||
.Setup(v => v.GetBooksByAuthor(It.IsAny<int>()))
|
||||
.Returns(new List<Book> { _album });
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Setup(v => v.GetFileSize(It.IsAny<string>()))
|
||||
.Returns(0);
|
||||
|
||||
Subject.HandleAsync(new ArtistRefreshCompleteEvent(_artist));
|
||||
Subject.HandleAsync(new AuthorRefreshCompleteEvent(_artist));
|
||||
|
||||
Mocker.GetMock<IImageResizer>()
|
||||
.Verify(v => v.Resize(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<int>()), Times.Exactly(2));
|
||||
|
|
@ -234,15 +234,15 @@ public void should_log_error_if_resize_failed()
|
|||
.Setup(v => v.FileExists(It.IsAny<string>()))
|
||||
.Returns(false);
|
||||
|
||||
Mocker.GetMock<IAlbumService>()
|
||||
.Setup(v => v.GetAlbumsByArtist(It.IsAny<int>()))
|
||||
Mocker.GetMock<IBookService>()
|
||||
.Setup(v => v.GetBooksByAuthor(It.IsAny<int>()))
|
||||
.Returns(new List<Book> { _album });
|
||||
|
||||
Mocker.GetMock<IImageResizer>()
|
||||
.Setup(v => v.Resize(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<int>()))
|
||||
.Throws<ApplicationException>();
|
||||
|
||||
Subject.HandleAsync(new ArtistRefreshCompleteEvent(_artist));
|
||||
Subject.HandleAsync(new AuthorRefreshCompleteEvent(_artist));
|
||||
|
||||
Mocker.GetMock<IImageResizer>()
|
||||
.Verify(v => v.Resize(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<int>()), Times.Exactly(2));
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
|
|
@ -316,8 +316,8 @@ private BookFile GivenPopulatedTrackfile(int mediumOffset)
|
|||
.Build();
|
||||
|
||||
var file = Builder<BookFile>.CreateNew()
|
||||
.With(x => x.Album = album)
|
||||
.With(x => x.Artist = artist)
|
||||
.With(x => x.Book = album)
|
||||
.With(x => x.Author = artist)
|
||||
.Build();
|
||||
|
||||
return file;
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@
|
|||
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.TrackImport;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.MediaFiles.BookImport;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.RootFolders;
|
||||
|
|
@ -43,16 +43,16 @@ public void Setup()
|
|||
.Setup(s => s.GetBestRootFolder(It.IsAny<string>()))
|
||||
.Returns(new RootFolder { Path = _rootFolder });
|
||||
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(s => s.GetArtists(It.IsAny<List<int>>()))
|
||||
Mocker.GetMock<IAuthorService>()
|
||||
.Setup(s => s.GetAuthors(It.IsAny<List<int>>()))
|
||||
.Returns(new List<Author>());
|
||||
|
||||
Mocker.GetMock<IMakeImportDecision>()
|
||||
.Setup(v => v.GetImportDecisions(It.IsAny<List<IFileInfo>>(), It.IsAny<IdentificationOverrides>(), It.IsAny<ImportDecisionMakerInfo>(), It.IsAny<ImportDecisionMakerConfig>()))
|
||||
.Returns(new List<ImportDecision<LocalTrack>>());
|
||||
.Returns(new List<ImportDecision<LocalBook>>());
|
||||
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Setup(v => v.GetFilesByArtist(It.IsAny<int>()))
|
||||
.Setup(v => v.GetFilesByAuthor(It.IsAny<int>()))
|
||||
.Returns(new List<BookFile>());
|
||||
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
|
|
@ -370,14 +370,14 @@ private void GivenRejections()
|
|||
Mocker.GetMock<IMakeImportDecision>()
|
||||
.Setup(x => x.GetImportDecisions(It.IsAny<List<IFileInfo>>(), It.IsAny<IdentificationOverrides>(), It.IsAny<ImportDecisionMakerInfo>(), It.IsAny<ImportDecisionMakerConfig>()))
|
||||
.Returns((List<IFileInfo> fileList, IdentificationOverrides idOverrides, ImportDecisionMakerInfo idInfo, ImportDecisionMakerConfig idConfig) =>
|
||||
fileList.Select(x => new LocalTrack
|
||||
fileList.Select(x => new LocalBook
|
||||
{
|
||||
Artist = _artist,
|
||||
Author = _artist,
|
||||
Path = x.FullName,
|
||||
Modified = x.LastWriteTimeUtc,
|
||||
FileTrackInfo = new ParsedTrackInfo()
|
||||
})
|
||||
.Select(x => new ImportDecision<LocalTrack>(x, new Rejection("Reject")))
|
||||
.Select(x => new ImportDecision<LocalBook>(x, new Rejection("Reject")))
|
||||
.ToList());
|
||||
}
|
||||
|
||||
|
|
@ -501,7 +501,7 @@ public void should_update_fields_for_updated_files()
|
|||
|
||||
FileSystem.AddFile(files[0], new MockFileData("".PadRight(100)) { LastWriteTime = new DateTime(2019, 2, 1) });
|
||||
|
||||
var localTrack = Builder<LocalTrack>.CreateNew()
|
||||
var localTrack = Builder<LocalBook>.CreateNew()
|
||||
.With(x => x.Path = files[0])
|
||||
.With(x => x.Modified = new DateTime(2019, 2, 1))
|
||||
.With(x => x.Size = 100)
|
||||
|
|
@ -514,7 +514,7 @@ public void should_update_fields_for_updated_files()
|
|||
|
||||
Mocker.GetMock<IMakeImportDecision>()
|
||||
.Setup(x => x.GetImportDecisions(It.IsAny<List<IFileInfo>>(), It.IsAny<IdentificationOverrides>(), It.IsAny<ImportDecisionMakerInfo>(), It.IsAny<ImportDecisionMakerConfig>()))
|
||||
.Returns(new List<ImportDecision<LocalTrack>> { new ImportDecision<LocalTrack>(localTrack, new Rejection("Reject")) });
|
||||
.Returns(new List<ImportDecision<LocalBook>> { new ImportDecision<LocalBook>(localTrack, new Rejection("Reject")) });
|
||||
|
||||
Subject.Scan(new List<string> { _artist.Path });
|
||||
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@
|
|||
using FizzWare.NBuilder;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.TrackedDownloads;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.BookImport;
|
||||
using NzbDrone.Core.MediaFiles.Commands;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
namespace NzbDrone.Core.Test.MediaFiles
|
||||
{
|
||||
[TestFixture]
|
||||
public class DownloadedAlbumsCommandServiceFixture : FileSystemTest<DownloadedAlbumsCommandService>
|
||||
public class DownloadedAlbumsCommandServiceFixture : FileSystemTest<DownloadedBooksCommandService>
|
||||
{
|
||||
private string _downloadFolder = "c:\\drop_other\\Show.S01E01\\".AsOsAgnostic();
|
||||
private string _downloadFile = "c:\\drop_other\\Show.S01E01.mkv".AsOsAgnostic();
|
||||
|
|
@ -28,11 +28,11 @@ public class DownloadedAlbumsCommandServiceFixture : FileSystemTest<DownloadedAl
|
|||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
Mocker.GetMock<IDownloadedTracksImportService>()
|
||||
Mocker.GetMock<IDownloadedBooksImportService>()
|
||||
.Setup(v => v.ProcessRootFolder(It.IsAny<IDirectoryInfo>()))
|
||||
.Returns(new List<ImportResult>());
|
||||
|
||||
Mocker.GetMock<IDownloadedTracksImportService>()
|
||||
Mocker.GetMock<IDownloadedBooksImportService>()
|
||||
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Author>(), It.IsAny<DownloadClientItem>()))
|
||||
.Returns(new List<ImportResult>());
|
||||
|
||||
|
|
@ -41,14 +41,14 @@ public void Setup()
|
|||
.With(v => v.Status = DownloadItemStatus.Downloading)
|
||||
.Build();
|
||||
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(v => v.Artist = new Author())
|
||||
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(v => v.Author = new Author())
|
||||
.Build();
|
||||
|
||||
_trackedDownload = new TrackedDownload
|
||||
{
|
||||
DownloadItem = downloadItem,
|
||||
RemoteAlbum = remoteAlbum,
|
||||
RemoteBook = remoteAlbum,
|
||||
State = TrackedDownloadState.Downloading
|
||||
};
|
||||
}
|
||||
|
|
@ -73,9 +73,9 @@ private void GivenValidQueueItem()
|
|||
[Test]
|
||||
public void should_skip_import_if_dronefactory_doesnt_exist()
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() => Subject.Execute(new DownloadedAlbumsScanCommand()));
|
||||
Assert.Throws<ArgumentException>(() => Subject.Execute(new DownloadedBooksScanCommand()));
|
||||
|
||||
Mocker.GetMock<IDownloadedTracksImportService>().Verify(c => c.ProcessRootFolder(It.IsAny<IDirectoryInfo>()), Times.Never());
|
||||
Mocker.GetMock<IDownloadedBooksImportService>().Verify(c => c.ProcessRootFolder(It.IsAny<IDirectoryInfo>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -83,9 +83,9 @@ public void should_process_folder_if_downloadclientid_is_not_specified()
|
|||
{
|
||||
GivenExistingFolder(_downloadFolder);
|
||||
|
||||
Subject.Execute(new DownloadedAlbumsScanCommand() { Path = _downloadFolder });
|
||||
Subject.Execute(new DownloadedBooksScanCommand() { Path = _downloadFolder });
|
||||
|
||||
Mocker.GetMock<IDownloadedTracksImportService>().Verify(c => c.ProcessPath(It.IsAny<string>(), ImportMode.Auto, null, null), Times.Once());
|
||||
Mocker.GetMock<IDownloadedBooksImportService>().Verify(c => c.ProcessPath(It.IsAny<string>(), ImportMode.Auto, null, null), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -93,9 +93,9 @@ public void should_process_file_if_downloadclientid_is_not_specified()
|
|||
{
|
||||
GivenExistingFile(_downloadFile);
|
||||
|
||||
Subject.Execute(new DownloadedAlbumsScanCommand() { Path = _downloadFile });
|
||||
Subject.Execute(new DownloadedBooksScanCommand() { Path = _downloadFile });
|
||||
|
||||
Mocker.GetMock<IDownloadedTracksImportService>().Verify(c => c.ProcessPath(It.IsAny<string>(), ImportMode.Auto, null, null), Times.Once());
|
||||
Mocker.GetMock<IDownloadedBooksImportService>().Verify(c => c.ProcessPath(It.IsAny<string>(), ImportMode.Auto, null, null), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -104,9 +104,9 @@ public void should_process_folder_with_downloadclientitem_if_available()
|
|||
GivenExistingFolder(_downloadFolder);
|
||||
GivenValidQueueItem();
|
||||
|
||||
Subject.Execute(new DownloadedAlbumsScanCommand() { Path = _downloadFolder, DownloadClientId = "sab1" });
|
||||
Subject.Execute(new DownloadedBooksScanCommand() { Path = _downloadFolder, DownloadClientId = "sab1" });
|
||||
|
||||
Mocker.GetMock<IDownloadedTracksImportService>().Verify(c => c.ProcessPath(_downloadFolder, ImportMode.Auto, _trackedDownload.RemoteAlbum.Artist, _trackedDownload.DownloadItem), Times.Once());
|
||||
Mocker.GetMock<IDownloadedBooksImportService>().Verify(c => c.ProcessPath(_downloadFolder, ImportMode.Auto, _trackedDownload.RemoteBook.Author, _trackedDownload.DownloadItem), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -114,9 +114,9 @@ public void should_process_folder_without_downloadclientitem_if_not_available()
|
|||
{
|
||||
GivenExistingFolder(_downloadFolder);
|
||||
|
||||
Subject.Execute(new DownloadedAlbumsScanCommand() { Path = _downloadFolder, DownloadClientId = "sab1" });
|
||||
Subject.Execute(new DownloadedBooksScanCommand() { Path = _downloadFolder, DownloadClientId = "sab1" });
|
||||
|
||||
Mocker.GetMock<IDownloadedTracksImportService>().Verify(c => c.ProcessPath(_downloadFolder, ImportMode.Auto, null, null), Times.Once());
|
||||
Mocker.GetMock<IDownloadedBooksImportService>().Verify(c => c.ProcessPath(_downloadFolder, ImportMode.Auto, null, null), Times.Once());
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
|
@ -124,9 +124,9 @@ public void should_process_folder_without_downloadclientitem_if_not_available()
|
|||
[Test]
|
||||
public void should_warn_if_neither_folder_or_file_exists()
|
||||
{
|
||||
Subject.Execute(new DownloadedAlbumsScanCommand() { Path = _downloadFolder });
|
||||
Subject.Execute(new DownloadedBooksScanCommand() { Path = _downloadFolder });
|
||||
|
||||
Mocker.GetMock<IDownloadedTracksImportService>().Verify(c => c.ProcessPath(It.IsAny<string>(), ImportMode.Auto, null, null), Times.Never());
|
||||
Mocker.GetMock<IDownloadedBooksImportService>().Verify(c => c.ProcessPath(It.IsAny<string>(), ImportMode.Auto, null, null), Times.Never());
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
|
@ -136,9 +136,9 @@ public void should_override_import_mode()
|
|||
{
|
||||
GivenExistingFile(_downloadFile);
|
||||
|
||||
Subject.Execute(new DownloadedAlbumsScanCommand() { Path = _downloadFile, ImportMode = ImportMode.Copy });
|
||||
Subject.Execute(new DownloadedBooksScanCommand() { Path = _downloadFile, ImportMode = ImportMode.Copy });
|
||||
|
||||
Mocker.GetMock<IDownloadedTracksImportService>().Verify(c => c.ProcessPath(It.IsAny<string>(), ImportMode.Copy, null, null), Times.Once());
|
||||
Mocker.GetMock<IDownloadedBooksImportService>().Verify(c => c.ProcessPath(It.IsAny<string>(), ImportMode.Copy, null, null), Times.Once());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@
|
|||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.TrackedDownloads;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.MediaFiles.BookImport;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
namespace NzbDrone.Core.Test.MediaFiles
|
||||
{
|
||||
[TestFixture]
|
||||
public class DownloadedTracksImportServiceFixture : FileSystemTest<DownloadedTracksImportService>
|
||||
public class DownloadedTracksImportServiceFixture : FileSystemTest<DownloadedBooksImportService>
|
||||
{
|
||||
private string _droneFactory = "c:\\drop\\".AsOsAgnostic();
|
||||
private string[] _subFolders = new[] { "c:\\drop\\foldername".AsOsAgnostic() };
|
||||
|
|
@ -34,14 +34,14 @@ public void Setup()
|
|||
{
|
||||
GivenAudioFiles(_audioFiles, 10);
|
||||
|
||||
Mocker.GetMock<IDiskScanService>().Setup(c => c.GetAudioFiles(It.IsAny<string>(), It.IsAny<bool>()))
|
||||
Mocker.GetMock<IDiskScanService>().Setup(c => c.GetBookFiles(It.IsAny<string>(), It.IsAny<bool>()))
|
||||
.Returns(_audioFiles.Select(x => DiskProvider.GetFileInfo(x)).ToArray());
|
||||
|
||||
Mocker.GetMock<IDiskScanService>().Setup(c => c.FilterFiles(It.IsAny<string>(), It.IsAny<IEnumerable<IFileInfo>>()))
|
||||
.Returns<string, IEnumerable<IFileInfo>>((b, s) => s.ToList());
|
||||
|
||||
Mocker.GetMock<IImportApprovedTracks>()
|
||||
.Setup(s => s.Import(It.IsAny<List<ImportDecision<LocalTrack>>>(), true, null, ImportMode.Auto))
|
||||
Mocker.GetMock<IImportApprovedBooks>()
|
||||
.Setup(s => s.Import(It.IsAny<List<ImportDecision<LocalBook>>>(), true, null, ImportMode.Auto))
|
||||
.Returns(new List<ImportResult>());
|
||||
|
||||
var downloadItem = Builder<DownloadClientItem>.CreateNew()
|
||||
|
|
@ -49,14 +49,14 @@ public void Setup()
|
|||
.With(v => v.Status = DownloadItemStatus.Downloading)
|
||||
.Build();
|
||||
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(v => v.Artist = new Author())
|
||||
var remoteAlbum = Builder<RemoteBook>.CreateNew()
|
||||
.With(v => v.Author = new Author())
|
||||
.Build();
|
||||
|
||||
_trackedDownload = new TrackedDownload
|
||||
{
|
||||
DownloadItem = downloadItem,
|
||||
RemoteAlbum = remoteAlbum,
|
||||
RemoteBook = remoteAlbum,
|
||||
State = TrackedDownloadState.Downloading
|
||||
};
|
||||
}
|
||||
|
|
@ -78,24 +78,24 @@ private void GivenValidArtist()
|
|||
|
||||
private void GivenSuccessfulImport()
|
||||
{
|
||||
var localTrack = new LocalTrack();
|
||||
var localTrack = new LocalBook();
|
||||
|
||||
var imported = new List<ImportDecision<LocalTrack>>();
|
||||
imported.Add(new ImportDecision<LocalTrack>(localTrack));
|
||||
var imported = new List<ImportDecision<LocalBook>>();
|
||||
imported.Add(new ImportDecision<LocalBook>(localTrack));
|
||||
|
||||
Mocker.GetMock<IMakeImportDecision>()
|
||||
.Setup(v => v.GetImportDecisions(It.IsAny<List<IFileInfo>>(), It.IsAny<IdentificationOverrides>(), It.IsAny<ImportDecisionMakerInfo>(), It.IsAny<ImportDecisionMakerConfig>()))
|
||||
.Returns(imported);
|
||||
|
||||
Mocker.GetMock<IImportApprovedTracks>()
|
||||
.Setup(s => s.Import(It.IsAny<List<ImportDecision<LocalTrack>>>(), It.IsAny<bool>(), It.IsAny<DownloadClientItem>(), It.IsAny<ImportMode>()))
|
||||
Mocker.GetMock<IImportApprovedBooks>()
|
||||
.Setup(s => s.Import(It.IsAny<List<ImportDecision<LocalBook>>>(), It.IsAny<bool>(), It.IsAny<DownloadClientItem>(), It.IsAny<ImportMode>()))
|
||||
.Returns(imported.Select(i => new ImportResult(i)).ToList())
|
||||
.Callback(() => WasImportedResponse());
|
||||
}
|
||||
|
||||
private void WasImportedResponse()
|
||||
{
|
||||
Mocker.GetMock<IDiskScanService>().Setup(c => c.GetAudioFiles(It.IsAny<string>(), It.IsAny<bool>()))
|
||||
Mocker.GetMock<IDiskScanService>().Setup(c => c.GetBookFiles(It.IsAny<string>(), It.IsAny<bool>()))
|
||||
.Returns(new IFileInfo[0]);
|
||||
}
|
||||
|
||||
|
|
@ -141,18 +141,18 @@ public void should_not_import_if_folder_is_a_artist_path()
|
|||
{
|
||||
GivenValidArtist();
|
||||
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(s => s.ArtistPathExists(It.IsAny<string>()))
|
||||
Mocker.GetMock<IAuthorService>()
|
||||
.Setup(s => s.AuthorPathExists(It.IsAny<string>()))
|
||||
.Returns(true);
|
||||
|
||||
Mocker.GetMock<IDiskScanService>()
|
||||
.Setup(c => c.GetAudioFiles(It.IsAny<string>(), It.IsAny<bool>()))
|
||||
.Setup(c => c.GetBookFiles(It.IsAny<string>(), It.IsAny<bool>()))
|
||||
.Returns(new IFileInfo[0]);
|
||||
|
||||
Subject.ProcessRootFolder(DiskProvider.GetDirectoryInfo(_droneFactory));
|
||||
|
||||
Mocker.GetMock<IDiskScanService>()
|
||||
.Verify(v => v.GetAudioFiles(It.IsAny<string>(), true), Times.Never());
|
||||
.Verify(v => v.GetBookFiles(It.IsAny<string>(), true), Times.Never());
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
|
@ -160,8 +160,8 @@ public void should_not_import_if_folder_is_a_artist_path()
|
|||
[Test]
|
||||
public void should_not_delete_folder_if_no_files_were_imported()
|
||||
{
|
||||
Mocker.GetMock<IImportApprovedTracks>()
|
||||
.Setup(s => s.Import(It.IsAny<List<ImportDecision<LocalTrack>>>(), false, null, ImportMode.Auto))
|
||||
Mocker.GetMock<IImportApprovedBooks>()
|
||||
.Setup(s => s.Import(It.IsAny<List<ImportDecision<LocalBook>>>(), false, null, ImportMode.Auto))
|
||||
.Returns(new List<ImportResult>());
|
||||
|
||||
Subject.ProcessRootFolder(DiskProvider.GetDirectoryInfo(_droneFactory));
|
||||
|
|
@ -175,17 +175,17 @@ public void should_not_delete_folder_if_files_were_imported_and_audio_files_rema
|
|||
{
|
||||
GivenValidArtist();
|
||||
|
||||
var localTrack = new LocalTrack();
|
||||
var localTrack = new LocalBook();
|
||||
|
||||
var imported = new List<ImportDecision<LocalTrack>>();
|
||||
imported.Add(new ImportDecision<LocalTrack>(localTrack));
|
||||
var imported = new List<ImportDecision<LocalBook>>();
|
||||
imported.Add(new ImportDecision<LocalBook>(localTrack));
|
||||
|
||||
Mocker.GetMock<IMakeImportDecision>()
|
||||
.Setup(v => v.GetImportDecisions(It.IsAny<List<IFileInfo>>(), It.IsAny<IdentificationOverrides>(), It.IsAny<ImportDecisionMakerInfo>(), It.IsAny<ImportDecisionMakerConfig>()))
|
||||
.Returns(imported);
|
||||
|
||||
Mocker.GetMock<IImportApprovedTracks>()
|
||||
.Setup(s => s.Import(It.IsAny<List<ImportDecision<LocalTrack>>>(), true, null, ImportMode.Auto))
|
||||
Mocker.GetMock<IImportApprovedBooks>()
|
||||
.Setup(s => s.Import(It.IsAny<List<ImportDecision<LocalBook>>>(), true, null, ImportMode.Auto))
|
||||
.Returns(imported.Select(i => new ImportResult(i)).ToList());
|
||||
|
||||
Subject.ProcessRootFolder(DiskProvider.GetDirectoryInfo(_droneFactory));
|
||||
|
|
@ -232,17 +232,17 @@ public void should_not_delete_if_there_is_large_rar_file()
|
|||
{
|
||||
GivenValidArtist();
|
||||
|
||||
var localTrack = new LocalTrack();
|
||||
var localTrack = new LocalBook();
|
||||
|
||||
var imported = new List<ImportDecision<LocalTrack>>();
|
||||
imported.Add(new ImportDecision<LocalTrack>(localTrack));
|
||||
var imported = new List<ImportDecision<LocalBook>>();
|
||||
imported.Add(new ImportDecision<LocalBook>(localTrack));
|
||||
|
||||
Mocker.GetMock<IMakeImportDecision>()
|
||||
.Setup(v => v.GetImportDecisions(It.IsAny<List<IFileInfo>>(), It.IsAny<IdentificationOverrides>(), It.IsAny<ImportDecisionMakerInfo>(), It.IsAny<ImportDecisionMakerConfig>()))
|
||||
.Returns(imported);
|
||||
|
||||
Mocker.GetMock<IImportApprovedTracks>()
|
||||
.Setup(s => s.Import(It.IsAny<List<ImportDecision<LocalTrack>>>(), true, null, ImportMode.Auto))
|
||||
Mocker.GetMock<IImportApprovedBooks>()
|
||||
.Setup(s => s.Import(It.IsAny<List<ImportDecision<LocalBook>>>(), true, null, ImportMode.Auto))
|
||||
.Returns(imported.Select(i => new ImportResult(i)).ToList());
|
||||
|
||||
GivenAudioFiles(new[] { _audioFiles.First().Replace(".ext", ".rar") }, 15.Megabytes());
|
||||
|
|
@ -272,17 +272,17 @@ public void should_not_delete_if_no_files_were_imported()
|
|||
{
|
||||
GivenValidArtist();
|
||||
|
||||
var localTrack = new LocalTrack();
|
||||
var localTrack = new LocalBook();
|
||||
|
||||
var imported = new List<ImportDecision<LocalTrack>>();
|
||||
imported.Add(new ImportDecision<LocalTrack>(localTrack));
|
||||
var imported = new List<ImportDecision<LocalBook>>();
|
||||
imported.Add(new ImportDecision<LocalBook>(localTrack));
|
||||
|
||||
Mocker.GetMock<IMakeImportDecision>()
|
||||
.Setup(v => v.GetImportDecisions(It.IsAny<List<IFileInfo>>(), It.IsAny<IdentificationOverrides>(), It.IsAny<ImportDecisionMakerInfo>(), It.IsAny<ImportDecisionMakerConfig>()))
|
||||
.Returns(imported);
|
||||
|
||||
Mocker.GetMock<IImportApprovedTracks>()
|
||||
.Setup(s => s.Import(It.IsAny<List<ImportDecision<LocalTrack>>>(), true, null, ImportMode.Auto))
|
||||
Mocker.GetMock<IImportApprovedBooks>()
|
||||
.Setup(s => s.Import(It.IsAny<List<ImportDecision<LocalBook>>>(), true, null, ImportMode.Auto))
|
||||
.Returns(new List<ImportResult>());
|
||||
|
||||
Subject.ProcessRootFolder(DiskProvider.GetDirectoryInfo(_droneFactory));
|
||||
|
|
@ -302,7 +302,7 @@ public void should_not_delete_folder_after_import()
|
|||
|
||||
_trackedDownload.DownloadItem.CanMoveFiles = false;
|
||||
|
||||
Subject.ProcessPath(_droneFactory, ImportMode.Auto, _trackedDownload.RemoteAlbum.Artist, _trackedDownload.DownloadItem);
|
||||
Subject.ProcessPath(_droneFactory, ImportMode.Auto, _trackedDownload.RemoteBook.Author, _trackedDownload.DownloadItem);
|
||||
|
||||
DiskProvider.FolderExists(_subFolders[0]).Should().BeTrue();
|
||||
}
|
||||
|
|
@ -316,7 +316,7 @@ public void should_delete_folder_if_importmode_move()
|
|||
|
||||
_trackedDownload.DownloadItem.CanMoveFiles = false;
|
||||
|
||||
Subject.ProcessPath(_droneFactory, ImportMode.Move, _trackedDownload.RemoteAlbum.Artist, _trackedDownload.DownloadItem);
|
||||
Subject.ProcessPath(_droneFactory, ImportMode.Move, _trackedDownload.RemoteBook.Author, _trackedDownload.DownloadItem);
|
||||
|
||||
DiskProvider.FolderExists(_subFolders[0]).Should().BeFalse();
|
||||
}
|
||||
|
|
@ -330,20 +330,20 @@ public void should_not_delete_folder_if_importmode_copy()
|
|||
|
||||
_trackedDownload.DownloadItem.CanMoveFiles = true;
|
||||
|
||||
Subject.ProcessPath(_droneFactory, ImportMode.Copy, _trackedDownload.RemoteAlbum.Artist, _trackedDownload.DownloadItem);
|
||||
Subject.ProcessPath(_droneFactory, ImportMode.Copy, _trackedDownload.RemoteBook.Author, _trackedDownload.DownloadItem);
|
||||
|
||||
DiskProvider.FolderExists(_subFolders[0]).Should().BeTrue();
|
||||
}
|
||||
|
||||
private void VerifyNoImport()
|
||||
{
|
||||
Mocker.GetMock<IImportApprovedTracks>().Verify(c => c.Import(It.IsAny<List<ImportDecision<LocalTrack>>>(), true, null, ImportMode.Auto),
|
||||
Mocker.GetMock<IImportApprovedBooks>().Verify(c => c.Import(It.IsAny<List<ImportDecision<LocalBook>>>(), true, null, ImportMode.Auto),
|
||||
Times.Never());
|
||||
}
|
||||
|
||||
private void VerifyImport()
|
||||
{
|
||||
Mocker.GetMock<IImportApprovedTracks>().Verify(c => c.Import(It.IsAny<List<ImportDecision<LocalTrack>>>(), true, null, ImportMode.Auto),
|
||||
Mocker.GetMock<IImportApprovedBooks>().Verify(c => c.Import(It.IsAny<List<ImportDecision<LocalBook>>>(), true, null, ImportMode.Auto),
|
||||
Times.Once());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@
|
|||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.BookImport;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
|
@ -21,18 +21,18 @@
|
|||
namespace NzbDrone.Core.Test.MediaFiles
|
||||
{
|
||||
[TestFixture]
|
||||
public class ImportApprovedTracksFixture : CoreTest<ImportApprovedTracks>
|
||||
public class ImportApprovedTracksFixture : CoreTest<ImportApprovedBooks>
|
||||
{
|
||||
private List<ImportDecision<LocalTrack>> _rejectedDecisions;
|
||||
private List<ImportDecision<LocalTrack>> _approvedDecisions;
|
||||
private List<ImportDecision<LocalBook>> _rejectedDecisions;
|
||||
private List<ImportDecision<LocalBook>> _approvedDecisions;
|
||||
|
||||
private DownloadClientItem _downloadClientItem;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_rejectedDecisions = new List<ImportDecision<LocalTrack>>();
|
||||
_approvedDecisions = new List<ImportDecision<LocalTrack>>();
|
||||
_rejectedDecisions = new List<ImportDecision<LocalBook>>();
|
||||
_approvedDecisions = new List<ImportDecision<LocalBook>>();
|
||||
|
||||
var artist = Builder<Author>.CreateNew()
|
||||
.With(e => e.QualityProfile = new QualityProfile { Items = Qualities.QualityFixture.GetDefaultQualities() })
|
||||
|
|
@ -43,15 +43,15 @@ public void Setup()
|
|||
.With(e => e.Author = artist)
|
||||
.Build();
|
||||
|
||||
_rejectedDecisions.Add(new ImportDecision<LocalTrack>(new LocalTrack(), new Rejection("Rejected!")));
|
||||
_rejectedDecisions.Add(new ImportDecision<LocalTrack>(new LocalTrack(), new Rejection("Rejected!")));
|
||||
_rejectedDecisions.Add(new ImportDecision<LocalTrack>(new LocalTrack(), new Rejection("Rejected!")));
|
||||
_rejectedDecisions.Add(new ImportDecision<LocalBook>(new LocalBook(), new Rejection("Rejected!")));
|
||||
_rejectedDecisions.Add(new ImportDecision<LocalBook>(new LocalBook(), new Rejection("Rejected!")));
|
||||
_rejectedDecisions.Add(new ImportDecision<LocalBook>(new LocalBook(), new Rejection("Rejected!")));
|
||||
|
||||
_approvedDecisions.Add(new ImportDecision<LocalTrack>(
|
||||
new LocalTrack
|
||||
_approvedDecisions.Add(new ImportDecision<LocalBook>(
|
||||
new LocalBook
|
||||
{
|
||||
Artist = artist,
|
||||
Album = album,
|
||||
Author = artist,
|
||||
Book = album,
|
||||
Path = Path.Combine(artist.Path, "Alien Ant Farm - 01 - Pilot.mp3"),
|
||||
Quality = new QualityModel(Quality.MP3_320),
|
||||
FileTrackInfo = new ParsedTrackInfo
|
||||
|
|
@ -61,13 +61,13 @@ public void Setup()
|
|||
}));
|
||||
|
||||
Mocker.GetMock<IUpgradeMediaFiles>()
|
||||
.Setup(s => s.UpgradeTrackFile(It.IsAny<BookFile>(), It.IsAny<LocalTrack>(), It.IsAny<bool>()))
|
||||
.Returns(new TrackFileMoveResult());
|
||||
.Setup(s => s.UpgradeBookFile(It.IsAny<BookFile>(), It.IsAny<LocalBook>(), It.IsAny<bool>()))
|
||||
.Returns(new BookFileMoveResult());
|
||||
|
||||
_downloadClientItem = Builder<DownloadClientItem>.CreateNew().Build();
|
||||
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Setup(s => s.GetFilesByAlbum(It.IsAny<int>()))
|
||||
.Setup(s => s.GetFilesByBook(It.IsAny<int>()))
|
||||
.Returns(new List<BookFile>());
|
||||
}
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ public void should_import_each_approved()
|
|||
[Test]
|
||||
public void should_only_import_approved()
|
||||
{
|
||||
var all = new List<ImportDecision<LocalTrack>>();
|
||||
var all = new List<ImportDecision<LocalBook>>();
|
||||
all.AddRange(_rejectedDecisions);
|
||||
all.AddRange(_approvedDecisions);
|
||||
|
||||
|
|
@ -101,9 +101,9 @@ public void should_only_import_approved()
|
|||
[Test]
|
||||
public void should_only_import_each_track_once()
|
||||
{
|
||||
var all = new List<ImportDecision<LocalTrack>>();
|
||||
var all = new List<ImportDecision<LocalBook>>();
|
||||
all.AddRange(_approvedDecisions);
|
||||
all.Add(new ImportDecision<LocalTrack>(_approvedDecisions.First().Item));
|
||||
all.Add(new ImportDecision<LocalBook>(_approvedDecisions.First().Item));
|
||||
|
||||
var result = Subject.Import(all, false);
|
||||
|
||||
|
|
@ -113,17 +113,17 @@ public void should_only_import_each_track_once()
|
|||
[Test]
|
||||
public void should_move_new_downloads()
|
||||
{
|
||||
Subject.Import(new List<ImportDecision<LocalTrack>> { _approvedDecisions.First() }, true);
|
||||
Subject.Import(new List<ImportDecision<LocalBook>> { _approvedDecisions.First() }, true);
|
||||
|
||||
Mocker.GetMock<IUpgradeMediaFiles>()
|
||||
.Verify(v => v.UpgradeTrackFile(It.IsAny<BookFile>(), _approvedDecisions.First().Item, false),
|
||||
.Verify(v => v.UpgradeBookFile(It.IsAny<BookFile>(), _approvedDecisions.First().Item, false),
|
||||
Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_publish_TrackImportedEvent_for_new_downloads()
|
||||
{
|
||||
Subject.Import(new List<ImportDecision<LocalTrack>> { _approvedDecisions.First() }, true);
|
||||
Subject.Import(new List<ImportDecision<LocalBook>> { _approvedDecisions.First() }, true);
|
||||
|
||||
Mocker.GetMock<IEventAggregator>()
|
||||
.Verify(v => v.PublishEvent(It.IsAny<TrackImportedEvent>()), Times.Once());
|
||||
|
|
@ -134,10 +134,10 @@ public void should_not_move_existing_files()
|
|||
{
|
||||
var track = _approvedDecisions.First();
|
||||
track.Item.ExistingFile = true;
|
||||
Subject.Import(new List<ImportDecision<LocalTrack>> { track }, false);
|
||||
Subject.Import(new List<ImportDecision<LocalBook>> { track }, false);
|
||||
|
||||
Mocker.GetMock<IUpgradeMediaFiles>()
|
||||
.Verify(v => v.UpgradeTrackFile(It.IsAny<BookFile>(), _approvedDecisions.First().Item, false),
|
||||
.Verify(v => v.UpgradeBookFile(It.IsAny<BookFile>(), _approvedDecisions.First().Item, false),
|
||||
Times.Never());
|
||||
}
|
||||
|
||||
|
|
@ -147,17 +147,17 @@ public void should_import_larger_files_first()
|
|||
var fileDecision = _approvedDecisions.First();
|
||||
fileDecision.Item.Size = 1.Gigabytes();
|
||||
|
||||
var sampleDecision = new ImportDecision<LocalTrack>(
|
||||
new LocalTrack
|
||||
var sampleDecision = new ImportDecision<LocalBook>(
|
||||
new LocalBook
|
||||
{
|
||||
Artist = fileDecision.Item.Artist,
|
||||
Album = fileDecision.Item.Album,
|
||||
Author = fileDecision.Item.Author,
|
||||
Book = fileDecision.Item.Book,
|
||||
Path = @"C:\Test\Music\Alien Ant Farm\Alien Ant Farm - 01 - Pilot.mp3".AsOsAgnostic(),
|
||||
Quality = new QualityModel(Quality.MP3_320),
|
||||
Size = 80.Megabytes()
|
||||
});
|
||||
|
||||
var all = new List<ImportDecision<LocalTrack>>();
|
||||
var all = new List<ImportDecision<LocalBook>>();
|
||||
all.Add(fileDecision);
|
||||
all.Add(sampleDecision);
|
||||
|
||||
|
|
@ -171,19 +171,19 @@ public void should_import_larger_files_first()
|
|||
[Test]
|
||||
public void should_copy_when_cannot_move_files_downloads()
|
||||
{
|
||||
Subject.Import(new List<ImportDecision<LocalTrack>> { _approvedDecisions.First() }, true, new DownloadClientItem { Title = "Alien.Ant.Farm-Truant", CanMoveFiles = false });
|
||||
Subject.Import(new List<ImportDecision<LocalBook>> { _approvedDecisions.First() }, true, new DownloadClientItem { Title = "Alien.Ant.Farm-Truant", CanMoveFiles = false });
|
||||
|
||||
Mocker.GetMock<IUpgradeMediaFiles>()
|
||||
.Verify(v => v.UpgradeTrackFile(It.IsAny<BookFile>(), _approvedDecisions.First().Item, true), Times.Once());
|
||||
.Verify(v => v.UpgradeBookFile(It.IsAny<BookFile>(), _approvedDecisions.First().Item, true), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_use_override_importmode()
|
||||
{
|
||||
Subject.Import(new List<ImportDecision<LocalTrack>> { _approvedDecisions.First() }, true, new DownloadClientItem { Title = "Alien.Ant.Farm-Truant", CanMoveFiles = false }, ImportMode.Move);
|
||||
Subject.Import(new List<ImportDecision<LocalBook>> { _approvedDecisions.First() }, true, new DownloadClientItem { Title = "Alien.Ant.Farm-Truant", CanMoveFiles = false }, ImportMode.Move);
|
||||
|
||||
Mocker.GetMock<IUpgradeMediaFiles>()
|
||||
.Verify(v => v.UpgradeTrackFile(It.IsAny<BookFile>(), _approvedDecisions.First().Item, false), Times.Once());
|
||||
.Verify(v => v.UpgradeBookFile(It.IsAny<BookFile>(), _approvedDecisions.First().Item, false), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -195,7 +195,7 @@ public void should_delete_existing_trackfiles_with_the_same_path()
|
|||
|
||||
var track = _approvedDecisions.First();
|
||||
track.Item.ExistingFile = true;
|
||||
Subject.Import(new List<ImportDecision<LocalTrack>> { track }, false);
|
||||
Subject.Import(new List<ImportDecision<LocalBook>> { track }, false);
|
||||
|
||||
Mocker.GetMock<IMediaFileService>()
|
||||
.Verify(v => v.Delete(It.IsAny<BookFile>(), DeleteMediaFileReason.ManualOverride), Times.Once());
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Exceptions;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
|
@ -55,10 +55,10 @@ public void Setup()
|
|||
public void get_files_by_artist()
|
||||
{
|
||||
VerifyData();
|
||||
var artistFiles = Subject.GetFilesByArtist(_artist.Id);
|
||||
var artistFiles = Subject.GetFilesByAuthor(_artist.Id);
|
||||
VerifyEagerLoaded(artistFiles);
|
||||
|
||||
artistFiles.Should().OnlyContain(c => c.Artist.Value.Id == _artist.Id);
|
||||
artistFiles.Should().OnlyContain(c => c.Author.Value.Id == _artist.Id);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -109,17 +109,17 @@ public void get_file_by_path()
|
|||
var file = Subject.GetFileWithPath(@"C:\Test\Path\Artist\somefile2.flac".AsOsAgnostic());
|
||||
|
||||
file.Should().NotBeNull();
|
||||
file.Album.IsLoaded.Should().BeTrue();
|
||||
file.Album.Value.Should().NotBeNull();
|
||||
file.Artist.IsLoaded.Should().BeTrue();
|
||||
file.Artist.Value.Should().NotBeNull();
|
||||
file.Book.IsLoaded.Should().BeTrue();
|
||||
file.Book.Value.Should().NotBeNull();
|
||||
file.Author.IsLoaded.Should().BeTrue();
|
||||
file.Author.Value.Should().NotBeNull();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void get_files_by_album()
|
||||
{
|
||||
VerifyData();
|
||||
var files = Subject.GetFilesByAlbum(_album.Id);
|
||||
var files = Subject.GetFilesByBook(_album.Id);
|
||||
VerifyEagerLoaded(files);
|
||||
|
||||
files.Should().OnlyContain(c => c.BookId == _album.Id);
|
||||
|
|
@ -136,12 +136,12 @@ private void VerifyEagerLoaded(List<BookFile> files)
|
|||
{
|
||||
foreach (var file in files)
|
||||
{
|
||||
file.Album.IsLoaded.Should().BeTrue();
|
||||
file.Album.Value.Should().NotBeNull();
|
||||
file.Artist.IsLoaded.Should().BeTrue();
|
||||
file.Artist.Value.Should().NotBeNull();
|
||||
file.Artist.Value.Metadata.IsLoaded.Should().BeTrue();
|
||||
file.Artist.Value.Metadata.Value.Should().NotBeNull();
|
||||
file.Book.IsLoaded.Should().BeTrue();
|
||||
file.Book.Value.Should().NotBeNull();
|
||||
file.Author.IsLoaded.Should().BeTrue();
|
||||
file.Author.Value.Should().NotBeNull();
|
||||
file.Author.Value.Metadata.IsLoaded.Should().BeTrue();
|
||||
file.Author.Value.Metadata.Value.Should().NotBeNull();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -149,10 +149,10 @@ private void VerifyUnmapped(List<BookFile> files)
|
|||
{
|
||||
foreach (var file in files)
|
||||
{
|
||||
file.Album.IsLoaded.Should().BeFalse();
|
||||
file.Album.Value.Should().BeNull();
|
||||
file.Artist.IsLoaded.Should().BeFalse();
|
||||
file.Artist.Value.Should().BeNull();
|
||||
file.Book.IsLoaded.Should().BeFalse();
|
||||
file.Book.Value.Should().BeNull();
|
||||
file.Author.IsLoaded.Should().BeFalse();
|
||||
file.Author.Value.Should().BeNull();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -160,7 +160,7 @@ private void VerifyUnmapped(List<BookFile> files)
|
|||
public void delete_files_by_album_should_work_if_join_fails()
|
||||
{
|
||||
Db.Delete(_album);
|
||||
Subject.DeleteFilesByAlbum(_album.Id);
|
||||
Subject.DeleteFilesByBook(_album.Id);
|
||||
|
||||
Db.All<BookFile>().Where(x => x.BookId == _album.Id).Should().HaveCount(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@
|
|||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
|
|
@ -213,7 +213,7 @@ public void filter_unmatched_should_return_existing_file_if_unmatched(FilterFile
|
|||
Path = "C:\\file2.avi".AsOsAgnostic(),
|
||||
Size = 10,
|
||||
Modified = _lastWrite,
|
||||
Album = new LazyLoaded<Book>(null)
|
||||
Book = new LazyLoaded<Book>(null)
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -239,7 +239,7 @@ public void filter_unmatched_should_not_return_existing_file_if_matched(FilterFi
|
|||
Path = "C:\\file2.avi".AsOsAgnostic(),
|
||||
Size = 10,
|
||||
Modified = _lastWrite,
|
||||
Album = Builder<Book>.CreateNew().Build()
|
||||
Book = Builder<Book>.CreateNew().Build()
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
using FizzWare.NBuilder;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.MediaFiles.TrackFileMovingServiceTests
|
||||
|
|
@ -35,7 +35,7 @@ public void should_throw_trackFileDeletedEvent_for_each_mapped_track_on_deletema
|
|||
{
|
||||
Subject.DeleteMany(_trackFiles, DeleteMediaFileReason.Manual);
|
||||
|
||||
VerifyEventPublished<TrackFileDeletedEvent>(Times.Exactly(2));
|
||||
VerifyEventPublished<BookFileDeletedEvent>(Times.Exactly(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -43,7 +43,7 @@ public void should_throw_trackFileDeletedEvent_for_mapped_track_on_delete()
|
|||
{
|
||||
Subject.Delete(_trackFiles[0], DeleteMediaFileReason.Manual);
|
||||
|
||||
VerifyEventPublished<TrackFileDeletedEvent>(Times.Once());
|
||||
VerifyEventPublished<BookFileDeletedEvent>(Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -51,7 +51,7 @@ public void should_throw_trackFileAddedEvent_for_each_track_added_on_addmany()
|
|||
{
|
||||
Subject.AddMany(_trackFiles);
|
||||
|
||||
VerifyEventPublished<TrackFileAddedEvent>(Times.Exactly(3));
|
||||
VerifyEventPublished<BookFileAddedEvent>(Times.Exactly(3));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -59,7 +59,7 @@ public void should_throw_trackFileAddedEvent_for_track_added()
|
|||
{
|
||||
Subject.Add(_trackFiles[0]);
|
||||
|
||||
VerifyEventPublished<TrackFileAddedEvent>(Times.Once());
|
||||
VerifyEventPublished<BookFileAddedEvent>(Times.Once());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,8 +4,8 @@
|
|||
using FizzWare.NBuilder;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,16 +3,16 @@
|
|||
using FizzWare.NBuilder;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.Commands;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.MediaFiles
|
||||
{
|
||||
public class RenameTrackFileServiceFixture : CoreTest<RenameTrackFileService>
|
||||
public class RenameTrackFileServiceFixture : CoreTest<RenameBookFileService>
|
||||
{
|
||||
private Author _artist;
|
||||
private List<BookFile> _trackFiles;
|
||||
|
|
@ -25,12 +25,12 @@ public void Setup()
|
|||
|
||||
_trackFiles = Builder<BookFile>.CreateListOfSize(2)
|
||||
.All()
|
||||
.With(e => e.Artist = _artist)
|
||||
.With(e => e.Author = _artist)
|
||||
.Build()
|
||||
.ToList();
|
||||
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(s => s.GetArtist(_artist.Id))
|
||||
Mocker.GetMock<IAuthorService>()
|
||||
.Setup(s => s.GetAuthor(_artist.Id))
|
||||
.Returns(_artist);
|
||||
}
|
||||
|
||||
|
|
@ -50,8 +50,8 @@ private void GivenTrackFiles()
|
|||
|
||||
private void GivenMovedFiles()
|
||||
{
|
||||
Mocker.GetMock<IMoveTrackFiles>()
|
||||
.Setup(s => s.MoveTrackFile(It.IsAny<BookFile>(), _artist));
|
||||
Mocker.GetMock<IMoveBookFiles>()
|
||||
.Setup(s => s.MoveBookFile(It.IsAny<BookFile>(), _artist));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -62,7 +62,7 @@ public void should_not_publish_event_if_no_files_to_rename()
|
|||
Subject.Execute(new RenameFilesCommand(_artist.Id, new List<int> { 1 }));
|
||||
|
||||
Mocker.GetMock<IEventAggregator>()
|
||||
.Verify(v => v.PublishEvent(It.IsAny<ArtistRenamedEvent>()), Times.Never());
|
||||
.Verify(v => v.PublishEvent(It.IsAny<AuthorRenamedEvent>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -70,14 +70,14 @@ public void should_not_publish_event_if_no_files_are_renamed()
|
|||
{
|
||||
GivenTrackFiles();
|
||||
|
||||
Mocker.GetMock<IMoveTrackFiles>()
|
||||
.Setup(s => s.MoveTrackFile(It.IsAny<BookFile>(), It.IsAny<Author>()))
|
||||
Mocker.GetMock<IMoveBookFiles>()
|
||||
.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 }));
|
||||
|
||||
Mocker.GetMock<IEventAggregator>()
|
||||
.Verify(v => v.PublishEvent(It.IsAny<ArtistRenamedEvent>()), Times.Never());
|
||||
.Verify(v => v.PublishEvent(It.IsAny<AuthorRenamedEvent>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -89,7 +89,7 @@ public void should_publish_event_if_files_are_renamed()
|
|||
Subject.Execute(new RenameFilesCommand(_artist.Id, new List<int> { 1 }));
|
||||
|
||||
Mocker.GetMock<IEventAggregator>()
|
||||
.Verify(v => v.PublishEvent(It.IsAny<ArtistRenamedEvent>()), Times.Once());
|
||||
.Verify(v => v.PublishEvent(It.IsAny<AuthorRenamedEvent>()), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@
|
|||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.Events;
|
||||
using NzbDrone.Core.Messaging.Events;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Organizer;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
|
@ -19,11 +19,11 @@
|
|||
namespace NzbDrone.Core.Test.MediaFiles.TrackFileMovingServiceTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class MoveTrackFileFixture : CoreTest<TrackFileMovingService>
|
||||
public class MoveTrackFileFixture : CoreTest<BookFileMovingService>
|
||||
{
|
||||
private Author _artist;
|
||||
private BookFile _trackFile;
|
||||
private LocalTrack _localtrack;
|
||||
private LocalBook _localtrack;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
|
|
@ -37,21 +37,21 @@ public void Setup()
|
|||
.With(f => f.Path = Path.Combine(_artist.Path, @"Album\File.mp3"))
|
||||
.Build();
|
||||
|
||||
_localtrack = Builder<LocalTrack>.CreateNew()
|
||||
.With(l => l.Artist = _artist)
|
||||
.With(l => l.Album = Builder<Book>.CreateNew().Build())
|
||||
_localtrack = Builder<LocalBook>.CreateNew()
|
||||
.With(l => l.Author = _artist)
|
||||
.With(l => l.Book = Builder<Book>.CreateNew().Build())
|
||||
.Build();
|
||||
|
||||
Mocker.GetMock<IBuildFileNames>()
|
||||
.Setup(s => s.BuildTrackFileName(It.IsAny<Author>(), It.IsAny<Book>(), It.IsAny<BookFile>(), null, null))
|
||||
.Setup(s => s.BuildBookFileName(It.IsAny<Author>(), It.IsAny<Book>(), It.IsAny<BookFile>(), null, null))
|
||||
.Returns("File Name");
|
||||
|
||||
Mocker.GetMock<IBuildFileNames>()
|
||||
.Setup(s => s.BuildTrackFilePath(It.IsAny<Author>(), It.IsAny<Book>(), It.IsAny<string>(), It.IsAny<string>()))
|
||||
.Setup(s => s.BuildBookFilePath(It.IsAny<Author>(), It.IsAny<Book>(), It.IsAny<string>(), It.IsAny<string>()))
|
||||
.Returns(@"C:\Test\Music\Artist\Album\File Name.mp3".AsOsAgnostic());
|
||||
|
||||
Mocker.GetMock<IBuildFileNames>()
|
||||
.Setup(s => s.BuildAlbumPath(It.IsAny<Author>(), It.IsAny<Book>()))
|
||||
.Setup(s => s.BuildBookPath(It.IsAny<Author>(), It.IsAny<Book>()))
|
||||
.Returns(@"C:\Test\Music\Artist\Album".AsOsAgnostic());
|
||||
|
||||
var rootFolder = @"C:\Test\Music\".AsOsAgnostic();
|
||||
|
|
@ -73,7 +73,7 @@ public void should_catch_UnauthorizedAccessException_during_folder_inheritance()
|
|||
.Setup(s => s.InheritFolderPermissions(It.IsAny<string>()))
|
||||
.Throws<UnauthorizedAccessException>();
|
||||
|
||||
Subject.MoveTrackFile(_trackFile, _localtrack);
|
||||
Subject.MoveBookFile(_trackFile, _localtrack);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -85,27 +85,27 @@ public void should_catch_InvalidOperationException_during_folder_inheritance()
|
|||
.Setup(s => s.InheritFolderPermissions(It.IsAny<string>()))
|
||||
.Throws<InvalidOperationException>();
|
||||
|
||||
Subject.MoveTrackFile(_trackFile, _localtrack);
|
||||
Subject.MoveBookFile(_trackFile, _localtrack);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_notify_on_artist_folder_creation()
|
||||
{
|
||||
Subject.MoveTrackFile(_trackFile, _localtrack);
|
||||
Subject.MoveBookFile(_trackFile, _localtrack);
|
||||
|
||||
Mocker.GetMock<IEventAggregator>()
|
||||
.Verify(s => s.PublishEvent<TrackFolderCreatedEvent>(It.Is<TrackFolderCreatedEvent>(p =>
|
||||
p.ArtistFolder.IsNotNullOrWhiteSpace())), Times.Once());
|
||||
p.AuthorFolder.IsNotNullOrWhiteSpace())), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_notify_on_album_folder_creation()
|
||||
{
|
||||
Subject.MoveTrackFile(_trackFile, _localtrack);
|
||||
Subject.MoveBookFile(_trackFile, _localtrack);
|
||||
|
||||
Mocker.GetMock<IEventAggregator>()
|
||||
.Verify(s => s.PublishEvent<TrackFolderCreatedEvent>(It.Is<TrackFolderCreatedEvent>(p =>
|
||||
p.AlbumFolder.IsNotNullOrWhiteSpace())), Times.Once());
|
||||
p.BookFolder.IsNotNullOrWhiteSpace())), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -115,11 +115,11 @@ public void should_not_notify_if_artist_folder_already_exists()
|
|||
.Setup(s => s.FolderExists(_artist.Path))
|
||||
.Returns(true);
|
||||
|
||||
Subject.MoveTrackFile(_trackFile, _localtrack);
|
||||
Subject.MoveBookFile(_trackFile, _localtrack);
|
||||
|
||||
Mocker.GetMock<IEventAggregator>()
|
||||
.Verify(s => s.PublishEvent<TrackFolderCreatedEvent>(It.Is<TrackFolderCreatedEvent>(p =>
|
||||
p.ArtistFolder.IsNotNullOrWhiteSpace())), Times.Never());
|
||||
p.AuthorFolder.IsNotNullOrWhiteSpace())), Times.Never());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,19 +5,19 @@
|
|||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport.Aggregation.Aggregators;
|
||||
using NzbDrone.Core.MediaFiles.BookImport.Aggregation.Aggregators;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Aggregation.Aggregators
|
||||
namespace NzbDrone.Core.Test.MediaFiles.BookImport.Aggregation.Aggregators
|
||||
{
|
||||
[TestFixture]
|
||||
public class AggregateFilenameInfoFixture : CoreTest<AggregateFilenameInfo>
|
||||
{
|
||||
private LocalAlbumRelease GivenTracks(List<string> files, string root)
|
||||
{
|
||||
var tracks = files.Select(x => new LocalTrack
|
||||
var tracks = files.Select(x => new LocalBook
|
||||
{
|
||||
Path = Path.Combine(root, x),
|
||||
FileTrackInfo = new ParsedTrackInfo
|
||||
|
|
@ -28,7 +28,7 @@ private LocalAlbumRelease GivenTracks(List<string> files, string root)
|
|||
return new LocalAlbumRelease(tracks);
|
||||
}
|
||||
|
||||
private void VerifyData(LocalTrack track, string artist, string title, int trackNum, int disc)
|
||||
private void VerifyData(LocalBook track, string artist, string title, int trackNum, int disc)
|
||||
{
|
||||
track.FileTrackInfo.ArtistTitle.Should().Be(artist);
|
||||
track.FileTrackInfo.Title.Should().Be(title);
|
||||
|
|
@ -49,10 +49,10 @@ public void should_aggregate_filenames_example()
|
|||
|
||||
Subject.Aggregate(release, true);
|
||||
|
||||
VerifyData(release.LocalTracks[0], "Adele", "Daydreamer", 1, 1);
|
||||
VerifyData(release.LocalTracks[1], "Adele", "Best for Last", 2, 1);
|
||||
VerifyData(release.LocalTracks[2], "Adele", "Chasing Pavements", 3, 1);
|
||||
VerifyData(release.LocalTracks[3], "Adele", "That's It, I Quit, I'm Moving On", 3, 2);
|
||||
VerifyData(release.LocalBooks[0], "Adele", "Daydreamer", 1, 1);
|
||||
VerifyData(release.LocalBooks[1], "Adele", "Best for Last", 2, 1);
|
||||
VerifyData(release.LocalBooks[2], "Adele", "Chasing Pavements", 3, 1);
|
||||
VerifyData(release.LocalBooks[3], "Adele", "That's It, I Quit, I'm Moving On", 3, 2);
|
||||
}
|
||||
|
||||
public static class TestCaseFactory
|
||||
|
|
@ -159,7 +159,7 @@ private List<string> GivenFilenames(string[] fields, string fieldSeparator, stri
|
|||
return outp;
|
||||
}
|
||||
|
||||
private void VerifyDataAuto(List<LocalTrack> tracks, string[] tokens, string whitespace)
|
||||
private void VerifyDataAuto(List<LocalBook> tracks, string[] tokens, string whitespace)
|
||||
{
|
||||
for (int i = 1; i <= tracks.Count; i++)
|
||||
{
|
||||
|
|
@ -200,7 +200,7 @@ public void should_aggregate_filenames_auto(Tuple<string[], string, string> test
|
|||
|
||||
Subject.Aggregate(release, true);
|
||||
|
||||
VerifyDataAuto(release.LocalTracks, testcase.Item1, testcase.Item3);
|
||||
VerifyDataAuto(release.LocalBooks, testcase.Item1, testcase.Item3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport.Identification;
|
||||
using NzbDrone.Core.MediaFiles.BookImport.Identification;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Identification
|
||||
namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
{
|
||||
[TestFixture]
|
||||
public class DistanceFixture : TestBase
|
||||
|
|
|
|||
|
|
@ -8,32 +8,32 @@
|
|||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Serializer;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Books.Commands;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.ImportLists.Exclusions;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport.Aggregation;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport.Aggregation.Aggregators;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport.Identification;
|
||||
using NzbDrone.Core.MediaFiles.BookImport;
|
||||
using NzbDrone.Core.MediaFiles.BookImport.Aggregation;
|
||||
using NzbDrone.Core.MediaFiles.BookImport.Aggregation.Aggregators;
|
||||
using NzbDrone.Core.MediaFiles.BookImport.Identification;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using NzbDrone.Core.MetadataSource.SkyHook;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Music.Commands;
|
||||
using NzbDrone.Core.Parser;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles.Metadata;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Identification
|
||||
namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
{
|
||||
[TestFixture]
|
||||
public class IdentificationServiceFixture : DbTest
|
||||
{
|
||||
private ArtistService _artistService;
|
||||
private AddArtistService _addArtistService;
|
||||
private RefreshArtistService _refreshArtistService;
|
||||
private AuthorService _authorService;
|
||||
private AddArtistService _addAuthorService;
|
||||
private RefreshAuthorService _refreshArtistService;
|
||||
|
||||
private IdentificationService _Subject;
|
||||
|
||||
|
|
@ -43,18 +43,18 @@ public void SetUp()
|
|||
UseRealHttp();
|
||||
|
||||
// Resolve all the parts we need
|
||||
Mocker.SetConstant<IArtistRepository>(Mocker.Resolve<ArtistRepository>());
|
||||
Mocker.SetConstant<IArtistMetadataRepository>(Mocker.Resolve<ArtistMetadataRepository>());
|
||||
Mocker.SetConstant<IAlbumRepository>(Mocker.Resolve<AlbumRepository>());
|
||||
Mocker.SetConstant<IAuthorRepository>(Mocker.Resolve<AuthorRepository>());
|
||||
Mocker.SetConstant<IAuthorMetadataRepository>(Mocker.Resolve<AuthorMetadataRepository>());
|
||||
Mocker.SetConstant<IBookRepository>(Mocker.Resolve<BookRepository>());
|
||||
Mocker.SetConstant<IImportListExclusionRepository>(Mocker.Resolve<ImportListExclusionRepository>());
|
||||
Mocker.SetConstant<IMediaFileRepository>(Mocker.Resolve<MediaFileRepository>());
|
||||
|
||||
Mocker.GetMock<IMetadataProfileService>().Setup(x => x.Exists(It.IsAny<int>())).Returns(true);
|
||||
|
||||
_artistService = Mocker.Resolve<ArtistService>();
|
||||
Mocker.SetConstant<IArtistService>(_artistService);
|
||||
Mocker.SetConstant<IArtistMetadataService>(Mocker.Resolve<ArtistMetadataService>());
|
||||
Mocker.SetConstant<IAlbumService>(Mocker.Resolve<AlbumService>());
|
||||
_authorService = Mocker.Resolve<AuthorService>();
|
||||
Mocker.SetConstant<IAuthorService>(_authorService);
|
||||
Mocker.SetConstant<IAuthorMetadataService>(Mocker.Resolve<AuthorMetadataService>());
|
||||
Mocker.SetConstant<IBookService>(Mocker.Resolve<BookService>());
|
||||
Mocker.SetConstant<IImportListExclusionService>(Mocker.Resolve<ImportListExclusionService>());
|
||||
Mocker.SetConstant<IMediaFileService>(Mocker.Resolve<MediaFileService>());
|
||||
|
||||
|
|
@ -62,12 +62,12 @@ public void SetUp()
|
|||
Mocker.SetConstant<IProvideAuthorInfo>(Mocker.Resolve<SkyHookProxy>());
|
||||
Mocker.SetConstant<IProvideBookInfo>(Mocker.Resolve<SkyHookProxy>());
|
||||
|
||||
_addArtistService = Mocker.Resolve<AddArtistService>();
|
||||
_addAuthorService = Mocker.Resolve<AddArtistService>();
|
||||
|
||||
Mocker.SetConstant<IRefreshAlbumService>(Mocker.Resolve<RefreshAlbumService>());
|
||||
_refreshArtistService = Mocker.Resolve<RefreshArtistService>();
|
||||
Mocker.SetConstant<IRefreshBookService>(Mocker.Resolve<RefreshBookService>());
|
||||
_refreshArtistService = Mocker.Resolve<RefreshAuthorService>();
|
||||
|
||||
Mocker.GetMock<IAddArtistValidator>().Setup(x => x.Validate(It.IsAny<Author>())).Returns(new ValidationResult());
|
||||
Mocker.GetMock<IAddAuthorValidator>().Setup(x => x.Validate(It.IsAny<Author>())).Returns(new ValidationResult());
|
||||
|
||||
Mocker.SetConstant<ITrackGroupingService>(Mocker.Resolve<TrackGroupingService>());
|
||||
Mocker.SetConstant<ICandidateService>(Mocker.Resolve<CandidateService>());
|
||||
|
|
@ -88,7 +88,7 @@ private void GivenMetadataProfile(MetadataProfile profile)
|
|||
Mocker.GetMock<IMetadataProfileService>().Setup(x => x.Get(profile.Id)).Returns(profile);
|
||||
}
|
||||
|
||||
private List<Author> GivenArtists(List<ArtistTestCase> artists)
|
||||
private List<Author> GivenArtists(List<AuthorTestCase> artists)
|
||||
{
|
||||
var outp = new List<Author>();
|
||||
for (int i = 0; i < artists.Count; i++)
|
||||
|
|
@ -96,7 +96,7 @@ private List<Author> GivenArtists(List<ArtistTestCase> artists)
|
|||
var meta = artists[i].MetadataProfile;
|
||||
meta.Id = i + 1;
|
||||
GivenMetadataProfile(meta);
|
||||
outp.Add(GivenArtist(artists[i].Artist, meta.Id));
|
||||
outp.Add(GivenArtist(artists[i].Author, meta.Id));
|
||||
}
|
||||
|
||||
return outp;
|
||||
|
|
@ -104,7 +104,7 @@ private List<Author> GivenArtists(List<ArtistTestCase> artists)
|
|||
|
||||
private Author GivenArtist(string foreignAuthorId, int metadataProfileId)
|
||||
{
|
||||
var artist = _addArtistService.AddArtist(new Author
|
||||
var artist = _addAuthorService.AddAuthor(new Author
|
||||
{
|
||||
Metadata = new AuthorMetadata
|
||||
{
|
||||
|
|
@ -114,7 +114,7 @@ private Author GivenArtist(string foreignAuthorId, int metadataProfileId)
|
|||
MetadataProfileId = metadataProfileId
|
||||
});
|
||||
|
||||
var command = new RefreshArtistCommand
|
||||
var command = new RefreshAuthorCommand
|
||||
{
|
||||
AuthorId = artist.Id,
|
||||
Trigger = CommandTrigger.Unspecified
|
||||
|
|
@ -122,7 +122,7 @@ private Author GivenArtist(string foreignAuthorId, int metadataProfileId)
|
|||
|
||||
_refreshArtistService.Execute(command);
|
||||
|
||||
return _artistService.FindById(foreignAuthorId);
|
||||
return _authorService.FindById(foreignAuthorId);
|
||||
}
|
||||
|
||||
private void GivenFingerprints(List<AcoustIdTestCase> fingerprints)
|
||||
|
|
@ -131,8 +131,8 @@ private void GivenFingerprints(List<AcoustIdTestCase> fingerprints)
|
|||
Mocker.GetMock<IFingerprintingService>().Setup(x => x.IsSetup()).Returns(true);
|
||||
|
||||
Mocker.GetMock<IFingerprintingService>()
|
||||
.Setup(x => x.Lookup(It.IsAny<List<LocalTrack>>(), It.IsAny<double>()))
|
||||
.Callback((List<LocalTrack> track, double thres) =>
|
||||
.Setup(x => x.Lookup(It.IsAny<List<LocalBook>>(), It.IsAny<double>()))
|
||||
.Callback((List<LocalBook> track, double thres) =>
|
||||
{
|
||||
track.ForEach(x => x.AcoustIdResults = fingerprints.SingleOrDefault(f => f.Path == x.Path).AcoustIdResults);
|
||||
});
|
||||
|
|
@ -172,11 +172,11 @@ public void should_match_tracks(string file)
|
|||
var path = Path.Combine(TestContext.CurrentContext.TestDirectory, "Files", "Identification", file);
|
||||
var testcase = JsonConvert.DeserializeObject<IdTestCase>(File.ReadAllText(path));
|
||||
|
||||
var artists = GivenArtists(testcase.LibraryArtists);
|
||||
var specifiedArtist = artists.SingleOrDefault(x => x.Metadata.Value.ForeignAuthorId == testcase.Artist);
|
||||
var idOverrides = new IdentificationOverrides { Artist = specifiedArtist };
|
||||
var artists = GivenArtists(testcase.LibraryAuthors);
|
||||
var specifiedArtist = artists.SingleOrDefault(x => x.Metadata.Value.ForeignAuthorId == testcase.Author);
|
||||
var idOverrides = new IdentificationOverrides { Author = specifiedArtist };
|
||||
|
||||
var tracks = testcase.Tracks.Select(x => new LocalTrack
|
||||
var tracks = testcase.Tracks.Select(x => new LocalBook
|
||||
{
|
||||
Path = x.Path.AsOsAgnostic(),
|
||||
FileTrackInfo = x.FileTrackInfo
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport.Identification;
|
||||
using NzbDrone.Core.MediaFiles.BookImport.Identification;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Identification
|
||||
namespace NzbDrone.Core.Test.MediaFiles.BookImport.Identification
|
||||
{
|
||||
[TestFixture]
|
||||
public class MunkresFixture : TestBase
|
||||
|
|
|
|||
|
|
@ -7,12 +7,12 @@
|
|||
using FizzWare.NBuilder.PropertyNaming;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport.Identification;
|
||||
using NzbDrone.Core.MediaFiles.BookImport.Identification;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Identification
|
||||
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)
|
||||
// but the standard random value namer would give paths that are too long on windows
|
||||
|
|
@ -66,7 +66,7 @@ protected override string GetString(MemberInfo memberInfo)
|
|||
[TestFixture]
|
||||
public class TrackGroupingServiceFixture : CoreTest<TrackGroupingService>
|
||||
{
|
||||
private List<LocalTrack> GivenTracks(string root, string artist, string album, int count)
|
||||
private List<LocalBook> GivenTracks(string root, string artist, string album, int count)
|
||||
{
|
||||
var fileInfos = Builder<ParsedTrackInfo>
|
||||
.CreateListOfSize(count)
|
||||
|
|
@ -77,7 +77,7 @@ private List<LocalTrack> GivenTracks(string root, string artist, string album, i
|
|||
.With(f => f.ReleaseMBId = null)
|
||||
.Build();
|
||||
|
||||
var tracks = fileInfos.Select(x => Builder<LocalTrack>
|
||||
var tracks = fileInfos.Select(x => Builder<LocalBook>
|
||||
.CreateNew()
|
||||
.With(y => y.FileTrackInfo = x)
|
||||
.With(y => y.Path = Path.Combine(root, x.Title))
|
||||
|
|
@ -86,13 +86,13 @@ private List<LocalTrack> GivenTracks(string root, string artist, string album, i
|
|||
return tracks;
|
||||
}
|
||||
|
||||
private List<LocalTrack> GivenTracksWithNoTags(string root, int count)
|
||||
private List<LocalBook> GivenTracksWithNoTags(string root, int count)
|
||||
{
|
||||
var outp = new List<LocalTrack>();
|
||||
var outp = new List<LocalBook>();
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
var track = Builder<LocalTrack>
|
||||
var track = Builder<LocalBook>
|
||||
.CreateNew()
|
||||
.With(y => y.FileTrackInfo = new ParsedTrackInfo())
|
||||
.With(y => y.Path = Path.Combine(root, $"{i}.mp3"))
|
||||
|
|
@ -104,7 +104,7 @@ private List<LocalTrack> GivenTracksWithNoTags(string root, int count)
|
|||
}
|
||||
|
||||
[Repeat(100)]
|
||||
private List<LocalTrack> GivenVaTracks(string root, string album, int count)
|
||||
private List<LocalBook> GivenVaTracks(string root, string album, int count)
|
||||
{
|
||||
var settings = new BuilderSettings();
|
||||
settings.SetPropertyNamerFor<ParsedTrackInfo>(new RandomValueNamerShortStrings(settings));
|
||||
|
|
@ -119,7 +119,7 @@ private List<LocalTrack> GivenVaTracks(string root, string album, int count)
|
|||
.With(f => f.ReleaseMBId = null)
|
||||
.Build();
|
||||
|
||||
var tracks = fileInfos.Select(x => Builder<LocalTrack>
|
||||
var tracks = fileInfos.Select(x => Builder<LocalBook>
|
||||
.CreateNew()
|
||||
.With(y => y.FileTrackInfo = x)
|
||||
.With(y => y.Path = Path.Combine(@"C:\music\incoming".AsOsAgnostic(), x.Title))
|
||||
|
|
@ -199,7 +199,7 @@ public void should_group_single_artist_album(int count)
|
|||
TrackGroupingService.LooksLikeSingleRelease(tracks).Should().Be(true);
|
||||
|
||||
output.Count.Should().Be(1);
|
||||
output[0].LocalTracks.Count.Should().Be(count);
|
||||
output[0].LocalBooks.Count.Should().Be(count);
|
||||
}
|
||||
|
||||
[TestCase("cd")]
|
||||
|
|
@ -215,7 +215,7 @@ public void should_group_multi_disc_release(string mediaName)
|
|||
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
output.Count.Should().Be(1);
|
||||
output[0].LocalTracks.Count.Should().Be(15);
|
||||
output[0].LocalBooks.Count.Should().Be(15);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -229,8 +229,8 @@ public void should_not_group_two_different_albums_by_same_artist()
|
|||
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
output.Count.Should().Be(2);
|
||||
output[0].LocalTracks.Count.Should().Be(10);
|
||||
output[1].LocalTracks.Count.Should().Be(5);
|
||||
output[0].LocalBooks.Count.Should().Be(10);
|
||||
output[1].LocalBooks.Count.Should().Be(5);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -244,7 +244,7 @@ public void should_group_albums_with_typos()
|
|||
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
output.Count.Should().Be(1);
|
||||
output[0].LocalTracks.Count.Should().Be(15);
|
||||
output[0].LocalBooks.Count.Should().Be(15);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -258,8 +258,8 @@ public void should_not_group_two_different_tracks_in_same_directory()
|
|||
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
output.Count.Should().Be(2);
|
||||
output[0].LocalTracks.Count.Should().Be(1);
|
||||
output[1].LocalTracks.Count.Should().Be(1);
|
||||
output[0].LocalBooks.Count.Should().Be(1);
|
||||
output[1].LocalBooks.Count.Should().Be(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -273,14 +273,14 @@ public void should_separate_two_albums_in_same_directory()
|
|||
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
output.Count.Should().Be(2);
|
||||
output[0].LocalTracks.Count.Should().Be(10);
|
||||
output[1].LocalTracks.Count.Should().Be(5);
|
||||
output[0].LocalBooks.Count.Should().Be(10);
|
||||
output[1].LocalBooks.Count.Should().Be(5);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_separate_many_albums_in_same_directory()
|
||||
{
|
||||
var tracks = new List<LocalTrack>();
|
||||
var tracks = new List<LocalBook>();
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
tracks.AddRange(GivenTracks($"C:\\music".AsOsAgnostic(), "artist" + i, "album" + i, 10));
|
||||
|
|
@ -291,7 +291,7 @@ public void should_separate_many_albums_in_same_directory()
|
|||
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
output.Count.Should().Be(100);
|
||||
output.Select(x => x.LocalTracks.Count).Distinct().Should().BeEquivalentTo(new List<int> { 10 });
|
||||
output.Select(x => x.LocalBooks.Count).Distinct().Should().BeEquivalentTo(new List<int> { 10 });
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -305,8 +305,8 @@ public void should_separate_two_albums_by_different_artists_in_same_directory()
|
|||
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
output.Count.Should().Be(2);
|
||||
output[0].LocalTracks.Count.Should().Be(10);
|
||||
output[1].LocalTracks.Count.Should().Be(5);
|
||||
output[0].LocalBooks.Count.Should().Be(10);
|
||||
output[1].LocalBooks.Count.Should().Be(5);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -320,7 +320,7 @@ public void should_group_va_release()
|
|||
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
output.Count.Should().Be(1);
|
||||
output[0].LocalTracks.Count.Should().Be(10);
|
||||
output[0].LocalBooks.Count.Should().Be(10);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -335,8 +335,8 @@ public void should_not_group_two_albums_by_different_artists_with_same_title()
|
|||
var output = Subject.GroupTracks(tracks);
|
||||
|
||||
output.Count.Should().Be(2);
|
||||
output[0].LocalTracks.Count.Should().Be(10);
|
||||
output[1].LocalTracks.Count.Should().Be(5);
|
||||
output[0].LocalBooks.Count.Should().Be(10);
|
||||
output[1].LocalBooks.Count.Should().Be(5);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -349,7 +349,7 @@ public void should_not_fail_if_all_tags_null()
|
|||
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
output.Count.Should().Be(1);
|
||||
output[0].LocalTracks.Count.Should().Be(10);
|
||||
output[0].LocalBooks.Count.Should().Be(10);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -363,7 +363,7 @@ public void should_not_fail_if_some_tags_null()
|
|||
|
||||
var output = Subject.GroupTracks(tracks);
|
||||
output.Count.Should().Be(1);
|
||||
output[0].LocalTracks.Count.Should().Be(12);
|
||||
output[0].LocalBooks.Count.Should().Be(12);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -380,12 +380,12 @@ public void should_cope_with_one_album_in_subfolder_of_another()
|
|||
foreach (var group in output)
|
||||
{
|
||||
TestLogger.Debug($"*** group {group} ***");
|
||||
TestLogger.Debug(string.Join("\n", group.LocalTracks.Select(x => x.Path)));
|
||||
TestLogger.Debug(string.Join("\n", group.LocalBooks.Select(x => x.Path)));
|
||||
}
|
||||
|
||||
output.Count.Should().Be(2);
|
||||
output[0].LocalTracks.Count.Should().Be(10);
|
||||
output[1].LocalTracks.Count.Should().Be(10);
|
||||
output[0].LocalBooks.Count.Should().Be(10);
|
||||
output[1].LocalBooks.Count.Should().Be(10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,26 +6,26 @@
|
|||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport.Aggregation;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport.Identification;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.MediaFiles.BookImport;
|
||||
using NzbDrone.Core.MediaFiles.BookImport.Aggregation;
|
||||
using NzbDrone.Core.MediaFiles.BookImport.Identification;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.MediaFiles.TrackImport
|
||||
namespace NzbDrone.Core.Test.MediaFiles.BookImport
|
||||
{
|
||||
[TestFixture]
|
||||
public class ImportDecisionMakerFixture : FileSystemTest<ImportDecisionMaker>
|
||||
{
|
||||
private List<IFileInfo> _fileInfos;
|
||||
private LocalTrack _localTrack;
|
||||
private LocalBook _localTrack;
|
||||
private Author _artist;
|
||||
private Book _album;
|
||||
private QualityModel _quality;
|
||||
|
|
@ -41,13 +41,13 @@ public class ImportDecisionMakerFixture : FileSystemTest<ImportDecisionMaker>
|
|||
private Mock<IImportDecisionEngineSpecification<LocalAlbumRelease>> _albumfail2;
|
||||
private Mock<IImportDecisionEngineSpecification<LocalAlbumRelease>> _albumfail3;
|
||||
|
||||
private Mock<IImportDecisionEngineSpecification<LocalTrack>> _pass1;
|
||||
private Mock<IImportDecisionEngineSpecification<LocalTrack>> _pass2;
|
||||
private Mock<IImportDecisionEngineSpecification<LocalTrack>> _pass3;
|
||||
private Mock<IImportDecisionEngineSpecification<LocalBook>> _pass1;
|
||||
private Mock<IImportDecisionEngineSpecification<LocalBook>> _pass2;
|
||||
private Mock<IImportDecisionEngineSpecification<LocalBook>> _pass3;
|
||||
|
||||
private Mock<IImportDecisionEngineSpecification<LocalTrack>> _fail1;
|
||||
private Mock<IImportDecisionEngineSpecification<LocalTrack>> _fail2;
|
||||
private Mock<IImportDecisionEngineSpecification<LocalTrack>> _fail3;
|
||||
private Mock<IImportDecisionEngineSpecification<LocalBook>> _fail1;
|
||||
private Mock<IImportDecisionEngineSpecification<LocalBook>> _fail2;
|
||||
private Mock<IImportDecisionEngineSpecification<LocalBook>> _fail3;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
|
|
@ -60,13 +60,13 @@ public void Setup()
|
|||
_albumfail2 = new Mock<IImportDecisionEngineSpecification<LocalAlbumRelease>>();
|
||||
_albumfail3 = new Mock<IImportDecisionEngineSpecification<LocalAlbumRelease>>();
|
||||
|
||||
_pass1 = new Mock<IImportDecisionEngineSpecification<LocalTrack>>();
|
||||
_pass2 = new Mock<IImportDecisionEngineSpecification<LocalTrack>>();
|
||||
_pass3 = new Mock<IImportDecisionEngineSpecification<LocalTrack>>();
|
||||
_pass1 = new Mock<IImportDecisionEngineSpecification<LocalBook>>();
|
||||
_pass2 = new Mock<IImportDecisionEngineSpecification<LocalBook>>();
|
||||
_pass3 = new Mock<IImportDecisionEngineSpecification<LocalBook>>();
|
||||
|
||||
_fail1 = new Mock<IImportDecisionEngineSpecification<LocalTrack>>();
|
||||
_fail2 = new Mock<IImportDecisionEngineSpecification<LocalTrack>>();
|
||||
_fail3 = new Mock<IImportDecisionEngineSpecification<LocalTrack>>();
|
||||
_fail1 = new Mock<IImportDecisionEngineSpecification<LocalBook>>();
|
||||
_fail2 = new Mock<IImportDecisionEngineSpecification<LocalBook>>();
|
||||
_fail3 = new Mock<IImportDecisionEngineSpecification<LocalBook>>();
|
||||
|
||||
_albumpass1.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalAlbumRelease>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Accept());
|
||||
_albumpass2.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalAlbumRelease>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Accept());
|
||||
|
|
@ -76,13 +76,13 @@ public void Setup()
|
|||
_albumfail2.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalAlbumRelease>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Reject("_albumfail2"));
|
||||
_albumfail3.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalAlbumRelease>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Reject("_albumfail3"));
|
||||
|
||||
_pass1.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalTrack>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Accept());
|
||||
_pass2.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalTrack>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Accept());
|
||||
_pass3.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalTrack>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Accept());
|
||||
_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());
|
||||
_pass3.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalBook>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Accept());
|
||||
|
||||
_fail1.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalTrack>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Reject("_fail1"));
|
||||
_fail2.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalTrack>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Reject("_fail2"));
|
||||
_fail3.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalTrack>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Reject("_fail3"));
|
||||
_fail1.Setup(c => c.IsSatisfiedBy(It.IsAny<LocalBook>(), It.IsAny<DownloadClientItem>())).Returns(Decision.Reject("_fail1"));
|
||||
_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()
|
||||
.With(e => e.QualityProfileId = 1)
|
||||
|
|
@ -95,17 +95,17 @@ public void Setup()
|
|||
|
||||
_quality = new QualityModel(Quality.MP3_320);
|
||||
|
||||
_localTrack = new LocalTrack
|
||||
_localTrack = new LocalBook
|
||||
{
|
||||
Artist = _artist,
|
||||
Author = _artist,
|
||||
Quality = _quality,
|
||||
Album = new Book(),
|
||||
Book = new Book(),
|
||||
Path = @"C:\Test\Unsorted\The.Office.S03E115.DVDRip.XviD-OSiTV.avi".AsOsAgnostic()
|
||||
};
|
||||
|
||||
_idOverrides = new IdentificationOverrides
|
||||
{
|
||||
Artist = _artist
|
||||
Author = _artist
|
||||
};
|
||||
|
||||
_idConfig = new ImportDecisionMakerConfig();
|
||||
|
|
@ -113,8 +113,8 @@ public void Setup()
|
|||
GivenAudioFiles(new List<string> { @"C:\Test\Unsorted\The.Office.S03E115.DVDRip.XviD-OSiTV.avi".AsOsAgnostic() });
|
||||
|
||||
Mocker.GetMock<IIdentificationService>()
|
||||
.Setup(s => s.Identify(It.IsAny<List<LocalTrack>>(), It.IsAny<IdentificationOverrides>(), It.IsAny<ImportDecisionMakerConfig>()))
|
||||
.Returns((List<LocalTrack> tracks, IdentificationOverrides idOverrides, ImportDecisionMakerConfig config) =>
|
||||
.Setup(s => s.Identify(It.IsAny<List<LocalBook>>(), It.IsAny<IdentificationOverrides>(), It.IsAny<ImportDecisionMakerConfig>()))
|
||||
.Returns((List<LocalBook> tracks, IdentificationOverrides idOverrides, ImportDecisionMakerConfig config) =>
|
||||
{
|
||||
var ret = new LocalAlbumRelease(tracks);
|
||||
ret.Book = _album;
|
||||
|
|
@ -146,10 +146,10 @@ private void GivenAudioFiles(IEnumerable<string> videoFiles)
|
|||
private void GivenAugmentationSuccess()
|
||||
{
|
||||
Mocker.GetMock<IAugmentingService>()
|
||||
.Setup(s => s.Augment(It.IsAny<LocalTrack>(), It.IsAny<bool>()))
|
||||
.Callback<LocalTrack, bool>((localTrack, otherFiles) =>
|
||||
.Setup(s => s.Augment(It.IsAny<LocalBook>(), It.IsAny<bool>()))
|
||||
.Callback<LocalBook, bool>((localTrack, otherFiles) =>
|
||||
{
|
||||
localTrack.Album = _localTrack.Album;
|
||||
localTrack.Book = _localTrack.Book;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -183,12 +183,12 @@ public void should_call_all_track_specifications_if_album_accepted()
|
|||
|
||||
Subject.GetImportDecisions(_fileInfos, null, itemInfo, _idConfig);
|
||||
|
||||
_fail1.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalTrack>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
_fail2.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalTrack>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
_fail3.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalTrack>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
_pass1.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalTrack>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
_pass2.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalTrack>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
_pass3.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalTrack>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
_fail1.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalBook>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
_fail2.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalBook>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
_fail3.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalBook>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
_pass1.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalBook>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
_pass2.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalBook>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
_pass3.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalBook>(), It.IsAny<DownloadClientItem>()), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -203,12 +203,12 @@ public void should_call_no_track_specifications_if_album_rejected()
|
|||
|
||||
Subject.GetImportDecisions(_fileInfos, null, itemInfo, _idConfig);
|
||||
|
||||
_fail1.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalTrack>(), It.IsAny<DownloadClientItem>()), Times.Never());
|
||||
_fail2.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalTrack>(), It.IsAny<DownloadClientItem>()), Times.Never());
|
||||
_fail3.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalTrack>(), It.IsAny<DownloadClientItem>()), Times.Never());
|
||||
_pass1.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalTrack>(), It.IsAny<DownloadClientItem>()), Times.Never());
|
||||
_pass2.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalTrack>(), It.IsAny<DownloadClientItem>()), Times.Never());
|
||||
_pass3.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalTrack>(), It.IsAny<DownloadClientItem>()), Times.Never());
|
||||
_fail1.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalBook>(), It.IsAny<DownloadClientItem>()), Times.Never());
|
||||
_fail2.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalBook>(), It.IsAny<DownloadClientItem>()), Times.Never());
|
||||
_fail3.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalBook>(), It.IsAny<DownloadClientItem>()), Times.Never());
|
||||
_pass1.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalBook>(), It.IsAny<DownloadClientItem>()), Times.Never());
|
||||
_pass2.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalBook>(), It.IsAny<DownloadClientItem>()), Times.Never());
|
||||
_pass3.Verify(c => c.IsSatisfiedBy(It.IsAny<LocalBook>(), It.IsAny<DownloadClientItem>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -283,7 +283,7 @@ public void should_not_blowup_the_process_due_to_failed_augment()
|
|||
GivenSpecifications(_pass1);
|
||||
|
||||
Mocker.GetMock<IAugmentingService>()
|
||||
.Setup(c => c.Augment(It.IsAny<LocalTrack>(), It.IsAny<bool>()))
|
||||
.Setup(c => c.Augment(It.IsAny<LocalBook>(), It.IsAny<bool>()))
|
||||
.Throws<TestException>();
|
||||
|
||||
GivenAudioFiles(new[]
|
||||
|
|
@ -296,7 +296,7 @@ public void should_not_blowup_the_process_due_to_failed_augment()
|
|||
var decisions = Subject.GetImportDecisions(_fileInfos, _idOverrides, null, _idConfig);
|
||||
|
||||
Mocker.GetMock<IAugmentingService>()
|
||||
.Verify(c => c.Augment(It.IsAny<LocalTrack>(), It.IsAny<bool>()), Times.Exactly(_fileInfos.Count));
|
||||
.Verify(c => c.Augment(It.IsAny<LocalBook>(), It.IsAny<bool>()), Times.Exactly(_fileInfos.Count));
|
||||
|
||||
ExceptionVerification.ExpectedErrors(3);
|
||||
}
|
||||
|
|
@ -314,8 +314,8 @@ public void should_not_throw_if_release_not_identified()
|
|||
});
|
||||
|
||||
Mocker.GetMock<IIdentificationService>()
|
||||
.Setup(s => s.Identify(It.IsAny<List<LocalTrack>>(), It.IsAny<IdentificationOverrides>(), It.IsAny<ImportDecisionMakerConfig>()))
|
||||
.Returns((List<LocalTrack> tracks, IdentificationOverrides idOverrides, ImportDecisionMakerConfig config) =>
|
||||
.Setup(s => s.Identify(It.IsAny<List<LocalBook>>(), It.IsAny<IdentificationOverrides>(), It.IsAny<ImportDecisionMakerConfig>()))
|
||||
.Returns((List<LocalBook> tracks, IdentificationOverrides idOverrides, ImportDecisionMakerConfig config) =>
|
||||
{
|
||||
return new List<LocalAlbumRelease> { new LocalAlbumRelease(tracks) };
|
||||
});
|
||||
|
|
@ -323,7 +323,7 @@ public void should_not_throw_if_release_not_identified()
|
|||
var decisions = Subject.GetImportDecisions(_fileInfos, _idOverrides, null, _idConfig);
|
||||
|
||||
Mocker.GetMock<IAugmentingService>()
|
||||
.Verify(c => c.Augment(It.IsAny<LocalTrack>(), It.IsAny<bool>()), Times.Exactly(_fileInfos.Count));
|
||||
.Verify(c => c.Augment(It.IsAny<LocalBook>(), It.IsAny<bool>()), Times.Exactly(_fileInfos.Count));
|
||||
|
||||
decisions.Should().HaveCount(3);
|
||||
decisions.First().Rejections.Should().NotBeEmpty();
|
||||
|
|
@ -344,7 +344,7 @@ public void should_not_throw_if_tracks_are_not_found()
|
|||
var decisions = Subject.GetImportDecisions(_fileInfos, _idOverrides, null, _idConfig);
|
||||
|
||||
Mocker.GetMock<IAugmentingService>()
|
||||
.Verify(c => c.Augment(It.IsAny<LocalTrack>(), It.IsAny<bool>()), Times.Exactly(_fileInfos.Count));
|
||||
.Verify(c => c.Augment(It.IsAny<LocalBook>(), It.IsAny<bool>()), Times.Exactly(_fileInfos.Count));
|
||||
|
||||
decisions.Should().HaveCount(3);
|
||||
decisions.First().Rejections.Should().NotBeEmpty();
|
||||
|
|
@ -354,7 +354,7 @@ public void should_not_throw_if_tracks_are_not_found()
|
|||
public void should_return_a_decision_when_exception_is_caught()
|
||||
{
|
||||
Mocker.GetMock<IAugmentingService>()
|
||||
.Setup(c => c.Augment(It.IsAny<LocalTrack>(), It.IsAny<bool>()))
|
||||
.Setup(c => c.Augment(It.IsAny<LocalBook>(), It.IsAny<bool>()))
|
||||
.Throws<TestException>();
|
||||
|
||||
GivenAudioFiles(new[]
|
||||
|
|
|
|||
|
|
@ -4,20 +4,20 @@
|
|||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport.Specifications;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.MediaFiles.BookImport.Specifications;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Specifications
|
||||
namespace NzbDrone.Core.Test.MediaFiles.BookImport.Specifications
|
||||
{
|
||||
[TestFixture]
|
||||
public class FreeSpaceSpecificationFixture : CoreTest<FreeSpaceSpecification>
|
||||
{
|
||||
private Author _artist;
|
||||
private LocalTrack _localTrack;
|
||||
private LocalBook _localTrack;
|
||||
private string _rootFolder;
|
||||
|
||||
[SetUp]
|
||||
|
|
@ -29,11 +29,11 @@ public void Setup()
|
|||
.With(s => s.Path = Path.Combine(_rootFolder, "Alice in Chains"))
|
||||
.Build();
|
||||
|
||||
_localTrack = new LocalTrack
|
||||
_localTrack = new LocalBook
|
||||
{
|
||||
Path = @"C:\Test\Unsorted\Alice in Chains\Alice in Chains - track1.mp3".AsOsAgnostic(),
|
||||
Album = new Book(),
|
||||
Artist = _artist
|
||||
Book = new Book(),
|
||||
Author = _artist
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,19 +4,19 @@
|
|||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport.Specifications;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.MediaFiles.BookImport.Specifications;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Specifications
|
||||
namespace NzbDrone.Core.Test.MediaFiles.BookImport.Specifications
|
||||
{
|
||||
[TestFixture]
|
||||
public class NotUnpackingSpecificationFixture : CoreTest<NotUnpackingSpecification>
|
||||
{
|
||||
private LocalTrack _localTrack;
|
||||
private LocalBook _localTrack;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
|
|
@ -25,11 +25,11 @@ public void Setup()
|
|||
.SetupGet(s => s.DownloadClientWorkingFolders)
|
||||
.Returns("_UNPACK_|_FAILED_");
|
||||
|
||||
_localTrack = new LocalTrack
|
||||
_localTrack = new LocalBook
|
||||
{
|
||||
Path = @"C:\Test\Unsorted Music\Kid.Rock\Kid.Rock.Cowboy.mp3".AsOsAgnostic(),
|
||||
Size = 100,
|
||||
Artist = Builder<Author>.CreateNew().Build()
|
||||
Author = Builder<Author>.CreateNew().Build()
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,24 +2,24 @@
|
|||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport.Specifications;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.MediaFiles.BookImport.Specifications;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Specifications
|
||||
namespace NzbDrone.Core.Test.MediaFiles.BookImport.Specifications
|
||||
{
|
||||
[TestFixture]
|
||||
public class SameFileSpecificationFixture : CoreTest<SameFileSpecification>
|
||||
{
|
||||
private LocalTrack _localTrack;
|
||||
private LocalBook _localTrack;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_localTrack = Builder<LocalTrack>.CreateNew()
|
||||
_localTrack = Builder<LocalBook>.CreateNew()
|
||||
.With(l => l.Size = 150.Megabytes())
|
||||
.Build();
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ public void Setup()
|
|||
[Test]
|
||||
public void should_be_accepted_if_no_existing_file()
|
||||
{
|
||||
_localTrack.Album = Builder<Book>.CreateNew()
|
||||
_localTrack.Book = Builder<Book>.CreateNew()
|
||||
.Build();
|
||||
|
||||
Subject.IsSatisfiedBy(_localTrack, null).Accepted.Should().BeTrue();
|
||||
|
|
@ -61,7 +61,7 @@ public void should_be_accepted_if_multiple_existing_files()
|
|||
[Test]
|
||||
public void should_be_accepted_if_file_size_is_different()
|
||||
{
|
||||
_localTrack.Album = Builder<Book>.CreateNew()
|
||||
_localTrack.Book = Builder<Book>.CreateNew()
|
||||
.With(e => e.BookFiles = new LazyLoaded<List<BookFile>>(
|
||||
new List<BookFile>
|
||||
{
|
||||
|
|
@ -78,7 +78,7 @@ public void should_be_accepted_if_file_size_is_different()
|
|||
[Test]
|
||||
public void should_be_reject_if_file_size_is_the_same()
|
||||
{
|
||||
_localTrack.Album = Builder<Book>.CreateNew()
|
||||
_localTrack.Book = Builder<Book>.CreateNew()
|
||||
.With(e => e.BookFiles = new LazyLoaded<List<BookFile>>(
|
||||
new List<BookFile>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,17 +2,17 @@
|
|||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport.Specifications;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.MediaFiles.BookImport.Specifications;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Profiles.Qualities;
|
||||
using NzbDrone.Core.Qualities;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.MediaFiles.TrackImport.Specifications
|
||||
namespace NzbDrone.Core.Test.MediaFiles.BookImport.Specifications
|
||||
{
|
||||
[TestFixture]
|
||||
public class UpgradeSpecificationFixture : CoreTest<UpgradeSpecification>
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.MediaFiles;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.RootFolders;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
|
@ -18,14 +18,14 @@ namespace NzbDrone.Core.Test.MediaFiles
|
|||
public class UpgradeMediaFileServiceFixture : CoreTest<UpgradeMediaFileService>
|
||||
{
|
||||
private BookFile _trackFile;
|
||||
private LocalTrack _localTrack;
|
||||
private LocalBook _localTrack;
|
||||
private string _rootPath = @"C:\Test\Music\Artist".AsOsAgnostic();
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_localTrack = new LocalTrack();
|
||||
_localTrack.Artist = new Author
|
||||
_localTrack = new LocalBook();
|
||||
_localTrack.Author = new Author
|
||||
{
|
||||
Path = _rootPath
|
||||
};
|
||||
|
|
@ -53,7 +53,7 @@ public void Setup()
|
|||
|
||||
private void GivenSingleTrackWithSingleTrackFile()
|
||||
{
|
||||
_localTrack.Album = Builder<Book>.CreateNew()
|
||||
_localTrack.Book = Builder<Book>.CreateNew()
|
||||
.With(e => e.BookFiles = new LazyLoaded<List<BookFile>>(
|
||||
new List<BookFile>
|
||||
{
|
||||
|
|
@ -71,7 +71,7 @@ public void should_delete_single_track_file_once()
|
|||
{
|
||||
GivenSingleTrackWithSingleTrackFile();
|
||||
|
||||
Subject.UpgradeTrackFile(_trackFile, _localTrack);
|
||||
Subject.UpgradeBookFile(_trackFile, _localTrack);
|
||||
|
||||
Mocker.GetMock<IRecycleBinProvider>().Verify(v => v.DeleteFile(It.IsAny<string>(), It.IsAny<string>()), Times.Once());
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ public void should_delete_track_file_from_database()
|
|||
{
|
||||
GivenSingleTrackWithSingleTrackFile();
|
||||
|
||||
Subject.UpgradeTrackFile(_trackFile, _localTrack);
|
||||
Subject.UpgradeBookFile(_trackFile, _localTrack);
|
||||
|
||||
Mocker.GetMock<IMediaFileService>().Verify(v => v.Delete(It.IsAny<BookFile>(), DeleteMediaFileReason.Upgrade), Times.Once());
|
||||
}
|
||||
|
|
@ -95,7 +95,7 @@ public void should_delete_existing_file_fromdb_if_file_doesnt_exist()
|
|||
.Setup(c => c.FileExists(It.IsAny<string>()))
|
||||
.Returns(false);
|
||||
|
||||
Subject.UpgradeTrackFile(_trackFile, _localTrack);
|
||||
Subject.UpgradeBookFile(_trackFile, _localTrack);
|
||||
|
||||
// Mocker.GetMock<IMediaFileService>().Verify(v => v.Delete(_localTrack.Album.BookFiles.Value, DeleteMediaFileReason.Upgrade), Times.Once());
|
||||
}
|
||||
|
|
@ -109,7 +109,7 @@ public void should_not_try_to_recyclebin_existing_file_if_file_doesnt_exist()
|
|||
.Setup(c => c.FileExists(It.IsAny<string>()))
|
||||
.Returns(false);
|
||||
|
||||
Subject.UpgradeTrackFile(_trackFile, _localTrack);
|
||||
Subject.UpgradeBookFile(_trackFile, _localTrack);
|
||||
|
||||
Mocker.GetMock<IRecycleBinProvider>().Verify(v => v.DeleteFile(It.IsAny<string>(), It.IsAny<string>()), Times.Never());
|
||||
}
|
||||
|
|
@ -119,18 +119,18 @@ public void should_return_old_track_file_in_oldFiles()
|
|||
{
|
||||
GivenSingleTrackWithSingleTrackFile();
|
||||
|
||||
Subject.UpgradeTrackFile(_trackFile, _localTrack).OldFiles.Count.Should().Be(1);
|
||||
Subject.UpgradeBookFile(_trackFile, _localTrack).OldFiles.Count.Should().Be(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Pending readarr fix")]
|
||||
public void should_import_if_existing_file_doesnt_exist_in_db()
|
||||
{
|
||||
_localTrack.Album = Builder<Book>.CreateNew()
|
||||
_localTrack.Book = Builder<Book>.CreateNew()
|
||||
.With(e => e.BookFiles = new LazyLoaded<List<BookFile>>())
|
||||
.Build();
|
||||
|
||||
Subject.UpgradeTrackFile(_trackFile, _localTrack);
|
||||
Subject.UpgradeBookFile(_trackFile, _localTrack);
|
||||
|
||||
// Mocker.GetMock<IMediaFileService>().Verify(v => v.Delete(_localTrack.Album.BookFiles.Value, It.IsAny<DeleteMediaFileReason>()), Times.Never());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.IndexerSearch;
|
||||
using NzbDrone.Core.MediaFiles.BookImport.Manual;
|
||||
using NzbDrone.Core.MediaFiles.Commands;
|
||||
using NzbDrone.Core.MediaFiles.TrackImport.Manual;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using NzbDrone.Core.Update.Commands;
|
||||
using NzbDrone.Test.Common;
|
||||
|
|
@ -27,8 +27,8 @@ private string GivenRandomPath()
|
|||
[Test]
|
||||
public void should_return_true_when_there_are_no_properties()
|
||||
{
|
||||
var command1 = new DownloadedAlbumsScanCommand();
|
||||
var command2 = new DownloadedAlbumsScanCommand();
|
||||
var command1 = new DownloadedBooksScanCommand();
|
||||
var command2 = new DownloadedBooksScanCommand();
|
||||
|
||||
CommandEqualityComparer.Instance.Equals(command1, command2).Should().BeTrue();
|
||||
}
|
||||
|
|
@ -36,8 +36,8 @@ public void should_return_true_when_there_are_no_properties()
|
|||
[Test]
|
||||
public void should_return_true_when_single_property_matches()
|
||||
{
|
||||
var command1 = new AlbumSearchCommand { BookIds = new List<int> { 1 } };
|
||||
var command2 = new AlbumSearchCommand { BookIds = new List<int> { 1 } };
|
||||
var command1 = new BookSearchCommand { BookIds = new List<int> { 1 } };
|
||||
var command2 = new BookSearchCommand { BookIds = new List<int> { 1 } };
|
||||
|
||||
CommandEqualityComparer.Instance.Equals(command1, command2).Should().BeTrue();
|
||||
}
|
||||
|
|
@ -45,8 +45,8 @@ public void should_return_true_when_single_property_matches()
|
|||
[Test]
|
||||
public void should_return_false_when_single_property_doesnt_match()
|
||||
{
|
||||
var command1 = new AlbumSearchCommand { BookIds = new List<int> { 1 } };
|
||||
var command2 = new AlbumSearchCommand { BookIds = new List<int> { 2 } };
|
||||
var command1 = new BookSearchCommand { BookIds = new List<int> { 1 } };
|
||||
var command2 = new BookSearchCommand { BookIds = new List<int> { 2 } };
|
||||
|
||||
CommandEqualityComparer.Instance.Equals(command1, command2).Should().BeFalse();
|
||||
}
|
||||
|
|
@ -54,8 +54,8 @@ public void should_return_false_when_single_property_doesnt_match()
|
|||
[Test]
|
||||
public void should_return_false_when_only_one_has_properties()
|
||||
{
|
||||
var command1 = new ArtistSearchCommand();
|
||||
var command2 = new ArtistSearchCommand { AuthorId = 2 };
|
||||
var command1 = new AuthorSearchCommand();
|
||||
var command2 = new AuthorSearchCommand { AuthorId = 2 };
|
||||
|
||||
CommandEqualityComparer.Instance.Equals(command1, command2).Should().BeFalse();
|
||||
}
|
||||
|
|
@ -63,8 +63,8 @@ public void should_return_false_when_only_one_has_properties()
|
|||
[Test]
|
||||
public void should_return_false_when_only_one_has_null_property()
|
||||
{
|
||||
var command1 = new AlbumSearchCommand(null);
|
||||
var command2 = new AlbumSearchCommand(new List<int>());
|
||||
var command1 = new BookSearchCommand(null);
|
||||
var command2 = new BookSearchCommand(new List<int>());
|
||||
|
||||
CommandEqualityComparer.Instance.Equals(command1, command2).Should().BeFalse();
|
||||
}
|
||||
|
|
@ -78,8 +78,8 @@ public void should_return_false_when_commands_are_diffrent_types()
|
|||
[Test]
|
||||
public void should_return_false_when_commands_list_are_different_lengths()
|
||||
{
|
||||
var command1 = new AlbumSearchCommand { BookIds = new List<int> { 1 } };
|
||||
var command2 = new AlbumSearchCommand { BookIds = new List<int> { 1, 2 } };
|
||||
var command1 = new BookSearchCommand { BookIds = new List<int> { 1 } };
|
||||
var command2 = new BookSearchCommand { BookIds = new List<int> { 1, 2 } };
|
||||
|
||||
CommandEqualityComparer.Instance.Equals(command1, command2).Should().BeFalse();
|
||||
}
|
||||
|
|
@ -87,8 +87,8 @@ public void should_return_false_when_commands_list_are_different_lengths()
|
|||
[Test]
|
||||
public void should_return_false_when_commands_list_dont_match()
|
||||
{
|
||||
var command1 = new AlbumSearchCommand { BookIds = new List<int> { 1 } };
|
||||
var command2 = new AlbumSearchCommand { BookIds = new List<int> { 2 } };
|
||||
var command1 = new BookSearchCommand { BookIds = new List<int> { 1 } };
|
||||
var command2 = new BookSearchCommand { BookIds = new List<int> { 2 } };
|
||||
|
||||
CommandEqualityComparer.Instance.Equals(command1, command2).Should().BeFalse();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books.Commands;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.ImportLists;
|
||||
using NzbDrone.Core.Messaging.Commands;
|
||||
using NzbDrone.Core.Music.Commands;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Core.Update.Commands;
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ public void should_return_regular_command_if_type_exclusive_command_running()
|
|||
var newCommandModel = Builder<CommandModel>
|
||||
.CreateNew()
|
||||
.With(c => c.Name = "RefreshArtist")
|
||||
.With(c => c.Body = new RefreshArtistCommand())
|
||||
.With(c => c.Body = new RefreshAuthorCommand())
|
||||
.Build();
|
||||
|
||||
Subject.Add(newCommandModel);
|
||||
|
|
@ -168,7 +168,7 @@ public void should_not_return_any_command_if_exclusive_running()
|
|||
var newCommandModel = Builder<CommandModel>
|
||||
.CreateNew()
|
||||
.With(c => c.Name = "RefreshArtist")
|
||||
.With(c => c.Body = new RefreshArtistCommand())
|
||||
.With(c => c.Body = new RefreshAuthorCommand())
|
||||
.Build();
|
||||
|
||||
Subject.Add(newCommandModel);
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Books;
|
||||
using NzbDrone.Core.MetadataSource;
|
||||
using NzbDrone.Core.Music;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.MetadataSource
|
||||
|
|
@ -30,7 +30,7 @@ public void should_prefer_the_walking_dead_over_talking_dead_when_searching_for_
|
|||
WithSeries("Talking Dead");
|
||||
WithSeries("The Walking Dead");
|
||||
|
||||
_artist.Sort(new SearchArtistComparer("the walking dead"));
|
||||
_artist.Sort(new SearchAuthorComparer("the walking dead"));
|
||||
|
||||
_artist.First().Name.Should().Be("The Walking Dead");
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@ public void should_prefer_the_walking_dead_over_talking_dead_when_searching_for_
|
|||
WithSeries("Talking Dead");
|
||||
WithSeries("The Walking Dead");
|
||||
|
||||
_artist.Sort(new SearchArtistComparer("walking dead"));
|
||||
_artist.Sort(new SearchAuthorComparer("walking dead"));
|
||||
|
||||
_artist.First().Name.Should().Be("The Walking Dead");
|
||||
}
|
||||
|
|
@ -52,7 +52,7 @@ public void should_prefer_blacklist_over_the_blacklist_when_searching_for_blackl
|
|||
WithSeries("The Blacklist");
|
||||
WithSeries("Blacklist");
|
||||
|
||||
_artist.Sort(new SearchArtistComparer("blacklist"));
|
||||
_artist.Sort(new SearchAuthorComparer("blacklist"));
|
||||
|
||||
_artist.First().Name.Should().Be("Blacklist");
|
||||
}
|
||||
|
|
@ -63,7 +63,7 @@ public void should_prefer_the_blacklist_over_blacklist_when_searching_for_the_bl
|
|||
WithSeries("Blacklist");
|
||||
WithSeries("The Blacklist");
|
||||
|
||||
_artist.Sort(new SearchArtistComparer("the blacklist"));
|
||||
_artist.Sort(new SearchAuthorComparer("the blacklist"));
|
||||
|
||||
_artist.First().Name.Should().Be("The Blacklist");
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue