Fixed parsing of shows with scene numbering

pull/25/head
Mark McDowall 11 years ago
parent 9a24268ee7
commit 3f85104d18

@ -164,6 +164,7 @@
<Compile Include="ProviderTests\RecycleBinProviderTests\DeleteDirectoryFixture.cs" />
<Compile Include="NotificationTests\PlexProviderTest.cs" />
<Compile Include="TvTests\EpisodeProviderTests\HandleEpisodeFileDeletedFixture.cs" />
<Compile Include="TvTests\EpisodeRepositoryTests\FindEpisodeFixture.cs" />
<Compile Include="TvTests\EpisodeRepositoryTests\EpisodesRepositoryReadFixture.cs" />
<Compile Include="TvTests\EpisodeRepositoryTests\EpisodesWithoutFilesFixture.cs" />
<Compile Include="TvTests\EpisodeRepositoryTests\EpisodesBetweenDatesFixture.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<EpisodeRepository, Episode>
{
private Episode _episode;
[SetUp]
public void Setup()
{
_episode = Builder<Episode>.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();
}
}
}

@ -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<Episode> EpisodesWithFiles()

Loading…
Cancel
Save