|
|
|
@ -1,26 +1,28 @@
|
|
|
|
|
// ReSharper disable RedundantUsingDirective
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
|
using FluentAssertions;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using NzbDrone.Core.Configuration;
|
|
|
|
|
using NzbDrone.Core.Datastore;
|
|
|
|
|
using NzbDrone.Core.MediaFiles;
|
|
|
|
|
using NzbDrone.Core.Organizer;
|
|
|
|
|
using NzbDrone.Core.Qualities;
|
|
|
|
|
using NzbDrone.Core.Tv;
|
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
namespace NzbDrone.Core.Test.OrganizerTests
|
|
|
|
|
{
|
|
|
|
|
[TestFixture]
|
|
|
|
|
// ReSharper disable InconsistentNaming
|
|
|
|
|
public class MediaFileProvider_GetNewFilenameTest : CoreTest
|
|
|
|
|
public class MediaFileProvider_GetNewFilenameTest : CoreTest<FileNameBuilder>
|
|
|
|
|
{
|
|
|
|
|
private Series _series;
|
|
|
|
|
|
|
|
|
|
private NameSpecification nameSpecification;
|
|
|
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
|
public void Setup()
|
|
|
|
|
{
|
|
|
|
@ -28,6 +30,15 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.CreateNew()
|
|
|
|
|
.With(s => s.Title = "South Park")
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nameSpecification = new NameSpecification();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<IBasicRepository<NameSpecification>>()
|
|
|
|
|
.Setup(c => c.SingleOrDefault()).Returns(nameSpecification);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
@ -36,13 +47,13 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = true;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = true;
|
|
|
|
|
nameSpecification.SortingAppendQuality = true;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 0;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 2;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
@ -51,7 +62,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("South Park - S15E06 - City Sushi [HDTV-720p]", result);
|
|
|
|
@ -63,13 +74,13 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
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(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = false;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = true;
|
|
|
|
|
nameSpecification.SortingAppendQuality = true;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 0;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 0;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
@ -78,7 +89,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("15x06 - City Sushi [HDTV-720p]", result);
|
|
|
|
@ -90,13 +101,13 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(false);
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = true;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = false;
|
|
|
|
|
nameSpecification.SortingAppendQuality = true;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 1;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 1;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
@ -105,7 +116,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("South Park 05x06 [HDTV-720p]", result);
|
|
|
|
@ -117,13 +128,13 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(false);
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = true;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = false;
|
|
|
|
|
nameSpecification.SortingAppendQuality = false;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 1;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 3;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
@ -133,7 +144,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("South Park s05e06", result);
|
|
|
|
@ -145,13 +156,13 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
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(1);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(3);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(true);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = true;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = true;
|
|
|
|
|
nameSpecification.SortingAppendQuality = false;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 1;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 3;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = true;
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
@ -160,7 +171,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("South.Park.s05e06.City.Sushi", result);
|
|
|
|
@ -172,13 +183,13 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
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(3);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(true);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = true;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = true;
|
|
|
|
|
nameSpecification.SortingAppendQuality = true;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 0;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 3;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = true;
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
@ -187,7 +198,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("South.Park.-.s05e06.-.City.Sushi.[HDTV-720p]", result);
|
|
|
|
@ -199,13 +210,13 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(false);
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = false;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = false;
|
|
|
|
|
nameSpecification.SortingAppendQuality = false;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 0;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 2;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
@ -215,7 +226,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("S15E06", result);
|
|
|
|
@ -227,14 +238,14 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
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);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(3);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = true;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = true;
|
|
|
|
|
nameSpecification.SortingAppendQuality = true;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 0;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 2;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = false;
|
|
|
|
|
nameSpecification.SortingMultiEpisodeStyle = 3;
|
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
@ -249,7 +260,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("The Mentalist - S03E23-E24 - Strawberries and Cream [HDTV-720p]", result);
|
|
|
|
@ -261,14 +272,14 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
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(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(2);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = false;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = true;
|
|
|
|
|
nameSpecification.SortingAppendQuality = true;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 0;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 0;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = false;
|
|
|
|
|
nameSpecification.SortingMultiEpisodeStyle = 2;
|
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
@ -283,7 +294,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("3x23x24 - Strawberries and Cream [HDTV-720p]", result);
|
|
|
|
@ -295,14 +306,14 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
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(1);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(0);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(2);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = false;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = true;
|
|
|
|
|
nameSpecification.SortingAppendQuality = true;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 1;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 0;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = false;
|
|
|
|
|
nameSpecification.SortingMultiEpisodeStyle = 2;
|
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
@ -317,7 +328,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("3x23x24 Strawberries and Cream [HDTV-720p]", result);
|
|
|
|
@ -329,14 +340,14 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
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(1);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingNumberStyle).Returns(3);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingReplaceSpaces).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingMultiEpisodeStyle).Returns(1);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = true;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = true;
|
|
|
|
|
nameSpecification.SortingAppendQuality = false;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 1;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 3;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = true;
|
|
|
|
|
nameSpecification.SortingMultiEpisodeStyle = 1;
|
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
@ -351,7 +362,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("The.Mentalist.s03e23.s03e24.Strawberries.and.Cream", result);
|
|
|
|
@ -363,14 +374,14 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(false);
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = true;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = false;
|
|
|
|
|
nameSpecification.SortingAppendQuality = false;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 0;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 2;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = true;
|
|
|
|
|
nameSpecification.SortingMultiEpisodeStyle = 0;
|
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
@ -385,7 +396,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("The.Mentalist.-.S03E23-24", result);
|
|
|
|
@ -397,14 +408,14 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(false);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(false);
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = false;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = false;
|
|
|
|
|
nameSpecification.SortingAppendQuality = false;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 0;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 0;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = true;
|
|
|
|
|
nameSpecification.SortingMultiEpisodeStyle = 2;
|
|
|
|
|
|
|
|
|
|
var episodeOne = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Strawberries and Cream (1)")
|
|
|
|
@ -419,7 +430,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("3x23x24", result);
|
|
|
|
@ -429,13 +440,13 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
public void GetNewFilename_should_append_proper_when_proper_and_append_quality_is_true()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = true;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = true;
|
|
|
|
|
nameSpecification.SortingAppendQuality = true;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 0;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 2;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
@ -444,7 +455,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, true, new EpisodeFile());
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, true, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p] [Proper]");
|
|
|
|
@ -454,13 +465,13 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
public void GetNewFilename_should_not_append_proper_when_not_proper_and_append_quality_is_true()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = true;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = true;
|
|
|
|
|
nameSpecification.SortingAppendQuality = true;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 0;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 2;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
@ -469,7 +480,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p]");
|
|
|
|
@ -479,13 +490,13 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
public void GetNewFilename_should_not_append_proper_when_proper_and_append_quality_is_false()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = true;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = true;
|
|
|
|
|
nameSpecification.SortingAppendQuality = false;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 0;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 2;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
@ -494,7 +505,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, true, new EpisodeFile());
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, true, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
result.Should().Be("South Park - S15E06 - City Sushi");
|
|
|
|
@ -504,14 +515,14 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
public void GetNewFilename_should_order_multiple_episode_files_in_numerical_order()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = true;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = true;
|
|
|
|
|
nameSpecification.SortingAppendQuality = false;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 0;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 2;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = false;
|
|
|
|
|
nameSpecification.SortingMultiEpisodeStyle = 3;
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Hey, Baby, What's Wrong? (1)")
|
|
|
|
@ -526,7 +537,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!");
|
|
|
|
@ -538,13 +549,13 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = true;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = true;
|
|
|
|
|
nameSpecification.SortingAppendQuality = true;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 2;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 2;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
@ -553,7 +564,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("South Park.S15E06.City Sushi [HDTV-720p]", result);
|
|
|
|
@ -565,13 +576,13 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
//Setup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = false;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = true;
|
|
|
|
|
nameSpecification.SortingAppendQuality = true;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 2;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 0;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
@ -580,7 +591,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
Assert.AreEqual("15x06.City Sushi [HDTV-720p]", result);
|
|
|
|
@ -590,14 +601,14 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
public void GetNewFilename_UseSceneName_when_sceneName_isNull()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = false;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = true;
|
|
|
|
|
nameSpecification.SortingAppendQuality = true;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 2;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 0;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = false;
|
|
|
|
|
nameSpecification.SortingUseSceneName = true;
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
@ -611,7 +622,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, episodeFile);
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, episodeFile);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
result.Should().Be(Path.GetFileNameWithoutExtension(episodeFile.Path));
|
|
|
|
@ -621,14 +632,14 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
public void GetNewFilename_UseSceneName_when_sceneName_isNotNull()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = false;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = true;
|
|
|
|
|
nameSpecification.SortingAppendQuality = true;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 2;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 0;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = false;
|
|
|
|
|
nameSpecification.SortingUseSceneName = true;
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "City Sushi")
|
|
|
|
@ -642,7 +653,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, episodeFile);
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episode }, _series, Quality.HDTV720p, false, episodeFile);
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
result.Should().Be(episodeFile.SceneName);
|
|
|
|
@ -652,14 +663,14 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
public void should_only_have_one_episodeTitle_when_episode_titles_are_the_same()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = true;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = true;
|
|
|
|
|
nameSpecification.SortingAppendQuality = false;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 0;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 2;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = false;
|
|
|
|
|
nameSpecification.SortingMultiEpisodeStyle = 3;
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Hey, Baby, What's Wrong? (1)")
|
|
|
|
@ -674,7 +685,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!");
|
|
|
|
@ -684,14 +695,14 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
public void should_have_two_episodeTitles_when_episode_titles_are_not_the_same()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = true;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = true;
|
|
|
|
|
nameSpecification.SortingAppendQuality = false;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 0;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 2;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = false;
|
|
|
|
|
nameSpecification.SortingMultiEpisodeStyle = 3;
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Hello")
|
|
|
|
@ -706,7 +717,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
result.Should().Be("30 Rock - S06E06-E07 - Hello + World");
|
|
|
|
@ -716,14 +727,14 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
public void should_have_two_episodeTitles_when_distinct_count_is_two()
|
|
|
|
|
{
|
|
|
|
|
//Setup
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = true;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = true;
|
|
|
|
|
nameSpecification.SortingAppendQuality = false;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 0;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 2;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = false;
|
|
|
|
|
nameSpecification.SortingMultiEpisodeStyle = 3;
|
|
|
|
|
|
|
|
|
|
var episode = Builder<Episode>.CreateNew()
|
|
|
|
|
.With(e => e.Title = "Hello (3)")
|
|
|
|
@ -744,7 +755,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
//Act
|
|
|
|
|
string result = Mocker.Resolve<IMediaFileService>().GetNewFilename(new List<Episode> { episode, episode2, episode3 }, new Series { Title = "30 Rock" }, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
string result = Subject.GetNewFilename(new List<Episode> { episode, episode2, episode3 }, new Series { Title = "30 Rock" }, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
|
|
|
|
|
//Assert
|
|
|
|
|
result.Should().Be("30 Rock - S06E06-E07-E08 - Hello + World");
|
|
|
|
@ -753,13 +764,13 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_use_airDate_if_series_isDaily()
|
|
|
|
|
{
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = true;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = true;
|
|
|
|
|
nameSpecification.SortingAppendQuality = true;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 0;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 2;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
var series = Builder<Series>
|
|
|
|
|
.CreateNew()
|
|
|
|
@ -774,7 +785,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.With(e => e.Title = "Kristen Stewart")
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var result = Mocker.Resolve<IMediaFileService>()
|
|
|
|
|
var result = Subject
|
|
|
|
|
.GetNewFilename(episodes, series, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
result.Should().Be("The Daily Show with Jon Stewart - 2012-12-13 - Kristen Stewart [HDTV-720p]");
|
|
|
|
|
}
|
|
|
|
@ -782,13 +793,13 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_use_airDate_if_series_isDaily_no_episode_title()
|
|
|
|
|
{
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeSeriesName).Returns(true);
|
|
|
|
|
fakeConfig.SetupGet(c => c.SortingIncludeEpisodeTitle).Returns(false);
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = true;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = false;
|
|
|
|
|
nameSpecification.SortingAppendQuality = false;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 0;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 2;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
var series = Builder<Series>
|
|
|
|
|
.CreateNew()
|
|
|
|
@ -803,7 +814,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.With(e => e.Title = "Kristen Stewart")
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var result = Mocker.Resolve<IMediaFileService>()
|
|
|
|
|
var result = Subject
|
|
|
|
|
.GetNewFilename(episodes, series, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
result.Should().Be("The Daily Show with Jon Stewart - 2012-12-13");
|
|
|
|
|
}
|
|
|
|
@ -811,13 +822,13 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_set_airdate_to_unknown_if_not_available()
|
|
|
|
|
{
|
|
|
|
|
var fakeConfig = Mocker.GetMock<IConfigService>();
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
nameSpecification.SortingIncludeSeriesName = true;
|
|
|
|
|
nameSpecification.SortingIncludeEpisodeTitle = true;
|
|
|
|
|
nameSpecification.SortingAppendQuality = false;
|
|
|
|
|
nameSpecification.SortingSeparatorStyle = 0;
|
|
|
|
|
nameSpecification.SortingNumberStyle = 2;
|
|
|
|
|
nameSpecification.SortingReplaceSpaces = false;
|
|
|
|
|
|
|
|
|
|
var series = Builder<Series>
|
|
|
|
|
.CreateNew()
|
|
|
|
@ -832,7 +843,7 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|
|
|
|
.With(e => e.Title = "Kristen Stewart")
|
|
|
|
|
.Build();
|
|
|
|
|
|
|
|
|
|
var result = Mocker.Resolve<IMediaFileService>()
|
|
|
|
|
var result = Subject
|
|
|
|
|
.GetNewFilename(episodes, series, Quality.HDTV720p, false, new EpisodeFile());
|
|
|
|
|
result.Should().Be("The Daily Show with Jon Stewart - Unknown - Kristen Stewart");
|
|
|
|
|
}
|