2011-06-06 00:37:32 +00:00
|
|
|
|
// ReSharper disable RedundantUsingDirective
|
2011-10-20 23:42:17 +00:00
|
|
|
|
|
2011-06-06 00:37:32 +00:00
|
|
|
|
using System.Collections.Generic;
|
2012-08-03 07:01:34 +00:00
|
|
|
|
using System.IO;
|
2011-06-06 00:37:32 +00:00
|
|
|
|
using FizzWare.NBuilder;
|
2012-01-22 19:25:59 +00:00
|
|
|
|
using FluentAssertions;
|
2011-06-06 00:37:32 +00:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using NzbDrone.Core.Providers;
|
|
|
|
|
using NzbDrone.Core.Providers.Core;
|
|
|
|
|
using NzbDrone.Core.Repository;
|
|
|
|
|
using NzbDrone.Core.Repository.Quality;
|
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
2011-11-14 00:22:18 +00:00
|
|
|
|
using NzbDrone.Test.Common.AutoMoq;
|
2011-06-06 00:37:32 +00:00
|
|
|
|
|
2012-01-18 07:45:21 +00:00
|
|
|
|
namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
2011-06-06 00:37:32 +00:00
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
// ReSharper disable InconsistentNaming
|
2011-11-13 07:27:16 +00:00
|
|
|
|
public class MediaFileProvider_GetNewFilenameTest : CoreTest
|
2011-06-06 00:37:32 +00:00
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void GetNewFilename_Series_Episode_Quality_S01E05_Dash()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
2011-12-15 04:15:53 +00:00
|
|
|
|
|
2011-06-06 00:37:32 +00:00
|
|
|
|
|
2011-12-15 04:15:53 +00:00
|
|
|
|
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
|
2011-07-08 03:57:44 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(2);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
|
2011-06-06 00:37:32 +00:00
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
2012-08-03 07:01:34 +00:00
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, new EpisodeFile());
|
2011-06-06 00:37:32 +00:00
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("South Park - S15E06 - City Sushi [HDTV]", result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void GetNewFilename_Episode_Quality_1x05_Dash()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
2011-12-15 04:15:53 +00:00
|
|
|
|
|
2011-06-06 00:37:32 +00:00
|
|
|
|
|
2011-12-15 04:15:53 +00:00
|
|
|
|
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(false);
|
2011-07-08 03:57:44 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
|
2011-06-06 00:37:32 +00:00
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
2012-08-03 07:01:34 +00:00
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, new EpisodeFile());
|
2011-06-06 00:37:32 +00:00
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("15x06 - City Sushi [HDTV]", result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void GetNewFilename_Series_Quality_01x05_Space()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
2011-12-15 04:15:53 +00:00
|
|
|
|
|
2011-06-06 00:37:32 +00:00
|
|
|
|
|
2011-12-15 04:15:53 +00:00
|
|
|
|
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
|
2011-07-08 03:57:44 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(false);
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(1);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(1);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
|
2011-06-06 00:37:32 +00:00
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
.With(e => e.SeasonNumber = 5)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
2012-08-03 07:01:34 +00:00
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, new EpisodeFile());
|
2011-06-06 00:37:32 +00:00
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("South Park 05x06 [HDTV]", result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void GetNewFilename_Series_s01e05_Space()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
2011-12-15 04:15:53 +00:00
|
|
|
|
|
2011-06-06 00:37:32 +00:00
|
|
|
|
|
2011-12-15 04:15:53 +00:00
|
|
|
|
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
|
2011-07-08 03:57:44 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(false);
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(1);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(3);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
|
2011-06-06 00:37:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
.With(e => e.SeasonNumber = 5)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
2012-08-03 07:01:34 +00:00
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, new EpisodeFile());
|
2011-06-06 00:37:32 +00:00
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("South Park s05e06", result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void GetNewFilename_Series_Episode_s01e05_Periods()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
2011-12-15 04:15:53 +00:00
|
|
|
|
|
2011-06-06 00:37:32 +00:00
|
|
|
|
|
2011-12-15 04:15:53 +00:00
|
|
|
|
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
|
2011-07-08 03:57:44 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(1);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(3);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(true);
|
2011-06-06 00:37:32 +00:00
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
.With(e => e.SeasonNumber = 5)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
2012-08-03 07:01:34 +00:00
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, new EpisodeFile());
|
2011-06-06 00:37:32 +00:00
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("South.Park.s05e06.City.Sushi", result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void GetNewFilename_Series_Episode_s01e05_Dash_Periods_Quality()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
2011-12-15 04:15:53 +00:00
|
|
|
|
|
2011-06-06 00:37:32 +00:00
|
|
|
|
|
2011-12-15 04:15:53 +00:00
|
|
|
|
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
|
2011-07-08 03:57:44 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(3);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(true);
|
2011-06-06 00:37:32 +00:00
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
.With(e => e.SeasonNumber = 5)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
2012-08-03 07:01:34 +00:00
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, new EpisodeFile());
|
2011-06-06 00:37:32 +00:00
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("South.Park.-.s05e06.-.City.Sushi.[HDTV]", result);
|
|
|
|
|
}
|
2011-06-06 04:03:08 +00:00
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void GetNewFilename_S01E05_Dash()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
2011-12-15 04:15:53 +00:00
|
|
|
|
|
2011-06-06 04:03:08 +00:00
|
|
|
|
|
2011-12-15 04:15:53 +00:00
|
|
|
|
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(false);
|
2011-07-08 03:57:44 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(false);
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(2);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
|
2011-06-06 04:03:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
2012-08-03 07:01:34 +00:00
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, new EpisodeFile());
|
2011-06-06 04:03:08 +00:00
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("S15E06", result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void GetNewFilename_multi_Series_Episode_Quality_S01E05_Scene_Dash()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
2011-12-15 04:15:53 +00:00
|
|
|
|
|
2011-06-06 04:03:08 +00:00
|
|
|
|
|
2011-12-15 04:15:53 +00:00
|
|
|
|
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
|
2011-07-08 03:57:44 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(2);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(3);
|
2011-06-06 04:03:08 +00:00
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
.With(e => e.EpisodeNumber = 23)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var episodeTwo = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (2)")
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
.With(e => e.EpisodeNumber = 24)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
2012-08-03 07:01:34 +00:00
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV, false, new EpisodeFile());
|
2011-06-06 04:03:08 +00:00
|
|
|
|
|
|
|
|
|
//Assert
|
2012-10-15 05:52:12 +00:00
|
|
|
|
Assert.AreEqual("The Mentalist - S03E23-E24 - Strawberries and Cream [HDTV]", result);
|
2011-06-06 04:03:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void GetNewFilename_multi_Episode_Quality_1x05_Repeat_Dash()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
2011-12-15 04:15:53 +00:00
|
|
|
|
|
2011-06-06 04:03:08 +00:00
|
|
|
|
|
2011-12-15 04:15:53 +00:00
|
|
|
|
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(false);
|
2011-07-08 03:57:44 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(2);
|
2011-06-06 04:03:08 +00:00
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
.With(e => e.EpisodeNumber = 23)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var episodeTwo = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (2)")
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
.With(e => e.EpisodeNumber = 24)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
2012-08-03 07:01:34 +00:00
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV, false, new EpisodeFile());
|
2011-06-06 04:03:08 +00:00
|
|
|
|
|
|
|
|
|
//Assert
|
2012-10-15 05:52:12 +00:00
|
|
|
|
Assert.AreEqual("3x23x24 - Strawberries and Cream [HDTV]", result);
|
2011-06-06 04:03:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void GetNewFilename_multi_Episode_Quality_01x05_Repeat_Space()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
2011-12-15 04:15:53 +00:00
|
|
|
|
|
2011-06-06 04:03:08 +00:00
|
|
|
|
|
2011-12-15 04:15:53 +00:00
|
|
|
|
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(false);
|
2011-07-08 03:57:44 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(1);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(2);
|
2011-06-06 04:03:08 +00:00
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
.With(e => e.EpisodeNumber = 23)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var episodeTwo = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (2)")
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
.With(e => e.EpisodeNumber = 24)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
2012-08-03 07:01:34 +00:00
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV, false, new EpisodeFile());
|
2011-06-06 04:03:08 +00:00
|
|
|
|
|
|
|
|
|
//Assert
|
2012-10-15 05:52:12 +00:00
|
|
|
|
Assert.AreEqual("3x23x24 Strawberries and Cream [HDTV]", result);
|
2011-06-06 04:03:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void GetNewFilename_multi_Series_Episode_s01e05_Duplicate_Period()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
2011-12-15 04:15:53 +00:00
|
|
|
|
|
2011-06-06 04:03:08 +00:00
|
|
|
|
|
2011-12-15 04:15:53 +00:00
|
|
|
|
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
|
2011-07-08 03:57:44 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(1);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(3);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(1);
|
2011-06-06 04:03:08 +00:00
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
.With(e => e.EpisodeNumber = 23)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var episodeTwo = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (2)")
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
.With(e => e.EpisodeNumber = 24)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
2012-08-03 07:01:34 +00:00
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV, false, new EpisodeFile());
|
2011-06-06 04:03:08 +00:00
|
|
|
|
|
|
|
|
|
//Assert
|
2012-10-15 05:52:12 +00:00
|
|
|
|
Assert.AreEqual("The.Mentalist.s03e23.s03e24.Strawberries.and.Cream", result);
|
2011-06-06 04:03:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void GetNewFilename_multi_Series_S01E05_Extend_Dash_Period()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
2011-12-15 04:15:53 +00:00
|
|
|
|
|
2011-06-06 04:03:08 +00:00
|
|
|
|
|
2011-12-15 04:15:53 +00:00
|
|
|
|
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
|
2011-07-08 03:57:44 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(false);
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(2);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(0);
|
2011-06-06 04:03:08 +00:00
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
.With(e => e.EpisodeNumber = 23)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var episodeTwo = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (2)")
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
.With(e => e.EpisodeNumber = 24)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
2012-08-03 07:01:34 +00:00
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV, false, new EpisodeFile());
|
2011-06-06 04:03:08 +00:00
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("The.Mentalist.-.S03E23-24", result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void GetNewFilename_multi_1x05_Repeat_Dash_Period()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
2011-12-15 04:15:53 +00:00
|
|
|
|
|
2011-06-06 04:03:08 +00:00
|
|
|
|
|
2011-12-15 04:15:53 +00:00
|
|
|
|
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(false);
|
2011-07-08 03:57:44 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(false);
|
2011-07-08 03:36:02 +00:00
|
|
|
|
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(2);
|
2011-06-06 04:03:08 +00:00
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
.With(e => e.EpisodeNumber = 23)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var episodeTwo = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (2)")
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
.With(e => e.EpisodeNumber = 24)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
2012-08-03 07:01:34 +00:00
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV, false, new EpisodeFile());
|
2011-06-06 04:03:08 +00:00
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("3x23x24", result);
|
|
|
|
|
}
|
2012-01-22 19:25:59 +00:00
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void GetNewFilename_should_append_proper_when_proper_and_append_quality_is_true()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
|
|
|
|
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(2);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
2012-08-03 07:01:34 +00:00
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, true, new EpisodeFile());
|
2012-01-22 19:25:59 +00:00
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
result.Should().Be("South Park - S15E06 - City Sushi [HDTV] [Proper]");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void GetNewFilename_should_not_append_proper_when_not_proper_and_append_quality_is_true()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
|
|
|
|
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(2);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
2012-08-03 07:01:34 +00:00
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, new EpisodeFile());
|
2012-01-22 19:25:59 +00:00
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
result.Should().Be("South Park - S15E06 - City Sushi [HDTV]");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void GetNewFilename_should_not_append_proper_when_proper_and_append_quality_is_false()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
|
|
|
|
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(2);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
2012-08-03 07:01:34 +00:00
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, true, new EpisodeFile());
|
2012-01-22 19:25:59 +00:00
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
result.Should().Be("South Park - S15E06 - City Sushi");
|
|
|
|
|
}
|
2012-02-12 22:11:08 +00:00
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void GetNewFilename_should_order_multiple_episode_files_in_numerical_order()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
|
|
|
|
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(2);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(3);
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Hey, Baby, What's Wrong? (1)")
|
|
|
|
|
.With(e => e.SeasonNumber = 6)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var episode2 = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Hey, Baby, What's Wrong? (2)")
|
|
|
|
|
.With(e => e.SeasonNumber = 6)
|
|
|
|
|
.With(e => e.EpisodeNumber = 7)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
2012-08-03 07:01:34 +00:00
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode2, episode }, "30 Rock", QualityTypes.HDTV, false, new EpisodeFile());
|
2012-02-12 22:11:08 +00:00
|
|
|
|
|
|
|
|
|
//Assert
|
2012-10-15 05:52:12 +00:00
|
|
|
|
result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!");
|
2012-02-12 22:11:08 +00:00
|
|
|
|
}
|
2012-04-15 00:17:36 +00:00
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void GetNewFilename_Series_Episode_Quality_S01E05_Period()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(2);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(2);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
2012-08-03 07:01:34 +00:00
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, new EpisodeFile());
|
2012-04-15 00:17:36 +00:00
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("South Park.S15E06.City Sushi [HDTV]", result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void GetNewFilename_Episode_Quality_1x05_Period()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(2);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
2012-08-03 07:01:34 +00:00
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, new EpisodeFile());
|
2012-04-15 00:17:36 +00:00
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("15x06.City Sushi [HDTV]", result);
|
|
|
|
|
}
|
2012-08-03 07:01:34 +00:00
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void GetNewFilename_UseSceneName_when_sceneName_isNull()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
|
|
|
|
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(2);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingUseSceneName).Returns(true);
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
.With(e => e.SceneName = null)
|
|
|
|
|
.With(e => e.Path = @"C:\Test\TV\30 Rock - S01E01 - Test")
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, episodeFile);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
result.Should().Be(Path.GetFileNameWithoutExtension(episodeFile.Path));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void GetNewFilename_UseSceneName_when_sceneName_isNotNull()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
|
|
|
|
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(2);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingUseSceneName).Returns(true);
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
.With(e => e.SceneName = "30.Rock.S01E01.xvid-LOL")
|
|
|
|
|
.With(e => e.Path = @"C:\Test\TV\30 Rock - S01E01 - Test")
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false, episodeFile);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
result.Should().Be(episodeFile.SceneName);
|
|
|
|
|
}
|
2012-10-15 05:52:12 +00:00
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_only_have_one_episodeTitle_when_episode_titles_are_the_same()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
|
|
|
|
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(2);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(3);
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Hey, Baby, What's Wrong? (1)")
|
|
|
|
|
.With(e => e.SeasonNumber = 6)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var episode2 = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Hey, Baby, What's Wrong? (2)")
|
|
|
|
|
.With(e => e.SeasonNumber = 6)
|
|
|
|
|
.With(e => e.EpisodeNumber = 7)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode2, episode }, "30 Rock", QualityTypes.HDTV, false, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_have_two_episodeTitles_when_episode_titles_are_not_the_same()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
|
|
|
|
var fakeConfig = Mocker.GetMock<ConfigProvider>();
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingAppendQuality).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingSeparatorStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(2);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(3);
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Hello")
|
|
|
|
|
.With(e => e.SeasonNumber = 6)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var episode2 = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "World")
|
|
|
|
|
.With(e => e.SeasonNumber = 6)
|
|
|
|
|
.With(e => e.EpisodeNumber = 7)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode2, episode }, "30 Rock", QualityTypes.HDTV, false, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
result.Should().Be("30 Rock - S06E06-E07 - Hello + World");
|
|
|
|
|
}
|
2011-06-06 00:37:32 +00:00
|
|
|
|
}
|
|
|
|
|
}
|