|
|
|
@ -3,6 +3,7 @@
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
|
using FluentAssertions;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using NzbDrone.Core.Providers;
|
|
|
|
|
using NzbDrone.Core.Providers.Core;
|
|
|
|
@ -38,7 +39,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV);
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("South Park - S15E06 - City Sushi [HDTV]", result);
|
|
|
|
@ -65,7 +66,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV);
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("15x06 - City Sushi [HDTV]", result);
|
|
|
|
@ -92,7 +93,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV);
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("South Park 05x06 [HDTV]", result);
|
|
|
|
@ -120,7 +121,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV);
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("South Park s05e06", result);
|
|
|
|
@ -147,7 +148,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV);
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("South.Park.s05e06.City.Sushi", result);
|
|
|
|
@ -174,7 +175,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV);
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("South.Park.-.s05e06.-.City.Sushi.[HDTV]", result);
|
|
|
|
@ -202,7 +203,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV);
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("S15E06", result);
|
|
|
|
@ -236,7 +237,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV);
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV, false);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("The Mentalist - S03E23-E24 - Strawberries and Cream (1) + Strawberries and Cream (2) [HDTV]", result);
|
|
|
|
@ -270,7 +271,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV);
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV, false);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("3x23x24 - Strawberries and Cream (1) + Strawberries and Cream (2) [HDTV]", result);
|
|
|
|
@ -304,7 +305,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV);
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV, false);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("3x23x24 Strawberries and Cream (1) + Strawberries and Cream (2) [HDTV]", result);
|
|
|
|
@ -338,7 +339,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV);
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV, false);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("The.Mentalist.s03e23.s03e24.Strawberries.and.Cream.(1).+.Strawberries.and.Cream.(2)", result);
|
|
|
|
@ -372,7 +373,7 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV);
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV, false);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("The.Mentalist.-.S03E23-24", result);
|
|
|
|
@ -406,10 +407,85 @@ namespace NzbDrone.Core.Test.ProviderTests.MediaFileProviderTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV);
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, "The Mentalist", QualityTypes.HDTV, false);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("3x23x24", result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[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
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, true);
|
|
|
|
|
|
|
|
|
|
//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
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, false);
|
|
|
|
|
|
|
|
|
|
//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
|
|
|
|
|
string result = Mocker.Resolve<MediaFileProvider>().GetNewFilename(new List<Episode> { episode }, "South Park", QualityTypes.HDTV, true);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
result.Should().Be("South Park - S15E06 - City Sushi");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|