mirror of https://github.com/lidarr/Lidarr
43 lines
2.1 KiB
C#
43 lines
2.1 KiB
C#
using System.Linq;
|
|
using FizzWare.NBuilder;
|
|
using FluentAssertions;
|
|
using NUnit.Framework;
|
|
using NzbDrone.Core.Configuration;
|
|
using NzbDrone.Core.MediaFiles;
|
|
using NzbDrone.Core.Organizer;
|
|
using NzbDrone.Core.Tv;
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
namespace NzbDrone.Core.Test.MediaFileTests
|
|
{
|
|
[TestFixture]
|
|
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")
|
|
.With(s => s.Path = @"C:\Test\30 Rock")
|
|
.With(s => s.SeasonFolder = useSeasonFolder)
|
|
.Build();
|
|
|
|
Mocker.GetMock<IConfigService>().Setup(e => e.SortingSeasonFolderFormat).Returns(seasonFolderFormat);
|
|
|
|
Subject.CalculateFilePath(fakeSeries, 1, filename, ".mkv").FullName.Should().Be(expectedPath);
|
|
}
|
|
}
|
|
} |