From a990fb91d50a5e28c78459a7cb03a89faf2b65de Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Sat, 18 Jun 2011 22:56:52 -0700 Subject: [PATCH] SeriesProvider.GetSeries(int seriesId) will now fail if series is not found. --- NzbDrone.Core.Test/SeriesProviderTest.cs | 1 + NzbDrone.Core/Providers/SeriesProvider.cs | 8 +++----- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/NzbDrone.Core.Test/SeriesProviderTest.cs b/NzbDrone.Core.Test/SeriesProviderTest.cs index 1597e4ad8..9064eb8d5 100644 --- a/NzbDrone.Core.Test/SeriesProviderTest.cs +++ b/NzbDrone.Core.Test/SeriesProviderTest.cs @@ -106,6 +106,7 @@ namespace NzbDrone.Core.Test [Test] + [ExpectedException(typeof(InvalidOperationException), ExpectedMessage = "Sequence contains no elements")] public void Get_series_invalid_series_id_should_return_null() { var mocker = new AutoMoqer(); diff --git a/NzbDrone.Core/Providers/SeriesProvider.cs b/NzbDrone.Core/Providers/SeriesProvider.cs index 1eab2b3bd..127e9f08a 100644 --- a/NzbDrone.Core/Providers/SeriesProvider.cs +++ b/NzbDrone.Core/Providers/SeriesProvider.cs @@ -44,11 +44,9 @@ namespace NzbDrone.Core.Providers public virtual Series GetSeries(int seriesId) { - var series = _database.SingleOrDefault("WHERE seriesId= @0", seriesId); - if (series != null) - { - series.QualityProfile = _qualityProvider.Get(series.QualityProfileId); - } + var series = _database.Single("WHERE seriesId= @0", seriesId); + series.QualityProfile = _qualityProvider.Get(series.QualityProfileId); + return series; }