diff --git a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj
index 43c25a6b9..e89ba8755 100644
--- a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj
+++ b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj
@@ -164,6 +164,7 @@
+
diff --git a/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/FindEpisodeFixture.cs b/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/FindEpisodeFixture.cs
new file mode 100644
index 000000000..3f813a3db
--- /dev/null
+++ b/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/FindEpisodeFixture.cs
@@ -0,0 +1,56 @@
+using System;
+using FizzWare.NBuilder;
+using FluentAssertions;
+using NUnit.Framework;
+using NzbDrone.Core.Test.Framework;
+using NzbDrone.Core.Tv;
+
+namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests
+{
+ [TestFixture]
+ public class FindEpisodeFixture : DbTest
+ {
+ private Episode _episode;
+
+ [SetUp]
+ public void Setup()
+ {
+ _episode = Builder.CreateNew()
+ .With(e => e.Id = 0)
+ .With(e => e.SeriesId = 1)
+ .With(e => e.SeasonNumber = 1)
+ .With(e => e.SceneSeasonNumber = 2)
+ .With(e => e.EpisodeNumber = 3)
+ .With(e => e.SceneEpisodeNumber = 4)
+ .Build();
+
+ _episode = Db.Insert(_episode);
+ }
+
+ [Test]
+ public void should_find_episode_by_scene_numbering()
+ {
+ Subject.FindEpisodeBySceneNumbering(_episode.SeriesId, _episode.SceneSeasonNumber, _episode.SceneEpisodeNumber)
+ .Id
+ .Should()
+ .Be(_episode.Id);
+ }
+
+ [Test]
+ public void should_find_episode_by_standard_numbering()
+ {
+ Subject.Find(_episode.SeriesId, _episode.SeasonNumber, _episode.EpisodeNumber)
+ .Id
+ .Should()
+ .Be(_episode.Id);
+ }
+
+ [Test]
+ public void should_not_find_episode_that_does_not_exist()
+ {
+ Subject.Find(_episode.SeriesId, _episode.SeasonNumber + 1, _episode.EpisodeNumber)
+ .Should()
+ .BeNull();
+ }
+ }
+}
diff --git a/NzbDrone.Core/Tv/EpisodeRepository.cs b/NzbDrone.Core/Tv/EpisodeRepository.cs
index 9529050ab..280dec96e 100644
--- a/NzbDrone.Core/Tv/EpisodeRepository.cs
+++ b/NzbDrone.Core/Tv/EpisodeRepository.cs
@@ -90,12 +90,12 @@ namespace NzbDrone.Core.Tv
public Episode GetEpisodeBySceneNumbering(int seriesId, int seasonNumber, int episodeNumber)
{
- return Query.Single(s => s.SeriesId == seriesId && s.SeasonNumber == seasonNumber && s.SceneEpisodeNumber == episodeNumber);
+ return Query.Single(s => s.SeriesId == seriesId && s.SceneSeasonNumber == seasonNumber && s.SceneEpisodeNumber == episodeNumber);
}
public Episode FindEpisodeBySceneNumbering(int seriesId, int seasonNumber, int episodeNumber)
{
- return Query.SingleOrDefault(s => s.SeriesId == seriesId && s.SeasonNumber == seasonNumber && s.SceneEpisodeNumber == episodeNumber);
+ return Query.SingleOrDefault(s => s.SeriesId == seriesId && s.SceneSeasonNumber == seasonNumber && s.SceneEpisodeNumber == episodeNumber);
}
public List EpisodesWithFiles()