|
|
|
@ -1,19 +1,14 @@
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Globalization;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using FizzWare.NBuilder;
|
|
|
|
|
using FluentAssertions;
|
|
|
|
|
using Moq;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using NzbDrone.Core.CustomFormats;
|
|
|
|
|
using NzbDrone.Core.MediaFiles;
|
|
|
|
|
using NzbDrone.Core.MediaFiles.MediaInfo;
|
|
|
|
|
using NzbDrone.Core.Movies;
|
|
|
|
|
using NzbDrone.Core.Organizer;
|
|
|
|
|
using NzbDrone.Core.Qualities;
|
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
|
using NzbDrone.Test.Common;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
|
|
|
|
{
|
|
|
|
@ -43,26 +38,32 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
|
|
|
|
Mocker.GetMock<IQualityDefinitionService>()
|
|
|
|
|
.Setup(v => v.Get(Moq.It.IsAny<Quality>()))
|
|
|
|
|
.Returns<Quality>(v => Quality.DefaultQualityDefinitions.First(c => c.Quality == v));
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<ICustomFormatService>()
|
|
|
|
|
.Setup(v => v.All())
|
|
|
|
|
.Returns(new List<CustomFormat>());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_reserved_device_name_in_movies_folder()
|
|
|
|
|
[TestCase("Con Game", 2021, "Con_Game (2021)")]
|
|
|
|
|
[TestCase("Com1 Sat", 2021, "Com1_Sat (2021)")]
|
|
|
|
|
public void should_replace_reserved_device_name_in_movies_folder(string title, int year, string expected)
|
|
|
|
|
{
|
|
|
|
|
_movie.Title = "Con Man";
|
|
|
|
|
_movie.Year = 2021;
|
|
|
|
|
_movie.Title = title;
|
|
|
|
|
_movie.Year = year;
|
|
|
|
|
_namingConfig.MovieFolderFormat = "{Movie.Title} ({Release Year})";
|
|
|
|
|
|
|
|
|
|
Subject.GetMovieFolder(_movie).Should().Be("Con_Man (2021)");
|
|
|
|
|
Subject.GetMovieFolder(_movie).Should().Be($"{expected}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_replace_reserved_device_name_in_file_name()
|
|
|
|
|
[TestCase("Con Game", 2021, "Con_Game (2021)")]
|
|
|
|
|
[TestCase("Com1 Sat", 2021, "Com1_Sat (2021)")]
|
|
|
|
|
public void should_replace_reserved_device_name_in_file_name(string title, int year, string expected)
|
|
|
|
|
{
|
|
|
|
|
_movie.Title = "Con Man";
|
|
|
|
|
_movie.Year = 2021;
|
|
|
|
|
_movie.Title = title;
|
|
|
|
|
_movie.Year = year;
|
|
|
|
|
_namingConfig.StandardMovieFormat = "{Movie.Title} ({Release Year})";
|
|
|
|
|
|
|
|
|
|
Subject.BuildFileName(_movie, _movieFile).Should().Be("Con_Man (2021)");
|
|
|
|
|
Subject.BuildFileName(_movie, _movieFile).Should().Be($"{expected}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|