mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-05 02:22:31 +01:00
fixed broken episode status tests
This commit is contained in:
parent
22c24f7419
commit
56169b515f
@ -17,7 +17,6 @@ public class EpisodeStatusTest : TestBase
|
||||
[Row(1, false, false, EpisodeStatusType.NotAired)]
|
||||
[Row(-2, false, false, EpisodeStatusType.Missing)]
|
||||
[Row(1, true, false, EpisodeStatusType.Ready)]
|
||||
[Row(1, true, true, EpisodeStatusType.Ignored)]
|
||||
[Row(1, false, true, EpisodeStatusType.Ignored)]
|
||||
public void no_grab_date(int offsetDays, bool hasEpisodes, bool ignored, EpisodeStatusType status)
|
||||
{
|
||||
@ -43,7 +42,6 @@ public void no_grab_date(int offsetDays, bool hasEpisodes, bool ignored, Episode
|
||||
[Row(1, false, false, EpisodeStatusType.NotAired)]
|
||||
[Row(-2, false, false, EpisodeStatusType.Missing)]
|
||||
[Row(1, true, false, EpisodeStatusType.Ready)]
|
||||
[Row(1, true, true, EpisodeStatusType.Ignored)]
|
||||
[Row(1, false, true, EpisodeStatusType.Ignored)]
|
||||
public void old_grab_date(int offsetDays, bool hasEpisodes, bool ignored,
|
||||
EpisodeStatusType status)
|
||||
@ -70,8 +68,8 @@ public void old_grab_date(int offsetDays, bool hasEpisodes, bool ignored,
|
||||
[Row(1, false, false, EpisodeStatusType.Downloading)]
|
||||
[Row(-2, false, false, EpisodeStatusType.Downloading)]
|
||||
[Row(1, true, false, EpisodeStatusType.Downloading)]
|
||||
[Row(1, true, true, EpisodeStatusType.Ignored)]
|
||||
[Row(1, false, true, EpisodeStatusType.Ignored)]
|
||||
[Row(1, true, true, EpisodeStatusType.Downloading)]
|
||||
[Row(1, false, true, EpisodeStatusType.Downloading)]
|
||||
public void recent_grab_date(int offsetDays, bool hasEpisodes, bool ignored,
|
||||
EpisodeStatusType status)
|
||||
{
|
||||
@ -95,8 +93,6 @@ public void recent_grab_date(int offsetDays, bool hasEpisodes, bool ignored,
|
||||
[Test]
|
||||
[Row(1, false, false, EpisodeStatusType.Ignored)]
|
||||
[Row(-2, false, false, EpisodeStatusType.Ignored)]
|
||||
[Row(1, true, false, EpisodeStatusType.Ignored)]
|
||||
[Row(1, true, true, EpisodeStatusType.Ignored)]
|
||||
[Row(1, false, true, EpisodeStatusType.Ignored)]
|
||||
public void skipped_season(int offsetDays, bool hasEpisodes, bool ignored, EpisodeStatusType status)
|
||||
{
|
||||
@ -104,8 +100,10 @@ public void skipped_season(int offsetDays, bool hasEpisodes, bool ignored, Episo
|
||||
.With(e => e.AirDate = DateTime.Now.AddDays(offsetDays))
|
||||
.With(e => e.Ignored = ignored)
|
||||
.With(e => e.EpisodeFileId = 0)
|
||||
.With(e => e.GrabDate = null)
|
||||
.With(e => e.Season = Builder<Season>.CreateNew()
|
||||
.With(s => s.Monitored == false).Build())
|
||||
|
||||
.Build();
|
||||
|
||||
if (hasEpisodes)
|
||||
@ -124,12 +122,12 @@ public void low_air_date()
|
||||
.With(e => e.AirDate = DateTime.Now.AddYears(-200))
|
||||
.With(e => e.Ignored = false)
|
||||
.With(e => e.EpisodeFileId = 0)
|
||||
.With(e=>e.GrabDate =null)
|
||||
.With(e => e.GrabDate = null)
|
||||
.With(e => e.Season = Builder<Season>.CreateNew()
|
||||
.With(s => s.Monitored = true).Build())
|
||||
.Build();
|
||||
|
||||
|
||||
|
||||
Assert.AreEqual(EpisodeStatusType.NotAired, episode.Status);
|
||||
}
|
||||
}
|
||||
|
@ -49,17 +49,17 @@ public EpisodeStatusType Status
|
||||
{
|
||||
get
|
||||
{
|
||||
if (EpisodeFileId != 0) return EpisodeStatusType.Ready;
|
||||
|
||||
var season = Season;
|
||||
|
||||
if (Ignored || (season != null && !season.Monitored)) return EpisodeStatusType.Ignored;
|
||||
|
||||
if (GrabDate != null && GrabDate.Value.AddDays(1) >= DateTime.Now)
|
||||
{
|
||||
return EpisodeStatusType.Downloading;
|
||||
}
|
||||
|
||||
if (EpisodeFileId != 0) return EpisodeStatusType.Ready;
|
||||
|
||||
var season = Season;
|
||||
|
||||
if (Ignored || (season != null && !season.Monitored)) return EpisodeStatusType.Ignored;
|
||||
|
||||
if (AirDate.Date.Year > 1900 && DateTime.Now.Date >= AirDate.Date)
|
||||
{
|
||||
return EpisodeStatusType.Missing;
|
||||
|
Loading…
Reference in New Issue
Block a user