diff --git a/NzbDrone.Core.Test/EpisodeProviderTest.cs b/NzbDrone.Core.Test/EpisodeProviderTest.cs index 47b9a38a9..16e1c9658 100644 --- a/NzbDrone.Core.Test/EpisodeProviderTest.cs +++ b/NzbDrone.Core.Test/EpisodeProviderTest.cs @@ -28,7 +28,7 @@ namespace NzbDrone.Core.Test var fakeSeries = Builder.CreateNew().Build(); var fakeEpisodes = Builder.CreateListOfSize(5) - .WhereAll().Have(e => e.SeriesId = 1).Build(); + .WhereAll().Have(e => e.SeriesId = 1).Have(e => e.EpisodeFileId = 0).Build(); db.InsertMany(fakeEpisodes); @@ -57,8 +57,8 @@ namespace NzbDrone.Core.Test var fakeEpisodes = Builder.CreateNew() .With(e => e.SeriesId = fakeSeries.SeriesId) .With(e => e.EpisodeNumber = 1) - .And(e => e.SeasonNumber = 2).Build(); - + .And(e => e.SeasonNumber = 2) + .With(e => e.EpisodeFileId = 0).Build(); db.Insert(fakeEpisodes); diff --git a/NzbDrone.Core.Test/SeriesProviderTest.cs b/NzbDrone.Core.Test/SeriesProviderTest.cs index 326b70acb..8e10dfeb6 100644 --- a/NzbDrone.Core.Test/SeriesProviderTest.cs +++ b/NzbDrone.Core.Test/SeriesProviderTest.cs @@ -19,43 +19,6 @@ namespace NzbDrone.Core.Test [TestFixture] public class SeriesProviderTest : TestBase { - [Test] - public void Map_path_to_series() - { - //Arrange - var fakeSeries = Builder.CreateNew() - .With(f => f.SeriesName = "The Simpsons") - .Build(); - - var fakeSearch = Builder.CreateNew() - .With(s => s.Id = fakeSeries.Id) - .With(s => s.SeriesName = fakeSeries.SeriesName) - .Build(); - - - var mocker = new AutoMoqer(); - - mocker.GetMock() - .Setup(f => f.Exists(It.IsAny())) - .Returns(false); - - mocker.GetMock() - .Setup(f => f.GetSeries(It.IsAny())) - .Returns(fakeSearch); - mocker.GetMock() - .Setup(f => f.GetSeries(fakeSeries.Id, false)) - .Returns(fakeSeries) - .Verifiable(); - - //Act - - var mappedSeries = mocker.Resolve().MapPathToSeries(@"D:\TV Shows\The Simpsons"); - - //Assert - mocker.GetMock().VerifyAll(); - Assert.AreEqual(fakeSeries, mappedSeries); - } - [TestCase(true)] [TestCase(false)] public void Add_new_series(bool useSeasonFolder) @@ -129,6 +92,9 @@ namespace NzbDrone.Core.Test var fakeSeries = Builder.CreateNew() .With(c => c.QualityProfileId = 1) + .With(c => c.EpisodeCount = 0) + .With(c => c.EpisodeFileCount = 0) + .With(c => c.SeasonCount = 0) .Build(); var fakeQuality = Builder.CreateNew().Build(); diff --git a/NzbDrone.Core/Providers/EpisodeProvider.cs b/NzbDrone.Core/Providers/EpisodeProvider.cs index 8bdca33be..edc435c2b 100644 --- a/NzbDrone.Core/Providers/EpisodeProvider.cs +++ b/NzbDrone.Core/Providers/EpisodeProvider.cs @@ -38,6 +38,7 @@ namespace NzbDrone.Core.Providers var episode = AttachSeries(_database.Fetch(@"SELECT * FROM Episodes LEFT JOIN EpisodeFiles ON Episodes.EpisodeFileId = EpisodeFiles.EpisodeFileId WHERE EpisodeId = @0", id).Single()); + if (episode.EpisodeFileId == 0) episode.EpisodeFile = null;