mirror of
https://github.com/Readarr/Readarr
synced 2026-02-04 13:53:29 +01:00
Rename MP3-320 to MP3
This commit is contained in:
parent
3abda061ba
commit
9fb7a1051e
40 changed files with 229 additions and 229 deletions
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
|
|
@ -43,7 +43,7 @@ public void Setup()
|
|||
.With(e => e.Author = _author)
|
||||
.With(e => e.Edition = _edition)
|
||||
.With(e => e.EditionId == _edition.Id)
|
||||
.With(e => e.Quality = new QualityModel(Quality.MP3_320))
|
||||
.With(e => e.Quality = new QualityModel(Quality.MP3))
|
||||
.BuildNew();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
|
|
@ -21,7 +21,7 @@ public void Setup()
|
|||
{
|
||||
AuthorId = 12345,
|
||||
BookIds = new List<int> { 1 },
|
||||
Quality = new QualityModel(Quality.MP3_320),
|
||||
Quality = new QualityModel(Quality.MP3),
|
||||
SourceTitle = "author.name.book.title",
|
||||
DownloadClient = "SabnzbdClient",
|
||||
DownloadId = "Sabnzbd_nzo_2dfh73k"
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public void one_to_one()
|
|||
[Test]
|
||||
public void embedded_document_as_json()
|
||||
{
|
||||
var quality = new QualityModel { Quality = Quality.MP3_320, Revision = new Revision(version: 2) };
|
||||
var quality = new QualityModel { Quality = Quality.MP3, Revision = new Revision(version: 2) };
|
||||
|
||||
var history = Builder<History.History>.CreateNew()
|
||||
.With(c => c.Id = 0)
|
||||
|
|
@ -47,14 +47,14 @@ public void embedded_list_of_document_with_json()
|
|||
.All().With(c => c.Id = 0)
|
||||
.Build().ToList();
|
||||
|
||||
history[0].Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2));
|
||||
history[1].Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2));
|
||||
history[0].Quality = new QualityModel(Quality.MP3, new Revision(version: 2));
|
||||
history[1].Quality = new QualityModel(Quality.MP3, new Revision(version: 2));
|
||||
|
||||
Db.InsertMany(history);
|
||||
|
||||
var returnedHistory = Db.All<History.History>();
|
||||
|
||||
returnedHistory[0].Quality.Quality.Should().Be(Quality.MP3_320);
|
||||
returnedHistory[0].Quality.Quality.Should().Be(Quality.MP3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public void Setup()
|
|||
var profile = new QualityProfile
|
||||
{
|
||||
Name = "Test",
|
||||
Cutoff = Quality.MP3_320.Id,
|
||||
Cutoff = Quality.MP3.Id,
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities()
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public void Setup()
|
|||
|
||||
_firstFile = new BookFile { Quality = new QualityModel(Quality.FLAC, new Revision(version: 2)), DateAdded = DateTime.Now };
|
||||
|
||||
_mp3 = new QualityModel(Quality.MP3_320, new Revision(version: 1));
|
||||
_mp3 = new QualityModel(Quality.MP3, new Revision(version: 1));
|
||||
_flac = new QualityModel(Quality.FLAC, new Revision(version: 1));
|
||||
|
||||
_remoteBook = new RemoteBook
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public void should_return_true_if_current_book_is_less_than_cutoff()
|
|||
Subject.CutoffNotMet(
|
||||
new QualityProfile
|
||||
{
|
||||
Cutoff = Quality.MP3_320.Id,
|
||||
Cutoff = Quality.MP3.Id,
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities()
|
||||
},
|
||||
new List<QualityModel> { new QualityModel(Quality.Unknown, new Revision(version: 2)) },
|
||||
|
|
@ -32,10 +32,10 @@ public void should_return_false_if_current_book_is_equal_to_cutoff()
|
|||
Subject.CutoffNotMet(
|
||||
new QualityProfile
|
||||
{
|
||||
Cutoff = Quality.MP3_320.Id,
|
||||
Cutoff = Quality.MP3.Id,
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities()
|
||||
},
|
||||
new List<QualityModel> { new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
new List<QualityModel> { new QualityModel(Quality.MP3, new Revision(version: 2)) },
|
||||
NoPreferredWordScore).Should().BeFalse();
|
||||
}
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ public void should_return_false_if_current_book_is_greater_than_cutoff()
|
|||
Cutoff = Quality.AZW3.Id,
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities()
|
||||
},
|
||||
new List<QualityModel> { new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
new List<QualityModel> { new QualityModel(Quality.MP3, new Revision(version: 2)) },
|
||||
NoPreferredWordScore).Should().BeFalse();
|
||||
}
|
||||
|
||||
|
|
@ -58,12 +58,12 @@ public void should_return_true_when_new_book_is_proper_but_existing_is_not()
|
|||
Subject.CutoffNotMet(
|
||||
new QualityProfile
|
||||
{
|
||||
Cutoff = Quality.MP3_320.Id,
|
||||
Cutoff = Quality.MP3.Id,
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities()
|
||||
},
|
||||
new List<QualityModel> { new QualityModel(Quality.MP3_320, new Revision(version: 1)) },
|
||||
new List<QualityModel> { new QualityModel(Quality.MP3, new Revision(version: 1)) },
|
||||
NoPreferredWordScore,
|
||||
new QualityModel(Quality.MP3_320, new Revision(version: 2))).Should().BeTrue();
|
||||
new QualityModel(Quality.MP3, new Revision(version: 2))).Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -72,10 +72,10 @@ public void should_return_false_if_cutoff_is_met_and_quality_is_higher()
|
|||
Subject.CutoffNotMet(
|
||||
new QualityProfile
|
||||
{
|
||||
Cutoff = Quality.MP3_320.Id,
|
||||
Cutoff = Quality.MP3.Id,
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities()
|
||||
},
|
||||
new List<QualityModel> { new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
new List<QualityModel> { new QualityModel(Quality.MP3, new Revision(version: 2)) },
|
||||
NoPreferredWordScore,
|
||||
new QualityModel(Quality.FLAC, new Revision(version: 2))).Should().BeFalse();
|
||||
}
|
||||
|
|
@ -85,13 +85,13 @@ public void should_return_true_if_cutoffs_are_met_and_score_is_higher()
|
|||
{
|
||||
QualityProfile profile = new QualityProfile
|
||||
{
|
||||
Cutoff = Quality.MP3_320.Id,
|
||||
Cutoff = Quality.MP3.Id,
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||
};
|
||||
|
||||
Subject.CutoffNotMet(
|
||||
profile,
|
||||
new List<QualityModel> { new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
new List<QualityModel> { new QualityModel(Quality.MP3, new Revision(version: 2)) },
|
||||
NoPreferredWordScore,
|
||||
new QualityModel(Quality.FLAC, new Revision(version: 2)),
|
||||
10).Should().BeTrue();
|
||||
|
|
@ -102,7 +102,7 @@ public void should_return_true_if_cutoffs_are_met_but_is_a_revision_upgrade()
|
|||
{
|
||||
QualityProfile profile = new QualityProfile
|
||||
{
|
||||
Cutoff = Quality.MP3_320.Id,
|
||||
Cutoff = Quality.MP3.Id,
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public void Setup()
|
|||
.With(c => c.QualityProfile = new QualityProfile
|
||||
{
|
||||
UpgradeAllowed = true,
|
||||
Cutoff = Quality.MP3_320.Id,
|
||||
Cutoff = Quality.MP3.Id,
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities()
|
||||
})
|
||||
.Build();
|
||||
|
|
@ -57,19 +57,19 @@ public void Setup()
|
|||
_parseResultMulti = new RemoteBook
|
||||
{
|
||||
Author = _fakeAuthor,
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3, new Revision(version: 2)) },
|
||||
Books = doubleBookList
|
||||
};
|
||||
|
||||
_parseResultSingle = new RemoteBook
|
||||
{
|
||||
Author = _fakeAuthor,
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3, new Revision(version: 2)) },
|
||||
Books = singleBookList
|
||||
};
|
||||
|
||||
_upgradableQuality = new QualityModel(Quality.MP3_320, new Revision(version: 1));
|
||||
_notupgradableQuality = new QualityModel(Quality.MP3_320, new Revision(version: 2));
|
||||
_upgradableQuality = new QualityModel(Quality.MP3, new Revision(version: 1));
|
||||
_notupgradableQuality = new QualityModel(Quality.MP3, new Revision(version: 2));
|
||||
|
||||
Mocker.GetMock<IConfigService>()
|
||||
.SetupGet(s => s.EnableCompletedDownloadHandling)
|
||||
|
|
@ -164,9 +164,9 @@ public void should_be_not_upgradable_if_only_second_books_is_upgradable()
|
|||
[Test]
|
||||
public void should_not_be_upgradable_if_book_is_of_same_quality_as_existing()
|
||||
{
|
||||
_fakeAuthor.QualityProfile = new QualityProfile { Cutoff = Quality.MP3_320.Id, Items = Qualities.QualityFixture.GetDefaultQualities() };
|
||||
_parseResultSingle.ParsedBookInfo.Quality = new QualityModel(Quality.MP3_320, new Revision(version: 1));
|
||||
_upgradableQuality = new QualityModel(Quality.MP3_320, new Revision(version: 1));
|
||||
_fakeAuthor.QualityProfile = new QualityProfile { Cutoff = Quality.MP3.Id, Items = Qualities.QualityFixture.GetDefaultQualities() };
|
||||
_parseResultSingle.ParsedBookInfo.Quality = new QualityModel(Quality.MP3, new Revision(version: 1));
|
||||
_upgradableQuality = new QualityModel(Quality.MP3, new Revision(version: 1));
|
||||
|
||||
GivenMostRecentForBook(FIRST_ALBUM_ID, string.Empty, _upgradableQuality, DateTime.UtcNow, HistoryEventType.Grabbed);
|
||||
|
||||
|
|
@ -176,9 +176,9 @@ public void should_not_be_upgradable_if_book_is_of_same_quality_as_existing()
|
|||
[Test]
|
||||
public void should_not_be_upgradable_if_cutoff_already_met()
|
||||
{
|
||||
_fakeAuthor.QualityProfile = new QualityProfile { Cutoff = Quality.MP3_320.Id, Items = Qualities.QualityFixture.GetDefaultQualities() };
|
||||
_parseResultSingle.ParsedBookInfo.Quality = new QualityModel(Quality.MP3_320, new Revision(version: 1));
|
||||
_upgradableQuality = new QualityModel(Quality.MP3_320, new Revision(version: 1));
|
||||
_fakeAuthor.QualityProfile = new QualityProfile { Cutoff = Quality.MP3.Id, Items = Qualities.QualityFixture.GetDefaultQualities() };
|
||||
_parseResultSingle.ParsedBookInfo.Quality = new QualityModel(Quality.MP3, new Revision(version: 1));
|
||||
_upgradableQuality = new QualityModel(Quality.MP3, new Revision(version: 1));
|
||||
|
||||
GivenMostRecentForBook(FIRST_ALBUM_ID, string.Empty, _upgradableQuality, DateTime.UtcNow, HistoryEventType.Grabbed);
|
||||
|
||||
|
|
@ -204,9 +204,9 @@ public void should_return_false_if_latest_history_has_a_download_id_and_cdh_is_d
|
|||
public void should_return_false_if_cutoff_already_met_and_cdh_is_disabled()
|
||||
{
|
||||
GivenCdhDisabled();
|
||||
_fakeAuthor.QualityProfile = new QualityProfile { Cutoff = Quality.MP3_320.Id, Items = Qualities.QualityFixture.GetDefaultQualities() };
|
||||
_parseResultSingle.ParsedBookInfo.Quality = new QualityModel(Quality.MP3_320, new Revision(version: 1));
|
||||
_upgradableQuality = new QualityModel(Quality.MP3_320, new Revision(version: 1));
|
||||
_fakeAuthor.QualityProfile = new QualityProfile { Cutoff = Quality.MP3.Id, Items = Qualities.QualityFixture.GetDefaultQualities() };
|
||||
_parseResultSingle.ParsedBookInfo.Quality = new QualityModel(Quality.MP3, new Revision(version: 1));
|
||||
_upgradableQuality = new QualityModel(Quality.MP3, new Revision(version: 1));
|
||||
|
||||
GivenMostRecentForBook(FIRST_ALBUM_ID, "test", _upgradableQuality, DateTime.UtcNow.AddDays(-100), HistoryEventType.Grabbed);
|
||||
|
||||
|
|
|
|||
|
|
@ -73,8 +73,8 @@ private void GivenPreferredDownloadProtocol(DownloadProtocol downloadProtocol)
|
|||
[Test]
|
||||
public void should_put_reals_before_non_reals()
|
||||
{
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320, new Revision(version: 1, real: 0)));
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320, new Revision(version: 1, real: 1)));
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3, new Revision(version: 1, real: 0)));
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3, new Revision(version: 1, real: 1)));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteBook1));
|
||||
|
|
@ -87,8 +87,8 @@ public void should_put_reals_before_non_reals()
|
|||
[Test]
|
||||
public void should_put_propers_before_non_propers()
|
||||
{
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320, new Revision(version: 1)));
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320, new Revision(version: 2)));
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3, new Revision(version: 1)));
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3, new Revision(version: 2)));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteBook1));
|
||||
|
|
@ -101,24 +101,24 @@ public void should_put_propers_before_non_propers()
|
|||
[Test]
|
||||
public void should_put_higher_quality_before_lower()
|
||||
{
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3));
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteBook1));
|
||||
decisions.Add(new DownloadDecision(remoteBook2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
qualifiedReports.First().RemoteBook.ParsedBookInfo.Quality.Quality.Should().Be(Quality.MP3_320);
|
||||
qualifiedReports.First().RemoteBook.ParsedBookInfo.Quality.Quality.Should().Be(Quality.MP3);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_order_by_age_then_largest_rounded_to_200mb()
|
||||
{
|
||||
var remoteBookSd = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320), size: 100.Megabytes(), age: 1);
|
||||
var remoteBookHdSmallOld = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320), size: 1200.Megabytes(), age: 1000);
|
||||
var remoteBookSmallYoung = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320), size: 1250.Megabytes(), age: 10);
|
||||
var remoteBookHdLargeYoung = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320), size: 3000.Megabytes(), age: 1);
|
||||
var remoteBookSd = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3), size: 100.Megabytes(), age: 1);
|
||||
var remoteBookHdSmallOld = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3), size: 1200.Megabytes(), age: 1000);
|
||||
var remoteBookSmallYoung = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3), size: 1250.Megabytes(), age: 10);
|
||||
var remoteBookHdLargeYoung = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3), size: 3000.Megabytes(), age: 1);
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteBookSd));
|
||||
|
|
@ -133,8 +133,8 @@ public void should_order_by_age_then_largest_rounded_to_200mb()
|
|||
[Test]
|
||||
public void should_order_by_youngest()
|
||||
{
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320), age: 10);
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320), age: 5);
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3), age: 10);
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3), age: 5);
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteBook1));
|
||||
|
|
@ -147,8 +147,8 @@ public void should_order_by_youngest()
|
|||
[Test]
|
||||
public void should_not_throw_if_no_books_are_found()
|
||||
{
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320), size: 500.Megabytes());
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320), size: 500.Megabytes());
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3), size: 500.Megabytes());
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3), size: 500.Megabytes());
|
||||
|
||||
remoteBook1.Books = new List<Book>();
|
||||
|
||||
|
|
@ -164,8 +164,8 @@ public void should_put_usenet_above_torrent_when_usenet_is_preferred()
|
|||
{
|
||||
GivenPreferredDownloadProtocol(DownloadProtocol.Usenet);
|
||||
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320), downloadProtocol: DownloadProtocol.Torrent);
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320), downloadProtocol: DownloadProtocol.Usenet);
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3), downloadProtocol: DownloadProtocol.Torrent);
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3), downloadProtocol: DownloadProtocol.Usenet);
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteBook1));
|
||||
|
|
@ -180,8 +180,8 @@ public void should_put_torrent_above_usenet_when_torrent_is_preferred()
|
|||
{
|
||||
GivenPreferredDownloadProtocol(DownloadProtocol.Torrent);
|
||||
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320), downloadProtocol: DownloadProtocol.Torrent);
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320), downloadProtocol: DownloadProtocol.Usenet);
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3), downloadProtocol: DownloadProtocol.Torrent);
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3), downloadProtocol: DownloadProtocol.Usenet);
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteBook1));
|
||||
|
|
@ -210,7 +210,7 @@ public void should_prefer_discography_pack_above_single_book()
|
|||
[Test]
|
||||
public void should_prefer_quality_over_discography_pack()
|
||||
{
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1), GivenBook(2) }, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1), GivenBook(2) }, new QualityModel(Quality.MP3));
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.FLAC));
|
||||
|
||||
remoteBook1.ParsedBookInfo.Discography = true;
|
||||
|
|
@ -226,8 +226,8 @@ public void should_prefer_quality_over_discography_pack()
|
|||
[Test]
|
||||
public void should_prefer_single_book_over_multi_book()
|
||||
{
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1), GivenBook(2) }, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1), GivenBook(2) }, new QualityModel(Quality.MP3));
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteBook1));
|
||||
|
|
@ -240,8 +240,8 @@ public void should_prefer_single_book_over_multi_book()
|
|||
[Test]
|
||||
public void should_prefer_releases_with_more_seeders()
|
||||
{
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3));
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3));
|
||||
|
||||
var torrentInfo1 = new TorrentInfo();
|
||||
torrentInfo1.PublishDate = DateTime.Now;
|
||||
|
|
@ -266,8 +266,8 @@ public void should_prefer_releases_with_more_seeders()
|
|||
[Test]
|
||||
public void should_prefer_releases_with_more_peers_given_equal_number_of_seeds()
|
||||
{
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3));
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3));
|
||||
|
||||
var torrentInfo1 = new TorrentInfo();
|
||||
torrentInfo1.PublishDate = DateTime.Now;
|
||||
|
|
@ -293,8 +293,8 @@ public void should_prefer_releases_with_more_peers_given_equal_number_of_seeds()
|
|||
[Test]
|
||||
public void should_prefer_releases_with_more_peers_no_seeds()
|
||||
{
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3));
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3));
|
||||
|
||||
var torrentInfo1 = new TorrentInfo();
|
||||
torrentInfo1.PublishDate = DateTime.Now;
|
||||
|
|
@ -321,8 +321,8 @@ public void should_prefer_releases_with_more_peers_no_seeds()
|
|||
[Test]
|
||||
public void should_prefer_first_release_if_peers_and_size_are_too_similar()
|
||||
{
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3));
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3));
|
||||
|
||||
var torrentInfo1 = new TorrentInfo();
|
||||
torrentInfo1.PublishDate = DateTime.Now;
|
||||
|
|
@ -350,8 +350,8 @@ public void should_prefer_first_release_if_peers_and_size_are_too_similar()
|
|||
[Test]
|
||||
public void should_prefer_first_release_if_age_and_size_are_too_similar()
|
||||
{
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3));
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3));
|
||||
|
||||
remoteBook1.Release.PublishDate = DateTime.UtcNow.AddDays(-100);
|
||||
remoteBook1.Release.Size = 200.Megabytes();
|
||||
|
|
@ -370,7 +370,7 @@ public void should_prefer_first_release_if_age_and_size_are_too_similar()
|
|||
[Test]
|
||||
public void should_prefer_quality_over_the_number_of_peers()
|
||||
{
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3));
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.AZW3));
|
||||
|
||||
var torrentInfo1 = new TorrentInfo();
|
||||
|
|
@ -399,15 +399,15 @@ public void should_prefer_quality_over_the_number_of_peers()
|
|||
[Test]
|
||||
public void should_put_higher_quality_before_lower_always()
|
||||
{
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook1 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3));
|
||||
var remoteBook2 = GivenRemoteBook(new List<Book> { GivenBook(1) }, new QualityModel(Quality.MP3));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteBook1));
|
||||
decisions.Add(new DownloadDecision(remoteBook2));
|
||||
|
||||
var qualifiedReports = Subject.PrioritizeDecisions(decisions);
|
||||
qualifiedReports.First().RemoteBook.ParsedBookInfo.Quality.Quality.Should().Be(Quality.MP3_320);
|
||||
qualifiedReports.First().RemoteBook.ParsedBookInfo.Quality.Quality.Should().Be(Quality.MP3);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@ public class QualityAllowedByProfileSpecificationFixture : CoreTest<QualityAllow
|
|||
|
||||
public static object[] AllowedTestCases =
|
||||
{
|
||||
new object[] { Quality.MP3_320 },
|
||||
new object[] { Quality.MP3_320 },
|
||||
new object[] { Quality.MP3_320 }
|
||||
new object[] { Quality.MP3 },
|
||||
new object[] { Quality.MP3 },
|
||||
new object[] { Quality.MP3 }
|
||||
};
|
||||
|
||||
public static object[] DeniedTestCases =
|
||||
|
|
@ -33,13 +33,13 @@ public class QualityAllowedByProfileSpecificationFixture : CoreTest<QualityAllow
|
|||
public void Setup()
|
||||
{
|
||||
var fakeAuthor = Builder<Author>.CreateNew()
|
||||
.With(c => c.QualityProfile = new QualityProfile { Cutoff = Quality.MP3_320.Id })
|
||||
.With(c => c.QualityProfile = new QualityProfile { Cutoff = Quality.MP3.Id })
|
||||
.Build();
|
||||
|
||||
_remoteBook = new RemoteBook
|
||||
{
|
||||
Author = fakeAuthor,
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3, new Revision(version: 2)) },
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ public void Setup()
|
|||
public void should_allow_if_quality_is_defined_in_profile(Quality qualityType)
|
||||
{
|
||||
_remoteBook.ParsedBookInfo.Quality.Quality = qualityType;
|
||||
_remoteBook.Author.QualityProfile.Value.Items = Qualities.QualityFixture.GetDefaultQualities(Quality.MP3_320, Quality.MP3_320, Quality.MP3_320);
|
||||
_remoteBook.Author.QualityProfile.Value.Items = Qualities.QualityFixture.GetDefaultQualities(Quality.MP3, Quality.MP3, Quality.MP3);
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
|
@ -58,7 +58,7 @@ public void should_allow_if_quality_is_defined_in_profile(Quality qualityType)
|
|||
public void should_not_allow_if_quality_is_not_defined_in_profile(Quality qualityType)
|
||||
{
|
||||
_remoteBook.ParsedBookInfo.Quality.Quality = qualityType;
|
||||
_remoteBook.Author.QualityProfile.Value.Items = Qualities.QualityFixture.GetDefaultQualities(Quality.MP3_320, Quality.MP3_320, Quality.MP3_320);
|
||||
_remoteBook.Author.QualityProfile.Value.Items = Qualities.QualityFixture.GetDefaultQualities(Quality.MP3, Quality.MP3, Quality.MP3);
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public void Setup()
|
|||
_remoteBook = Builder<RemoteBook>.CreateNew()
|
||||
.With(r => r.Author = _author)
|
||||
.With(r => r.Books = new List<Book> { _book })
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3_320) })
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3) })
|
||||
.With(r => r.PreferredWordScore = 0)
|
||||
.Build();
|
||||
}
|
||||
|
|
@ -113,7 +113,7 @@ public void should_return_false_if_everything_is_the_same()
|
|||
.With(r => r.Books = new List<Book> { _book })
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320)
|
||||
Quality = new QualityModel(Quality.MP3)
|
||||
})
|
||||
.With(r => r.Release = _releaseInfo)
|
||||
.Build();
|
||||
|
|
@ -126,7 +126,7 @@ public void should_return_false_if_everything_is_the_same()
|
|||
[Test]
|
||||
public void should_return_true_when_quality_in_queue_is_lower()
|
||||
{
|
||||
_author.QualityProfile.Value.Cutoff = Quality.MP3_320.Id;
|
||||
_author.QualityProfile.Value.Cutoff = Quality.MP3.Id;
|
||||
|
||||
var remoteBook = Builder<RemoteBook>.CreateNew()
|
||||
.With(r => r.Author = _author)
|
||||
|
|
@ -150,7 +150,7 @@ public void should_return_true_when_book_doesnt_match()
|
|||
.With(r => r.Books = new List<Book> { _otherBook })
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320)
|
||||
Quality = new QualityModel(Quality.MP3)
|
||||
})
|
||||
.With(r => r.Release = _releaseInfo)
|
||||
.Build();
|
||||
|
|
@ -169,7 +169,7 @@ public void should_return_true_when_qualities_are_the_same_with_higher_preferred
|
|||
.With(r => r.Books = new List<Book> { _book })
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320)
|
||||
Quality = new QualityModel(Quality.MP3)
|
||||
})
|
||||
.With(r => r.Release = _releaseInfo)
|
||||
.Build();
|
||||
|
|
@ -186,7 +186,7 @@ public void should_return_false_when_qualities_are_the_same()
|
|||
.With(r => r.Books = new List<Book> { _book })
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320)
|
||||
Quality = new QualityModel(Quality.MP3)
|
||||
})
|
||||
.With(r => r.Release = _releaseInfo)
|
||||
.Build();
|
||||
|
|
@ -205,7 +205,7 @@ public void should_return_false_when_quality_in_queue_is_better()
|
|||
.With(r => r.Books = new List<Book> { _book })
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320)
|
||||
Quality = new QualityModel(Quality.MP3)
|
||||
})
|
||||
.With(r => r.Release = _releaseInfo)
|
||||
.Build();
|
||||
|
|
@ -222,7 +222,7 @@ public void should_return_false_if_matching_multi_book_is_in_queue()
|
|||
.With(r => r.Books = new List<Book> { _book, _otherBook })
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320)
|
||||
Quality = new QualityModel(Quality.MP3)
|
||||
})
|
||||
.With(r => r.Release = _releaseInfo)
|
||||
.Build();
|
||||
|
|
@ -239,7 +239,7 @@ public void should_return_false_if_multi_book_has_one_book_in_queue()
|
|||
.With(r => r.Books = new List<Book> { _book })
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320)
|
||||
Quality = new QualityModel(Quality.MP3)
|
||||
})
|
||||
.With(r => r.Release = _releaseInfo)
|
||||
.Build();
|
||||
|
|
@ -258,7 +258,7 @@ public void should_return_false_if_multi_part_book_is_already_in_queue()
|
|||
.With(r => r.Books = new List<Book> { _book, _otherBook })
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320)
|
||||
Quality = new QualityModel(Quality.MP3)
|
||||
})
|
||||
.With(r => r.Release = _releaseInfo)
|
||||
.Build();
|
||||
|
|
@ -277,7 +277,7 @@ public void should_return_false_if_multi_part_book_has_two_books_in_queue()
|
|||
.With(r => r.Author = _author)
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320)
|
||||
Quality = new QualityModel(Quality.MP3)
|
||||
})
|
||||
.With(r => r.Release = _releaseInfo)
|
||||
.TheFirst(1)
|
||||
|
|
@ -321,7 +321,7 @@ public void should_return_true_if_everything_is_the_same_for_failed_pending()
|
|||
.With(r => r.Books = new List<Book> { _book })
|
||||
.With(r => r.ParsedBookInfo = new ParsedBookInfo
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320)
|
||||
Quality = new QualityModel(Quality.MP3)
|
||||
})
|
||||
.With(r => r.Release = _releaseInfo)
|
||||
.Build();
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public void should_return_true_if_is_a_repack_for_a_different_quality()
|
|||
}).ToList();
|
||||
_trackFiles.Select(c =>
|
||||
{
|
||||
c.Quality = new QualityModel(Quality.MP3_320);
|
||||
c.Quality = new QualityModel(Quality.MP3);
|
||||
return c;
|
||||
}).ToList();
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public void Setup()
|
|||
_profile.Items = new List<QualityProfileQualityItem>();
|
||||
_profile.Items.Add(new QualityProfileQualityItem { Allowed = true, Quality = Quality.PDF });
|
||||
_profile.Items.Add(new QualityProfileQualityItem { Allowed = true, Quality = Quality.AZW3 });
|
||||
_profile.Items.Add(new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3_320 });
|
||||
_profile.Items.Add(new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3 });
|
||||
|
||||
_profile.Cutoff = Quality.AZW3.Id;
|
||||
|
||||
|
|
@ -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()
|
||||
{
|
||||
_remoteBook.ParsedBookInfo.Quality = new QualityModel(Quality.MP3_320);
|
||||
_remoteBook.ParsedBookInfo.Quality = new QualityModel(Quality.MP3);
|
||||
|
||||
Subject.IsSatisfiedBy(_remoteBook, null).Accepted.Should().BeTrue();
|
||||
}
|
||||
|
|
@ -149,10 +149,10 @@ public void should_be_false_when_release_is_younger_than_delay()
|
|||
[Test]
|
||||
public void should_be_true_when_release_is_a_proper_for_existing_book()
|
||||
{
|
||||
_remoteBook.ParsedBookInfo.Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2));
|
||||
_remoteBook.ParsedBookInfo.Quality = new QualityModel(Quality.MP3, new Revision(version: 2));
|
||||
_remoteBook.Release.PublishDate = DateTime.UtcNow;
|
||||
|
||||
GivenExistingFile(new QualityModel(Quality.MP3_320));
|
||||
GivenExistingFile(new QualityModel(Quality.MP3));
|
||||
GivenUpgradeForExistingFile();
|
||||
|
||||
Mocker.GetMock<IUpgradableSpecification>()
|
||||
|
|
@ -167,10 +167,10 @@ public void should_be_true_when_release_is_a_proper_for_existing_book()
|
|||
[Test]
|
||||
public void should_be_true_when_release_is_a_real_for_existing_book()
|
||||
{
|
||||
_remoteBook.ParsedBookInfo.Quality = new QualityModel(Quality.MP3_320, new Revision(real: 1));
|
||||
_remoteBook.ParsedBookInfo.Quality = new QualityModel(Quality.MP3, new Revision(real: 1));
|
||||
_remoteBook.Release.PublishDate = DateTime.UtcNow;
|
||||
|
||||
GivenExistingFile(new QualityModel(Quality.MP3_320));
|
||||
GivenExistingFile(new QualityModel(Quality.MP3));
|
||||
GivenUpgradeForExistingFile();
|
||||
|
||||
Mocker.GetMock<IUpgradableSpecification>()
|
||||
|
|
|
|||
|
|
@ -63,14 +63,14 @@ public void Setup()
|
|||
_parseResultMulti = new RemoteBook
|
||||
{
|
||||
Author = fakeAuthor,
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3, new Revision(version: 2)) },
|
||||
Books = doubleBookList
|
||||
};
|
||||
|
||||
_parseResultSingle = new RemoteBook
|
||||
{
|
||||
Author = fakeAuthor,
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3, new Revision(version: 2)) },
|
||||
Books = singleBookList
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public void should_return_false_when_quality_is_better_and_upgrade_allowed_is_fa
|
|||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||
UpgradeAllowed = false
|
||||
},
|
||||
new QualityModel(Quality.MP3_320),
|
||||
new QualityModel(Quality.MP3),
|
||||
new QualityModel(Quality.FLAC))
|
||||
.Should().BeFalse();
|
||||
}
|
||||
|
|
@ -36,7 +36,7 @@ public void should_return_true_for_quality_upgrade_when_upgrading_is_allowed()
|
|||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||
UpgradeAllowed = true
|
||||
},
|
||||
new QualityModel(Quality.MP3_320),
|
||||
new QualityModel(Quality.MP3),
|
||||
new QualityModel(Quality.FLAC))
|
||||
.Should().BeTrue();
|
||||
}
|
||||
|
|
@ -51,8 +51,8 @@ public void should_return_true_for_same_quality_when_upgrading_is_allowed()
|
|||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||
UpgradeAllowed = true
|
||||
},
|
||||
new QualityModel(Quality.MP3_320),
|
||||
new QualityModel(Quality.MP3_320))
|
||||
new QualityModel(Quality.MP3),
|
||||
new QualityModel(Quality.MP3))
|
||||
.Should().BeTrue();
|
||||
}
|
||||
|
||||
|
|
@ -66,8 +66,8 @@ public void should_return_true_for_same_quality_when_upgrading_is_not_allowed()
|
|||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||
UpgradeAllowed = false
|
||||
},
|
||||
new QualityModel(Quality.MP3_320),
|
||||
new QualityModel(Quality.MP3_320))
|
||||
new QualityModel(Quality.MP3),
|
||||
new QualityModel(Quality.MP3))
|
||||
.Should().BeTrue();
|
||||
}
|
||||
|
||||
|
|
@ -81,8 +81,8 @@ public void should_return_true_for_lower_quality_when_upgrading_is_allowed()
|
|||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||
UpgradeAllowed = true
|
||||
},
|
||||
new QualityModel(Quality.MP3_320),
|
||||
new QualityModel(Quality.MP3_320))
|
||||
new QualityModel(Quality.MP3),
|
||||
new QualityModel(Quality.MP3))
|
||||
.Should().BeTrue();
|
||||
}
|
||||
|
||||
|
|
@ -96,8 +96,8 @@ public void should_return_true_for_lower_quality_when_upgrading_is_not_allowed()
|
|||
Items = Qualities.QualityFixture.GetDefaultQualities(),
|
||||
UpgradeAllowed = false
|
||||
},
|
||||
new QualityModel(Quality.MP3_320),
|
||||
new QualityModel(Quality.MP3_320))
|
||||
new QualityModel(Quality.MP3),
|
||||
new QualityModel(Quality.MP3))
|
||||
.Should().BeTrue();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public void Setup()
|
|||
.With(c => c.QualityProfile = new QualityProfile
|
||||
{
|
||||
UpgradeAllowed = true,
|
||||
Cutoff = Quality.MP3_320.Id,
|
||||
Cutoff = Quality.MP3.Id,
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities()
|
||||
})
|
||||
.Build();
|
||||
|
|
@ -51,26 +51,26 @@ public void Setup()
|
|||
_parseResultMulti = new RemoteBook
|
||||
{
|
||||
Author = fakeAuthor,
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3, new Revision(version: 2)) },
|
||||
Books = doubleBookList
|
||||
};
|
||||
|
||||
_parseResultSingle = new RemoteBook
|
||||
{
|
||||
Author = fakeAuthor,
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2)) },
|
||||
ParsedBookInfo = new ParsedBookInfo { Quality = new QualityModel(Quality.MP3, new Revision(version: 2)) },
|
||||
Books = singleBookList
|
||||
};
|
||||
}
|
||||
|
||||
private void WithFirstFileUpgradable()
|
||||
{
|
||||
_firstFile.Quality = new QualityModel(Quality.MP3_320);
|
||||
_firstFile.Quality = new QualityModel(Quality.MP3);
|
||||
}
|
||||
|
||||
private void WithSecondFileUpgradable()
|
||||
{
|
||||
_secondFile.Quality = new QualityModel(Quality.MP3_320);
|
||||
_secondFile.Quality = new QualityModel(Quality.MP3);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -113,9 +113,9 @@ public void should_be_upgradable_if_all_files_are_upgradable()
|
|||
[Test]
|
||||
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.ParsedBookInfo.Quality = new QualityModel(Quality.MP3_320);
|
||||
_firstFile.Quality = new QualityModel(Quality.MP3);
|
||||
_secondFile.Quality = new QualityModel(Quality.MP3);
|
||||
_parseResultSingle.ParsedBookInfo.Quality = new QualityModel(Quality.MP3);
|
||||
Subject.IsSatisfiedBy(_parseResultSingle, null).Accepted.Should().BeFalse();
|
||||
}
|
||||
|
||||
|
|
@ -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.ParsedBookInfo.Quality = new QualityModel(Quality.MP3_320);
|
||||
_parseResultSingle.ParsedBookInfo.Quality = new QualityModel(Quality.MP3);
|
||||
Subject.IsSatisfiedBy(_parseResultSingle, null).Accepted.Should().BeFalse();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ public class UpgradeSpecificationFixture : CoreTest<UpgradableSpecification>
|
|||
public static object[] IsUpgradeTestCases =
|
||||
{
|
||||
new object[] { Quality.AZW3, 1, Quality.AZW3, 2, Quality.AZW3, true },
|
||||
new object[] { Quality.MP3_320, 1, Quality.MP3_320, 2, Quality.MP3_320, true },
|
||||
new object[] { Quality.MP3_320, 1, Quality.MP3_320, 1, Quality.MP3_320, false },
|
||||
new object[] { Quality.MP3_320, 1, Quality.AZW3, 2, Quality.MP3_320, false },
|
||||
new object[] { Quality.MP3_320, 1, Quality.AZW3, 2, Quality.MP3_320, false },
|
||||
new object[] { Quality.MP3_320, 1, Quality.MP3_320, 1, Quality.MP3_320, false }
|
||||
new object[] { Quality.MP3, 1, Quality.MP3, 2, Quality.MP3, true },
|
||||
new object[] { Quality.MP3, 1, Quality.MP3, 1, Quality.MP3, false },
|
||||
new object[] { Quality.MP3, 1, Quality.AZW3, 2, Quality.MP3, false },
|
||||
new object[] { Quality.MP3, 1, Quality.AZW3, 2, Quality.MP3, false },
|
||||
new object[] { Quality.MP3, 1, Quality.MP3, 1, Quality.MP3, false }
|
||||
};
|
||||
|
||||
private static readonly int NoPreferredWordScore = 0;
|
||||
|
|
@ -65,9 +65,9 @@ public void should_return_true_if_proper_and_download_propers_is_do_not_download
|
|||
|
||||
Subject.IsUpgradable(
|
||||
profile,
|
||||
new QualityModel(Quality.MP3_320, new Revision(version: 1)),
|
||||
new QualityModel(Quality.MP3, new Revision(version: 1)),
|
||||
NoPreferredWordScore,
|
||||
new QualityModel(Quality.MP3_320, new Revision(version: 2)),
|
||||
new QualityModel(Quality.MP3, new Revision(version: 2)),
|
||||
NoPreferredWordScore)
|
||||
.Should().BeTrue();
|
||||
}
|
||||
|
|
@ -84,9 +84,9 @@ public void should_return_false_if_proper_and_autoDownloadPropers_is_do_not_pref
|
|||
|
||||
Subject.IsUpgradable(
|
||||
profile,
|
||||
new QualityModel(Quality.MP3_320, new Revision(version: 1)),
|
||||
new QualityModel(Quality.MP3, new Revision(version: 1)),
|
||||
NoPreferredWordScore,
|
||||
new QualityModel(Quality.MP3_320, new Revision(version: 2)),
|
||||
new QualityModel(Quality.MP3, new Revision(version: 2)),
|
||||
NoPreferredWordScore)
|
||||
.Should().BeFalse();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ private RemoteBook GetRemoteBook(List<Book> books, QualityModel quality, Downloa
|
|||
public void should_download_report_if_book_was_not_already_downloaded()
|
||||
{
|
||||
var books = new List<Book> { GetBook(1) };
|
||||
var remoteBook = GetRemoteBook(books, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook = GetRemoteBook(books, new QualityModel(Quality.MP3));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteBook));
|
||||
|
|
@ -74,7 +74,7 @@ public void should_download_report_if_book_was_not_already_downloaded()
|
|||
public void should_only_download_book_once()
|
||||
{
|
||||
var books = new List<Book> { GetBook(1) };
|
||||
var remoteBook = GetRemoteBook(books, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook = GetRemoteBook(books, new QualityModel(Quality.MP3));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteBook));
|
||||
|
|
@ -89,11 +89,11 @@ public void should_not_download_if_any_book_was_already_downloaded()
|
|||
{
|
||||
var remoteBook1 = GetRemoteBook(
|
||||
new List<Book> { GetBook(1) },
|
||||
new QualityModel(Quality.MP3_320));
|
||||
new QualityModel(Quality.MP3));
|
||||
|
||||
var remoteBook2 = GetRemoteBook(
|
||||
new List<Book> { GetBook(1), GetBook(2) },
|
||||
new QualityModel(Quality.MP3_320));
|
||||
new QualityModel(Quality.MP3));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteBook1));
|
||||
|
|
@ -107,7 +107,7 @@ public void should_not_download_if_any_book_was_already_downloaded()
|
|||
public void should_return_downloaded_reports()
|
||||
{
|
||||
var books = new List<Book> { GetBook(1) };
|
||||
var remoteBook = GetRemoteBook(books, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook = GetRemoteBook(books, new QualityModel(Quality.MP3));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteBook));
|
||||
|
|
@ -120,11 +120,11 @@ public void should_return_all_downloaded_reports()
|
|||
{
|
||||
var remoteBook1 = GetRemoteBook(
|
||||
new List<Book> { GetBook(1) },
|
||||
new QualityModel(Quality.MP3_320));
|
||||
new QualityModel(Quality.MP3));
|
||||
|
||||
var remoteBook2 = GetRemoteBook(
|
||||
new List<Book> { GetBook(2) },
|
||||
new QualityModel(Quality.MP3_320));
|
||||
new QualityModel(Quality.MP3));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteBook1));
|
||||
|
|
@ -138,15 +138,15 @@ public void should_only_return_downloaded_reports()
|
|||
{
|
||||
var remoteBook1 = GetRemoteBook(
|
||||
new List<Book> { GetBook(1) },
|
||||
new QualityModel(Quality.MP3_320));
|
||||
new QualityModel(Quality.MP3));
|
||||
|
||||
var remoteBook2 = GetRemoteBook(
|
||||
new List<Book> { GetBook(2) },
|
||||
new QualityModel(Quality.MP3_320));
|
||||
new QualityModel(Quality.MP3));
|
||||
|
||||
var remoteBook3 = GetRemoteBook(
|
||||
new List<Book> { GetBook(2) },
|
||||
new QualityModel(Quality.MP3_320));
|
||||
new QualityModel(Quality.MP3));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteBook1));
|
||||
|
|
@ -160,7 +160,7 @@ public void should_only_return_downloaded_reports()
|
|||
public void should_not_add_to_downloaded_list_when_download_fails()
|
||||
{
|
||||
var books = new List<Book> { GetBook(1) };
|
||||
var remoteBook = GetRemoteBook(books, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook = GetRemoteBook(books, new QualityModel(Quality.MP3));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteBook));
|
||||
|
|
@ -184,7 +184,7 @@ public void should_return_an_empty_list_when_none_are_appproved()
|
|||
public void should_not_grab_if_pending()
|
||||
{
|
||||
var books = new List<Book> { GetBook(1) };
|
||||
var remoteBook = GetRemoteBook(books, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook = GetRemoteBook(books, new QualityModel(Quality.MP3));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteBook, new Rejection("Failure!", RejectionType.Temporary)));
|
||||
|
|
@ -197,7 +197,7 @@ public void should_not_grab_if_pending()
|
|||
public void should_not_add_to_pending_if_book_was_grabbed()
|
||||
{
|
||||
var books = new List<Book> { GetBook(1) };
|
||||
var remoteBook = GetRemoteBook(books, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook = GetRemoteBook(books, new QualityModel(Quality.MP3));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteBook));
|
||||
|
|
@ -211,7 +211,7 @@ public void should_not_add_to_pending_if_book_was_grabbed()
|
|||
public void should_add_to_pending_even_if_already_added_to_pending()
|
||||
{
|
||||
var books = new List<Book> { GetBook(1) };
|
||||
var remoteBook = GetRemoteBook(books, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook = GetRemoteBook(books, new QualityModel(Quality.MP3));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteBook, new Rejection("Failure!", RejectionType.Temporary)));
|
||||
|
|
@ -225,7 +225,7 @@ public void should_add_to_pending_even_if_already_added_to_pending()
|
|||
public void should_add_to_failed_if_already_failed_for_that_protocol()
|
||||
{
|
||||
var books = new List<Book> { GetBook(1) };
|
||||
var remoteBook = GetRemoteBook(books, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook = GetRemoteBook(books, new QualityModel(Quality.MP3));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteBook));
|
||||
|
|
@ -242,8 +242,8 @@ public void should_add_to_failed_if_already_failed_for_that_protocol()
|
|||
public void should_not_add_to_failed_if_failed_for_a_different_protocol()
|
||||
{
|
||||
var books = new List<Book> { GetBook(1) };
|
||||
var remoteBook = GetRemoteBook(books, new QualityModel(Quality.MP3_320), DownloadProtocol.Usenet);
|
||||
var remoteBook2 = GetRemoteBook(books, new QualityModel(Quality.MP3_320), DownloadProtocol.Torrent);
|
||||
var remoteBook = GetRemoteBook(books, new QualityModel(Quality.MP3), DownloadProtocol.Usenet);
|
||||
var remoteBook2 = GetRemoteBook(books, new QualityModel(Quality.MP3), DownloadProtocol.Torrent);
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteBook));
|
||||
|
|
@ -261,7 +261,7 @@ public void should_not_add_to_failed_if_failed_for_a_different_protocol()
|
|||
public void should_add_to_rejected_if_release_unavailable_on_indexer()
|
||||
{
|
||||
var books = new List<Book> { GetBook(1) };
|
||||
var remoteBook = GetRemoteBook(books, new QualityModel(Quality.MP3_320));
|
||||
var remoteBook = GetRemoteBook(books, new QualityModel(Quality.MP3));
|
||||
|
||||
var decisions = new List<DownloadDecision>();
|
||||
decisions.Add(new DownloadDecision(remoteBook));
|
||||
|
|
|
|||
|
|
@ -41,12 +41,12 @@ public void Setup()
|
|||
_profile = new QualityProfile
|
||||
{
|
||||
Name = "Test",
|
||||
Cutoff = Quality.MP3_320.Id,
|
||||
Cutoff = Quality.MP3.Id,
|
||||
Items = new List<QualityProfileQualityItem>
|
||||
{
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3_320 },
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3_320 },
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3_320 }
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3 },
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3 },
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3 }
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ public void Setup()
|
|||
_release = Builder<ReleaseInfo>.CreateNew().Build();
|
||||
|
||||
_parsedBookInfo = Builder<ParsedBookInfo>.CreateNew().Build();
|
||||
_parsedBookInfo.Quality = new QualityModel(Quality.MP3_320);
|
||||
_parsedBookInfo.Quality = new QualityModel(Quality.MP3);
|
||||
|
||||
_remoteBook = new RemoteBook();
|
||||
_remoteBook.Books = new List<Book> { _book };
|
||||
|
|
|
|||
|
|
@ -41,11 +41,11 @@ public void Setup()
|
|||
_profile = new QualityProfile
|
||||
{
|
||||
Name = "Test",
|
||||
Cutoff = Quality.MP3_320.Id,
|
||||
Cutoff = Quality.MP3.Id,
|
||||
Items = new List<QualityProfileQualityItem>
|
||||
{
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3_320 },
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3_320 },
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3 },
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3 },
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.FLAC }
|
||||
},
|
||||
};
|
||||
|
|
@ -55,7 +55,7 @@ public void Setup()
|
|||
_release = Builder<ReleaseInfo>.CreateNew().Build();
|
||||
|
||||
_parsedBookInfo = Builder<ParsedBookInfo>.CreateNew().Build();
|
||||
_parsedBookInfo.Quality = new QualityModel(Quality.MP3_320);
|
||||
_parsedBookInfo.Quality = new QualityModel(Quality.MP3);
|
||||
|
||||
_remoteBook = new RemoteBook();
|
||||
_remoteBook.Books = new List<Book> { _book };
|
||||
|
|
@ -120,7 +120,7 @@ public void should_delete_if_the_grabbed_quality_is_the_same()
|
|||
[Test]
|
||||
public void should_delete_if_the_grabbed_quality_is_the_higher()
|
||||
{
|
||||
GivenHeldRelease(new QualityModel(Quality.MP3_320));
|
||||
GivenHeldRelease(new QualityModel(Quality.MP3));
|
||||
|
||||
Subject.Handle(new BookGrabbedEvent(_remoteBook));
|
||||
|
||||
|
|
|
|||
|
|
@ -41,12 +41,12 @@ public void Setup()
|
|||
_profile = new QualityProfile
|
||||
{
|
||||
Name = "Test",
|
||||
Cutoff = Quality.MP3_320.Id,
|
||||
Cutoff = Quality.MP3.Id,
|
||||
Items = new List<QualityProfileQualityItem>
|
||||
{
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3_320 },
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3_320 },
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3_320 }
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3 },
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3 },
|
||||
new QualityProfileQualityItem { Allowed = true, Quality = Quality.MP3 }
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -55,7 +55,7 @@ public void Setup()
|
|||
_release = Builder<ReleaseInfo>.CreateNew().Build();
|
||||
|
||||
_parsedBookInfo = Builder<ParsedBookInfo>.CreateNew().Build();
|
||||
_parsedBookInfo.Quality = new QualityModel(Quality.MP3_320);
|
||||
_parsedBookInfo.Quality = new QualityModel(Quality.MP3);
|
||||
|
||||
_remoteBook = new RemoteBook();
|
||||
_remoteBook.Books = new List<Book> { _book };
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using FizzWare.NBuilder;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.History;
|
||||
|
|
@ -29,7 +29,7 @@ public void should_read_write_dictionary()
|
|||
public void should_get_download_history()
|
||||
{
|
||||
var historyBluray = Builder<History.History>.CreateNew()
|
||||
.With(c => c.Quality = new QualityModel(Quality.MP3_320))
|
||||
.With(c => c.Quality = new QualityModel(Quality.MP3))
|
||||
.With(c => c.AuthorId = 12)
|
||||
.With(c => c.EventType = HistoryEventType.Grabbed)
|
||||
.BuildNew();
|
||||
|
|
@ -43,7 +43,7 @@ public void should_get_download_history()
|
|||
Subject.Insert(historyBluray);
|
||||
Subject.Insert(historyDvd);
|
||||
|
||||
var downloadHistory = Subject.FindDownloadHistory(12, new QualityModel(Quality.MP3_320));
|
||||
var downloadHistory = Subject.FindDownloadHistory(12, new QualityModel(Quality.MP3));
|
||||
|
||||
downloadHistory.Should().HaveCount(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,14 +28,14 @@ public void Setup()
|
|||
{
|
||||
_profile = new QualityProfile
|
||||
{
|
||||
Cutoff = Quality.MP3_320.Id,
|
||||
Cutoff = Quality.MP3.Id,
|
||||
Items = QualityFixture.GetDefaultQualities(),
|
||||
};
|
||||
|
||||
_profileCustom = new QualityProfile
|
||||
{
|
||||
Cutoff = Quality.MP3_320.Id,
|
||||
Items = QualityFixture.GetDefaultQualities(Quality.MP3_320),
|
||||
Cutoff = Quality.MP3.Id,
|
||||
Items = QualityFixture.GetDefaultQualities(Quality.MP3),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ public void Setup()
|
|||
Book = book,
|
||||
Edition = edition,
|
||||
Path = Path.Combine(author.Path, "Alien Ant Farm - 01 - Pilot.mp3"),
|
||||
Quality = new QualityModel(Quality.MP3_320),
|
||||
Quality = new QualityModel(Quality.MP3),
|
||||
FileTrackInfo = new ParsedTrackInfo
|
||||
{
|
||||
ReleaseGroup = "DRONE"
|
||||
|
|
@ -170,7 +170,7 @@ public void should_import_larger_files_first()
|
|||
Book = fileDecision.Item.Book,
|
||||
Edition = fileDecision.Item.Edition,
|
||||
Path = @"C:\Test\Music\Alien Ant Farm\Alien Ant Farm - 01 - Pilot.mp3".AsOsAgnostic(),
|
||||
Quality = new QualityModel(Quality.MP3_320),
|
||||
Quality = new QualityModel(Quality.MP3),
|
||||
Size = 80.Megabytes()
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public void Setup()
|
|||
var files = Builder<BookFile>.CreateListOfSize(10)
|
||||
.All()
|
||||
.With(c => c.Id = 0)
|
||||
.With(c => c.Quality = new QualityModel(Quality.MP3_320))
|
||||
.With(c => c.Quality = new QualityModel(Quality.MP3))
|
||||
.TheFirst(5)
|
||||
.With(c => c.EditionId = _edition.Id)
|
||||
.TheRest()
|
||||
|
|
@ -99,7 +99,7 @@ public void get_files_by_base_path_should_not_get_files_for_partial_path(string
|
|||
var files = Builder<BookFile>.CreateListOfSize(2)
|
||||
.All()
|
||||
.With(c => c.Id = 0)
|
||||
.With(c => c.Quality = new QualityModel(Quality.MP3_320))
|
||||
.With(c => c.Quality = new QualityModel(Quality.MP3))
|
||||
.TheFirst(1)
|
||||
.With(c => c.Path = @"C:\Test\Path2\Author\somefile1.flac".AsOsAgnostic())
|
||||
.TheNext(1)
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ public void Setup()
|
|||
.With(x => x.Book = _book)
|
||||
.Build();
|
||||
|
||||
_quality = new QualityModel(Quality.MP3_320);
|
||||
_quality = new QualityModel(Quality.MP3);
|
||||
|
||||
_localTrack = new LocalBook
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public void Setup()
|
|||
_localTrack = new LocalTrack
|
||||
{
|
||||
Path = @"C:\Test\Imagine Dragons\Imagine.Dragons.Song.1.mp3",
|
||||
Quality = new QualityModel(Quality.MP3_320, new Revision(version: 1)),
|
||||
Quality = new QualityModel(Quality.MP3, new Revision(version: 1)),
|
||||
Author = _author,
|
||||
Book = _book
|
||||
};
|
||||
|
|
@ -77,7 +77,7 @@ public void should_return_true_if_upgrade_for_existing_trackFile()
|
|||
.With(e => e.TrackFile = new LazyLoaded<TrackFile>(
|
||||
new TrackFile
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320, new Revision(version: 1))
|
||||
Quality = new QualityModel(Quality.MP3, new Revision(version: 1))
|
||||
}))
|
||||
.Build()
|
||||
.ToList();
|
||||
|
|
@ -94,7 +94,7 @@ public void should_return_true_if_upgrade_for_existing_trackFile_for_multi_track
|
|||
.With(e => e.TrackFile = new LazyLoaded<TrackFile>(
|
||||
new TrackFile
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320, new Revision(version: 1))
|
||||
Quality = new QualityModel(Quality.MP3, new Revision(version: 1))
|
||||
}))
|
||||
.Build()
|
||||
.ToList();
|
||||
|
|
@ -145,7 +145,7 @@ public void should_return_false_if_not_an_upgrade_for_one_existing_trackFile_for
|
|||
.With(e => e.TrackFile = new LazyLoaded<TrackFile>(
|
||||
new TrackFile
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320, new Revision(version: 1))
|
||||
Quality = new QualityModel(Quality.MP3, new Revision(version: 1))
|
||||
}))
|
||||
.TheNext(1)
|
||||
.With(e => e.TrackFileId = 2)
|
||||
|
|
@ -173,7 +173,7 @@ public void should_return_false_if_not_a_revision_upgrade_and_prefers_propers()
|
|||
.With(e => e.TrackFile = new LazyLoaded<TrackFile>(
|
||||
new TrackFile
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2))
|
||||
Quality = new QualityModel(Quality.MP3, new Revision(version: 2))
|
||||
}))
|
||||
.Build()
|
||||
.ToList();
|
||||
|
|
@ -194,7 +194,7 @@ public void should_return_true_if_not_a_revision_upgrade_and_does_not_prefer_pro
|
|||
.With(e => e.TrackFile = new LazyLoaded<TrackFile>(
|
||||
new TrackFile
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320, new Revision(version: 2))
|
||||
Quality = new QualityModel(Quality.MP3, new Revision(version: 2))
|
||||
}))
|
||||
.Build()
|
||||
.ToList();
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public void should_lazyload_profiles()
|
|||
{
|
||||
var profile = new QualityProfile
|
||||
{
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities(Quality.FLAC, Quality.MP3_320, Quality.MP3_320),
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities(Quality.FLAC, Quality.MP3, Quality.MP3),
|
||||
|
||||
Cutoff = Quality.FLAC.Id,
|
||||
Name = "TestProfile"
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public void Setup()
|
|||
.With(s => s.Book = _book)
|
||||
.Build();
|
||||
|
||||
_trackFile = new BookFile { Quality = new QualityModel(Quality.MP3_320), ReleaseGroup = "ReadarrTest" };
|
||||
_trackFile = new BookFile { Quality = new QualityModel(Quality.MP3), ReleaseGroup = "ReadarrTest" };
|
||||
|
||||
_namingConfig = NamingConfig.Default;
|
||||
_namingConfig.RenameBooks = true;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public void Setup()
|
|||
_trackFile = Builder<BookFile>.CreateNew()
|
||||
.With(e => e.Part = 1)
|
||||
.With(e => e.PartCount = 1)
|
||||
.With(e => e.Quality = new QualityModel(Quality.MP3_320))
|
||||
.With(e => e.Quality = new QualityModel(Quality.MP3))
|
||||
.With(e => e.ReleaseGroup = "ReadarrTest")
|
||||
.With(e => e.MediaInfo = new Parser.Model.MediaInfoModel
|
||||
{
|
||||
|
|
@ -252,7 +252,7 @@ public void should_replace_quality_title()
|
|||
_namingConfig.StandardBookFormat = "{Quality Title}";
|
||||
|
||||
Subject.BuildBookFileName(_author, _edition, _trackFile)
|
||||
.Should().Be("MP3-320");
|
||||
.Should().Be("MP3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -306,7 +306,7 @@ public void should_replace_all_contents_in_pattern()
|
|||
_namingConfig.StandardBookFormat = "{Author Name} - {Book Title} - [{Quality Title}]";
|
||||
|
||||
Subject.BuildBookFileName(_author, _edition, _trackFile)
|
||||
.Should().Be("Linkin Park - Hybrid Theory - [MP3-320]");
|
||||
.Should().Be("Linkin Park - Hybrid Theory - [MP3]");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -386,7 +386,7 @@ public void should_include_affixes_if_value_not_empty()
|
|||
_namingConfig.StandardBookFormat = "{Author.Name}{_Book.Title_}{Quality.Title}";
|
||||
|
||||
Subject.BuildBookFileName(_author, _edition, _trackFile)
|
||||
.Should().Be("Linkin.Park_Hybrid.Theory_MP3-320");
|
||||
.Should().Be("Linkin.Park_Hybrid.Theory_MP3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -440,7 +440,7 @@ public void should_not_include_quality_proper_when_release_is_not_a_proper()
|
|||
_namingConfig.StandardBookFormat = "{Quality Title} {Quality Proper}";
|
||||
|
||||
Subject.BuildBookFileName(_author, _edition, _trackFile)
|
||||
.Should().Be("MP3-320");
|
||||
.Should().Be("MP3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -449,7 +449,7 @@ public void should_not_wrap_proper_in_square_brackets_when_not_a_proper()
|
|||
_namingConfig.StandardBookFormat = "{Author Name} - {Book Title} [{Quality Title}] {[Quality Proper]}";
|
||||
|
||||
Subject.BuildBookFileName(_author, _edition, _trackFile)
|
||||
.Should().Be("Linkin Park - Hybrid Theory [MP3-320]");
|
||||
.Should().Be("Linkin Park - Hybrid Theory [MP3]");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
@ -458,7 +458,7 @@ public void should_replace_quality_full_with_quality_title_only_when_not_a_prope
|
|||
_namingConfig.StandardBookFormat = "{Author Name} - {Book Title} [{Quality Full}]";
|
||||
|
||||
Subject.BuildBookFileName(_author, _edition, _trackFile)
|
||||
.Should().Be("Linkin Park - Hybrid Theory [MP3-320]");
|
||||
.Should().Be("Linkin Park - Hybrid Theory [MP3]");
|
||||
}
|
||||
|
||||
[TestCase(' ')]
|
||||
|
|
@ -470,7 +470,7 @@ public void should_trim_extra_separators_from_end_when_quality_proper_is_not_inc
|
|||
_namingConfig.StandardBookFormat = string.Format("{{Quality{0}Title}}{0}{{Quality{0}Proper}}", separator);
|
||||
|
||||
Subject.BuildBookFileName(_author, _edition, _trackFile)
|
||||
.Should().Be("MP3-320");
|
||||
.Should().Be("MP3");
|
||||
}
|
||||
|
||||
[TestCase(' ')]
|
||||
|
|
@ -482,7 +482,7 @@ public void should_trim_extra_separators_from_middle_when_quality_proper_is_not_
|
|||
_namingConfig.StandardBookFormat = string.Format("{{Quality{0}Title}}{0}{{Quality{0}Proper}}{0}{{Book{0}Title}}", separator);
|
||||
|
||||
Subject.BuildBookFileName(_author, _edition, _trackFile)
|
||||
.Should().Be(string.Format("MP3-320{0}Hybrid{0}Theory", separator));
|
||||
.Should().Be(string.Format("MP3{0}Hybrid{0}Theory", separator));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public void Setup()
|
|||
.With(s => s.Book = _book)
|
||||
.Build();
|
||||
|
||||
_trackFile = new BookFile { Quality = new QualityModel(Quality.MP3_320), ReleaseGroup = "ReadarrTest" };
|
||||
_trackFile = new BookFile { Quality = new QualityModel(Quality.MP3), ReleaseGroup = "ReadarrTest" };
|
||||
|
||||
_namingConfig = NamingConfig.Default;
|
||||
_namingConfig.RenameBooks = true;
|
||||
|
|
|
|||
|
|
@ -15,70 +15,70 @@ public class HashedReleaseFixture : CoreTest
|
|||
{
|
||||
@"C:\Test\Some.Hashed.Release.(256kbps)-Mercury\0e895c37245186812cb08aab1529cf8ee389dd05.mp3".AsOsAgnostic(),
|
||||
"Some Hashed Release",
|
||||
Quality.MP3_320,
|
||||
Quality.MP3,
|
||||
"Mercury"
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
@"C:\Test-[256]\0e895c37245186812cb08aab1529cf8ee389dd05\Some.Hashed.Release.S01E01.720p.WEB-DL.AAC2.0.H.264-Mercury.mp3".AsOsAgnostic(),
|
||||
"Some Hashed Release",
|
||||
Quality.MP3_320,
|
||||
Quality.MP3,
|
||||
"Mercury"
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
@"C:\Test\Fake.Dir.S01E01-Test\yrucreM-462.H.0.2CAA.LD-BEW.p027.10E10S.esaeleR.dehsaH.emoS.mp3".AsOsAgnostic(),
|
||||
"Some Hashed Release",
|
||||
Quality.MP3_320,
|
||||
Quality.MP3,
|
||||
"Mercury"
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
@"C:\Test\Fake.Dir.S01E01-Test\yrucreM-LN 1.5DD LD-BEW P0801 10E10S esaeleR dehsaH emoS.mp3".AsOsAgnostic(),
|
||||
"Some Hashed Release",
|
||||
Quality.MP3_320,
|
||||
Quality.MP3,
|
||||
"Mercury"
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
@"C:\Test\Weeds.S01E10.DVDRip.XviD-Readarr\AHFMZXGHEWD660.mp3".AsOsAgnostic(),
|
||||
"Weeds",
|
||||
Quality.MP3_320,
|
||||
Quality.MP3,
|
||||
"Readarr"
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
@"C:\Test\Deadwood.S02E12.1080p.BluRay.x264-Readarr\Backup_72023S02-12.mp3".AsOsAgnostic(),
|
||||
"Deadwood",
|
||||
Quality.MP3_320,
|
||||
Quality.MP3,
|
||||
null
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
@"C:\Test\Grimm S04E08 Chupacabra 720p WEB-DL DD5 1 H 264-ECI\123.mp3".AsOsAgnostic(),
|
||||
"Grimm",
|
||||
Quality.MP3_320,
|
||||
Quality.MP3,
|
||||
"ECI"
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
@"C:\Test\Grimm S04E08 Chupacabra 720p WEB-DL DD5 1 H 264-ECI\abc.mp3".AsOsAgnostic(),
|
||||
"Grimm",
|
||||
Quality.MP3_320,
|
||||
Quality.MP3,
|
||||
"ECI"
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
@"C:\Test\Grimm S04E08 Chupacabra 720p WEB-DL DD5 1 H 264-ECI\b00bs.mp3".AsOsAgnostic(),
|
||||
"Grimm",
|
||||
Quality.MP3_320,
|
||||
Quality.MP3,
|
||||
"ECI"
|
||||
},
|
||||
new object[]
|
||||
{
|
||||
@"C:\Test\The.Good.Wife.S02E23.720p.HDTV.x264-NZBgeek/cgajsofuejsa501.mp3".AsOsAgnostic(),
|
||||
"The Good Wife",
|
||||
Quality.MP3_320,
|
||||
Quality.MP3,
|
||||
"NZBgeek"
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ public class QualityParserFixture : CoreTest
|
|||
{
|
||||
public static object[] SelfQualityParserCases =
|
||||
{
|
||||
new object[] { Quality.MP3_320 },
|
||||
new object[] { Quality.MP3 },
|
||||
new object[] { Quality.FLAC },
|
||||
new object[] { Quality.EPUB },
|
||||
new object[] { Quality.MOBI },
|
||||
|
|
@ -39,7 +39,7 @@ public class QualityParserFixture : CoreTest
|
|||
[TestCase("Maroon 5 Ft Kendrick Lamar -Dont Wanna Know MP3 2016")]
|
||||
public void should_parse_mp3_quality(string title)
|
||||
{
|
||||
ParseAndVerifyQuality(title, null, 0, Quality.MP3_320);
|
||||
ParseAndVerifyQuality(title, null, 0, Quality.MP3);
|
||||
}
|
||||
|
||||
[TestCase("Kendrick Lamar - DAMN (2017) FLAC")]
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ public void should_be_able_to_read_and_write()
|
|||
{
|
||||
var profile = new QualityProfile
|
||||
{
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities(Quality.MP3_320, Quality.MP3_320, Quality.MP3_320),
|
||||
Cutoff = Quality.MP3_320.Id,
|
||||
Items = Qualities.QualityFixture.GetDefaultQualities(Quality.MP3, Quality.MP3, Quality.MP3),
|
||||
Cutoff = Quality.MP3.Id,
|
||||
Name = "TestProfile"
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Lifecycle;
|
||||
|
|
@ -26,7 +26,7 @@ public void init_should_insert_any_missing_definitions()
|
|||
.Setup(s => s.All())
|
||||
.Returns(new List<QualityDefinition>
|
||||
{
|
||||
new QualityDefinition(Quality.MP3_320) { Weight = 1, MinSize = 0, MaxSize = 100, Id = 20 }
|
||||
new QualityDefinition(Quality.MP3) { Weight = 1, MinSize = 0, MaxSize = 100, Id = 20 }
|
||||
});
|
||||
|
||||
Subject.Handle(new ApplicationStartedEvent());
|
||||
|
|
@ -42,7 +42,7 @@ public void init_should_update_existing_definitions()
|
|||
.Setup(s => s.All())
|
||||
.Returns(new List<QualityDefinition>
|
||||
{
|
||||
new QualityDefinition(Quality.MP3_320) { Weight = 1, MinSize = 0, MaxSize = 100, Id = 20 }
|
||||
new QualityDefinition(Quality.MP3) { Weight = 1, MinSize = 0, MaxSize = 100, Id = 20 }
|
||||
});
|
||||
|
||||
Subject.Handle(new ApplicationStartedEvent());
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public class QualityFixture : CoreTest
|
|||
new object[] { 2, Quality.MOBI },
|
||||
new object[] { 3, Quality.EPUB },
|
||||
new object[] { 4, Quality.AZW3 },
|
||||
new object[] { 10, Quality.MP3_320 },
|
||||
new object[] { 10, Quality.MP3 },
|
||||
new object[] { 11, Quality.FLAC },
|
||||
};
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ public class QualityFixture : CoreTest
|
|||
new object[] { Quality.MOBI, 2 },
|
||||
new object[] { Quality.EPUB, 3 },
|
||||
new object[] { Quality.AZW3, 4 },
|
||||
new object[] { Quality.MP3_320, 10 },
|
||||
new object[] { Quality.MP3, 10 },
|
||||
new object[] { Quality.FLAC, 11 },
|
||||
};
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ public static List<QualityProfileQualityItem> GetDefaultQualities(params Quality
|
|||
Quality.MOBI,
|
||||
Quality.EPUB,
|
||||
Quality.AZW3,
|
||||
Quality.MP3_320,
|
||||
Quality.MP3,
|
||||
Quality.FLAC
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -28,17 +28,17 @@ static MediaFileExtensions()
|
|||
{ ".wavpack", Quality.FLAC },
|
||||
{ ".wav", Quality.FLAC },
|
||||
{ ".alac", Quality.FLAC },
|
||||
{ ".mp2", Quality.MP3_320 },
|
||||
{ ".mp3", Quality.MP3_320 },
|
||||
{ ".wma", Quality.MP3_320 },
|
||||
{ ".m4a", Quality.MP3_320 },
|
||||
{ ".m4p", Quality.MP3_320 },
|
||||
{ ".mp2", Quality.MP3 },
|
||||
{ ".mp3", Quality.MP3 },
|
||||
{ ".wma", Quality.MP3 },
|
||||
{ ".m4a", Quality.MP3 },
|
||||
{ ".m4p", Quality.MP3 },
|
||||
{ ".m4b", Quality.M4B },
|
||||
{ ".aac", Quality.MP3_320 },
|
||||
{ ".mp4a", Quality.MP3_320 },
|
||||
{ ".ogg", Quality.MP3_320 },
|
||||
{ ".oga", Quality.MP3_320 },
|
||||
{ ".vorbis", Quality.MP3_320 },
|
||||
{ ".aac", Quality.MP3 },
|
||||
{ ".mp4a", Quality.MP3 },
|
||||
{ ".ogg", Quality.MP3 },
|
||||
{ ".oga", Quality.MP3 },
|
||||
{ ".vorbis", Quality.MP3 },
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public FileNameSampleService(IBuildFileNames buildFileNames)
|
|||
|
||||
_singleTrackFile = new BookFile
|
||||
{
|
||||
Quality = new QualityModel(Quality.MP3_320, new Revision(2)),
|
||||
Quality = new QualityModel(Quality.MP3, new Revision(2)),
|
||||
Path = "/music/Author.Name.Book.Name.TrackNum.Track.Title.MP3256.mp3",
|
||||
SceneName = "Author.Name.Book.Name.TrackNum.Track.Title.MP3256",
|
||||
ReleaseGroup = "RlsGrp",
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ public static QualityModel ParseQuality(string name, string desc = null, List<in
|
|||
case Codec.AACVBR:
|
||||
case Codec.OGG:
|
||||
case Codec.OPUS:
|
||||
result.Quality = Quality.MP3_320;
|
||||
result.Quality = Quality.MP3;
|
||||
break;
|
||||
case Codec.Unknown:
|
||||
default:
|
||||
|
|
@ -236,7 +236,7 @@ private static Quality FindQuality(Codec codec)
|
|||
case Codec.AAC:
|
||||
return Quality.M4B;
|
||||
default:
|
||||
return Quality.MP3_320;
|
||||
return Quality.MP3;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,14 +97,14 @@ public void Handle(ApplicationStartedEvent message)
|
|||
Quality.EPUB,
|
||||
Quality.AZW3,
|
||||
Quality.UnknownAudio,
|
||||
Quality.MP3_320,
|
||||
Quality.MP3,
|
||||
Quality.M4B,
|
||||
Quality.FLAC);
|
||||
|
||||
AddDefaultProfile("Audio",
|
||||
Quality.MP3_320,
|
||||
Quality.MP3,
|
||||
Quality.UnknownAudio,
|
||||
Quality.MP3_320,
|
||||
Quality.MP3,
|
||||
Quality.M4B,
|
||||
Quality.FLAC);
|
||||
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public override bool Equals(object obj)
|
|||
public static Quality MOBI => new Quality(2, "MOBI");
|
||||
public static Quality EPUB => new Quality(3, "EPUB");
|
||||
public static Quality AZW3 => new Quality(4, "AZW3");
|
||||
public static Quality MP3_320 => new Quality(10, "MP3-320");
|
||||
public static Quality MP3 => new Quality(10, "MP3");
|
||||
public static Quality FLAC => new Quality(11, "FLAC");
|
||||
public static Quality M4B => new Quality(12, "M4B");
|
||||
public static Quality UnknownAudio => new Quality(13, "Unknown Audio");
|
||||
|
|
@ -90,7 +90,7 @@ static Quality()
|
|||
EPUB,
|
||||
AZW3,
|
||||
UnknownAudio,
|
||||
MP3_320,
|
||||
MP3,
|
||||
M4B,
|
||||
FLAC
|
||||
};
|
||||
|
|
@ -109,7 +109,7 @@ static Quality()
|
|||
new QualityDefinition(Quality.EPUB) { Weight = 11, MinSize = 0, MaxSize = 350, GroupWeight = 11 },
|
||||
new QualityDefinition(Quality.AZW3) { Weight = 12, MinSize = 0, MaxSize = 350, GroupWeight = 12 },
|
||||
new QualityDefinition(Quality.UnknownAudio) { Weight = 50, MinSize = 0, MaxSize = 350, GroupWeight = 50 },
|
||||
new QualityDefinition(Quality.MP3_320) { Weight = 100, MinSize = 0, MaxSize = 350, GroupWeight = 100 },
|
||||
new QualityDefinition(Quality.MP3) { Weight = 100, MinSize = 0, MaxSize = 350, GroupWeight = 100 },
|
||||
new QualityDefinition(Quality.M4B) { Weight = 105, MinSize = 0, MaxSize = 350, GroupWeight = 105 },
|
||||
new QualityDefinition(Quality.FLAC) { Weight = 110, MinSize = 0, MaxSize = null, GroupWeight = 110 },
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue