diff --git a/NzbDrone.Common.Test/NzbDrone.Common.Test.ncrunchproject b/NzbDrone.Common.Test/NzbDrone.Common.Test.ncrunchproject
index c2e8bc20c..a11e9b3c3 100644
--- a/NzbDrone.Common.Test/NzbDrone.Common.Test.ncrunchproject
+++ b/NzbDrone.Common.Test/NzbDrone.Common.Test.ncrunchproject
@@ -14,6 +14,7 @@
true
60000
+
AutoDetect
@@ -32,5 +33,8 @@
NzbDrone.Common.Test.ServiceProviderTests.Should_be_able_to_start_and_stop_service
+
+ .*
+
\ No newline at end of file
diff --git a/NzbDrone.Core.Test/JobTests/ImportNewSeriesJobTest.cs b/NzbDrone.Core.Test/JobTests/ImportNewSeriesJobTest.cs
index ee6c51bfe..b1844ff90 100644
--- a/NzbDrone.Core.Test/JobTests/ImportNewSeriesJobTest.cs
+++ b/NzbDrone.Core.Test/JobTests/ImportNewSeriesJobTest.cs
@@ -2,7 +2,7 @@
using System;
using System.Collections.Generic;
-
+using System.Linq;
using FizzWare.NBuilder;
using Moq;
using NUnit.Framework;
@@ -174,7 +174,7 @@ public void AutoIgnoreSeason_existing_should_not_ignore_currentseason()
Mocker.GetMock()
.Setup(p => p.GetFilesBySeries(seriesId))
- .Returns(episodesFiles);
+ .Returns(episodesFiles.ToList());
Mocker.GetMock()
.Setup(p => p.GetSeasonNumbers(seriesId))
@@ -200,7 +200,7 @@ public void AutoIgnoreSeason_existing_should_ignore_seasons_with_no_file()
Mocker.GetMock()
.Setup(p => p.GetFilesBySeries(seriesId))
- .Returns(episodesFiles);
+ .Returns(episodesFiles.ToList());
Mocker.GetMock()
.Setup(p => p.GetSeasonNumbers(seriesId))
diff --git a/NzbDrone.Core.Test/JobTests/RenameSeasonJobFixture.cs b/NzbDrone.Core.Test/JobTests/RenameSeasonJobFixture.cs
index 3a6b30e71..7133d4705 100644
--- a/NzbDrone.Core.Test/JobTests/RenameSeasonJobFixture.cs
+++ b/NzbDrone.Core.Test/JobTests/RenameSeasonJobFixture.cs
@@ -44,7 +44,7 @@ public void Setup()
Mocker.GetMock()
.Setup(s => s.GetFilesBySeason(_series.Id, 5))
- .Returns(_episodeFiles);
+ .Returns(_episodeFiles.ToList());
}
private void WithMovedFiles()
diff --git a/NzbDrone.Core.Test/MediaFileTests/MediaFileServiceTest.cs b/NzbDrone.Core.Test/MediaFileTests/MediaFileServiceTest.cs
index f73b08311..142a886a7 100644
--- a/NzbDrone.Core.Test/MediaFileTests/MediaFileServiceTest.cs
+++ b/NzbDrone.Core.Test/MediaFileTests/MediaFileServiceTest.cs
@@ -4,6 +4,7 @@
using NUnit.Framework;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.MediaFiles;
+using NzbDrone.Core.Organizer;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Test.Framework;
@@ -17,7 +18,7 @@ public class MediaFileServiceTest : CoreTest
[TestCase("Law & Order: Criminal Intent - S10E07 - Icarus [HDTV-720p]", "Law & Order- Criminal Intent - S10E07 - Icarus [HDTV-720p]")]
public void CleanFileName(string name, string expectedName)
{
- MediaFileService.CleanFilename(name).Should().Be(expectedName);
+ FileNameBuilder.CleanFilename(name).Should().Be(expectedName);
}
[Test]
diff --git a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj
index 8b3da67f1..3ec096119 100644
--- a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj
+++ b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj
@@ -222,7 +222,7 @@
-
+
diff --git a/NzbDrone.Core.Test/MediaFileTests/GetNewFilenameFixture.cs b/NzbDrone.Core.Test/OrganizerTests/GetNewFilenameFixture.cs
similarity index 50%
rename from NzbDrone.Core.Test/MediaFileTests/GetNewFilenameFixture.cs
rename to NzbDrone.Core.Test/OrganizerTests/GetNewFilenameFixture.cs
index 5b774a25b..55b59dfca 100644
--- a/NzbDrone.Core.Test/MediaFileTests/GetNewFilenameFixture.cs
+++ b/NzbDrone.Core.Test/OrganizerTests/GetNewFilenameFixture.cs
@@ -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
{
private Series _series;
+ private NameSpecification nameSpecification;
+
[SetUp]
public void Setup()
{
@@ -28,6 +30,15 @@ public void Setup()
.CreateNew()
.With(s => s.Title = "South Park")
.Build();
+
+
+ nameSpecification = new NameSpecification();
+
+
+ Mocker.GetMock>()
+ .Setup(c => c.SingleOrDefault()).Returns(nameSpecification);
+
+
}
[Test]
@@ -36,13 +47,13 @@ public void GetNewFilename_Series_Episode_Quality_S01E05_Dash()
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
.With(e => e.Title = "City Sushi")
@@ -51,7 +62,7 @@ public void GetNewFilename_Series_Episode_Quality_S01E05_Dash()
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
+ string result = Subject.GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("South Park - S15E06 - City Sushi [HDTV-720p]", result);
@@ -63,13 +74,13 @@ public void GetNewFilename_Episode_Quality_1x05_Dash()
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
.With(e => e.Title = "City Sushi")
@@ -78,7 +89,7 @@ public void GetNewFilename_Episode_Quality_1x05_Dash()
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
+ string result = Subject.GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("15x06 - City Sushi [HDTV-720p]", result);
@@ -90,13 +101,13 @@ public void GetNewFilename_Series_Quality_01x05_Space()
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
.With(e => e.Title = "City Sushi")
@@ -105,7 +116,7 @@ public void GetNewFilename_Series_Quality_01x05_Space()
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
+ string result = Subject.GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("South Park 05x06 [HDTV-720p]", result);
@@ -117,13 +128,13 @@ public void GetNewFilename_Series_s01e05_Space()
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
@@ -133,7 +144,7 @@ public void GetNewFilename_Series_s01e05_Space()
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
+ string result = Subject.GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("South Park s05e06", result);
@@ -145,13 +156,13 @@ public void GetNewFilename_Series_Episode_s01e05_Periods()
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
.With(e => e.Title = "City Sushi")
@@ -160,7 +171,7 @@ public void GetNewFilename_Series_Episode_s01e05_Periods()
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
+ string result = Subject.GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("South.Park.s05e06.City.Sushi", result);
@@ -172,13 +183,13 @@ public void GetNewFilename_Series_Episode_s01e05_Dash_Periods_Quality()
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
.With(e => e.Title = "City Sushi")
@@ -187,7 +198,7 @@ public void GetNewFilename_Series_Episode_s01e05_Dash_Periods_Quality()
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
+ string result = Subject.GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("South.Park.-.s05e06.-.City.Sushi.[HDTV-720p]", result);
@@ -199,13 +210,13 @@ public void GetNewFilename_S01E05_Dash()
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
@@ -215,7 +226,7 @@ public void GetNewFilename_S01E05_Dash()
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
+ string result = Subject.GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("S15E06", result);
@@ -227,14 +238,14 @@ public void GetNewFilename_multi_Series_Episode_Quality_S01E05_Scene_Dash()
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
.With(e => e.Title = "Strawberries and Cream (1)")
@@ -249,7 +260,7 @@ public void GetNewFilename_multi_Series_Episode_Quality_S01E05_Scene_Dash()
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile());
+ string result = Subject.GetNewFilename(new List { 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 @@ public void GetNewFilename_multi_Episode_Quality_1x05_Repeat_Dash()
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
.With(e => e.Title = "Strawberries and Cream (1)")
@@ -283,7 +294,7 @@ public void GetNewFilename_multi_Episode_Quality_1x05_Repeat_Dash()
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile());
+ string result = Subject.GetNewFilename(new List { 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 @@ public void GetNewFilename_multi_Episode_Quality_01x05_Repeat_Space()
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
.With(e => e.Title = "Strawberries and Cream (1)")
@@ -317,7 +328,7 @@ public void GetNewFilename_multi_Episode_Quality_01x05_Repeat_Space()
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile());
+ string result = Subject.GetNewFilename(new List { 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 @@ public void GetNewFilename_multi_Series_Episode_s01e05_Duplicate_Period()
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
.With(e => e.Title = "Strawberries and Cream (1)")
@@ -351,7 +362,7 @@ public void GetNewFilename_multi_Series_Episode_s01e05_Duplicate_Period()
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile());
+ string result = Subject.GetNewFilename(new List { 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 @@ public void GetNewFilename_multi_Series_S01E05_Extend_Dash_Period()
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
.With(e => e.Title = "Strawberries and Cream (1)")
@@ -385,7 +396,7 @@ public void GetNewFilename_multi_Series_S01E05_Extend_Dash_Period()
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile());
+ string result = Subject.GetNewFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("The.Mentalist.-.S03E23-24", result);
@@ -397,14 +408,14 @@ public void GetNewFilename_multi_1x05_Repeat_Dash_Period()
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
.With(e => e.Title = "Strawberries and Cream (1)")
@@ -419,7 +430,7 @@ public void GetNewFilename_multi_1x05_Repeat_Dash_Period()
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile());
+ string result = Subject.GetNewFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, Quality.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("3x23x24", result);
@@ -429,13 +440,13 @@ public void GetNewFilename_multi_1x05_Repeat_Dash_Period()
public void GetNewFilename_should_append_proper_when_proper_and_append_quality_is_true()
{
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
.With(e => e.Title = "City Sushi")
@@ -444,7 +455,7 @@ public void GetNewFilename_should_append_proper_when_proper_and_append_quality_i
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, true, new EpisodeFile());
+ string result = Subject.GetNewFilename(new List { episode }, _series, Quality.HDTV720p, true, new EpisodeFile());
//Assert
result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p] [Proper]");
@@ -454,13 +465,13 @@ public void GetNewFilename_should_append_proper_when_proper_and_append_quality_i
public void GetNewFilename_should_not_append_proper_when_not_proper_and_append_quality_is_true()
{
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
.With(e => e.Title = "City Sushi")
@@ -469,7 +480,7 @@ public void GetNewFilename_should_not_append_proper_when_not_proper_and_append_q
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
+ string result = Subject.GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
//Assert
result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p]");
@@ -479,13 +490,13 @@ public void GetNewFilename_should_not_append_proper_when_not_proper_and_append_q
public void GetNewFilename_should_not_append_proper_when_proper_and_append_quality_is_false()
{
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
.With(e => e.Title = "City Sushi")
@@ -494,7 +505,7 @@ public void GetNewFilename_should_not_append_proper_when_proper_and_append_quali
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, true, new EpisodeFile());
+ string result = Subject.GetNewFilename(new List { episode }, _series, Quality.HDTV720p, true, new EpisodeFile());
//Assert
result.Should().Be("South Park - S15E06 - City Sushi");
@@ -504,14 +515,14 @@ public void GetNewFilename_should_not_append_proper_when_proper_and_append_quali
public void GetNewFilename_should_order_multiple_episode_files_in_numerical_order()
{
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
.With(e => e.Title = "Hey, Baby, What's Wrong? (1)")
@@ -526,7 +537,7 @@ public void GetNewFilename_should_order_multiple_episode_files_in_numerical_orde
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episode2, episode }, new Series { Title = "30 Rock" }, Quality.HDTV720p, false, new EpisodeFile());
+ string result = Subject.GetNewFilename(new List { 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 @@ public void GetNewFilename_Series_Episode_Quality_S01E05_Period()
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
.With(e => e.Title = "City Sushi")
@@ -553,7 +564,7 @@ public void GetNewFilename_Series_Episode_Quality_S01E05_Period()
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
+ string result = Subject.GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("South Park.S15E06.City Sushi [HDTV-720p]", result);
@@ -565,13 +576,13 @@ public void GetNewFilename_Episode_Quality_1x05_Period()
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
.With(e => e.Title = "City Sushi")
@@ -580,7 +591,7 @@ public void GetNewFilename_Episode_Quality_1x05_Period()
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
+ string result = Subject.GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, new EpisodeFile());
//Assert
Assert.AreEqual("15x06.City Sushi [HDTV-720p]", result);
@@ -590,14 +601,14 @@ public void GetNewFilename_Episode_Quality_1x05_Period()
public void GetNewFilename_UseSceneName_when_sceneName_isNull()
{
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
.With(e => e.Title = "City Sushi")
@@ -611,7 +622,7 @@ public void GetNewFilename_UseSceneName_when_sceneName_isNull()
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, episodeFile);
+ string result = Subject.GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, episodeFile);
//Assert
result.Should().Be(Path.GetFileNameWithoutExtension(episodeFile.Path));
@@ -621,14 +632,14 @@ public void GetNewFilename_UseSceneName_when_sceneName_isNull()
public void GetNewFilename_UseSceneName_when_sceneName_isNotNull()
{
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
.With(e => e.Title = "City Sushi")
@@ -642,7 +653,7 @@ public void GetNewFilename_UseSceneName_when_sceneName_isNotNull()
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, episodeFile);
+ string result = Subject.GetNewFilename(new List { episode }, _series, Quality.HDTV720p, false, episodeFile);
//Assert
result.Should().Be(episodeFile.SceneName);
@@ -652,14 +663,14 @@ public void GetNewFilename_UseSceneName_when_sceneName_isNotNull()
public void should_only_have_one_episodeTitle_when_episode_titles_are_the_same()
{
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
.With(e => e.Title = "Hey, Baby, What's Wrong? (1)")
@@ -674,7 +685,7 @@ public void should_only_have_one_episodeTitle_when_episode_titles_are_the_same()
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episode2, episode }, new Series { Title = "30 Rock" }, Quality.HDTV720p, false, new EpisodeFile());
+ string result = Subject.GetNewFilename(new List { 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 @@ public void should_only_have_one_episodeTitle_when_episode_titles_are_the_same()
public void should_have_two_episodeTitles_when_episode_titles_are_not_the_same()
{
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
.With(e => e.Title = "Hello")
@@ -706,7 +717,7 @@ public void should_have_two_episodeTitles_when_episode_titles_are_not_the_same()
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episode2, episode }, new Series { Title = "30 Rock" }, Quality.HDTV720p, false, new EpisodeFile());
+ string result = Subject.GetNewFilename(new List { 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 @@ public void should_have_two_episodeTitles_when_episode_titles_are_not_the_same()
public void should_have_two_episodeTitles_when_distinct_count_is_two()
{
//Setup
- var fakeConfig = Mocker.GetMock();
- 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.CreateNew()
.With(e => e.Title = "Hello (3)")
@@ -744,7 +755,7 @@ public void should_have_two_episodeTitles_when_distinct_count_is_two()
.Build();
//Act
- string result = Mocker.Resolve().GetNewFilename(new List { episode, episode2, episode3 }, new Series { Title = "30 Rock" }, Quality.HDTV720p, false, new EpisodeFile());
+ string result = Subject.GetNewFilename(new List { 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 @@ public void should_have_two_episodeTitles_when_distinct_count_is_two()
[Test]
public void should_use_airDate_if_series_isDaily()
{
- var fakeConfig = Mocker.GetMock();
- 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
.CreateNew()
@@ -774,7 +785,7 @@ public void should_use_airDate_if_series_isDaily()
.With(e => e.Title = "Kristen Stewart")
.Build();
- var result = Mocker.Resolve()
+ 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 @@ public void should_use_airDate_if_series_isDaily()
[Test]
public void should_use_airDate_if_series_isDaily_no_episode_title()
{
- var fakeConfig = Mocker.GetMock();
- 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
.CreateNew()
@@ -803,7 +814,7 @@ public void should_use_airDate_if_series_isDaily_no_episode_title()
.With(e => e.Title = "Kristen Stewart")
.Build();
- var result = Mocker.Resolve()
+ 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 @@ public void should_use_airDate_if_series_isDaily_no_episode_title()
[Test]
public void should_set_airdate_to_unknown_if_not_available()
{
- var fakeConfig = Mocker.GetMock();
- 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
.CreateNew()
@@ -832,7 +843,7 @@ public void should_set_airdate_to_unknown_if_not_available()
.With(e => e.Title = "Kristen Stewart")
.Build();
- var result = Mocker.Resolve()
+ var result = Subject
.GetNewFilename(episodes, series, Quality.HDTV720p, false, new EpisodeFile());
result.Should().Be("The Daily Show with Jon Stewart - Unknown - Kristen Stewart");
}
diff --git a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/CleanUpDropFolderFixture.cs b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/CleanUpDropFolderFixture.cs
index 65455ccb0..00b6db828 100644
--- a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/CleanUpDropFolderFixture.cs
+++ b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/CleanUpDropFolderFixture.cs
@@ -9,6 +9,7 @@
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Core.MediaFiles;
+using NzbDrone.Core.Organizer;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model;
@@ -106,10 +107,10 @@ public void should_move_file_if_a_conflict_is_found()
Mocker.GetMock().Setup(s => s.GetEpisodesByFileId(episodeFile.Id))
.Returns(episode);
- Mocker.GetMock().Setup(s => s.GetNewFilename(It.IsAny>(), series, Quality.Unknown, false, It.IsAny()))
+ Mocker.GetMock().Setup(s => s.GetNewFilename(It.IsAny>(), series, Quality.Unknown, false, It.IsAny()))
.Returns(newFilename);
- Mocker.GetMock().Setup(s => s.CalculateFilePath(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()))
+ Mocker.GetMock().Setup(s => s.CalculateFilePath(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny()))
.Returns(new FileInfo(newFilePath));
Mocker.GetMock()
diff --git a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/MoveEpisodeFileFixture.cs b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/MoveEpisodeFileFixture.cs
index 0c8169e21..13abeaa5e 100644
--- a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/MoveEpisodeFileFixture.cs
+++ b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/MoveEpisodeFileFixture.cs
@@ -11,6 +11,7 @@
using NzbDrone.Core.Download;
using NzbDrone.Core.ExternalNotification;
using NzbDrone.Core.MediaFiles;
+using NzbDrone.Core.Organizer;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Model;
@@ -56,11 +57,11 @@ public void should_not_move_file_if_source_and_destination_are_the_same_path()
.Setup(e => e.GetEpisodesByFileId(file.Id))
.Returns(fakeEpisode);
- Mocker.GetMock()
+ Mocker.GetMock()
.Setup(e => e.GetNewFilename(fakeEpisode, fakeSeries, It.IsAny(), It.IsAny(), It.IsAny()))
.Returns(filename);
- Mocker.GetMock()
+ Mocker.GetMock()
.Setup(e => e.CalculateFilePath(It.IsAny(), fakeEpisode.First().SeasonNumber, filename, ".avi"))
.Returns(fi);
@@ -106,11 +107,11 @@ public void should_use_EpisodeFiles_quality()
.Setup(e => e.GetEpisodesByFileId(file.Id))
.Returns(fakeEpisode);
- Mocker.GetMock()
+ Mocker.GetMock()
.Setup(e => e.GetNewFilename(fakeEpisode, fakeSeries, It.IsAny(), It.IsAny(), It.IsAny()))
.Returns(filename);
- Mocker.GetMock()
+ Mocker.GetMock()
.Setup(e => e.CalculateFilePath(It.IsAny(), fakeEpisode.First().SeasonNumber, filename, ".mkv"))
.Returns(fi);
@@ -158,11 +159,11 @@ public void should_log_error_and_return_null_when_source_file_does_not_exists()
.Setup(e => e.GetEpisodesByFileId(file.Id))
.Returns(fakeEpisode);
- Mocker.GetMock()
+ Mocker.GetMock()
.Setup(e => e.GetNewFilename(fakeEpisode, fakeSeries, It.IsAny(), It.IsAny(), It.IsAny()))
.Returns(filename);
- Mocker.GetMock()
+ Mocker.GetMock()
.Setup(e => e.CalculateFilePath(It.IsAny(), fakeEpisode.First().SeasonNumber, filename, ".mkv"))
.Returns(fi);
diff --git a/NzbDrone.Core.Test/ProviderTests/MisnamedProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/MisnamedProviderTest.cs
index 24debc39b..d7aceb666 100644
--- a/NzbDrone.Core.Test/ProviderTests/MisnamedProviderTest.cs
+++ b/NzbDrone.Core.Test/ProviderTests/MisnamedProviderTest.cs
@@ -5,6 +5,7 @@
using Moq;
using NUnit.Framework;
using NzbDrone.Core.MediaFiles;
+using NzbDrone.Core.Organizer;
using NzbDrone.Core.Qualities;
using NzbDrone.Core.Tv;
using NzbDrone.Core.Providers;
@@ -48,11 +49,11 @@ public void no_misnamed_files()
Mocker.GetMock()
.Setup(c => c.EpisodesWithFiles()).Returns(episodes);
- Mocker.GetMock()
+ Mocker.GetMock()
.Setup(c => c.GetNewFilename(new List { episodes[0] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[0]))
.Returns("Title1");
- Mocker.GetMock()
+ Mocker.GetMock()
.Setup(c => c.GetNewFilename(new List { episodes[1] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[1]))
.Returns("Title2");
@@ -95,11 +96,11 @@ public void all_misnamed_files()
Mocker.GetMock()
.Setup(c => c.EpisodesWithFiles()).Returns(episodes);
- Mocker.GetMock()
+ Mocker.GetMock()
.Setup(c => c.GetNewFilename(new List { episodes[0] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[0]))
.Returns("New Title 1");
- Mocker.GetMock()
+ Mocker.GetMock()
.Setup(c => c.GetNewFilename(new List { episodes[1] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[1]))
.Returns("New Title 2");
@@ -142,11 +143,11 @@ public void one_misnamed_file()
Mocker.GetMock()
.Setup(c => c.EpisodesWithFiles()).Returns(episodes);
- Mocker.GetMock()
+ Mocker.GetMock()
.Setup(c => c.GetNewFilename(new List { episodes[0] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[0]))
.Returns("New Title 1");
- Mocker.GetMock()
+ Mocker.GetMock()
.Setup(c => c.GetNewFilename(new List { episodes[1] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[1]))
.Returns("Title2");
@@ -191,11 +192,11 @@ public void misnamed_multi_episode_file()
Mocker.GetMock()
.Setup(c => c.EpisodesWithFiles()).Returns(episodes);
- Mocker.GetMock()
+ Mocker.GetMock()
.Setup(c => c.GetNewFilename(new List { episodes[0], episodes[1] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[0]))
.Returns("New Title 1");
- Mocker.GetMock()
+ Mocker.GetMock()
.Setup(c => c.GetNewFilename(new List { episodes[2] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[1]))
.Returns("Title2");
@@ -240,11 +241,11 @@ public void no_misnamed_multi_episode_file()
Mocker.GetMock()
.Setup(c => c.EpisodesWithFiles()).Returns(episodes);
- Mocker.GetMock()
+ Mocker.GetMock()
.Setup(c => c.GetNewFilename(new List { episodes[0], episodes[1] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[0]))
.Returns("Title1");
- Mocker.GetMock()
+ Mocker.GetMock()
.Setup(c => c.GetNewFilename(new List { episodes[2] }, It.IsAny(), It.IsAny(), It.IsAny(), episodeFiles[1]))
.Returns("Title2");
diff --git a/NzbDrone.Core/Configuration/ConfigService.cs b/NzbDrone.Core/Configuration/ConfigService.cs
index 1d1e578ef..e8470b657 100644
--- a/NzbDrone.Core/Configuration/ConfigService.cs
+++ b/NzbDrone.Core/Configuration/ConfigService.cs
@@ -149,29 +149,6 @@ public String DownloadClientTvDirectory
set { SetValue("DownloadClientTvDirectory", value); }
}
- public bool SortingIncludeSeriesName
- {
- get { return GetValueBoolean("Sorting_SeriesName", true); }
- set { SetValue("Sorting_SeriesName", value); }
- }
-
- public bool SortingIncludeEpisodeTitle
- {
- get { return GetValueBoolean("Sorting_EpisodeName", true); }
- set { SetValue("Sorting_EpisodeName", value); }
- }
-
- public bool SortingReplaceSpaces
- {
- get { return GetValueBoolean("Sorting_ReplaceSpaces"); }
- set { SetValue("Sorting_ReplaceSpaces", value); }
- }
-
- public bool SortingAppendQuality
- {
- get { return GetValueBoolean("Sorting_AppendQaulity", true); }
- set { SetValue("Sorting_AppendQaulity", value); }
- }
public bool UseSeasonFolder
{
@@ -186,30 +163,6 @@ public string SortingSeasonFolderFormat
set { SetValue("Sorting_SeasonFolderFormat", value); }
}
- public int SortingSeparatorStyle
- {
- get { return GetValueInt("Sorting_SeparatorStyle"); }
- set { SetValue("Sorting_SeparatorStyle", value); }
- }
-
- public int SortingNumberStyle
- {
- get { return GetValueInt("Sorting_NumberStyle", 2); }
- set { SetValue("Sorting_NumberStyle", value); }
- }
-
- public int SortingMultiEpisodeStyle
- {
- get { return GetValueInt("Sorting_MultiEpisodeStyle"); }
- set { SetValue("Sorting_MultiEpisodeStyle", value); }
- }
-
- public bool SortingUseSceneName
- {
- get { return GetValueBoolean("Sorting_UseSceneName", false); }
- set { SetValue("Sorting_UseSceneName", value); }
- }
-
public int DefaultQualityProfile
{
get { return GetValueInt("DefaultQualityProfile", 1); }
diff --git a/NzbDrone.Core/Configuration/IConfigService.cs b/NzbDrone.Core/Configuration/IConfigService.cs
index f8b3b8fc8..fb644569c 100644
--- a/NzbDrone.Core/Configuration/IConfigService.cs
+++ b/NzbDrone.Core/Configuration/IConfigService.cs
@@ -25,16 +25,8 @@ public interface IConfigService
SabPriorityType SabBacklogTvPriority { get; set; }
SabPriorityType SabRecentTvPriority { get; set; }
String DownloadClientTvDirectory { get; set; }
- bool SortingIncludeSeriesName { get; set; }
- bool SortingIncludeEpisodeTitle { get; set; }
- bool SortingReplaceSpaces { get; set; }
- bool SortingAppendQuality { get; set; }
bool UseSeasonFolder { get; set; }
string SortingSeasonFolderFormat { get; set; }
- int SortingSeparatorStyle { get; set; }
- int SortingNumberStyle { get; set; }
- int SortingMultiEpisodeStyle { get; set; }
- bool SortingUseSceneName { get; set; }
int DefaultQualityProfile { get; set; }
Boolean XbmcUpdateLibrary { get; set; }
Boolean XbmcCleanLibrary { get; set; }
diff --git a/NzbDrone.Core/Datastore/BasicRepository.cs b/NzbDrone.Core/Datastore/BasicRepository.cs
index 4042e98c3..57bfd60c8 100644
--- a/NzbDrone.Core/Datastore/BasicRepository.cs
+++ b/NzbDrone.Core/Datastore/BasicRepository.cs
@@ -8,13 +8,15 @@ namespace NzbDrone.Core.Datastore
IEnumerable All();
int Count();
TModel Get(int id);
+ TModel Single();
+ TModel SingleOrDefault();
TModel Insert(TModel model);
TModel Update(TModel model);
- TModel Upsert(TModel model);
+ TModel UpSert(TModel model);
void Delete(int id);
IList InsertMany(IList model);
IList UpdateMany(IList model);
- void DeleteMany(IList model);
+ void DeleteMany(List model);
void Purge();
bool HasItems();
}
@@ -45,6 +47,16 @@ public TModel Get(int id)
return Queryable.Single(c => c.Id == id);
}
+ public TModel Single()
+ {
+ return Queryable.Single();
+ }
+
+ public TModel SingleOrDefault()
+ {
+ return Queryable.SingleOrDefault();
+ }
+
public TModel Insert(TModel model)
{
return ObjectDatabase.Insert(model);
@@ -65,12 +77,12 @@ public IList UpdateMany(IList model)
return ObjectDatabase.UpdateMany(model);
}
- public void DeleteMany(IList model)
+ public void DeleteMany(List