2011-10-23 05:31:28 +03:00
|
|
|
// ReSharper disable RedundantUsingDirective
|
|
|
|
|
2011-11-14 03:22:18 +03:00
|
|
|
using System.Linq;
|
2011-10-23 05:31:28 +03:00
|
|
|
using System;
|
|
|
|
using System.IO;
|
|
|
|
using FluentAssertions;
|
|
|
|
using NUnit.Framework;
|
|
|
|
using NzbDrone.Core.Model;
|
|
|
|
using NzbDrone.Core.Providers;
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
|
2011-11-14 03:22:18 +03:00
|
|
|
namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
2011-10-23 05:31:28 +03:00
|
|
|
{
|
|
|
|
[TestFixture]
|
|
|
|
// ReSharper disable InconsistentNaming
|
2011-11-13 10:27:16 +03:00
|
|
|
public class PostDownloadProviderFixture : CoreTest
|
2011-10-23 05:31:28 +03:00
|
|
|
{
|
|
|
|
[TestCase(@"c:\_NzbDrone_InvalidEpisode_Title", @"c:\_UnknownSeries_Title", PostDownloadStatusType.UnknownSeries)]
|
|
|
|
[TestCase(@"c:\Title", @"c:\_Failed_Title", PostDownloadStatusType.Failed)]
|
|
|
|
[TestCase(@"c:\Root\Test Title", @"c:\Root\_ParseError_Test Title", PostDownloadStatusType.ParseError)]
|
|
|
|
public void GetFolderNameWithStatus_should_return_a_string_with_the_error_removing_existing_error(string currentName, string excpectedName, PostDownloadStatusType status)
|
|
|
|
{
|
2011-10-25 07:34:48 +03:00
|
|
|
PostDownloadProvider.GetTaggedFolderName(new DirectoryInfo(currentName), status).Should().Be(
|
2011-10-23 05:31:28 +03:00
|
|
|
excpectedName);
|
|
|
|
}
|
|
|
|
|
|
|
|
[TestCase(PostDownloadStatusType.NoError)]
|
|
|
|
[ExpectedException(typeof(InvalidOperationException))]
|
|
|
|
public void GetFolderNameWithStatus_should_throw_if_status_is_not_an_error(PostDownloadStatusType status)
|
|
|
|
{
|
2011-10-25 07:34:48 +03:00
|
|
|
PostDownloadProvider.GetTaggedFolderName(new DirectoryInfo(TempFolder), status);
|
2011-10-23 05:31:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[TestCase("_NzbDrone_ParseError_The Office (US) - S01E01 - Episode Title", "The Office (US) - S01E01 - Episode Title")]
|
|
|
|
[TestCase("_Status_The Office (US) - S01E01 - Episode Title", "The Office (US) - S01E01 - Episode Title")]
|
|
|
|
[TestCase("The Office (US) - S01E01 - Episode Title", "The Office (US) - S01E01 - Episode Title")]
|
|
|
|
[TestCase("_The Office (US) - S01E01 - Episode Title", "_The Office (US) - S01E01 - Episode Title")]
|
|
|
|
public void RemoveStatus_should_remove_status_string_from_folder_name(string folderName, string cleanFolderName)
|
|
|
|
{
|
|
|
|
PostDownloadProvider.RemoveStatusFromFolderName(folderName).Should().Be(cleanFolderName);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|