mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-26 22:46:37 -04:00
New: Readarr 0.1
This commit is contained in:
@@ -58,19 +58,11 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
|
||||
.Returns(remoteAlbum.Artist);
|
||||
}
|
||||
|
||||
private Album CreateAlbum(int id, int trackCount)
|
||||
private Book CreateAlbum(int id)
|
||||
{
|
||||
return new Album
|
||||
return new Book
|
||||
{
|
||||
Id = id,
|
||||
AlbumReleases = new List<AlbumRelease>
|
||||
{
|
||||
new AlbumRelease
|
||||
{
|
||||
Monitored = true,
|
||||
TrackCount = trackCount
|
||||
}
|
||||
}
|
||||
Id = id
|
||||
};
|
||||
}
|
||||
|
||||
@@ -78,8 +70,8 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
|
||||
{
|
||||
return new RemoteAlbum
|
||||
{
|
||||
Artist = new Artist(),
|
||||
Albums = new List<Album> { CreateAlbum(1, 1) }
|
||||
Artist = new Author(),
|
||||
Albums = new List<Book> { CreateAlbum(1) }
|
||||
};
|
||||
}
|
||||
|
||||
@@ -94,7 +86,7 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
|
||||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.GetArtist(It.IsAny<string>()))
|
||||
.Returns((Artist)null);
|
||||
.Returns((Author)null);
|
||||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.GetArtist("Droned S01E01"))
|
||||
@@ -112,7 +104,7 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
|
||||
public void should_not_mark_as_imported_if_all_files_were_rejected()
|
||||
{
|
||||
Mocker.GetMock<IDownloadedTracksImportService>()
|
||||
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Artist>(), It.IsAny<DownloadClientItem>()))
|
||||
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Author>(), It.IsAny<DownloadClientItem>()))
|
||||
.Returns(new List<ImportResult>
|
||||
{
|
||||
new ImportResult(
|
||||
@@ -136,7 +128,7 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
|
||||
public void should_not_mark_as_imported_if_no_tracks_were_parsed()
|
||||
{
|
||||
Mocker.GetMock<IDownloadedTracksImportService>()
|
||||
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Artist>(), It.IsAny<DownloadClientItem>()))
|
||||
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Author>(), It.IsAny<DownloadClientItem>()))
|
||||
.Returns(new List<ImportResult>
|
||||
{
|
||||
new ImportResult(
|
||||
@@ -159,7 +151,7 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
|
||||
public void should_not_mark_as_imported_if_all_files_were_skipped()
|
||||
{
|
||||
Mocker.GetMock<IDownloadedTracksImportService>()
|
||||
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Artist>(), It.IsAny<DownloadClientItem>()))
|
||||
.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"),
|
||||
@@ -176,17 +168,15 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
|
||||
{
|
||||
GivenArtistMatch();
|
||||
|
||||
_trackedDownload.RemoteAlbum.Albums = new List<Album>
|
||||
_trackedDownload.RemoteAlbum.Albums = new List<Book>
|
||||
{
|
||||
CreateAlbum(1, 3)
|
||||
CreateAlbum(1)
|
||||
};
|
||||
|
||||
Mocker.GetMock<IDownloadedTracksImportService>()
|
||||
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Artist>(), It.IsAny<DownloadClientItem>()))
|
||||
.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() })),
|
||||
new ImportResult(new ImportDecision<LocalTrack>(new LocalTrack { Path = @"C:\TestPath\Droned.S01E01.mkv".AsOsAgnostic() }), "Test Failure")
|
||||
});
|
||||
@@ -199,20 +189,20 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
|
||||
[Test]
|
||||
public void should_not_mark_as_imported_if_some_tracks_were_not_imported()
|
||||
{
|
||||
_trackedDownload.RemoteAlbum.Albums = new List<Album>
|
||||
_trackedDownload.RemoteAlbum.Albums = new List<Book>
|
||||
{
|
||||
CreateAlbum(1, 1),
|
||||
CreateAlbum(1, 2),
|
||||
CreateAlbum(1, 1)
|
||||
CreateAlbum(1),
|
||||
CreateAlbum(1),
|
||||
CreateAlbum(1)
|
||||
};
|
||||
|
||||
Mocker.GetMock<IDownloadedTracksImportService>()
|
||||
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Artist>(), It.IsAny<DownloadClientItem>()))
|
||||
.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() })),
|
||||
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")
|
||||
});
|
||||
@@ -236,23 +226,12 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
|
||||
[Test]
|
||||
public void should_not_mark_as_imported_if_some_of_episodes_were_not_imported_including_history()
|
||||
{
|
||||
var tracks = Builder<Track>.CreateListOfSize(3).BuildList();
|
||||
|
||||
var releases = Builder<AlbumRelease>.CreateListOfSize(3).All().With(x => x.Monitored = true).With(x => x.TrackCount = 1).BuildList();
|
||||
releases[0].Tracks = new List<Track> { tracks[0] };
|
||||
releases[1].Tracks = new List<Track> { tracks[1] };
|
||||
releases[2].Tracks = new List<Track> { tracks[2] };
|
||||
|
||||
var albums = Builder<Album>.CreateListOfSize(3).BuildList();
|
||||
|
||||
albums[0].AlbumReleases = new List<AlbumRelease> { releases[0] };
|
||||
albums[1].AlbumReleases = new List<AlbumRelease> { releases[1] };
|
||||
albums[2].AlbumReleases = new List<AlbumRelease> { releases[2] };
|
||||
var albums = Builder<Book>.CreateListOfSize(3).BuildList();
|
||||
|
||||
_trackedDownload.RemoteAlbum.Albums = albums;
|
||||
|
||||
Mocker.GetMock<IDownloadedTracksImportService>()
|
||||
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Artist>(), It.IsAny<DownloadClientItem>()))
|
||||
.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" })),
|
||||
@@ -279,13 +258,13 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
|
||||
[Test]
|
||||
public void should_mark_as_imported_if_all_tracks_were_imported()
|
||||
{
|
||||
_trackedDownload.RemoteAlbum.Albums = new List<Album>
|
||||
_trackedDownload.RemoteAlbum.Albums = new List<Book>
|
||||
{
|
||||
CreateAlbum(1, 2)
|
||||
CreateAlbum(1)
|
||||
};
|
||||
|
||||
Mocker.GetMock<IDownloadedTracksImportService>()
|
||||
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Artist>(), It.IsAny<DownloadClientItem>()))
|
||||
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Author>(), It.IsAny<DownloadClientItem>()))
|
||||
.Returns(new List<ImportResult>
|
||||
{
|
||||
new ImportResult(
|
||||
@@ -305,31 +284,21 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
|
||||
[Test]
|
||||
public void should_mark_as_imported_if_all_episodes_were_imported_including_history()
|
||||
{
|
||||
var track1 = new Track { Id = 1 };
|
||||
var track2 = new Track { Id = 2 };
|
||||
|
||||
var releases = Builder<AlbumRelease>.CreateListOfSize(2).All().With(x => x.Monitored = true).With(x => x.TrackCount = 1).BuildList();
|
||||
releases[0].Tracks = new List<Track> { track1 };
|
||||
releases[1].Tracks = new List<Track> { track2 };
|
||||
|
||||
var albums = Builder<Album>.CreateListOfSize(2).BuildList();
|
||||
|
||||
albums[0].AlbumReleases = new List<AlbumRelease> { releases[0] };
|
||||
albums[1].AlbumReleases = new List<AlbumRelease> { releases[1] };
|
||||
var albums = Builder<Book>.CreateListOfSize(2).BuildList();
|
||||
|
||||
_trackedDownload.RemoteAlbum.Albums = albums;
|
||||
|
||||
Mocker.GetMock<IDownloadedTracksImportService>()
|
||||
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Artist>(), It.IsAny<DownloadClientItem>()))
|
||||
.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", Tracks = new List<Track> { track1 } })),
|
||||
new LocalTrack { Path = @"C:\TestPath\Droned.S01E01.mkv", Album = albums[0] })),
|
||||
|
||||
new ImportResult(
|
||||
new ImportDecision<LocalTrack>(
|
||||
new LocalTrack { Path = @"C:\TestPath\Droned.S01E02.mkv", Tracks = new List<Track> { track2 } }), "Test Failure")
|
||||
new LocalTrack { Path = @"C:\TestPath\Droned.S01E02.mkv", Album = albums[1] }), "Test Failure")
|
||||
});
|
||||
|
||||
var history = Builder<History.History>.CreateListOfSize(2)
|
||||
@@ -354,7 +323,7 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
|
||||
GivenABadlyNamedDownload();
|
||||
|
||||
Mocker.GetMock<IDownloadedTracksImportService>()
|
||||
.Setup(v => v.ProcessPath(It.IsAny<string>(), It.IsAny<ImportMode>(), It.IsAny<Artist>(), It.IsAny<DownloadClientItem>()))
|
||||
.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() }))
|
||||
|
||||
@@ -58,8 +58,8 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
|
||||
{
|
||||
return new RemoteAlbum
|
||||
{
|
||||
Artist = new Artist(),
|
||||
Albums = new List<Album> { new Album { Id = 1 } }
|
||||
Artist = new Author(),
|
||||
Albums = new List<Book> { new Book { Id = 1 } }
|
||||
};
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
|
||||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.GetArtist(It.IsAny<string>()))
|
||||
.Returns((Artist)null);
|
||||
.Returns((Author)null);
|
||||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.GetArtist("Droned S01E01"))
|
||||
@@ -161,7 +161,7 @@ namespace NzbDrone.Core.Test.Download.CompletedDownloadServiceTests
|
||||
_trackedDownload.RemoteAlbum.Artist = null;
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.GetArtist("Drone.S01E01.HDTV"))
|
||||
.Returns((Artist)null);
|
||||
.Returns((Author)null);
|
||||
|
||||
Subject.Check(_trackedDownload);
|
||||
|
||||
|
||||
+36
-36
@@ -30,27 +30,27 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
|
||||
.Returns<List<DownloadDecision>>(v => v);
|
||||
}
|
||||
|
||||
private Album GetAlbum(int id)
|
||||
private Book GetAlbum(int id)
|
||||
{
|
||||
return Builder<Album>.CreateNew()
|
||||
return Builder<Book>.CreateNew()
|
||||
.With(e => e.Id = id)
|
||||
.Build();
|
||||
}
|
||||
|
||||
private RemoteAlbum GetRemoteAlbum(List<Album> albums, QualityModel quality, DownloadProtocol downloadProtocol = DownloadProtocol.Usenet)
|
||||
private RemoteAlbum GetRemoteAlbum(List<Book> albums, QualityModel quality, DownloadProtocol downloadProtocol = DownloadProtocol.Usenet)
|
||||
{
|
||||
var remoteAlbum = new RemoteAlbum();
|
||||
remoteAlbum.ParsedAlbumInfo = new ParsedAlbumInfo();
|
||||
remoteAlbum.ParsedAlbumInfo.Quality = quality;
|
||||
|
||||
remoteAlbum.Albums = new List<Album>();
|
||||
remoteAlbum.Albums = new List<Book>();
|
||||
remoteAlbum.Albums.AddRange(albums);
|
||||
|
||||
remoteAlbum.Release = new ReleaseInfo();
|
||||
remoteAlbum.Release.DownloadProtocol = downloadProtocol;
|
||||
remoteAlbum.Release.PublishDate = DateTime.UtcNow;
|
||||
|
||||
remoteAlbum.Artist = Builder<Artist>.CreateNew()
|
||||
remoteAlbum.Artist = Builder<Author>.CreateNew()
|
||||
.With(e => e.QualityProfile = new QualityProfile { Items = Qualities.QualityFixture.GetDefaultQualities() })
|
||||
.Build();
|
||||
|
||||
@@ -60,8 +60,8 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
|
||||
[Test]
|
||||
public void should_download_report_if_album_was_not_already_downloaded()
|
||||
{
|
||||
var albums = new List<Album> { GetAlbum(1) };
|
||||
var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_192));
|
||||
var albums = new List<Book> { GetAlbum(1) };
|
||||
var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteAlbum));
|
||||
@@ -73,8 +73,8 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
|
||||
[Test]
|
||||
public void should_only_download_album_once()
|
||||
{
|
||||
var albums = new List<Album> { GetAlbum(1) };
|
||||
var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_192));
|
||||
var albums = new List<Book> { GetAlbum(1) };
|
||||
var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteAlbum));
|
||||
@@ -88,12 +88,12 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
|
||||
public void should_not_download_if_any_album_was_already_downloaded()
|
||||
{
|
||||
var remoteAlbum1 = GetRemoteAlbum(
|
||||
new List<Album> { GetAlbum(1) },
|
||||
new QualityModel(Quality.MP3_192));
|
||||
new List<Book> { GetAlbum(1) },
|
||||
new QualityModel(Quality.MP3_320));
|
||||
|
||||
var remoteAlbum2 = GetRemoteAlbum(
|
||||
new List<Album> { GetAlbum(1), GetAlbum(2) },
|
||||
new QualityModel(Quality.MP3_192));
|
||||
new List<Book> { GetAlbum(1), GetAlbum(2) },
|
||||
new QualityModel(Quality.MP3_320));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteAlbum1));
|
||||
@@ -106,8 +106,8 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
|
||||
[Test]
|
||||
public void should_return_downloaded_reports()
|
||||
{
|
||||
var albums = new List<Album> { GetAlbum(1) };
|
||||
var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_192));
|
||||
var albums = new List<Book> { GetAlbum(1) };
|
||||
var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteAlbum));
|
||||
@@ -119,12 +119,12 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
|
||||
public void should_return_all_downloaded_reports()
|
||||
{
|
||||
var remoteAlbum1 = GetRemoteAlbum(
|
||||
new List<Album> { GetAlbum(1) },
|
||||
new QualityModel(Quality.MP3_192));
|
||||
new List<Book> { GetAlbum(1) },
|
||||
new QualityModel(Quality.MP3_320));
|
||||
|
||||
var remoteAlbum2 = GetRemoteAlbum(
|
||||
new List<Album> { GetAlbum(2) },
|
||||
new QualityModel(Quality.MP3_192));
|
||||
new List<Book> { GetAlbum(2) },
|
||||
new QualityModel(Quality.MP3_320));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteAlbum1));
|
||||
@@ -137,16 +137,16 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
|
||||
public void should_only_return_downloaded_reports()
|
||||
{
|
||||
var remoteAlbum1 = GetRemoteAlbum(
|
||||
new List<Album> { GetAlbum(1) },
|
||||
new QualityModel(Quality.MP3_192));
|
||||
new List<Book> { GetAlbum(1) },
|
||||
new QualityModel(Quality.MP3_320));
|
||||
|
||||
var remoteAlbum2 = GetRemoteAlbum(
|
||||
new List<Album> { GetAlbum(2) },
|
||||
new QualityModel(Quality.MP3_192));
|
||||
new List<Book> { GetAlbum(2) },
|
||||
new QualityModel(Quality.MP3_320));
|
||||
|
||||
var remoteAlbum3 = GetRemoteAlbum(
|
||||
new List<Album> { GetAlbum(2) },
|
||||
new QualityModel(Quality.MP3_192));
|
||||
new List<Book> { GetAlbum(2) },
|
||||
new QualityModel(Quality.MP3_320));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteAlbum1));
|
||||
@@ -159,8 +159,8 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
|
||||
[Test]
|
||||
public void should_not_add_to_downloaded_list_when_download_fails()
|
||||
{
|
||||
var albums = new List<Album> { GetAlbum(1) };
|
||||
var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_192));
|
||||
var albums = new List<Book> { GetAlbum(1) };
|
||||
var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteAlbum));
|
||||
@@ -183,8 +183,8 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
|
||||
[Test]
|
||||
public void should_not_grab_if_pending()
|
||||
{
|
||||
var albums = new List<Album> { GetAlbum(1) };
|
||||
var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_192));
|
||||
var albums = new List<Book> { GetAlbum(1) };
|
||||
var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteAlbum, new Rejection("Failure!", RejectionType.Temporary)));
|
||||
@@ -196,8 +196,8 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
|
||||
[Test]
|
||||
public void should_not_add_to_pending_if_album_was_grabbed()
|
||||
{
|
||||
var albums = new List<Album> { GetAlbum(1) };
|
||||
var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_192));
|
||||
var albums = new List<Book> { GetAlbum(1) };
|
||||
var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteAlbum));
|
||||
@@ -210,8 +210,8 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
|
||||
[Test]
|
||||
public void should_add_to_pending_even_if_already_added_to_pending()
|
||||
{
|
||||
var albums = new List<Album> { GetAlbum(1) };
|
||||
var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_192));
|
||||
var albums = new List<Book> { GetAlbum(1) };
|
||||
var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteAlbum, new Rejection("Failure!", RejectionType.Temporary)));
|
||||
@@ -224,7 +224,7 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
|
||||
[Test]
|
||||
public void should_add_to_failed_if_already_failed_for_that_protocol()
|
||||
{
|
||||
var albums = new List<Album> { GetAlbum(1) };
|
||||
var albums = new List<Book> { GetAlbum(1) };
|
||||
var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
@@ -241,7 +241,7 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
|
||||
[Test]
|
||||
public void should_not_add_to_failed_if_failed_for_a_different_protocol()
|
||||
{
|
||||
var albums = new List<Album> { GetAlbum(1) };
|
||||
var albums = new List<Book> { GetAlbum(1) };
|
||||
var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320), DownloadProtocol.Usenet);
|
||||
var remoteAlbum2 = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320), DownloadProtocol.Torrent);
|
||||
|
||||
@@ -260,7 +260,7 @@ namespace NzbDrone.Core.Test.Download.DownloadApprovedReportsTests
|
||||
[Test]
|
||||
public void should_add_to_rejected_if_release_unavailable_on_indexer()
|
||||
{
|
||||
var albums = new List<Album> { GetAlbum(1) };
|
||||
var albums = new List<Book> { GetAlbum(1) };
|
||||
var remoteAlbum = GetRemoteAlbum(albums, new QualityModel(Quality.MP3_320));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
|
||||
+6
-6
@@ -147,7 +147,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
||||
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.Get(It.Is<HttpRequest>(v => v.Url.FullUri == _downloadUrl)), Times.Once());
|
||||
Mocker.GetMock<IDiskProvider>().Verify(c => c.OpenWriteStream(_filePath), Times.Once());
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>()), Times.Never());
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -161,7 +161,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.Get(It.Is<HttpRequest>(v => v.Url.FullUri == _downloadUrl)), Times.Never());
|
||||
Mocker.GetMock<IDiskProvider>().Verify(c => c.OpenWriteStream(_filePath), Times.Never());
|
||||
Mocker.GetMock<IDiskProvider>().Verify(c => c.OpenWriteStream(_magnetFilePath), Times.Once());
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>()), Times.Never());
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -181,7 +181,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.Get(It.Is<HttpRequest>(v => v.Url.FullUri == _downloadUrl)), Times.Never());
|
||||
Mocker.GetMock<IDiskProvider>().Verify(c => c.OpenWriteStream(_filePath), Times.Never());
|
||||
Mocker.GetMock<IDiskProvider>().Verify(c => c.OpenWriteStream(_magnetFilePath), Times.Once());
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>()), Times.Never());
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -196,7 +196,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.Get(It.Is<HttpRequest>(v => v.Url.FullUri == _downloadUrl)), Times.Never());
|
||||
Mocker.GetMock<IDiskProvider>().Verify(c => c.OpenWriteStream(_filePath), Times.Never());
|
||||
Mocker.GetMock<IDiskProvider>().Verify(c => c.OpenWriteStream(_magnetFilePath), Times.Never());
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>()), Times.Never());
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -211,7 +211,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.Get(It.Is<HttpRequest>(v => v.Url.FullUri == _downloadUrl)), Times.Once());
|
||||
Mocker.GetMock<IDiskProvider>().Verify(c => c.OpenWriteStream(_filePath), Times.Once());
|
||||
Mocker.GetMock<IDiskProvider>().Verify(c => c.OpenWriteStream(_magnetFilePath), Times.Never());
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>()), Times.Never());
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -227,7 +227,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
||||
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.Get(It.Is<HttpRequest>(v => v.Url.FullUri == _downloadUrl)), Times.Once());
|
||||
Mocker.GetMock<IDiskProvider>().Verify(c => c.OpenWriteStream(expectedFilename), Times.Once());
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>()), Times.Never());
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
+2
-2
@@ -119,7 +119,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
||||
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.Get(It.Is<HttpRequest>(v => v.Url.FullUri == _downloadUrl)), Times.Once());
|
||||
Mocker.GetMock<IDiskProvider>().Verify(c => c.OpenWriteStream(_filePath), Times.Once());
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>()), Times.Never());
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -135,7 +135,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.Blackhole
|
||||
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.Get(It.Is<HttpRequest>(v => v.Url.FullUri == _downloadUrl)), Times.Once());
|
||||
Mocker.GetMock<IDiskProvider>().Verify(c => c.OpenWriteStream(expectedFilename), Times.Once());
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>()), Times.Never());
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -52,9 +52,9 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
|
||||
|
||||
remoteAlbum.ParsedAlbumInfo = new ParsedAlbumInfo();
|
||||
|
||||
remoteAlbum.Albums = new List<Album>();
|
||||
remoteAlbum.Albums = new List<Book>();
|
||||
|
||||
remoteAlbum.Artist = new Artist();
|
||||
remoteAlbum.Artist = new Author();
|
||||
|
||||
return remoteAlbum;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
|
||||
|
||||
private void WithFailedDownload()
|
||||
{
|
||||
Mocker.GetMock<IHttpClient>().Setup(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>())).Throws(new WebException());
|
||||
Mocker.GetMock<IHttpClient>().Setup(c => c.DownloadFile(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>())).Throws(new WebException());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -55,7 +55,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
|
||||
{
|
||||
Subject.Download(_remoteAlbum);
|
||||
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.DownloadFile(_nzbUrl, _nzbPath), Times.Once());
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.DownloadFile(_nzbUrl, _nzbPath, null), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -90,7 +90,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests
|
||||
|
||||
Subject.Download(_remoteAlbum);
|
||||
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.DownloadFile(It.IsAny<string>(), expectedFilename), Times.Once());
|
||||
Mocker.GetMock<IHttpClient>().Verify(c => c.DownloadFile(It.IsAny<string>(), expectedFilename, null), Times.Once());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.QBittorrentTests
|
||||
protected void GivenRedirectToTorrent()
|
||||
{
|
||||
var httpHeader = new HttpHeader();
|
||||
httpHeader["Location"] = "http://test.readarr.audio/not-a-real-torrent.torrent";
|
||||
httpHeader["Location"] = "http://test.readarr.com/not-a-real-torrent.torrent";
|
||||
|
||||
Mocker.GetMock<IHttpClient>()
|
||||
.Setup(s => s.Get(It.Is<HttpRequest>(h => h.Url.FullUri == _downloadUrl)))
|
||||
|
||||
@@ -354,7 +354,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.SabnzbdTests
|
||||
.Returns(new SabnzbdAddResponse { Ids = new List<string> { "readarrtest" } });
|
||||
|
||||
var remoteAlbum = CreateRemoteAlbum();
|
||||
remoteAlbum.Albums = Builder<Album>.CreateListOfSize(1)
|
||||
remoteAlbum.Albums = Builder<Book>.CreateListOfSize(1)
|
||||
.All()
|
||||
.With(e => e.ReleaseDate = DateTime.Today)
|
||||
.Build()
|
||||
|
||||
+1
-1
@@ -107,7 +107,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.UTorrentTests
|
||||
protected void GivenRedirectToTorrent()
|
||||
{
|
||||
var httpHeader = new HttpHeader();
|
||||
httpHeader["Location"] = "http://test.readarr.audio/not-a-real-torrent.torrent";
|
||||
httpHeader["Location"] = "http://test.readarr.com/not-a-real-torrent.torrent";
|
||||
|
||||
Mocker.GetMock<IHttpClient>()
|
||||
.Setup(s => s.Get(It.Is<HttpRequest>(h => h.Url.ToString() == _downloadUrl)))
|
||||
|
||||
@@ -34,10 +34,10 @@ namespace NzbDrone.Core.Test.Download
|
||||
.Setup(v => v.GetDownloadClient(It.IsAny<DownloadProtocol>()))
|
||||
.Returns<DownloadProtocol>(v => _downloadClients.FirstOrDefault(d => d.Protocol == v));
|
||||
|
||||
var episodes = Builder<Album>.CreateListOfSize(2)
|
||||
var episodes = Builder<Book>.CreateListOfSize(2)
|
||||
.TheFirst(1).With(s => s.Id = 12)
|
||||
.TheNext(1).With(s => s.Id = 99)
|
||||
.All().With(s => s.ArtistId = 5)
|
||||
.All().With(s => s.AuthorId = 5)
|
||||
.Build().ToList();
|
||||
|
||||
var releaseInfo = Builder<ReleaseInfo>.CreateNew()
|
||||
@@ -46,7 +46,7 @@ namespace NzbDrone.Core.Test.Download
|
||||
.Build();
|
||||
|
||||
_parseResult = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(c => c.Artist = Builder<Artist>.CreateNew().Build())
|
||||
.With(c => c.Artist = Builder<Author>.CreateNew().Build())
|
||||
.With(c => c.Release = releaseInfo)
|
||||
.With(c => c.Albums = episodes)
|
||||
.Build();
|
||||
|
||||
@@ -34,8 +34,8 @@ namespace NzbDrone.Core.Test.Download.FailedDownloadServiceTests
|
||||
|
||||
var remoteAlbum = new RemoteAlbum
|
||||
{
|
||||
Artist = new Artist(),
|
||||
Albums = new List<Album> { new Album { Id = 1 } }
|
||||
Artist = new Author(),
|
||||
Albums = new List<Book> { new Book { Id = 1 } }
|
||||
};
|
||||
|
||||
_trackedDownload = Builder<TrackedDownload>.CreateNew()
|
||||
|
||||
@@ -34,8 +34,8 @@ namespace NzbDrone.Core.Test.Download.FailedDownloadServiceTests
|
||||
|
||||
var remoteAlbum = new RemoteAlbum
|
||||
{
|
||||
Artist = new Artist(),
|
||||
Albums = new List<Album> { new Album { Id = 1 } }
|
||||
Artist = new Author(),
|
||||
Albums = new List<Book> { new Book { Id = 1 } }
|
||||
};
|
||||
|
||||
_trackedDownload = Builder<TrackedDownload>.CreateNew()
|
||||
|
||||
@@ -21,8 +21,8 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
|
||||
public class AddFixture : CoreTest<PendingReleaseService>
|
||||
{
|
||||
private DownloadDecision _temporarilyRejected;
|
||||
private Artist _artist;
|
||||
private Album _album;
|
||||
private Author _artist;
|
||||
private Book _album;
|
||||
private QualityProfile _profile;
|
||||
private ReleaseInfo _release;
|
||||
private ParsedAlbumInfo _parsedAlbumInfo;
|
||||
@@ -32,19 +32,19 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_artist = Builder<Artist>.CreateNew()
|
||||
_artist = Builder<Author>.CreateNew()
|
||||
.Build();
|
||||
|
||||
_album = Builder<Album>.CreateNew()
|
||||
_album = Builder<Book>.CreateNew()
|
||||
.Build();
|
||||
|
||||
_profile = new QualityProfile
|
||||
{
|
||||
Name = "Test",
|
||||
Cutoff = Quality.MP3_256.Id,
|
||||
Cutoff = Quality.MP3_320.Id,
|
||||
Items = new List<QualityProfileQualityItem>
|
||||
{
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3_256 },
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3_320 },
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3_320 },
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3_320 }
|
||||
},
|
||||
@@ -55,10 +55,10 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
|
||||
_release = Builder<ReleaseInfo>.CreateNew().Build();
|
||||
|
||||
_parsedAlbumInfo = Builder<ParsedAlbumInfo>.CreateNew().Build();
|
||||
_parsedAlbumInfo.Quality = new QualityModel(Quality.MP3_256);
|
||||
_parsedAlbumInfo.Quality = new QualityModel(Quality.MP3_320);
|
||||
|
||||
_remoteAlbum = new RemoteAlbum();
|
||||
_remoteAlbum.Albums = new List<Album> { _album };
|
||||
_remoteAlbum.Albums = new List<Book> { _album };
|
||||
_remoteAlbum.Artist = _artist;
|
||||
_remoteAlbum.ParsedAlbumInfo = _parsedAlbumInfo;
|
||||
_remoteAlbum.Release = _release;
|
||||
@@ -72,8 +72,8 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
|
||||
.Returns(_heldReleases);
|
||||
|
||||
Mocker.GetMock<IPendingReleaseRepository>()
|
||||
.Setup(s => s.AllByArtistId(It.IsAny<int>()))
|
||||
.Returns<int>(i => _heldReleases.Where(v => v.ArtistId == i).ToList());
|
||||
.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>()))
|
||||
@@ -81,11 +81,11 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
|
||||
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(s => s.GetArtists(It.IsAny<IEnumerable<int>>()))
|
||||
.Returns(new List<Artist> { _artist });
|
||||
.Returns(new List<Author> { _artist });
|
||||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.GetAlbums(It.IsAny<ParsedAlbumInfo>(), _artist, null))
|
||||
.Returns(new List<Album> { _album });
|
||||
.Returns(new List<Book> { _album });
|
||||
|
||||
Mocker.GetMock<IPrioritizeDownloadDecision>()
|
||||
.Setup(s => s.PrioritizeDecisions(It.IsAny<List<DownloadDecision>>()))
|
||||
@@ -100,7 +100,7 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
|
||||
|
||||
var heldReleases = Builder<PendingRelease>.CreateListOfSize(1)
|
||||
.All()
|
||||
.With(h => h.ArtistId = _artist.Id)
|
||||
.With(h => h.AuthorId = _artist.Id)
|
||||
.With(h => h.Title = title)
|
||||
.With(h => h.Release = release)
|
||||
.With(h => h.Reason = reason)
|
||||
|
||||
+14
-14
@@ -21,8 +21,8 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
|
||||
public class RemoveGrabbedFixture : CoreTest<PendingReleaseService>
|
||||
{
|
||||
private DownloadDecision _temporarilyRejected;
|
||||
private Artist _artist;
|
||||
private Album _album;
|
||||
private Author _artist;
|
||||
private Book _album;
|
||||
private QualityProfile _profile;
|
||||
private ReleaseInfo _release;
|
||||
private ParsedAlbumInfo _parsedAlbumInfo;
|
||||
@@ -32,19 +32,19 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_artist = Builder<Artist>.CreateNew()
|
||||
_artist = Builder<Author>.CreateNew()
|
||||
.Build();
|
||||
|
||||
_album = Builder<Album>.CreateNew()
|
||||
_album = Builder<Book>.CreateNew()
|
||||
.Build();
|
||||
|
||||
_profile = new QualityProfile
|
||||
{
|
||||
Name = "Test",
|
||||
Cutoff = Quality.MP3_256.Id,
|
||||
Cutoff = Quality.MP3_320.Id,
|
||||
Items = new List<QualityProfileQualityItem>
|
||||
{
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3_256 },
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3_320 },
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3_320 },
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.FLAC }
|
||||
},
|
||||
@@ -55,10 +55,10 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
|
||||
_release = Builder<ReleaseInfo>.CreateNew().Build();
|
||||
|
||||
_parsedAlbumInfo = Builder<ParsedAlbumInfo>.CreateNew().Build();
|
||||
_parsedAlbumInfo.Quality = new QualityModel(Quality.MP3_256);
|
||||
_parsedAlbumInfo.Quality = new QualityModel(Quality.MP3_320);
|
||||
|
||||
_remoteAlbum = new RemoteAlbum();
|
||||
_remoteAlbum.Albums = new List<Album> { _album };
|
||||
_remoteAlbum.Albums = new List<Book> { _album };
|
||||
_remoteAlbum.Artist = _artist;
|
||||
_remoteAlbum.ParsedAlbumInfo = _parsedAlbumInfo;
|
||||
_remoteAlbum.Release = _release;
|
||||
@@ -72,8 +72,8 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
|
||||
.Returns(_heldReleases);
|
||||
|
||||
Mocker.GetMock<IPendingReleaseRepository>()
|
||||
.Setup(s => s.AllByArtistId(It.IsAny<int>()))
|
||||
.Returns<int>(i => _heldReleases.Where(v => v.ArtistId == i).ToList());
|
||||
.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>()))
|
||||
@@ -81,11 +81,11 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
|
||||
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(s => s.GetArtists(It.IsAny<IEnumerable<int>>()))
|
||||
.Returns(new List<Artist> { _artist });
|
||||
.Returns(new List<Author> { _artist });
|
||||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.GetAlbums(It.IsAny<ParsedAlbumInfo>(), _artist, null))
|
||||
.Returns(new List<Album> { _album });
|
||||
.Returns(new List<Book> { _album });
|
||||
|
||||
Mocker.GetMock<IPrioritizeDownloadDecision>()
|
||||
.Setup(s => s.PrioritizeDecisions(It.IsAny<List<DownloadDecision>>()))
|
||||
@@ -99,7 +99,7 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
|
||||
|
||||
var heldReleases = Builder<PendingRelease>.CreateListOfSize(1)
|
||||
.All()
|
||||
.With(h => h.ArtistId = _artist.Id)
|
||||
.With(h => h.AuthorId = _artist.Id)
|
||||
.With(h => h.Release = _release.JsonClone())
|
||||
.With(h => h.ParsedAlbumInfo = parsedEpisodeInfo)
|
||||
.Build();
|
||||
@@ -120,7 +120,7 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
|
||||
[Test]
|
||||
public void should_delete_if_the_grabbed_quality_is_the_higher()
|
||||
{
|
||||
GivenHeldRelease(new QualityModel(Quality.MP3_192));
|
||||
GivenHeldRelease(new QualityModel(Quality.MP3_320));
|
||||
|
||||
Subject.Handle(new AlbumGrabbedEvent(_remoteAlbum));
|
||||
|
||||
|
||||
+7
-7
@@ -16,18 +16,18 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
|
||||
public class RemovePendingFixture : CoreTest<PendingReleaseService>
|
||||
{
|
||||
private List<PendingRelease> _pending;
|
||||
private Album _album;
|
||||
private Book _album;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_pending = new List<PendingRelease>();
|
||||
|
||||
_album = Builder<Album>.CreateNew()
|
||||
_album = Builder<Book>.CreateNew()
|
||||
.Build();
|
||||
|
||||
Mocker.GetMock<IPendingReleaseRepository>()
|
||||
.Setup(s => s.AllByArtistId(It.IsAny<int>()))
|
||||
.Setup(s => s.AllByAuthorId(It.IsAny<int>()))
|
||||
.Returns(_pending);
|
||||
|
||||
Mocker.GetMock<IPendingReleaseRepository>()
|
||||
@@ -36,15 +36,15 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
|
||||
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(s => s.GetArtist(It.IsAny<int>()))
|
||||
.Returns(new Artist());
|
||||
.Returns(new Author());
|
||||
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(s => s.GetArtists(It.IsAny<IEnumerable<int>>()))
|
||||
.Returns(new List<Artist> { new Artist() });
|
||||
.Returns(new List<Author> { new Author() });
|
||||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.GetAlbums(It.IsAny<ParsedAlbumInfo>(), It.IsAny<Artist>(), null))
|
||||
.Returns(new List<Album> { _album });
|
||||
.Setup(s => s.GetAlbums(It.IsAny<ParsedAlbumInfo>(), It.IsAny<Author>(), null))
|
||||
.Returns(new List<Book> { _album });
|
||||
}
|
||||
|
||||
private void AddPending(int id, string album)
|
||||
|
||||
+12
-12
@@ -22,8 +22,8 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
|
||||
public class RemoveRejectedFixture : CoreTest<PendingReleaseService>
|
||||
{
|
||||
private DownloadDecision _temporarilyRejected;
|
||||
private Artist _artist;
|
||||
private Album _album;
|
||||
private Author _artist;
|
||||
private Book _album;
|
||||
private QualityProfile _profile;
|
||||
private ReleaseInfo _release;
|
||||
private ParsedAlbumInfo _parsedAlbumInfo;
|
||||
@@ -32,20 +32,20 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_artist = Builder<Artist>.CreateNew()
|
||||
_artist = Builder<Author>.CreateNew()
|
||||
.Build();
|
||||
|
||||
_album = Builder<Album>.CreateNew()
|
||||
_album = Builder<Book>.CreateNew()
|
||||
.Build();
|
||||
|
||||
_profile = new QualityProfile
|
||||
{
|
||||
Name = "Test",
|
||||
Cutoff = Quality.MP3_192.Id,
|
||||
Cutoff = Quality.MP3_320.Id,
|
||||
Items = new List<QualityProfileQualityItem>
|
||||
{
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3_192 },
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3_256 },
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3_320 },
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3_320 },
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3_320 }
|
||||
},
|
||||
};
|
||||
@@ -55,10 +55,10 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
|
||||
_release = Builder<ReleaseInfo>.CreateNew().Build();
|
||||
|
||||
_parsedAlbumInfo = Builder<ParsedAlbumInfo>.CreateNew().Build();
|
||||
_parsedAlbumInfo.Quality = new QualityModel(Quality.MP3_192);
|
||||
_parsedAlbumInfo.Quality = new QualityModel(Quality.MP3_320);
|
||||
|
||||
_remoteAlbum = new RemoteAlbum();
|
||||
_remoteAlbum.Albums = new List<Album> { _album };
|
||||
_remoteAlbum.Albums = new List<Book> { _album };
|
||||
_remoteAlbum.Artist = _artist;
|
||||
_remoteAlbum.ParsedAlbumInfo = _parsedAlbumInfo;
|
||||
_remoteAlbum.Release = _release;
|
||||
@@ -75,11 +75,11 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
|
||||
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(s => s.GetArtists(It.IsAny<IEnumerable<int>>()))
|
||||
.Returns(new List<Artist> { _artist });
|
||||
.Returns(new List<Author> { _artist });
|
||||
|
||||
Mocker.GetMock<IParsingService>()
|
||||
.Setup(s => s.GetAlbums(It.IsAny<ParsedAlbumInfo>(), _artist, null))
|
||||
.Returns(new List<Album> { _album });
|
||||
.Returns(new List<Book> { _album });
|
||||
|
||||
Mocker.GetMock<IPrioritizeDownloadDecision>()
|
||||
.Setup(s => s.PrioritizeDecisions(It.IsAny<List<DownloadDecision>>()))
|
||||
@@ -94,7 +94,7 @@ namespace NzbDrone.Core.Test.Download.Pending.PendingReleaseServiceTests
|
||||
|
||||
var heldReleases = Builder<PendingRelease>.CreateListOfSize(1)
|
||||
.All()
|
||||
.With(h => h.ArtistId = _artist.Id)
|
||||
.With(h => h.AuthorId = _artist.Id)
|
||||
.With(h => h.Title = title)
|
||||
.With(h => h.Release = release)
|
||||
.Build();
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace NzbDrone.Core.Test.Download
|
||||
|
||||
Mocker.GetMock<IAlbumService>()
|
||||
.Setup(x => x.GetAlbumsByArtist(It.IsAny<int>()))
|
||||
.Returns(Builder<Album>.CreateListOfSize(3).Build() as List<Album>);
|
||||
.Returns(Builder<Book>.CreateListOfSize(3).Build() as List<Book>);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -31,8 +31,8 @@ namespace NzbDrone.Core.Test.Download
|
||||
{
|
||||
var failedEvent = new DownloadFailedEvent
|
||||
{
|
||||
ArtistId = 1,
|
||||
AlbumIds = new List<int> { 1 },
|
||||
AuthorId = 1,
|
||||
BookIds = new List<int> { 1 },
|
||||
SkipReDownload = true
|
||||
};
|
||||
|
||||
@@ -48,8 +48,8 @@ namespace NzbDrone.Core.Test.Download
|
||||
{
|
||||
var failedEvent = new DownloadFailedEvent
|
||||
{
|
||||
ArtistId = 1,
|
||||
AlbumIds = new List<int> { 1 }
|
||||
AuthorId = 1,
|
||||
BookIds = new List<int> { 1 }
|
||||
};
|
||||
|
||||
Mocker.GetMock<IConfigService>()
|
||||
@@ -68,15 +68,15 @@ namespace NzbDrone.Core.Test.Download
|
||||
{
|
||||
var failedEvent = new DownloadFailedEvent
|
||||
{
|
||||
ArtistId = 1,
|
||||
AlbumIds = new List<int> { 2 }
|
||||
AuthorId = 1,
|
||||
BookIds = new List<int> { 2 }
|
||||
};
|
||||
|
||||
Subject.Handle(failedEvent);
|
||||
|
||||
Mocker.GetMock<IManageCommandQueue>()
|
||||
.Verify(x => x.Push(It.Is<AlbumSearchCommand>(c => c.AlbumIds.Count == 1 &&
|
||||
c.AlbumIds[0] == 2),
|
||||
.Verify(x => x.Push(It.Is<AlbumSearchCommand>(c => c.BookIds.Count == 1 &&
|
||||
c.BookIds[0] == 2),
|
||||
It.IsAny<CommandPriority>(),
|
||||
It.IsAny<CommandTrigger>()),
|
||||
Times.Once());
|
||||
@@ -91,16 +91,16 @@ namespace NzbDrone.Core.Test.Download
|
||||
{
|
||||
var failedEvent = new DownloadFailedEvent
|
||||
{
|
||||
ArtistId = 1,
|
||||
AlbumIds = new List<int> { 2, 3 }
|
||||
AuthorId = 1,
|
||||
BookIds = new List<int> { 2, 3 }
|
||||
};
|
||||
|
||||
Subject.Handle(failedEvent);
|
||||
|
||||
Mocker.GetMock<IManageCommandQueue>()
|
||||
.Verify(x => x.Push(It.Is<AlbumSearchCommand>(c => c.AlbumIds.Count == 2 &&
|
||||
c.AlbumIds[0] == 2 &&
|
||||
c.AlbumIds[1] == 3),
|
||||
.Verify(x => x.Push(It.Is<AlbumSearchCommand>(c => c.BookIds.Count == 2 &&
|
||||
c.BookIds[0] == 2 &&
|
||||
c.BookIds[1] == 3),
|
||||
It.IsAny<CommandPriority>(),
|
||||
It.IsAny<CommandTrigger>()),
|
||||
Times.Once());
|
||||
@@ -116,14 +116,14 @@ namespace NzbDrone.Core.Test.Download
|
||||
// note that artist is set to have 3 albums in setup
|
||||
var failedEvent = new DownloadFailedEvent
|
||||
{
|
||||
ArtistId = 2,
|
||||
AlbumIds = new List<int> { 1, 2, 3 }
|
||||
AuthorId = 2,
|
||||
BookIds = new List<int> { 1, 2, 3 }
|
||||
};
|
||||
|
||||
Subject.Handle(failedEvent);
|
||||
|
||||
Mocker.GetMock<IManageCommandQueue>()
|
||||
.Verify(x => x.Push(It.Is<ArtistSearchCommand>(c => c.ArtistId == failedEvent.ArtistId),
|
||||
.Verify(x => x.Push(It.Is<ArtistSearchCommand>(c => c.AuthorId == failedEvent.AuthorId),
|
||||
It.IsAny<CommandPriority>(),
|
||||
It.IsAny<CommandTrigger>()),
|
||||
Times.Once());
|
||||
|
||||
+5
-5
@@ -13,14 +13,14 @@ namespace NzbDrone.Core.Test.Download.TrackedDownloads
|
||||
[TestFixture]
|
||||
public class TrackedDownloadAlreadyImportedFixture : CoreTest<TrackedDownloadAlreadyImported>
|
||||
{
|
||||
private List<Album> _albums;
|
||||
private List<Book> _albums;
|
||||
private TrackedDownload _trackedDownload;
|
||||
private List<History.History> _historyItems;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_albums = new List<Album>();
|
||||
_albums = new List<Book>();
|
||||
|
||||
var remoteAlbum = Builder<RemoteAlbum>.CreateNew()
|
||||
.With(r => r.Albums = _albums)
|
||||
@@ -35,17 +35,17 @@ namespace NzbDrone.Core.Test.Download.TrackedDownloads
|
||||
|
||||
public void GivenEpisodes(int count)
|
||||
{
|
||||
_albums.AddRange(Builder<Album>.CreateListOfSize(count)
|
||||
_albums.AddRange(Builder<Book>.CreateListOfSize(count)
|
||||
.BuildList());
|
||||
}
|
||||
|
||||
public void GivenHistoryForEpisode(Album episode, params HistoryEventType[] eventTypes)
|
||||
public void GivenHistoryForEpisode(Book episode, params HistoryEventType[] eventTypes)
|
||||
{
|
||||
foreach (var eventType in eventTypes)
|
||||
{
|
||||
_historyItems.Add(
|
||||
Builder<History.History>.CreateNew()
|
||||
.With(h => h.AlbumId = episode.Id)
|
||||
.With(h => h.BookId = episode.Id)
|
||||
.With(h => h.EventType = eventType)
|
||||
.Build());
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ namespace NzbDrone.Core.Test.Download.TrackedDownloads
|
||||
{
|
||||
DownloadId = "35238",
|
||||
SourceTitle = "Audio Artist - Audio Album [2018 - FLAC]",
|
||||
ArtistId = 5,
|
||||
AlbumId = 4,
|
||||
AuthorId = 5,
|
||||
BookId = 4,
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -41,8 +41,8 @@ namespace NzbDrone.Core.Test.Download.TrackedDownloads
|
||||
|
||||
var remoteAlbum = new RemoteAlbum
|
||||
{
|
||||
Artist = new Artist() { Id = 5 },
|
||||
Albums = new List<Album> { new Album { Id = 4 } },
|
||||
Artist = new Author() { Id = 5 },
|
||||
Albums = new List<Book> { new Book { Id = 4 } },
|
||||
ParsedAlbumInfo = new ParsedAlbumInfo()
|
||||
{
|
||||
AlbumTitle = "Audio Album",
|
||||
@@ -82,8 +82,8 @@ namespace NzbDrone.Core.Test.Download.TrackedDownloads
|
||||
|
||||
var remoteAlbum = new RemoteAlbum
|
||||
{
|
||||
Artist = new Artist() { Id = 5 },
|
||||
Albums = new List<Album> { new Album { Id = 4 } },
|
||||
Artist = new Author() { Id = 5 },
|
||||
Albums = new List<Book> { new Book { Id = 4 } },
|
||||
ParsedAlbumInfo = new ParsedAlbumInfo()
|
||||
{
|
||||
AlbumTitle = "Audio Album",
|
||||
|
||||
Reference in New Issue
Block a user