|
|
@ -50,9 +50,6 @@ namespace NzbDrone.Core.Test
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
.Build();
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
var fakeMediaFileProvider = mocker.GetMock<MediaFileProvider>();
|
|
|
|
|
|
|
|
fakeMediaFileProvider.Setup(m => m.GetEpisodeFile(12345)).Returns(episodeFile);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> {episode});
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> {episode});
|
|
|
|
|
|
|
|
|
|
|
@ -60,7 +57,7 @@ namespace NzbDrone.Core.Test
|
|
|
|
fakeSeriesProvider.Setup(m => m.GetSeries(series.SeriesId)).Returns(series);
|
|
|
|
fakeSeriesProvider.Setup(m => m.GetSeries(series.SeriesId)).Returns(series);
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(12345);
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile);
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
//Assert
|
|
|
|
Assert.AreEqual("South Park - S15E06 - City Sushi [HDTV]", result);
|
|
|
|
Assert.AreEqual("South Park - S15E06 - City Sushi [HDTV]", result);
|
|
|
@ -96,9 +93,6 @@ namespace NzbDrone.Core.Test
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
.Build();
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
var fakeMediaFileProvider = mocker.GetMock<MediaFileProvider>();
|
|
|
|
|
|
|
|
fakeMediaFileProvider.Setup(m => m.GetEpisodeFile(12345)).Returns(episodeFile);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episode });
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episode });
|
|
|
|
|
|
|
|
|
|
|
@ -106,7 +100,7 @@ namespace NzbDrone.Core.Test
|
|
|
|
fakeSeriesProvider.Setup(m => m.GetSeries(series.SeriesId)).Returns(series);
|
|
|
|
fakeSeriesProvider.Setup(m => m.GetSeries(series.SeriesId)).Returns(series);
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(12345);
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile);
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
//Assert
|
|
|
|
Assert.AreEqual("15x06 - City Sushi [HDTV]", result);
|
|
|
|
Assert.AreEqual("15x06 - City Sushi [HDTV]", result);
|
|
|
@ -142,9 +136,6 @@ namespace NzbDrone.Core.Test
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
.Build();
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
var fakeMediaFileProvider = mocker.GetMock<MediaFileProvider>();
|
|
|
|
|
|
|
|
fakeMediaFileProvider.Setup(m => m.GetEpisodeFile(12345)).Returns(episodeFile);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episode });
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episode });
|
|
|
|
|
|
|
|
|
|
|
@ -152,7 +143,7 @@ namespace NzbDrone.Core.Test
|
|
|
|
fakeSeriesProvider.Setup(m => m.GetSeries(series.SeriesId)).Returns(series);
|
|
|
|
fakeSeriesProvider.Setup(m => m.GetSeries(series.SeriesId)).Returns(series);
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(12345);
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile);
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
//Assert
|
|
|
|
Assert.AreEqual("South Park 05x06 [HDTV]", result);
|
|
|
|
Assert.AreEqual("South Park 05x06 [HDTV]", result);
|
|
|
@ -188,9 +179,6 @@ namespace NzbDrone.Core.Test
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
.Build();
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
var fakeMediaFileProvider = mocker.GetMock<MediaFileProvider>();
|
|
|
|
|
|
|
|
fakeMediaFileProvider.Setup(m => m.GetEpisodeFile(12345)).Returns(episodeFile);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episode });
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episode });
|
|
|
|
|
|
|
|
|
|
|
@ -198,7 +186,7 @@ namespace NzbDrone.Core.Test
|
|
|
|
fakeSeriesProvider.Setup(m => m.GetSeries(series.SeriesId)).Returns(series);
|
|
|
|
fakeSeriesProvider.Setup(m => m.GetSeries(series.SeriesId)).Returns(series);
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(12345);
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile);
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
//Assert
|
|
|
|
Assert.AreEqual("South Park s05e06", result);
|
|
|
|
Assert.AreEqual("South Park s05e06", result);
|
|
|
@ -234,9 +222,6 @@ namespace NzbDrone.Core.Test
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
.Build();
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
var fakeMediaFileProvider = mocker.GetMock<MediaFileProvider>();
|
|
|
|
|
|
|
|
fakeMediaFileProvider.Setup(m => m.GetEpisodeFile(12345)).Returns(episodeFile);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episode });
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episode });
|
|
|
|
|
|
|
|
|
|
|
@ -244,7 +229,7 @@ namespace NzbDrone.Core.Test
|
|
|
|
fakeSeriesProvider.Setup(m => m.GetSeries(series.SeriesId)).Returns(series);
|
|
|
|
fakeSeriesProvider.Setup(m => m.GetSeries(series.SeriesId)).Returns(series);
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(12345);
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile);
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
//Assert
|
|
|
|
Assert.AreEqual("South.Park.s05e06.City.Sushi", result);
|
|
|
|
Assert.AreEqual("South.Park.s05e06.City.Sushi", result);
|
|
|
@ -280,9 +265,6 @@ namespace NzbDrone.Core.Test
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
.Build();
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
var fakeMediaFileProvider = mocker.GetMock<MediaFileProvider>();
|
|
|
|
|
|
|
|
fakeMediaFileProvider.Setup(m => m.GetEpisodeFile(12345)).Returns(episodeFile);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episode });
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episode });
|
|
|
|
|
|
|
|
|
|
|
@ -290,10 +272,365 @@ namespace NzbDrone.Core.Test
|
|
|
|
fakeSeriesProvider.Setup(m => m.GetSeries(series.SeriesId)).Returns(series);
|
|
|
|
fakeSeriesProvider.Setup(m => m.GetSeries(series.SeriesId)).Returns(series);
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
//Act
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(12345);
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile);
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
//Assert
|
|
|
|
Assert.AreEqual("South.Park.-.s05e06.-.City.Sushi.[HDTV]", result);
|
|
|
|
Assert.AreEqual("South.Park.-.s05e06.-.City.Sushi.[HDTV]", result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void GetNewFilename_S01E05_Dash()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = mocker.GetMock<ConfigProvider>();
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SeriesName).Returns(false);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.EpisodeName).Returns(false);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.AppendQuality).Returns(false);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(0);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.NumberStyle).Returns(2);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var series = Builder<Series>.CreateNew().With(s => s.Title = "South Park").Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.EpisodeFileId = 12345)
|
|
|
|
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
|
|
|
|
.With(e => e.Quality = QualityTypes.HDTV)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.EpisodeFileId = episodeFile.EpisodeFileId)
|
|
|
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 15)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episode });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeSeriesProvider = mocker.GetMock<SeriesProvider>();
|
|
|
|
|
|
|
|
fakeSeriesProvider.Setup(m => m.GetSeries(series.SeriesId)).Returns(series);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
|
|
|
Assert.AreEqual("S15E06", result);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void GetNewFilename_multi_Series_Episode_Quality_S01E05_Scene_Dash()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = mocker.GetMock<ConfigProvider>();
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SeriesName).Returns(true);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.EpisodeName).Returns(true);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.AppendQuality).Returns(true);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(0);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.NumberStyle).Returns(2);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(3);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var series = Builder<Series>.CreateNew().With(s => s.Title = "The Mentalist").Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.EpisodeFileId = 12345)
|
|
|
|
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
|
|
|
|
.With(e => e.Quality = QualityTypes.HDTV)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.EpisodeFileId = episodeFile.EpisodeFileId)
|
|
|
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 23)
|
|
|
|
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeTwo = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.EpisodeFileId = episodeFile.EpisodeFileId)
|
|
|
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (2)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 24)
|
|
|
|
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episodeOne, episodeTwo });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeSeriesProvider = mocker.GetMock<SeriesProvider>();
|
|
|
|
|
|
|
|
fakeSeriesProvider.Setup(m => m.GetSeries(series.SeriesId)).Returns(series);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
|
|
|
Assert.AreEqual("The Mentalist - S03E23-E24 - Strawberries and Cream (1) + Strawberries and Cream (2) [HDTV]", result);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void GetNewFilename_multi_Episode_Quality_1x05_Repeat_Dash()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = mocker.GetMock<ConfigProvider>();
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SeriesName).Returns(false);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.EpisodeName).Returns(true);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.AppendQuality).Returns(true);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(0);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.NumberStyle).Returns(0);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var series = Builder<Series>.CreateNew().With(s => s.Title = "The Mentalist").Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.EpisodeFileId = 12345)
|
|
|
|
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
|
|
|
|
.With(e => e.Quality = QualityTypes.HDTV)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.EpisodeFileId = episodeFile.EpisodeFileId)
|
|
|
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 23)
|
|
|
|
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeTwo = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.EpisodeFileId = episodeFile.EpisodeFileId)
|
|
|
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (2)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 24)
|
|
|
|
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episodeOne, episodeTwo });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeSeriesProvider = mocker.GetMock<SeriesProvider>();
|
|
|
|
|
|
|
|
fakeSeriesProvider.Setup(m => m.GetSeries(series.SeriesId)).Returns(series);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
|
|
|
Assert.AreEqual("3x23x24 - Strawberries and Cream (1) + Strawberries and Cream (2) [HDTV]", result);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void GetNewFilename_multi_Episode_Quality_01x05_Repeat_Space()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = mocker.GetMock<ConfigProvider>();
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SeriesName).Returns(false);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.EpisodeName).Returns(true);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.AppendQuality).Returns(true);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(1);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.NumberStyle).Returns(0);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var series = Builder<Series>.CreateNew().With(s => s.Title = "The Mentalist").Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.EpisodeFileId = 12345)
|
|
|
|
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
|
|
|
|
.With(e => e.Quality = QualityTypes.HDTV)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.EpisodeFileId = episodeFile.EpisodeFileId)
|
|
|
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 23)
|
|
|
|
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeTwo = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.EpisodeFileId = episodeFile.EpisodeFileId)
|
|
|
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (2)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 24)
|
|
|
|
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episodeOne, episodeTwo });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeSeriesProvider = mocker.GetMock<SeriesProvider>();
|
|
|
|
|
|
|
|
fakeSeriesProvider.Setup(m => m.GetSeries(series.SeriesId)).Returns(series);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
|
|
|
Assert.AreEqual("3x23x24 Strawberries and Cream (1) + Strawberries and Cream (2) [HDTV]", result);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void GetNewFilename_multi_Series_Episode_s01e05_Duplicate_Period()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = mocker.GetMock<ConfigProvider>();
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SeriesName).Returns(true);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.EpisodeName).Returns(true);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.AppendQuality).Returns(false);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(1);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.NumberStyle).Returns(3);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(true);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var series = Builder<Series>.CreateNew().With(s => s.Title = "The Mentalist").Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.EpisodeFileId = 12345)
|
|
|
|
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
|
|
|
|
.With(e => e.Quality = QualityTypes.HDTV)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.EpisodeFileId = episodeFile.EpisodeFileId)
|
|
|
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 23)
|
|
|
|
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeTwo = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.EpisodeFileId = episodeFile.EpisodeFileId)
|
|
|
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (2)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 24)
|
|
|
|
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episodeOne, episodeTwo });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeSeriesProvider = mocker.GetMock<SeriesProvider>();
|
|
|
|
|
|
|
|
fakeSeriesProvider.Setup(m => m.GetSeries(series.SeriesId)).Returns(series);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
|
|
|
Assert.AreEqual("The.Mentalist.s03e23.s03e24.Strawberries.and.Cream.(1).+.Strawberries.and.Cream.(2)", result);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void GetNewFilename_multi_Series_S01E05_Extend_Dash_Period()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = mocker.GetMock<ConfigProvider>();
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SeriesName).Returns(true);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.EpisodeName).Returns(false);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.AppendQuality).Returns(false);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(0);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.NumberStyle).Returns(2);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(true);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var series = Builder<Series>.CreateNew().With(s => s.Title = "The Mentalist").Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.EpisodeFileId = 12345)
|
|
|
|
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
|
|
|
|
.With(e => e.Quality = QualityTypes.HDTV)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.EpisodeFileId = episodeFile.EpisodeFileId)
|
|
|
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 23)
|
|
|
|
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeTwo = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.EpisodeFileId = episodeFile.EpisodeFileId)
|
|
|
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (2)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 24)
|
|
|
|
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episodeOne, episodeTwo });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeSeriesProvider = mocker.GetMock<SeriesProvider>();
|
|
|
|
|
|
|
|
fakeSeriesProvider.Setup(m => m.GetSeries(series.SeriesId)).Returns(series);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
|
|
|
Assert.AreEqual("The.Mentalist.-.S03E23-24", result);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
|
|
|
public void GetNewFilename_multi_1x05_Repeat_Dash_Period()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
var mocker = new AutoMoqer();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = mocker.GetMock<ConfigProvider>();
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SeriesName).Returns(false);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.EpisodeName).Returns(false);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.AppendQuality).Returns(false);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.SeparatorStyle).Returns(0);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.NumberStyle).Returns(0);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(true);
|
|
|
|
|
|
|
|
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var series = Builder<Series>.CreateNew().With(s => s.Title = "The Mentalist").Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.EpisodeFileId = 12345)
|
|
|
|
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
|
|
|
|
.With(e => e.Quality = QualityTypes.HDTV)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.EpisodeFileId = episodeFile.EpisodeFileId)
|
|
|
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 23)
|
|
|
|
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeTwo = Builder<Episode>.CreateNew()
|
|
|
|
|
|
|
|
.With(e => e.EpisodeFileId = episodeFile.EpisodeFileId)
|
|
|
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (2)")
|
|
|
|
|
|
|
|
.With(e => e.SeasonNumber = 3)
|
|
|
|
|
|
|
|
.With(e => e.EpisodeNumber = 24)
|
|
|
|
|
|
|
|
.With(e => e.SeriesId = series.SeriesId)
|
|
|
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episodeOne, episodeTwo });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeSeriesProvider = mocker.GetMock<SeriesProvider>();
|
|
|
|
|
|
|
|
fakeSeriesProvider.Setup(m => m.GetSeries(series.SeriesId)).Returns(series);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
|
|
|
Assert.AreEqual("3x23x24", result);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|