1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00
Sonarr/NzbDrone.Core.Test/MediaFileTests/MediaFileServiceTest.cs

46 lines
2.2 KiB
C#
Raw Normal View History

2013-03-01 10:03:41 +03:00
using System.Linq;
using FizzWare.NBuilder;
2011-06-03 00:06:46 +03:00
using FluentAssertions;
using Marr.Data;
2011-06-03 00:06:46 +03:00
using NUnit.Framework;
2013-02-24 09:48:52 +03:00
using NzbDrone.Core.Configuration;
2013-03-01 10:03:41 +03:00
using NzbDrone.Core.MediaFiles;
using NzbDrone.Core.Organizer;
using NzbDrone.Core.RootFolders;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Test.Framework;
2013-03-01 10:03:41 +03:00
namespace NzbDrone.Core.Test.MediaFileTests
{
[TestFixture]
2013-03-05 04:47:51 +03:00
public class MediaFileServiceTest : CoreTest<MediaFileService>
{
[Test]
[TestCase("Law & Order: Criminal Intent - S10E07 - Icarus [HDTV-720p]", "Law & Order- Criminal Intent - S10E07 - Icarus [HDTV-720p]")]
public void CleanFileName(string name, string expectedName)
{
FileNameBuilder.CleanFilename(name).Should().Be(expectedName);
}
[Test]
[TestCase("30 Rock - S01E05 - Episode Title", 1, true, "Season %0s", @"C:\Test\30 Rock\Season 01\30 Rock - S01E05 - Episode Title.mkv")]
[TestCase("30 Rock - S01E05 - Episode Title", 1, true, "Season %s", @"C:\Test\30 Rock\Season 1\30 Rock - S01E05 - Episode Title.mkv")]
[TestCase("30 Rock - S01E05 - Episode Title", 1, false, "Season %0s", @"C:\Test\30 Rock\30 Rock - S01E05 - Episode Title.mkv")]
[TestCase("30 Rock - S01E05 - Episode Title", 1, false, "Season %s", @"C:\Test\30 Rock\30 Rock - S01E05 - Episode Title.mkv")]
[TestCase("30 Rock - S01E05 - Episode Title", 1, true, "ReallyUglySeasonFolder %s", @"C:\Test\30 Rock\ReallyUglySeasonFolder 1\30 Rock - S01E05 - Episode Title.mkv")]
public void CalculateFilePath_SeasonFolder_SingleNumber(string filename, int seasonNumber, bool useSeasonFolder, string seasonFolderFormat, string expectedPath)
{
var fakeSeries = Builder<Series>.CreateNew()
.With(s => s.Title = "30 Rock")
2013-04-11 19:13:57 +03:00
.With(s => s.RootFolder = new LazyLoaded<RootFolder>(new RootFolder { Path = @"C:\Test" }))
.With(s => s.FolderName = "30 Rock")
.With(s => s.SeasonFolder = useSeasonFolder)
.Build();
2013-02-24 22:39:31 +03:00
Mocker.GetMock<IConfigService>().Setup(e => e.SortingSeasonFolderFormat).Returns(seasonFolderFormat);
2013-03-05 04:47:51 +03:00
Subject.CalculateFilePath(fakeSeries, 1, filename, ".mkv").FullName.Should().Be(expectedPath);
}
}
2011-04-10 05:44:01 +03:00
}