mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-05 10:32:35 +01:00
Merge branch 'master' of git://github.com/kayone/NzbDrone
This commit is contained in:
commit
a151c9cd0f
@ -280,9 +280,9 @@ public void existing_episodes_keep_their_episodeId_file_id()
|
||||
[Test]
|
||||
public void IsSeasonIgnored_should_return_true_if_all_episodes_ignored()
|
||||
{
|
||||
var repo = MockLib.GetEmptyRepository();
|
||||
var db = MockLib.GetEmptyDatabase();
|
||||
var mocker = new AutoMoqer(MockBehavior.Strict);
|
||||
mocker.SetConstant(repo);
|
||||
mocker.SetConstant(db);
|
||||
|
||||
var episodes = Builder<Episode>.CreateListOfSize(4)
|
||||
.WhereAll()
|
||||
@ -291,7 +291,7 @@ public void IsSeasonIgnored_should_return_true_if_all_episodes_ignored()
|
||||
.Have(c => c.SeasonNumber = 2)
|
||||
.Build();
|
||||
|
||||
repo.AddMany(episodes);
|
||||
episodes.ToList().ForEach(c => db.Insert(c));
|
||||
|
||||
//Act
|
||||
var result = mocker.Resolve<EpisodeProvider>().IsIgnored(10, 2);
|
||||
@ -303,9 +303,9 @@ public void IsSeasonIgnored_should_return_true_if_all_episodes_ignored()
|
||||
[Test]
|
||||
public void IsSeasonIgnored_should_return_false_if_none_of_episodes_are_ignored()
|
||||
{
|
||||
var repo = MockLib.GetEmptyRepository();
|
||||
var db = MockLib.GetEmptyDatabase();
|
||||
var mocker = new AutoMoqer(MockBehavior.Strict);
|
||||
mocker.SetConstant(repo);
|
||||
mocker.SetConstant(db);
|
||||
|
||||
var episodes = Builder<Episode>.CreateListOfSize(4)
|
||||
.WhereAll()
|
||||
@ -314,8 +314,8 @@ public void IsSeasonIgnored_should_return_false_if_none_of_episodes_are_ignored(
|
||||
.Have(c => c.SeasonNumber = 2)
|
||||
.Build();
|
||||
|
||||
repo.AddMany(episodes);
|
||||
|
||||
episodes.ToList().ForEach(c => db.Insert(c));
|
||||
|
||||
//Act
|
||||
var result = mocker.Resolve<EpisodeProvider>().IsIgnored(10, 2);
|
||||
|
||||
@ -326,9 +326,9 @@ public void IsSeasonIgnored_should_return_false_if_none_of_episodes_are_ignored(
|
||||
[Test]
|
||||
public void IsSeasonIgnored_should_return_false_if_some_of_episodes_are_ignored()
|
||||
{
|
||||
var repo = MockLib.GetEmptyRepository();
|
||||
var db = MockLib.GetEmptyDatabase();
|
||||
var mocker = new AutoMoqer(MockBehavior.Strict);
|
||||
mocker.SetConstant(repo);
|
||||
mocker.SetConstant(db);
|
||||
|
||||
var episodes = Builder<Episode>.CreateListOfSize(4)
|
||||
.WhereAll()
|
||||
@ -340,7 +340,7 @@ public void IsSeasonIgnored_should_return_false_if_some_of_episodes_are_ignored(
|
||||
episodes[2].Ignored = false;
|
||||
|
||||
|
||||
repo.AddMany(episodes);
|
||||
episodes.ToList().ForEach(c => db.Insert(c));
|
||||
|
||||
//Act
|
||||
var result = mocker.Resolve<EpisodeProvider>().IsIgnored(10, 2);
|
||||
@ -352,9 +352,9 @@ public void IsSeasonIgnored_should_return_false_if_some_of_episodes_are_ignored(
|
||||
[Test]
|
||||
public void IsSeasonIgnored_should_return_true_if_invalid_series()
|
||||
{
|
||||
var repo = MockLib.GetEmptyRepository();
|
||||
var db = MockLib.GetEmptyDatabase();
|
||||
var mocker = new AutoMoqer(MockBehavior.Strict);
|
||||
mocker.SetConstant(repo);
|
||||
mocker.SetConstant(db);
|
||||
|
||||
//Act
|
||||
var result = mocker.Resolve<EpisodeProvider>().IsIgnored(10, 2);
|
||||
|
@ -162,15 +162,12 @@ public virtual void RefreshEpisodeInfo(Series series)
|
||||
{
|
||||
newList.ForEach(episode => _database.Insert(episode));
|
||||
updateList.ForEach(episode => _database.Update(episode));
|
||||
#if DEBUG
|
||||
|
||||
//Shouldn't run if Database is a mock since transaction will be null
|
||||
if (_database.GetType().Namespace != "Castle.Proxies" && tran != null)
|
||||
{
|
||||
tran.Complete();
|
||||
}
|
||||
#else
|
||||
tran.Complete();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
@ -189,9 +186,9 @@ public virtual bool IsIgnored(int seriesId, int seasonNumber)
|
||||
{
|
||||
|
||||
var unIgnoredCount = _database.ExecuteScalar<int>(
|
||||
"SELECT COUNT (*) FROM Episodes WHERE SeriesId=@0 AND SeasonNumber=@1 AND Ignored=False");
|
||||
"SELECT COUNT (*) FROM Episodes WHERE SeriesId=@0 AND SeasonNumber=@1 AND Ignored='0'", seriesId, seasonNumber);
|
||||
|
||||
return unIgnoredCount != 0;
|
||||
return unIgnoredCount == 0;
|
||||
}
|
||||
|
||||
public virtual IList<int> GetSeasons(int seriesId)
|
||||
@ -212,15 +209,12 @@ public virtual void SetSeasonIgnore(long seriesId, int seasonNumber, bool isIgno
|
||||
_database.Update(episode);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
//Shouldn't run if Database is a mock since transaction will be null
|
||||
if (_database.GetType().Namespace != "Castle.Proxies" && tran != null)
|
||||
{
|
||||
tran.Complete();
|
||||
}
|
||||
#else
|
||||
tran.Complete();
|
||||
#endif
|
||||
|
||||
Logger.Info("Ignore flag for Series:{0} Season:{1} successfully set to {2}", seriesId, seasonNumber, isIgnored);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user