|
|
|
@ -18,7 +18,7 @@ namespace NzbDrone.Core.Test
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
// ReSharper disable InconsistentNaming
|
|
|
|
|
public class RenameProviderTest : TestBase
|
|
|
|
|
public class MediaFileProvider_GetNewFilenameTest : TestBase
|
|
|
|
|
{
|
|
|
|
|
[Test]
|
|
|
|
|
public void GetNewFilename_Series_Episode_Quality_S01E05_Dash()
|
|
|
|
@ -34,23 +34,14 @@ namespace NzbDrone.Core.Test
|
|
|
|
|
fakeConfig.SetupGet(c => c.NumberStyle).Returns(2);
|
|
|
|
|
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false);
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
.With(e => e.EpisodeFileId = 12345)
|
|
|
|
|
.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)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> {episode});
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile, "South Park");
|
|
|
|
|
string result = mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("South Park - S15E06 - City Sushi [HDTV]", result);
|
|
|
|
@ -70,23 +61,14 @@ namespace NzbDrone.Core.Test
|
|
|
|
|
fakeConfig.SetupGet(c => c.NumberStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false);
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
.With(e => e.EpisodeFileId = 12345)
|
|
|
|
|
.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)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episode });
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile, "South Park");
|
|
|
|
|
string result = mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("15x06 - City Sushi [HDTV]", result);
|
|
|
|
@ -106,23 +88,14 @@ namespace NzbDrone.Core.Test
|
|
|
|
|
fakeConfig.SetupGet(c => c.NumberStyle).Returns(1);
|
|
|
|
|
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false);
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
.With(e => e.EpisodeFileId = 12345)
|
|
|
|
|
.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 = 5)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episode });
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile, "South Park");
|
|
|
|
|
string result = mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("South Park 05x06 [HDTV]", result);
|
|
|
|
@ -142,23 +115,15 @@ namespace NzbDrone.Core.Test
|
|
|
|
|
fakeConfig.SetupGet(c => c.NumberStyle).Returns(3);
|
|
|
|
|
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false);
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
.With(e => e.EpisodeFileId = 12345)
|
|
|
|
|
.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 = 5)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episode });
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile, "South Park");
|
|
|
|
|
string result = mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("South Park s05e06", result);
|
|
|
|
@ -178,23 +143,14 @@ namespace NzbDrone.Core.Test
|
|
|
|
|
fakeConfig.SetupGet(c => c.NumberStyle).Returns(3);
|
|
|
|
|
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(true);
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
.With(e => e.EpisodeFileId = 12345)
|
|
|
|
|
.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 = 5)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episode });
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile, "South Park");
|
|
|
|
|
string result = mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("South.Park.s05e06.City.Sushi", result);
|
|
|
|
@ -214,25 +170,14 @@ namespace NzbDrone.Core.Test
|
|
|
|
|
fakeConfig.SetupGet(c => c.NumberStyle).Returns(3);
|
|
|
|
|
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(true);
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
.With(e => e.EpisodeFileId = 12345)
|
|
|
|
|
.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 = 5)
|
|
|
|
|
.With(e => e.EpisodeNumber = 6)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episode });
|
|
|
|
|
|
|
|
|
|
var fakeSeriesProvider = mocker.GetMock<SeriesProvider>();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile, "South Park");
|
|
|
|
|
string result = mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("South.Park.-.s05e06.-.City.Sushi.[HDTV]", result);
|
|
|
|
@ -252,23 +197,15 @@ namespace NzbDrone.Core.Test
|
|
|
|
|
fakeConfig.SetupGet(c => c.NumberStyle).Returns(2);
|
|
|
|
|
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false);
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
.With(e => e.EpisodeFileId = 12345)
|
|
|
|
|
.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)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episode });
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile, "South Park");
|
|
|
|
|
string result = mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("S15E06", result);
|
|
|
|
@ -289,30 +226,20 @@ namespace NzbDrone.Core.Test
|
|
|
|
|
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(3);
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
.With(e => e.EpisodeFileId = 12345)
|
|
|
|
|
.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)
|
|
|
|
|
.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)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episodeOne, episodeTwo });
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile, "The Mentalist");
|
|
|
|
|
string result = mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("The Mentalist - S03E23-E24 - Strawberries and Cream (1) + Strawberries and Cream (2) [HDTV]", result);
|
|
|
|
@ -333,30 +260,20 @@ namespace NzbDrone.Core.Test
|
|
|
|
|
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(2);
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
.With(e => e.EpisodeFileId = 12345)
|
|
|
|
|
.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)
|
|
|
|
|
.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)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episodeOne, episodeTwo });
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile, "The Mentalist");
|
|
|
|
|
string result = mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("3x23x24 - Strawberries and Cream (1) + Strawberries and Cream (2) [HDTV]", result);
|
|
|
|
@ -377,30 +294,20 @@ namespace NzbDrone.Core.Test
|
|
|
|
|
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(2);
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
.With(e => e.EpisodeFileId = 12345)
|
|
|
|
|
.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)
|
|
|
|
|
.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)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episodeOne, episodeTwo });
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile, "The Mentalist");
|
|
|
|
|
string result = mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("3x23x24 Strawberries and Cream (1) + Strawberries and Cream (2) [HDTV]", result);
|
|
|
|
@ -421,30 +328,20 @@ namespace NzbDrone.Core.Test
|
|
|
|
|
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(1);
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
.With(e => e.EpisodeFileId = 12345)
|
|
|
|
|
.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)
|
|
|
|
|
.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)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episodeOne, episodeTwo });
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile, "The Mentalist");
|
|
|
|
|
string result = mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("The.Mentalist.s03e23.s03e24.Strawberries.and.Cream.(1).+.Strawberries.and.Cream.(2)", result);
|
|
|
|
@ -465,31 +362,20 @@ namespace NzbDrone.Core.Test
|
|
|
|
|
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
.With(e => e.EpisodeFileId = 12345)
|
|
|
|
|
.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)
|
|
|
|
|
.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)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episodeOne, episodeTwo });
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile, "The Mentalist");
|
|
|
|
|
string result = mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("The.Mentalist.-.S03E23-24", result);
|
|
|
|
@ -510,30 +396,20 @@ namespace NzbDrone.Core.Test
|
|
|
|
|
fakeConfig.SetupGet(c => c.ReplaceSpaces).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.MultiEpisodeStyle).Returns(2);
|
|
|
|
|
|
|
|
|
|
var episodeFile = Builder<EpisodeFile>.CreateNew()
|
|
|
|
|
.With(e => e.EpisodeFileId = 12345)
|
|
|
|
|
.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)
|
|
|
|
|
.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)
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var fakeEpisodeProvider = mocker.GetMock<EpisodeProvider>();
|
|
|
|
|
fakeEpisodeProvider.Setup(m => m.EpisodesByFileId(12345)).Returns(new List<Episode> { episodeOne, episodeTwo });
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = mocker.Resolve<RenameProvider>().GetNewFilename(episodeFile, "The Mentalist");
|
|
|
|
|
string result = mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("3x23x24", result);
|