1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-24 22:35:49 -04:00

Episode file import fixes

Fixed: Import event when file doesn't have a valid scene name
Fixed: Filename when file doesn't have a valid scene name
This commit is contained in:
Mark McDowall
2014-09-15 16:46:12 -07:00
parent 7c01f46cc0
commit 4cbb59d4e8
6 changed files with 49 additions and 4 deletions
@@ -1,4 +1,11 @@
using NUnit.Framework;
using System.IO;
using System.Linq;
using FizzWare.NBuilder;
using Moq;
using NUnit.Framework;
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.MediaFiles.Events;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Profiles;
using NzbDrone.Core.Test.Framework;
using NzbDrone.Core.History;
@@ -6,6 +13,7 @@ using NzbDrone.Core.Qualities;
using System.Collections.Generic;
using NzbDrone.Core.Test.Qualities;
using FluentAssertions;
using NzbDrone.Core.Tv;
namespace NzbDrone.Core.Test.HistoryTests
{
@@ -56,5 +64,27 @@ namespace NzbDrone.Core.Test.HistoryTests
quality.Should().Be(new QualityModel(Quality.DVD));
}
[Test]
public void should_use_file_name_for_source_title_if_scene_name_is_null()
{
var series = Builder<Series>.CreateNew().Build();
var episodes = Builder<Episode>.CreateListOfSize(1).Build().ToList();
var episodeFile = Builder<EpisodeFile>.CreateNew()
.With(f => f.SceneName = null)
.Build();
var localEpisode = new LocalEpisode
{
Series = series,
Episodes = episodes,
Path = @"C:\Test\Unsorted\Series.s01e01.mkv"
};
Subject.Handle(new EpisodeImportedEvent(localEpisode, episodeFile, true));
Mocker.GetMock<IHistoryRepository>()
.Verify(v => v.Insert(It.Is<History.History>(h => h.SourceTitle == Path.GetFileNameWithoutExtension(localEpisode.Path))));
}
}
}