diff --git a/NzbDrone.Core.Test/ProviderTests/UpcomingEpisodesProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/UpcomingEpisodesProviderTest.cs index 627dd2ca1..317c5b0fb 100644 --- a/NzbDrone.Core.Test/ProviderTests/UpcomingEpisodesProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/UpcomingEpisodesProviderTest.cs @@ -64,97 +64,27 @@ namespace NzbDrone.Core.Test.ProviderTests } [Test] - public void Get_Yesterday() + public void Get_UpcomingEpisodes() { - var result = Mocker.Resolve().Yesterday(); + var result = Mocker.Resolve().UpcomingEpisodes(); //Assert - result.Should().NotBeEmpty(); - result.Should().OnlyContain(c => c.AirDate.Value.Date == DateTime.Today.AddDays(-1).Date); - result.First().Series.Should().NotBeNull(); - result.First().Series.SeriesId.Should().Be(series.SeriesId); - } - - [Test] - public void Get_Today() - { - //Act - var result = Mocker.Resolve().Today(); - - result.Should().NotBeEmpty(); - result.Should().OnlyContain(c => c.AirDate.Value.Date == DateTime.Today.Date); - result.First().Series.Should().NotBeNull(); - result.First().Series.SeriesId.Should().Be(series.SeriesId); - } - - [Test] - public void Get_Tomorrow() - { - var result = Mocker.Resolve().Tomorrow(); - - result.Should().NotBeEmpty(); - result.Should().OnlyContain(c => c.AirDate.Value.Date == DateTime.Today.AddDays(1).Date); - result.First().Series.Should().NotBeNull(); - result.First().Series.SeriesId.Should().Be(series.SeriesId); - } - - [Test] - public void Get_Week() - { - var result = Mocker.Resolve().Week(); - - //Assert - result.Should().HaveCount(2); + result.Should().HaveCount(5); result.Should().OnlyContain(c => c.Series != null && c.SeriesId == series.SeriesId); } [Test] - public void Get_Yesterday_should_skip_ingored() + public void Get_UpcomingEpisodes_should_skip_ingored() { WithIgnoredEpisodes(); - Mocker.Resolve().Yesterday().Should().BeEmpty(); + Mocker.Resolve().UpcomingEpisodes().Should().BeEmpty(); } [Test] - public void Get_Today_should_skip_ingored() - { - WithIgnoredEpisodes(); - Mocker.Resolve().Today().Should().BeEmpty(); - } - - [Test] - public void Get_Tomorrow_should_skip_ingored() - { - WithIgnoredEpisodes(); - Mocker.Resolve().Tomorrow().Should().BeEmpty(); - } - - [Test] - public void Get_Week_should_skip_ingored() - { - WithIgnoredEpisodes(); - Mocker.Resolve().Week().Should().BeEmpty(); - } - - [Test] - public void Get_Today_should_skip_unmonitored_series() + public void Get_UpcomingEpisodes_should_skip_unmonitored_series() { WithIgnoredSeries(); - Mocker.Resolve().Today().Should().BeEmpty(); - } - - [Test] - public void Get_Tomoroww_should_skip_unmonitored_series() - { - WithIgnoredSeries(); - Mocker.Resolve().Tomorrow().Should().BeEmpty(); - } - - [Test] - public void Get_Week_should_skip_unmonitored_series() - { - WithIgnoredSeries(); - Mocker.Resolve().Week().Should().BeEmpty(); + Mocker.Resolve().UpcomingEpisodes().Should().BeEmpty(); } } } diff --git a/NzbDrone.Core/Providers/UpcomingEpisodesProvider.cs b/NzbDrone.Core/Providers/UpcomingEpisodesProvider.cs index 00c924d84..7cb4df06f 100644 --- a/NzbDrone.Core/Providers/UpcomingEpisodesProvider.cs +++ b/NzbDrone.Core/Providers/UpcomingEpisodesProvider.cs @@ -18,27 +18,7 @@ namespace NzbDrone.Core.Providers _database = database; } - public virtual List Yesterday() - { - return RecentEpisodes().Where(c => c.AirDate.Value.Date == DateTime.Now.Date.AddDays(-1)).ToList(); - } - - public virtual List Today() - { - return RecentEpisodes().Where(c => c.AirDate.Value.Date == DateTime.Now.Date).ToList(); - } - - public virtual List Tomorrow() - { - return RecentEpisodes().Where(c => c.AirDate.Value.Date == DateTime.Now.Date.AddDays(1)).ToList(); - } - - public virtual List Week() - { - return RecentEpisodes().Where(c => c.AirDate >= DateTime.Today.AddDays(2).Date).ToList(); - } - - public virtual List RecentEpisodes() + public virtual List UpcomingEpisodes() { return _database.Fetch(@"SELECT * FROM Episodes INNER JOIN Series ON Episodes.SeriesId = Series.SeriesId