test clean up.
This commit is contained in:
parent
7eb0d62c53
commit
a221994cd7
|
@ -41,10 +41,10 @@
|
|||
// .Setup(c => c.Start(It.IsAny<ProcessStartInfo>()))
|
||||
// .Returns(dummy);
|
||||
|
||||
// //act
|
||||
//
|
||||
// Mocker.Resolve<IISProvider>().StartServer();
|
||||
|
||||
// //assert
|
||||
//
|
||||
// Mocker.Resolve<IISProvider>().IISProcessId.Should().Be(dummy.Id);
|
||||
// }
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ using NzbDrone.Test.Common.AutoMoq;
|
|||
namespace NzbDrone.Common.Test
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class ConfigFileProviderTest : TestBase
|
||||
{
|
||||
[SetUp]
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
// ReSharper disable InconsistentNaming
|
||||
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
|
@ -84,11 +82,11 @@ namespace NzbDrone.Common.Test
|
|||
[Test]
|
||||
public void CopyFolder_should_copy_folder()
|
||||
{
|
||||
//Act
|
||||
|
||||
var diskProvider = new DiskProvider();
|
||||
diskProvider.CopyDirectory(BinFolder.FullName, BinFolderCopy.FullName);
|
||||
|
||||
//Assert
|
||||
|
||||
VerifyCopy();
|
||||
}
|
||||
|
||||
|
@ -96,7 +94,7 @@ namespace NzbDrone.Common.Test
|
|||
[Test]
|
||||
public void CopyFolder_should_overright_existing_folder()
|
||||
{
|
||||
//Act
|
||||
|
||||
var diskProvider = new DiskProvider();
|
||||
|
||||
diskProvider.CopyDirectory(BinFolder.FullName, BinFolderCopy.FullName);
|
||||
|
@ -107,7 +105,7 @@ namespace NzbDrone.Common.Test
|
|||
|
||||
diskProvider.CopyDirectory(BinFolder.FullName, BinFolderCopy.FullName);
|
||||
|
||||
//Assert
|
||||
|
||||
VerifyCopy();
|
||||
}
|
||||
|
||||
|
@ -120,10 +118,10 @@ namespace NzbDrone.Common.Test
|
|||
diskProvider.CopyDirectory(BinFolder.FullName, BinFolderMove.FullName);
|
||||
VerifyCopy();
|
||||
|
||||
//Act
|
||||
|
||||
diskProvider.MoveDirectory(BinFolderCopy.FullName, BinFolderMove.FullName);
|
||||
|
||||
//Assert
|
||||
|
||||
VerifyMove();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable InconsistentNaming
|
||||
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable InconsistentNaming
|
||||
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
@ -70,7 +70,7 @@ namespace NzbDrone.Common.Test
|
|||
{
|
||||
var startInfo = new ProcessStartInfo(DummyApp.DUMMY_PROCCESS_NAME + ".exe");
|
||||
|
||||
//Act/Assert
|
||||
|
||||
_processProvider.GetProcessByName(DummyApp.DUMMY_PROCCESS_NAME).Should()
|
||||
.BeEmpty("Dummy process is already running");
|
||||
_processProvider.Start(startInfo).Should().NotBeNull();
|
||||
|
|
|
@ -7,7 +7,7 @@ using NzbDrone.Test.Common;
|
|||
namespace NzbDrone.Common.Test
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class ReportingService_ReportParseError_Fixture : TestBase
|
||||
{
|
||||
[SetUp]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable InconsistentNaming
|
||||
|
||||
|
||||
using System.ServiceProcess;
|
||||
using FluentAssertions;
|
||||
|
@ -43,7 +43,7 @@ namespace NzbDrone.Common.Test
|
|||
[Test]
|
||||
public void Exists_should_find_existing_service()
|
||||
{
|
||||
//Act
|
||||
|
||||
var exists = serviceProvider.ServiceExist(ALWAYS_INSTALLED_SERVICE);
|
||||
|
||||
exists.Should().BeTrue();
|
||||
|
@ -52,7 +52,7 @@ namespace NzbDrone.Common.Test
|
|||
[Test]
|
||||
public void Exists_should_not_find_random_service()
|
||||
{
|
||||
//Act
|
||||
|
||||
var exists = serviceProvider.ServiceExist("random_service_name");
|
||||
|
||||
exists.Should().BeFalse();
|
||||
|
@ -62,7 +62,7 @@ namespace NzbDrone.Common.Test
|
|||
[Test]
|
||||
public void Service_should_be_installed_and_then_uninstalled()
|
||||
{
|
||||
//Act
|
||||
|
||||
serviceProvider.ServiceExist(TEMP_SERVICE_NAME).Should().BeFalse("Service already installed");
|
||||
serviceProvider.Install(TEMP_SERVICE_NAME);
|
||||
serviceProvider.ServiceExist(TEMP_SERVICE_NAME).Should().BeTrue();
|
||||
|
@ -76,7 +76,7 @@ namespace NzbDrone.Common.Test
|
|||
[Explicit]
|
||||
public void UnInstallService()
|
||||
{
|
||||
//Act
|
||||
|
||||
serviceProvider.UnInstall(ServiceProvider.NZBDRONE_SERVICE_NAME);
|
||||
serviceProvider.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME).Should().BeFalse();
|
||||
}
|
||||
|
@ -105,10 +105,10 @@ namespace NzbDrone.Common.Test
|
|||
serviceProvider.GetService(ALWAYS_INSTALLED_SERVICE).Status
|
||||
.Should().NotBe(ServiceControllerStatus.Running);
|
||||
|
||||
//Act
|
||||
|
||||
serviceProvider.Stop(ALWAYS_INSTALLED_SERVICE);
|
||||
|
||||
//Assert
|
||||
|
||||
serviceProvider.GetService(ALWAYS_INSTALLED_SERVICE).Status
|
||||
.Should().Be(ServiceControllerStatus.Stopped);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable InconsistentNaming
|
||||
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace NzbDrone.Core.Test.Configuration
|
|||
Subject.SetValue(key, newValue);
|
||||
var result = Subject.GetValue(key, "");
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().Be(newValue);
|
||||
AllStoredModels.Should().HaveCount(1);
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ namespace NzbDrone.Core.Test.Configuration
|
|||
var allProperties = typeof(ConfigService).GetProperties().Where(p => p.GetSetMethod() != null).ToList();
|
||||
|
||||
|
||||
//Act
|
||||
|
||||
foreach (var propertyInfo in allProperties)
|
||||
{
|
||||
object value = null;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
@ -18,7 +18,7 @@ using NzbDrone.Core.Test.Framework;
|
|||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class AcceptableSizeSpecificationFixture : CoreTest
|
||||
{
|
||||
private EpisodeParseResult parseResultMulti;
|
||||
|
@ -84,10 +84,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
.Returns(false);
|
||||
|
||||
//Act
|
||||
|
||||
bool result = Mocker.Resolve<AcceptableSizeSpecification>().IsSatisfiedBy(parseResultSingle);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
|
@ -105,10 +105,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
.Returns(false);
|
||||
|
||||
//Act
|
||||
|
||||
bool result = Mocker.Resolve<AcceptableSizeSpecification>().IsSatisfiedBy(parseResultSingle);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
|
@ -126,10 +126,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
.Returns(false);
|
||||
|
||||
//Act
|
||||
|
||||
bool result = Mocker.Resolve<AcceptableSizeSpecification>().IsSatisfiedBy(parseResultSingle);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeFalse();
|
||||
}
|
||||
|
||||
|
@ -147,10 +147,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
.Returns(false);
|
||||
|
||||
//Act
|
||||
|
||||
bool result = Mocker.Resolve<AcceptableSizeSpecification>().IsSatisfiedBy(parseResultSingle);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeFalse();
|
||||
}
|
||||
|
||||
|
@ -168,10 +168,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
.Returns(false);
|
||||
|
||||
//Act
|
||||
|
||||
bool result = Mocker.Resolve<AcceptableSizeSpecification>().IsSatisfiedBy(parseResultMulti);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
|
@ -189,10 +189,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
.Returns(false);
|
||||
|
||||
//Act
|
||||
|
||||
bool result = Mocker.Resolve<AcceptableSizeSpecification>().IsSatisfiedBy(parseResultMulti);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
|
@ -210,10 +210,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
.Returns(false);
|
||||
|
||||
//Act
|
||||
|
||||
bool result = Mocker.Resolve<AcceptableSizeSpecification>().IsSatisfiedBy(parseResultMulti);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeFalse();
|
||||
}
|
||||
|
||||
|
@ -231,10 +231,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
.Returns(false);
|
||||
|
||||
//Act
|
||||
|
||||
bool result = Mocker.Resolve<AcceptableSizeSpecification>().IsSatisfiedBy(parseResultMulti);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeFalse();
|
||||
}
|
||||
|
||||
|
@ -252,10 +252,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
.Returns(true);
|
||||
|
||||
//Act
|
||||
|
||||
bool result = Mocker.Resolve<AcceptableSizeSpecification>().IsSatisfiedBy(parseResultSingle);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
|
@ -273,10 +273,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
.Returns(true);
|
||||
|
||||
//Act
|
||||
|
||||
bool result = Mocker.Resolve<AcceptableSizeSpecification>().IsSatisfiedBy(parseResultSingle);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
|
@ -294,10 +294,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
.Returns(true);
|
||||
|
||||
//Act
|
||||
|
||||
bool result = Mocker.Resolve<AcceptableSizeSpecification>().IsSatisfiedBy(parseResultSingle);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeFalse();
|
||||
}
|
||||
|
||||
|
@ -315,10 +315,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
.Returns(true);
|
||||
|
||||
//Act
|
||||
|
||||
bool result = Mocker.Resolve<AcceptableSizeSpecification>().IsSatisfiedBy(parseResultSingle);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeFalse();
|
||||
}
|
||||
|
||||
|
@ -337,10 +337,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
.Returns(true);
|
||||
|
||||
//Act
|
||||
|
||||
bool result = Mocker.Resolve<AcceptableSizeSpecification>().IsSatisfiedBy(parseResultSingle);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
|
@ -359,10 +359,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
.Returns(true);
|
||||
|
||||
//Act
|
||||
|
||||
bool result = Mocker.Resolve<AcceptableSizeSpecification>().IsSatisfiedBy(parseResultSingle);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
|
@ -382,10 +382,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests
|
|||
s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()))
|
||||
.Returns(true);
|
||||
|
||||
//Act
|
||||
|
||||
bool result = Mocker.Resolve<AcceptableSizeSpecification>().IsSatisfiedBy(parseResultSingle);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
@ -20,7 +20,7 @@ using NzbDrone.Core.Test.Framework;
|
|||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class AllowedReleaseGroupSpecificationFixture : CoreTest
|
||||
{
|
||||
private EpisodeParseResult parseResult;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
@ -18,7 +18,7 @@ using NzbDrone.Core.Test.Framework;
|
|||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class CustomStartDateSpecificationFixture : CoreTest
|
||||
{
|
||||
private CustomStartDateSpecification _customStartDateSpecification;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
@ -17,7 +17,7 @@ using NzbDrone.Core.Test.Framework;
|
|||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class LanguageSpecificationFixture : CoreTest
|
||||
{
|
||||
private EpisodeParseResult parseResult;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
@ -18,7 +18,7 @@ using NzbDrone.Core.Test.Framework;
|
|||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class MonitoredEpisodeSpecificationFixture : CoreTest
|
||||
{
|
||||
private MonitoredEpisodeSpecification monitoredEpisodeSpecification;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
@ -16,7 +16,7 @@ using NzbDrone.Core.Test.Framework;
|
|||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class QualityAllowedByProfileSpecificationFixture : CoreTest
|
||||
{
|
||||
private QualityAllowedByProfileSpecification _qualityAllowedByProfile;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
|
@ -13,7 +13,7 @@ using NzbDrone.Core.Test.Framework;
|
|||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class QualityUpgradeSpecificationFixture : CoreTest<QualityUpgradableSpecification>
|
||||
{
|
||||
public static object[] IsUpgradeTestCases =
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
@ -18,7 +18,7 @@ using NzbDrone.Core.Test.Framework;
|
|||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class RetentionSpecificationFixture : CoreTest
|
||||
{
|
||||
private RetentionSpecification retentionSpecification;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -19,7 +19,7 @@ using NzbDrone.Core.Test.Framework;
|
|||
namespace NzbDrone.Core.Test.DecisionEngineTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class UpgradeDiskSpecificationFixture : CoreTest
|
||||
{
|
||||
private UpgradeDiskSpecification _upgradeDisk;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
|
|
@ -12,7 +12,7 @@ using NzbDrone.Core.Test.Framework;
|
|||
namespace NzbDrone.Core.Test
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class EpisodeParseResultTest : CoreTest
|
||||
{
|
||||
[Test]
|
||||
|
|
|
@ -11,7 +11,7 @@ using NzbDrone.Core.Test.Framework;
|
|||
namespace NzbDrone.Core.Test
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class EpisodeStatusTest : CoreTest
|
||||
{
|
||||
[TestCase(1, false, false, EpisodeStatusType.NotAired)]
|
||||
|
|
|
@ -9,7 +9,7 @@ using NzbDrone.Core.Test.Framework;
|
|||
namespace NzbDrone.Core.Test
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class FluentTest : CoreTest
|
||||
{
|
||||
[TestCase(null, "def", "def")]
|
||||
|
@ -86,11 +86,11 @@ namespace NzbDrone.Core.Test
|
|||
[Test]
|
||||
public void ParentUriString_should_return_self_if_already_parent()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var url = "http://www.nzbdrone.com";
|
||||
var uri = new Uri(url);
|
||||
|
||||
//Act
|
||||
|
||||
var result = uri.ParentUriString();
|
||||
|
||||
//Resolve
|
||||
|
@ -100,11 +100,11 @@ namespace NzbDrone.Core.Test
|
|||
[Test]
|
||||
public void ParentUriString_should_return_parent_url_when_path_is_passed()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var url = "http://www.nzbdrone.com/test/";
|
||||
var uri = new Uri(url);
|
||||
|
||||
//Act
|
||||
|
||||
var result = uri.ParentUriString();
|
||||
|
||||
//Resolve
|
||||
|
@ -114,11 +114,11 @@ namespace NzbDrone.Core.Test
|
|||
[Test]
|
||||
public void ParentUriString_should_return_parent_url_when_multiple_paths_are_passed()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var url = "http://www.nzbdrone.com/test/test2";
|
||||
var uri = new Uri(url);
|
||||
|
||||
//Act
|
||||
|
||||
var result = uri.ParentUriString();
|
||||
|
||||
//Resolve
|
||||
|
@ -128,11 +128,11 @@ namespace NzbDrone.Core.Test
|
|||
[Test]
|
||||
public void ParentUriString_should_return_parent_url_when_url_with_query_string_is_passed()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var url = "http://www.nzbdrone.com/test.aspx?test=10";
|
||||
var uri = new Uri(url);
|
||||
|
||||
//Act
|
||||
|
||||
var result = uri.ParentUriString();
|
||||
|
||||
//Resolve
|
||||
|
@ -142,11 +142,11 @@ namespace NzbDrone.Core.Test
|
|||
[Test]
|
||||
public void ParentUriString_should_return_parent_url_when_url_with_path_and_query_strings_is_passed()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var url = "http://www.nzbdrone.com/tester/test.aspx?test=10";
|
||||
var uri = new Uri(url);
|
||||
|
||||
//Act
|
||||
|
||||
var result = uri.ParentUriString();
|
||||
|
||||
//Resolve
|
||||
|
@ -156,11 +156,11 @@ namespace NzbDrone.Core.Test
|
|||
[Test]
|
||||
public void ParentUriString_should_return_parent_url_when_url_with_query_strings_is_passed()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var url = "http://www.nzbdrone.com/test.aspx?test=10&test2=5";
|
||||
var uri = new Uri(url);
|
||||
|
||||
//Act
|
||||
|
||||
var result = uri.ParentUriString();
|
||||
|
||||
//Resolve
|
||||
|
@ -170,10 +170,10 @@ namespace NzbDrone.Core.Test
|
|||
[Test]
|
||||
public void MaxOrDefault_should_return_zero_when_collection_is_empty()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
//Act
|
||||
|
||||
var result = (new List<int>()).MaxOrDefault();
|
||||
|
||||
//Resolve
|
||||
|
@ -183,10 +183,10 @@ namespace NzbDrone.Core.Test
|
|||
[Test]
|
||||
public void MaxOrDefault_should_return_max_when_collection_is_not_empty()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var list = new List<int> { 6, 4, 5, 3, 8, 10 };
|
||||
|
||||
//Act
|
||||
|
||||
var result = list.MaxOrDefault();
|
||||
|
||||
//Resolve
|
||||
|
@ -196,10 +196,10 @@ namespace NzbDrone.Core.Test
|
|||
[Test]
|
||||
public void MaxOrDefault_should_return_zero_when_collection_is_null()
|
||||
{
|
||||
//Setup
|
||||
|
||||
List<int> list = null;
|
||||
|
||||
//Act
|
||||
|
||||
var result = list.MaxOrDefault();
|
||||
|
||||
//Resolve
|
||||
|
@ -209,10 +209,10 @@ namespace NzbDrone.Core.Test
|
|||
[Test]
|
||||
public void Truncate_should_truncate_strings_to_max_specified_number_of_bytes()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var str = ReadAllText("Files", "LongOverview.txt");
|
||||
|
||||
//Act
|
||||
|
||||
var resultString = str.Truncate(1000);
|
||||
|
||||
//Resolve
|
||||
|
@ -223,10 +223,10 @@ namespace NzbDrone.Core.Test
|
|||
[Test]
|
||||
public void Truncate_should_not_truncate_string_shorter_than_max_bytes()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var str = "Hello World";
|
||||
|
||||
//Act
|
||||
|
||||
var resultString = str.Truncate(1000);
|
||||
|
||||
//Resolve
|
||||
|
@ -237,10 +237,10 @@ namespace NzbDrone.Core.Test
|
|||
[Test]
|
||||
public void MinOrDefault_should_return_zero_when_collection_is_empty()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
//Act
|
||||
|
||||
var result = (new List<int>()).MinOrDefault();
|
||||
|
||||
//Resolve
|
||||
|
@ -250,10 +250,10 @@ namespace NzbDrone.Core.Test
|
|||
[Test]
|
||||
public void MinOrDefault_should_return_min_when_collection_is_not_empty()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var list = new List<int> { 6, 4, 5, 3, 8, 10 };
|
||||
|
||||
//Act
|
||||
|
||||
var result = list.MinOrDefault();
|
||||
|
||||
//Resolve
|
||||
|
@ -263,10 +263,10 @@ namespace NzbDrone.Core.Test
|
|||
[Test]
|
||||
public void MinOrDefault_should_return_zero_when_collection_is_null()
|
||||
{
|
||||
//Setup
|
||||
|
||||
List<int> list = null;
|
||||
|
||||
//Act
|
||||
|
||||
var result = list.MinOrDefault();
|
||||
|
||||
//Resolve
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
|
|
@ -1,21 +1,12 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Helpers;
|
||||
using NzbDrone.Core.Model.Notification;
|
||||
using NzbDrone.Core.Providers;
|
||||
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.HelperTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class SortHelperTest : CoreTest
|
||||
{
|
||||
[TestCase("The Office (US)", "Office (US)")]
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -15,7 +15,7 @@ using NzbDrone.Test.Common;
|
|||
namespace NzbDrone.Core.Test.HelperTests.XElementHelperTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class ParseDayOfWeekFixture : CoreTest
|
||||
{
|
||||
[Test]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Linq;
|
||||
|
@ -15,7 +15,7 @@ using NzbDrone.Core.Test.Framework;
|
|||
namespace NzbDrone.Core.Test.HelperTests.XElementHelperTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class XElementHelperTest : CoreTest
|
||||
{
|
||||
[Test]
|
||||
|
|
|
@ -119,10 +119,10 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
|
|||
|
||||
WithMisMatchedSeries();
|
||||
|
||||
//Act
|
||||
|
||||
var result = Subject.ProcessReports(_matchingSeries, new { }, parseResults, _episodeSearchResult, _notification);
|
||||
|
||||
//Assert
|
||||
|
||||
result.SearchHistoryItems.Should().HaveCount(parseResults.Count);
|
||||
result.SearchHistoryItems.Should().NotContain(s => s.Success);
|
||||
|
||||
|
@ -147,10 +147,10 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
|
|||
WithQualityNeeded();
|
||||
WithSuccessfulDownload();
|
||||
|
||||
//Act
|
||||
|
||||
var result = Subject.ProcessReports(_matchingSeries, new { }, parseResults, _episodeSearchResult, _notification);
|
||||
|
||||
//Assert
|
||||
|
||||
result.SearchHistoryItems.Should().HaveCount(parseResults.Count);
|
||||
result.SearchHistoryItems.Should().Contain(s => s.Success);
|
||||
|
||||
|
@ -182,10 +182,10 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
|
|||
.Setup(s => s.DownloadReport(It.Is<EpisodeParseResult>(d => d.Quality.Quality == Quality.SDTV)))
|
||||
.Returns(true);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Subject.ProcessReports(_matchingSeries, new { }, parseResults, _episodeSearchResult, _notification);
|
||||
|
||||
//Assert
|
||||
|
||||
result.SearchHistoryItems.Should().HaveCount(parseResults.Count);
|
||||
result.SearchHistoryItems.Should().Contain(s => s.Success);
|
||||
|
||||
|
@ -215,10 +215,10 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests
|
|||
.Setup(s => s.IsDownloadPermitted(It.Is<EpisodeParseResult>(d => d.Quality.Quality == Quality.Bluray1080p)))
|
||||
.Returns(ReportRejectionReasons.None);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Subject.ProcessReports(_matchingSeries, new { }, parseResults, _episodeSearchResult, _notification);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Successes.Should().NotBeNull();
|
||||
result.Successes.Should().NotBeEmpty();
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ using NzbDrone.Test.Common;
|
|||
namespace NzbDrone.Core.Test.IndexerTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class IndexerFixture : CoreTest
|
||||
{
|
||||
private void WithConfiguredIndexers()
|
||||
|
@ -143,7 +143,7 @@ namespace NzbDrone.Core.Test.IndexerTests
|
|||
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
|
||||
.Returns(OpenRead("Files", "Rss", "SizeParsing", "nzbsrus.xml"));
|
||||
|
||||
//Act
|
||||
|
||||
var parseResults = Mocker.Resolve<NzbsRUs>().FetchRss();
|
||||
|
||||
parseResults.Should().HaveCount(1);
|
||||
|
@ -166,7 +166,7 @@ namespace NzbDrone.Core.Test.IndexerTests
|
|||
.Setup(h => h.DownloadStream(It.IsAny<String>(), It.IsAny<NetworkCredential>()))
|
||||
.Returns(OpenRead("Files", "Rss", "SizeParsing", "newznab.xml"));
|
||||
|
||||
//Act
|
||||
|
||||
var parseResults = Mocker.Resolve<Newznab>().FetchRss();
|
||||
|
||||
parseResults[0].Size.Should().Be(1183105773);
|
||||
|
@ -185,7 +185,7 @@ namespace NzbDrone.Core.Test.IndexerTests
|
|||
.Setup(h => h.DownloadStream("http://www.nzbindex.nl/rss/alt.binaries.hdtv/?sort=agedesc&minsize=100&complete=1&max=50&more=1&q=", It.IsAny<NetworkCredential>()))
|
||||
.Returns(OpenRead("Files", "Rss", "SizeParsing", "nzbindex.xml"));
|
||||
|
||||
//Act
|
||||
|
||||
var parseResults = Mocker.Resolve<NzbIndex>().FetchRss();
|
||||
|
||||
parseResults[0].Size.Should().Be(587328389);
|
||||
|
@ -204,7 +204,7 @@ namespace NzbDrone.Core.Test.IndexerTests
|
|||
.Setup(h => h.DownloadStream("http://www.nzbclub.com/nzbfeed.aspx?ig=2&gid=5542&st=1&ns=1&q=", It.IsAny<NetworkCredential>()))
|
||||
.Returns(OpenRead("Files", "Rss", "SizeParsing", "nzbclub.xml"));
|
||||
|
||||
//Act
|
||||
|
||||
var parseResults = Mocker.Resolve<NzbClub>().FetchRss();
|
||||
|
||||
parseResults.Should().HaveCount(2);
|
||||
|
@ -220,7 +220,7 @@ namespace NzbDrone.Core.Test.IndexerTests
|
|||
.Setup(h => h.DownloadStream("http://rss.omgwtfnzbs.org/rss-search.php?catid=19,20&user=MockedConfigValue&api=MockedConfigValue&eng=1", It.IsAny<NetworkCredential>()))
|
||||
.Returns(OpenRead("Files", "Rss", "SizeParsing", "omgwtfnzbs.xml"));
|
||||
|
||||
//Act
|
||||
|
||||
var parseResults = Mocker.Resolve<Omgwtfnzbs>().FetchRss();
|
||||
|
||||
parseResults.Should().HaveCount(1);
|
||||
|
@ -480,7 +480,7 @@ namespace NzbDrone.Core.Test.IndexerTests
|
|||
.Setup(h => h.DownloadStream("http://rss.omgwtfnzbs.org/rss-search.php?catid=19,20&user=MockedConfigValue&api=MockedConfigValue&eng=1", It.IsAny<NetworkCredential>()))
|
||||
.Returns(OpenRead("Files", "Rss", "SizeParsing", "omgwtfnzbs.xml"));
|
||||
|
||||
//Act
|
||||
|
||||
var parseResults = Mocker.Resolve<Omgwtfnzbs>().FetchRss();
|
||||
|
||||
parseResults.Should().HaveCount(1);
|
||||
|
|
|
@ -21,7 +21,7 @@ using NzbDrone.Test.Common;
|
|||
namespace NzbDrone.Core.Test.IndexerTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class NzbxFixture : CoreTest
|
||||
{
|
||||
[Test]
|
||||
|
@ -31,7 +31,7 @@ namespace NzbDrone.Core.Test.IndexerTests
|
|||
.Setup(h => h.DownloadString("https://nzbx.co/api/recent?category=tv", It.IsAny<NetworkCredential>()))
|
||||
.Returns(ReadAllText("Files", "Rss", "SizeParsing", "nzbx_recent.json"));
|
||||
|
||||
//Act
|
||||
|
||||
var parseResults = Mocker.Resolve<Nzbx>().FetchRss();
|
||||
|
||||
parseResults.Should().HaveCount(1);
|
||||
|
@ -45,7 +45,7 @@ namespace NzbDrone.Core.Test.IndexerTests
|
|||
.Setup(h => h.DownloadString("https://nzbx.co/api/search?q=30+Rock+S01E01", It.IsAny<NetworkCredential>()))
|
||||
.Returns(ReadAllText("Files", "Rss", "SizeParsing", "nzbx_search.json"));
|
||||
|
||||
//Act
|
||||
|
||||
var parseResults = Mocker.Resolve<Nzbx>().FetchEpisode("30 Rock", 1, 1);
|
||||
|
||||
parseResults.Should().HaveCount(1);
|
||||
|
@ -91,7 +91,7 @@ namespace NzbDrone.Core.Test.IndexerTests
|
|||
.Setup(h => h.DownloadString("https://nzbx.co/api/recent?category=tv", It.IsAny<NetworkCredential>()))
|
||||
.Returns(ReadAllText("Files", "Rss", "SizeParsing", "nzbx_recent.json"));
|
||||
|
||||
//Act
|
||||
|
||||
var parseResults = Mocker.Resolve<Nzbx>().FetchRss();
|
||||
|
||||
parseResults.Should().HaveCount(1);
|
||||
|
@ -107,7 +107,7 @@ namespace NzbDrone.Core.Test.IndexerTests
|
|||
.Setup(h => h.DownloadString("https://nzbx.co/api/search?q=30+Rock+S01E01", It.IsAny<NetworkCredential>()))
|
||||
.Returns(ReadAllText("Files", "Rss", "SizeParsing", "nzbx_search.json"));
|
||||
|
||||
//Act
|
||||
|
||||
var parseResults = Mocker.Resolve<Nzbx>().FetchEpisode("30 Rock", 1, 1);
|
||||
|
||||
parseResults.Should().HaveCount(1);
|
||||
|
@ -121,7 +121,7 @@ namespace NzbDrone.Core.Test.IndexerTests
|
|||
.Setup(h => h.DownloadString("https://nzbx.co/api/recent?category=tv", It.IsAny<NetworkCredential>()))
|
||||
.Returns(ReadAllText("Files", "Rss", "SizeParsing", "nzbx_recent.json"));
|
||||
|
||||
//Act
|
||||
|
||||
var parseResults = Mocker.Resolve<Nzbx>().FetchRss();
|
||||
|
||||
parseResults.Should().HaveCount(1);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -18,7 +18,7 @@ using NzbDrone.Test.Common.AutoMoq;
|
|||
namespace NzbDrone.Core.Test.Indexers
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class IndexerServiceTest : CoreTest<IndexerService>
|
||||
{
|
||||
[Test]
|
||||
|
|
|
@ -14,7 +14,7 @@ using NzbDrone.Test.Common;
|
|||
namespace NzbDrone.Core.Test.Indexers
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class NewznabProviderTest : CoreTest<NewznabService>
|
||||
{
|
||||
private void WithInvalidName()
|
||||
|
|
|
@ -44,10 +44,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
{
|
||||
Mocker.GetMock<DiskProvider>().Setup(c => c.FolderExists(SANDBOX_FOLDER)).Returns(true);
|
||||
|
||||
//Act
|
||||
|
||||
StartUpdate();
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<DiskProvider>().Verify(c => c.DeleteFolder(SANDBOX_FOLDER, true));
|
||||
}
|
||||
|
||||
|
@ -56,10 +56,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
{
|
||||
Mocker.GetMock<DiskProvider>().Setup(c => c.FolderExists(SANDBOX_FOLDER)).Returns(false);
|
||||
|
||||
//Act
|
||||
|
||||
StartUpdate();
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<DiskProvider>().Verify(c => c.DeleteFolder(SANDBOX_FOLDER, true), Times.Never());
|
||||
}
|
||||
|
||||
|
@ -69,10 +69,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
{
|
||||
var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName);
|
||||
|
||||
//Act
|
||||
|
||||
StartUpdate();
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<HttpProvider>().Verify(
|
||||
c => c.DownloadFile(updatePackage.Url, updateArchive));
|
||||
}
|
||||
|
@ -82,10 +82,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
{
|
||||
var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName);
|
||||
|
||||
//Act
|
||||
|
||||
StartUpdate();
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<ArchiveProvider>().Verify(
|
||||
c => c.ExtractArchive(updateArchive, SANDBOX_FOLDER));
|
||||
}
|
||||
|
@ -95,10 +95,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
{
|
||||
var updateClientFolder = Mocker.GetMock<EnvironmentProvider>().Object.GetUpdateClientFolder();
|
||||
|
||||
//Act
|
||||
|
||||
StartUpdate();
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<DiskProvider>().Verify(
|
||||
c => c.MoveDirectory(updateClientFolder, SANDBOX_FOLDER));
|
||||
}
|
||||
|
@ -106,16 +106,16 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
[Test]
|
||||
public void should_start_update_client()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var updateClientPath = Mocker.GetMock<EnvironmentProvider>().Object.GetUpdateClientExePath();
|
||||
|
||||
Mocker.GetMock<EnvironmentProvider>()
|
||||
.SetupGet(c => c.NzbDroneProcessIdFromEnviroment).Returns(12);
|
||||
|
||||
//Act
|
||||
|
||||
StartUpdate();
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<ProcessProvider>().Verify(
|
||||
c => c.Start(It.Is<ProcessStartInfo>(p =>
|
||||
p.FileName == updateClientPath &&
|
||||
|
@ -143,7 +143,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
var updateSubFolder = new DirectoryInfo(Mocker.GetMock<EnvironmentProvider>().Object.GetUpdateSandboxFolder());
|
||||
|
||||
|
||||
//Act
|
||||
|
||||
updateSubFolder.Exists.Should().BeFalse();
|
||||
|
||||
Mocker.Resolve<HttpProvider>();
|
||||
|
@ -151,7 +151,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
Mocker.Resolve<ArchiveProvider>();
|
||||
StartUpdate();
|
||||
updateSubFolder.Refresh();
|
||||
//Assert
|
||||
|
||||
|
||||
updateSubFolder.Exists.Should().BeTrue();
|
||||
updateSubFolder.GetDirectories("nzbdrone").Should().HaveCount(1);
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
[Test]
|
||||
public void no_missing_epsiodes_should_not_trigger_any_search()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var notification = new ProgressNotification("Backlog Search Job Test");
|
||||
|
||||
var episodes = new List<Episode>();
|
||||
|
@ -39,10 +39,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
||||
|
||||
//Act
|
||||
|
||||
Subject.Start(notification, null);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, new { SeriesId = It.IsAny<int>(), SeasonNumber = It.IsAny<int>() }),
|
||||
Times.Never());
|
||||
|
||||
|
@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
[Test]
|
||||
public void individual_missing_episode()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var notification = new ProgressNotification("Backlog Search Job Test");
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
|
@ -74,10 +74,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
Mocker.GetMock<EpisodeSearchJob>()
|
||||
.Setup(s => s.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("EpisodeId") == 1)));
|
||||
|
||||
//Act
|
||||
|
||||
Subject.Start(notification, null);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("EpisodeId") >= 0)),
|
||||
Times.Once());
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
[Test]
|
||||
public void individual_missing_episodes_only()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var notification = new ProgressNotification("Backlog Search Job Test");
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
|
@ -103,10 +103,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
||||
|
||||
//Act
|
||||
|
||||
Subject.Start(notification, null);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("EpisodeId") >= 0)),
|
||||
Times.Exactly(episodes.Count));
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
[Test]
|
||||
public void series_season_missing_episodes_only_mismatch_count()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var notification = new ProgressNotification("Backlog Search Job Test");
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
|
@ -136,10 +136,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.GetEpisodeNumbersBySeason(1, 1)).Returns(new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 });
|
||||
|
||||
//Act
|
||||
|
||||
Subject.Start(notification, null);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("EpisodeId") >= 0)),
|
||||
Times.Exactly(episodes.Count));
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
[Test]
|
||||
public void series_season_missing_episodes_only()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var notification = new ProgressNotification("Backlog Search Job Test");
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
|
@ -170,10 +170,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.GetEpisodeNumbersBySeason(1, 1)).Returns(episodes.Select(e => e.EpisodeNumber).ToList());
|
||||
|
||||
//Act
|
||||
|
||||
Subject.Start(notification, null);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") >= 0 &&
|
||||
d.GetPropertyValue<int>("SeasonNumber") >= 0)),
|
||||
Times.Once());
|
||||
|
@ -182,7 +182,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
[Test]
|
||||
public void multiple_missing_episodes()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var notification = new ProgressNotification("Backlog Search Job Test");
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
|
@ -212,10 +212,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.GetEpisodeNumbersBySeason(1, 1)).Returns(new List<int> { 1, 2, 3, 4, 5 });
|
||||
|
||||
//Act
|
||||
|
||||
Subject.Start(notification, null);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") >= 0 &&
|
||||
d.GetPropertyValue<int>("SeasonNumber") >= 0)),
|
||||
Times.Once());
|
||||
|
@ -227,7 +227,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
[Test]
|
||||
public void GetMissingForEnabledSeries_should_only_return_episodes_for_monitored_series()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var series = Builder<Series>.CreateListOfSize(2)
|
||||
.TheFirst(1)
|
||||
.With(s => s.Monitored = false)
|
||||
|
@ -250,10 +250,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Subject.GetMissingForEnabledSeries();
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().NotBeEmpty();
|
||||
result.Should().Contain(s => s.Series.Monitored);
|
||||
result.Should().NotContain(s => !s.Series.Monitored);
|
||||
|
@ -262,7 +262,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
[Test]
|
||||
public void GetMissingForEnabledSeries_should_only_return_explicity_enabled_series_when_backlog_searching_is_ignored()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var series = Builder<Series>.CreateListOfSize(3)
|
||||
.TheFirst(1)
|
||||
.With(s => s.Monitored = true)
|
||||
|
@ -289,10 +289,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Subject.GetMissingForEnabledSeries();
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().NotBeEmpty();
|
||||
result.Should().Contain(s => s.Series.BacklogSetting == BacklogSettingType.Enable);
|
||||
result.Should().NotContain(s => s.Series.BacklogSetting == BacklogSettingType.Disable);
|
||||
|
@ -302,7 +302,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
[Test]
|
||||
public void GetMissingForEnabledSeries_should_return_explicity_enabled_and_inherit_series_when_backlog_searching_is_enabled()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var series = Builder<Series>.CreateListOfSize(3)
|
||||
.TheFirst(1)
|
||||
.With(s => s.Monitored = true)
|
||||
|
@ -329,10 +329,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Subject.GetMissingForEnabledSeries();
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().NotBeEmpty();
|
||||
result.Should().Contain(s => s.Series.BacklogSetting == BacklogSettingType.Enable);
|
||||
result.Should().NotContain(s => s.Series.BacklogSetting == BacklogSettingType.Disable);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -21,7 +21,7 @@ using System.Linq;
|
|||
namespace NzbDrone.Core.Test.JobTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class DiskScanJobTest : CoreTest
|
||||
{
|
||||
[Test]
|
||||
|
@ -39,10 +39,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
.Setup(p => p.Scan(series))
|
||||
.Returns(new List<EpisodeFile>());
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<DiskScanJob>().Start(new ProgressNotification("Test"), new { SeriesId = series.Id });
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -20,7 +20,7 @@ using NzbDrone.Test.Common.AutoMoq;
|
|||
namespace NzbDrone.Core.Test.JobTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class ImportNewSeriesJobTest : CoreTest
|
||||
{
|
||||
[Test]
|
||||
|
@ -69,10 +69,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
Mocker.GetMock<IMediaFileService>()
|
||||
.Setup(s => s.GetFilesBySeries(It.IsAny<int>())).Returns(new List<EpisodeFile>());
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<ImportNewSeriesJob>().Start(notification, null);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].Id)), Times.Once());
|
||||
Mocker.GetMock<DiskScanJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].Id)), Times.Once());
|
||||
|
||||
|
@ -123,10 +123,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
Mocker.GetMock<XemUpdateJob>()
|
||||
.Setup(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].Id)));
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<ImportNewSeriesJob>().Start(notification, null);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[0].Id)), Times.Once());
|
||||
Mocker.GetMock<UpdateInfoJob>().Verify(j => j.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == series[1].Id)), Times.Once());
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
|
|
@ -37,16 +37,16 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
[Test]
|
||||
public void no_missing_epsiodes_should_not_trigger_any_search()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var episodes = new List<Episode>();
|
||||
|
||||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<RecentBacklogSearchJob>().Start(MockNotification, null);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(MockNotification, new { EpisodeId = It.IsAny<int>() }),
|
||||
Times.Never());
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
.With(s => s.BacklogSetting = BacklogSettingType.Enable)
|
||||
.Build();
|
||||
|
||||
//Setup
|
||||
|
||||
var episodes = Builder<Episode>.CreateListOfSize(50)
|
||||
.All()
|
||||
.With(e => e.Series = series)
|
||||
|
@ -92,10 +92,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
|
||||
Mocker.GetMock<EpisodeSearchJob>().Setup(c => c.Start(It.IsAny<ProgressNotification>(), It.Is<object>(d => d.GetPropertyValue<int>("EpisodeId") >= 0)));
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<RecentBacklogSearchJob>().Start(MockNotification, null);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(It.IsAny<ProgressNotification>(), It.Is<object>(d => d.GetPropertyValue<int>("EpisodeId") >= 0)),
|
||||
Times.Exactly(40));
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
[Test]
|
||||
public void GetMissingForEnabledSeries_should_only_return_episodes_for_monitored_series()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var series = Builder<Series>.CreateListOfSize(2)
|
||||
.TheFirst(1)
|
||||
.With(s => s.Monitored = false)
|
||||
|
@ -126,10 +126,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<RecentBacklogSearchJob>().GetMissingForEnabledSeries();
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().NotBeEmpty();
|
||||
result.Should().Contain(s => s.Series.Monitored);
|
||||
result.Should().NotContain(s => !s.Series.Monitored);
|
||||
|
@ -138,7 +138,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
[Test]
|
||||
public void GetMissingForEnabledSeries_should_only_return_explicity_enabled_series_when_backlog_searching_is_ignored()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var series = Builder<Series>.CreateListOfSize(3)
|
||||
.TheFirst(1)
|
||||
.With(s => s.Monitored = true)
|
||||
|
@ -165,10 +165,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<RecentBacklogSearchJob>().GetMissingForEnabledSeries();
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().NotBeEmpty();
|
||||
result.Should().Contain(s => s.Series.BacklogSetting == BacklogSettingType.Enable);
|
||||
result.Should().NotContain(s => s.Series.BacklogSetting == BacklogSettingType.Disable);
|
||||
|
@ -178,7 +178,7 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
[Test]
|
||||
public void GetMissingForEnabledSeries_should_return_explicity_enabled_and_inherit_series_when_backlog_searching_is_enabled()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var series = Builder<Series>.CreateListOfSize(3)
|
||||
.TheFirst(1)
|
||||
.With(s => s.Monitored = true)
|
||||
|
@ -205,10 +205,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<RecentBacklogSearchJob>().GetMissingForEnabledSeries();
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().NotBeEmpty();
|
||||
result.Should().Contain(s => s.Series.BacklogSetting == BacklogSettingType.Enable);
|
||||
result.Should().NotContain(s => s.Series.BacklogSetting == BacklogSettingType.Disable);
|
||||
|
|
|
@ -14,7 +14,7 @@ using NzbDrone.Test.Common.AutoMoq;
|
|||
namespace NzbDrone.Core.Test.JobTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class RssSyncJobTest : CoreTest
|
||||
{
|
||||
public void WithMinutes(int minutes)
|
||||
|
|
|
@ -16,7 +16,7 @@ using NzbDrone.Test.Common;
|
|||
namespace NzbDrone.Core.Test.JobTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class SeasonSearchJobTest : CoreTest
|
||||
{
|
||||
private List<Episode> _episodes;
|
||||
|
@ -47,10 +47,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
.Setup(c => c.PartialSeasonSearch(notification, 1, 1))
|
||||
.Returns(_episodes.Select(e => e.EpisodeNumber).ToList());
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<SeasonSearchJob>().Start(notification, new { SeriesId = 1, SeasonNumber = 1 });
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
Mocker.GetMock<SearchProvider>().Verify(c => c.PartialSeasonSearch(notification, 1, 1), Times.Once());
|
||||
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, new { EpisodeId = It.IsAny<int>() }), Times.Never());
|
||||
|
@ -63,10 +63,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
.Setup(c => c.PartialSeasonSearch(notification, 1, 1))
|
||||
.Returns(new List<int>());
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<SeasonSearchJob>().Start(notification, new { SeriesId = 1, SeasonNumber = 1 });
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<SearchProvider>().Verify(c => c.PartialSeasonSearch(notification, 1, 1), Times.Once());
|
||||
}
|
||||
|
||||
|
@ -91,10 +91,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
.Returns(new List<int>{1});
|
||||
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<SeasonSearchJob>().Start(notification, new { SeriesId = 1, SeasonNumber = 1 });
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
Mocker.GetMock<SearchProvider>().Verify(c => c.PartialSeasonSearch(notification, 1, 1), Times.Once());
|
||||
}
|
||||
|
@ -105,10 +105,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
Mocker.GetMock<SearchProvider>()
|
||||
.Setup(c => c.PartialSeasonSearch(notification, 1, 0)).Returns(new List<int>());
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<SeasonSearchJob>().Start(notification, new { SeriesId = 1, SeasonNumber = 0 });
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<SearchProvider>().Verify(c => c.PartialSeasonSearch(notification, 1, 1), Times.Never());
|
||||
Mocker.GetMock<EpisodeSearchJob>().Verify(c => c.Start(notification, new { EpisodeId = It.IsAny<int>() }), Times.Never());
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ using NzbDrone.Test.Common.AutoMoq;
|
|||
namespace NzbDrone.Core.Test.JobTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class SeriesSearchJobTest : CoreTest
|
||||
{
|
||||
[Test]
|
||||
|
@ -35,10 +35,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
Mocker.GetMock<SeasonSearchJob>()
|
||||
.Setup(c => c.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == 1 && d.GetPropertyValue<int>("SeasonNumber") >= 0))).Verifiable();
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<SeriesSearchJob>().Start(notification, new { SeriesId = 1 });
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
Mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, It.Is<object>(d => d.GetPropertyValue<int>("SeriesId") == 1 && d.GetPropertyValue<int>("SeasonNumber") >= 0)),
|
||||
Times.Exactly(seasons.Count));
|
||||
|
@ -56,10 +56,10 @@ namespace NzbDrone.Core.Test.JobTests
|
|||
Mocker.GetMock<ISeasonRepository>()
|
||||
.Setup(c => c.GetSeasonNumbers(1)).Returns(seasons);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<SeriesSearchJob>().Start(notification, new { SeriesId = 1 });
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
Mocker.GetMock<SeasonSearchJob>().Verify(c => c.Start(notification, new { SeriesId = 1, SeasonNumber = It.IsAny<int>() }),
|
||||
Times.Never());
|
||||
|
|
|
@ -55,10 +55,10 @@ namespace NzbDrone.Core.Test.MediaFileTests
|
|||
.Setup(e => e.BuildFilePath(It.IsAny<Series>(), fakeEpisode.First().SeasonNumber, filename, ".avi"))
|
||||
.Returns(fi);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Subject.MoveEpisodeFile(file, false);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeNull();
|
||||
}
|
||||
|
||||
|
|
|
@ -219,7 +219,7 @@
|
|||
<Compile Include="ProviderTests\XemCommunicationProviderTests\GetSceneTvdbMappingsFixture.cs" />
|
||||
<Compile Include="ProviderTests\XemCommunicationProviderTests\GetXemSeriesIdsFixture.cs" />
|
||||
<Compile Include="Services\ParseErrorServiceFixture.cs" />
|
||||
<Compile Include="HelperTests\SortHelperFixture.cs" />
|
||||
<Compile Include="HelperTests\SortHelperTest.cs" />
|
||||
<Compile Include="DecisionEngineTests\AcceptableSizeSpecificationFixture.cs" />
|
||||
<Compile Include="Qualities\QualitySizeServiceFixture.cs" />
|
||||
<Compile Include="ProviderTests\MisnamedProviderTest.cs" />
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
@ -17,7 +17,7 @@ using NzbDrone.Core.Test.Framework;
|
|||
namespace NzbDrone.Core.Test.OrganizerTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class MediaFileProvider_GetNewFilenameTest : CoreTest<FileNameBuilder>
|
||||
{
|
||||
private Series _series;
|
||||
|
@ -45,7 +45,7 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
[Test]
|
||||
public void GetNewFilename_Series_Episode_Quality_S01E05_Dash()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -62,17 +62,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.EpisodeNumber = 6)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual("South Park - S15E06 - City Sushi [HDTV-720p]", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNewFilename_Episode_Quality_1x05_Dash()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -89,17 +89,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.EpisodeNumber = 6)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual("15x06 - City Sushi [HDTV-720p]", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNewFilename_Series_Quality_01x05_Space()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -116,17 +116,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.EpisodeNumber = 6)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual("South Park 05x06 [HDTV-720p]", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNewFilename_Series_s01e05_Space()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -144,17 +144,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.EpisodeNumber = 6)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual("South Park s05e06", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNewFilename_Series_Episode_s01e05_Periods()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -171,17 +171,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.EpisodeNumber = 6)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual("South.Park.s05e06.City.Sushi", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNewFilename_Series_Episode_s01e05_Dash_Periods_Quality()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -198,17 +198,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.EpisodeNumber = 6)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual("South.Park.-.s05e06.-.City.Sushi.[HDTV-720p]", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNewFilename_S01E05_Dash()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -226,17 +226,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.EpisodeNumber = 6)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual("S15E06", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNewFilename_multi_Series_Episode_Quality_S01E05_Scene_Dash()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -260,17 +260,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.EpisodeNumber = 24)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual("The Mentalist - S03E23-E24 - Strawberries and Cream [HDTV-720p]", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNewFilename_multi_Episode_Quality_1x05_Repeat_Dash()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -294,17 +294,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.EpisodeNumber = 24)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual("3x23x24 - Strawberries and Cream [HDTV-720p]", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNewFilename_multi_Episode_Quality_01x05_Repeat_Space()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -328,17 +328,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.EpisodeNumber = 24)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual("3x23x24 Strawberries and Cream [HDTV-720p]", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNewFilename_multi_Series_Episode_s01e05_Duplicate_Period()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -362,17 +362,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.EpisodeNumber = 24)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual("The.Mentalist.s03e23.s03e24.Strawberries.and.Cream", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNewFilename_multi_Series_S01E05_Extend_Dash_Period()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -396,17 +396,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.EpisodeNumber = 24)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual("The.Mentalist.-.S03E23-24", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNewFilename_multi_1x05_Repeat_Dash_Period()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -430,17 +430,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.EpisodeNumber = 24)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual("3x23x24", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNewFilename_should_append_proper_when_proper_and_append_quality_is_true()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
nameSpecification.IncludeSeriesName = true;
|
||||
nameSpecification.IncludeEpisodeTitle = true;
|
||||
|
@ -455,17 +455,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.EpisodeNumber = 6)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = true });
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p] [Proper]");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNewFilename_should_not_append_proper_when_not_proper_and_append_quality_is_true()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
nameSpecification.IncludeSeriesName = true;
|
||||
nameSpecification.IncludeEpisodeTitle = true;
|
||||
|
@ -480,17 +480,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.EpisodeNumber = 6)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p]");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNewFilename_should_not_append_proper_when_proper_and_append_quality_is_false()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
nameSpecification.IncludeSeriesName = true;
|
||||
nameSpecification.IncludeEpisodeTitle = true;
|
||||
|
@ -505,17 +505,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.EpisodeNumber = 6)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = true });
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().Be("South Park - S15E06 - City Sushi");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNewFilename_should_order_multiple_episode_files_in_numerical_order()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
nameSpecification.IncludeSeriesName = true;
|
||||
nameSpecification.IncludeEpisodeTitle = true;
|
||||
|
@ -537,17 +537,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.EpisodeNumber = 7)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNewFilename_Series_Episode_Quality_S01E05_Period()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -564,17 +564,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.EpisodeNumber = 6)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual("South Park.S15E06.City Sushi [HDTV-720p]", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNewFilename_Episode_Quality_1x05_Period()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -591,17 +591,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.EpisodeNumber = 6)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual("15x06.City Sushi [HDTV-720p]", result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNewFilename_UseSceneName_when_sceneName_isNull()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
nameSpecification.IncludeSeriesName = false;
|
||||
nameSpecification.IncludeEpisodeTitle = true;
|
||||
|
@ -622,17 +622,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.Path = @"C:\Test\TV\30 Rock - S01E01 - Test")
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, episodeFile);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().Be(Path.GetFileNameWithoutExtension(episodeFile.Path));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNewFilename_UseSceneName_when_sceneName_isNotNull()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
nameSpecification.IncludeSeriesName = false;
|
||||
nameSpecification.IncludeEpisodeTitle = true;
|
||||
|
@ -653,17 +653,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.Path = @"C:\Test\TV\30 Rock - S01E01 - Test")
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episode }, _series, episodeFile);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().Be(episodeFile.SceneName);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_only_have_one_episodeTitle_when_episode_titles_are_the_same()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
nameSpecification.IncludeSeriesName = true;
|
||||
nameSpecification.IncludeEpisodeTitle = true;
|
||||
|
@ -685,17 +685,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.EpisodeNumber = 7)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_have_two_episodeTitles_when_episode_titles_are_not_the_same()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
nameSpecification.IncludeSeriesName = true;
|
||||
nameSpecification.IncludeEpisodeTitle = true;
|
||||
|
@ -717,17 +717,17 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.EpisodeNumber = 7)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episode2, episode }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().Be("30 Rock - S06E06-E07 - Hello + World");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_have_two_episodeTitles_when_distinct_count_is_two()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
nameSpecification.IncludeSeriesName = true;
|
||||
nameSpecification.IncludeEpisodeTitle = true;
|
||||
|
@ -755,10 +755,10 @@ namespace NzbDrone.Core.Test.OrganizerTests
|
|||
.With(e => e.EpisodeNumber = 8)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
string result = Subject.BuildFilename(new List<Episode> { episode, episode2, episode3 }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false });
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().Be("30 Rock - S06E06-E07-E08 - Hello + World");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
@ -12,7 +12,7 @@ using NzbDrone.Test.Common;
|
|||
|
||||
namespace NzbDrone.Core.Test.ParserTests
|
||||
{
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
[TestFixture]
|
||||
public class ParserFixture : CoreTest
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
@ -10,7 +10,7 @@ using NzbDrone.Core.Test.Framework;
|
|||
namespace NzbDrone.Core.Test.ParserTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class QualityParserFixture : CoreTest
|
||||
{
|
||||
public static object[] QualityParserCases =
|
||||
|
|
|
@ -21,29 +21,29 @@ using NzbDrone.Test.Common.AutoMoq;
|
|||
|
||||
namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||
{
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class CleanUpDropFolderFixture : CoreTest
|
||||
{
|
||||
[Test]
|
||||
public void should_do_nothing_if_no_files_are_found()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var folder = @"C:\Test\DropDir\The Office";
|
||||
|
||||
Mocker.GetMock<DiskProvider>().Setup(s => s.GetFiles(folder, SearchOption.AllDirectories))
|
||||
.Returns(new string[0]);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<DiskScanProvider>().CleanUpDropFolder(folder);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<IMediaFileService>().Verify(v => v.GetFileByPath(It.IsAny<string>()), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_do_nothing_if_no_conflicting_files_are_found()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var folder = @"C:\Test\DropDir\The Office";
|
||||
var filename = Path.Combine(folder, "NotAProblem.avi");
|
||||
|
||||
|
@ -58,10 +58,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
|||
Mocker.GetMock<IMediaFileService>().Setup(s => s.GetFileByPath(filename))
|
||||
.Returns(() => null);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<DiskScanProvider>().CleanUpDropFolder(folder);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<IMediaFileService>().Verify(v => v.GetFileByPath(filename), Times.Once());
|
||||
Mocker.GetMock<ISeriesRepository>().Verify(v => v.Get(It.IsAny<int>()), Times.Never());
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
|||
[Test]
|
||||
public void should_move_file_if_a_conflict_is_found()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var folder = @"C:\Test\DropDir\The Office";
|
||||
var filename = Path.Combine(folder, "Problem.avi");
|
||||
var seriesId = 12345;
|
||||
|
@ -119,10 +119,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
|||
|
||||
Mocker.GetMock<DiskProvider>().Setup(s => s.MoveFile(episodeFile.Path, newFilePath));
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<DiskScanProvider>().CleanUpDropFolder(folder);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<IMediaFileService>().Verify(v => v.GetFileByPath(filename), Times.Once());
|
||||
Mocker.GetMock<DiskProvider>().Verify(v => v.MoveFile(filename.NormalizePath(), newFilePath), Times.Once());
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ using NzbDrone.Test.Common.AutoMoq;
|
|||
|
||||
namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||
{
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class GetVideoFilesFixture : CoreTest
|
||||
{
|
||||
private string[] _files;
|
||||
|
|
|
@ -18,7 +18,7 @@ using NzbDrone.Test.Common.AutoMoq;
|
|||
|
||||
namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||
{
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class ImportFileFixture : CoreTest
|
||||
{
|
||||
public static object[] ImportTestCases =
|
||||
|
@ -70,10 +70,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
|||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, newFile);
|
||||
|
||||
//Assert
|
||||
|
||||
VerifyFileImport(result, Mocker, fakeEpisode, SIZE);
|
||||
|
||||
}
|
||||
|
@ -97,10 +97,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
|||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, newFile);
|
||||
|
||||
//Assert
|
||||
|
||||
VerifyFileImport(result, Mocker, fakeEpisode, SIZE);
|
||||
}
|
||||
|
||||
|
@ -127,10 +127,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
|||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
||||
|
||||
//Assert
|
||||
|
||||
VerifySkipImport(result, Mocker);
|
||||
}
|
||||
|
||||
|
@ -146,10 +146,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
|||
|
||||
With80MBFile();
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
||||
|
||||
//Assert
|
||||
|
||||
VerifySkipImport(result, Mocker);
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
@ -168,10 +168,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
|||
|
||||
With80MBFile();
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
||||
|
||||
//Assert
|
||||
|
||||
VerifySkipImport(result, Mocker);
|
||||
}
|
||||
|
||||
|
@ -199,10 +199,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
|||
.Returns(new List<Episode>());
|
||||
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
||||
|
||||
//Assert
|
||||
|
||||
VerifySkipImport(result, Mocker);
|
||||
}
|
||||
|
||||
|
@ -228,10 +228,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
|||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode });
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
||||
|
||||
//Assert
|
||||
|
||||
VerifyFileImport(result, Mocker, fakeEpisode, SIZE);
|
||||
Mocker.GetMock<RecycleBinProvider>().Verify(p => p.DeleteFile(It.IsAny<string>()), Times.Once());
|
||||
}
|
||||
|
@ -260,10 +260,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
|||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(fakeEpisodes);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
||||
|
||||
//Assert
|
||||
|
||||
VerifyFileImport(result, Mocker, fakeEpisodes[0], SIZE);
|
||||
Mocker.GetMock<RecycleBinProvider>().Verify(p => p.DeleteFile(It.IsAny<string>()), Times.Once());
|
||||
}
|
||||
|
@ -293,10 +293,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
|||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(fakeEpisodes);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
||||
|
||||
//Assert
|
||||
|
||||
VerifySkipImport(result, Mocker);
|
||||
}
|
||||
|
||||
|
@ -331,10 +331,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
|||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode1, fakeEpisode2 });
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
||||
|
||||
//Assert
|
||||
|
||||
VerifyFileImport(result, Mocker, fakeEpisode1, SIZE);
|
||||
Mocker.GetMock<RecycleBinProvider>().Verify(p => p.DeleteFile(It.IsAny<string>()), Times.Exactly(2));
|
||||
}
|
||||
|
@ -360,10 +360,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
|||
Mocker.GetMock<IEpisodeService>()
|
||||
.Setup(e => e.GetEpisodesByParseResult(It.IsAny<EpisodeParseResult>())).Returns(new List<Episode> { fakeEpisode});
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<DiskScanProvider>().ImportFile(fakeSeries, fileName);
|
||||
|
||||
//Assert
|
||||
|
||||
VerifyFileImport(result, Mocker, fakeEpisode, SIZE);
|
||||
Mocker.GetMock<DiskProvider>().Verify(p => p.DeleteFile(It.IsAny<string>()), Times.Never());
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ using NzbDrone.Test.Common;
|
|||
|
||||
namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
||||
{
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class ScanFixture : CoreTest
|
||||
{
|
||||
[Test]
|
||||
|
@ -44,7 +44,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
|||
[Test]
|
||||
public void series_should_log_warning_if_path_doesnt_exist_on_disk()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
|
@ -56,10 +56,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests
|
|||
.Setup(c => c.FolderExists(series.Path))
|
||||
.Returns(false);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<DiskScanProvider>().Scan(series, series.Path);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -21,13 +21,13 @@ using NzbDrone.Test.Common;
|
|||
namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class QueueFixture : CoreTest
|
||||
{
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
//Setup
|
||||
|
||||
string sabHost = "192.168.5.55";
|
||||
int sabPort = 2222;
|
||||
string apikey = "5c770e3197e4fe763423ee7c392c25d1";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -21,7 +21,7 @@ using NzbDrone.Test.Common;
|
|||
namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class SabProviderFixture : CoreTest
|
||||
{
|
||||
private const string url = "http://www.nzbclub.com/nzb_download.aspx?mid=1950232";
|
||||
|
@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
|||
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=0&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
|
||||
.Returns("{ \"status\": true }");
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<SabProvider>().DownloadNzb(url, title, false).Should().BeTrue();
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
|||
{
|
||||
WithFailResponse();
|
||||
|
||||
//Act
|
||||
|
||||
Assert.Throws<ApplicationException>(() => Mocker.Resolve<SabProvider>().DownloadNzb(url, title, false).Should().BeFalse());
|
||||
//ExceptionVerification.ExpectedErrors(1);
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
|||
[Test]
|
||||
public void should_be_able_to_get_categories_when_config_is_passed_in()
|
||||
{
|
||||
//Setup
|
||||
|
||||
const string host = "192.168.5.22";
|
||||
const int port = 1111;
|
||||
const string apikey = "5c770e3197e4fe763423ee7c392c25d2";
|
||||
|
@ -83,10 +83,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
|||
.Setup(s => s.DownloadString("http://192.168.5.22:1111/api?mode=get_cats&output=json&apikey=5c770e3197e4fe763423ee7c392c25d2&ma_username=admin2&ma_password=pass2"))
|
||||
.Returns(ReadAllText("Files","Categories_json.txt"));
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<SabProvider>().GetCategories(host, port, apikey, username, password);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().NotBeNull();
|
||||
result.categories.Should().NotBeEmpty();
|
||||
}
|
||||
|
@ -98,10 +98,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
|||
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=get_cats&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
|
||||
.Returns(ReadAllText("Files","Categories_json.txt"));
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<SabProvider>().GetCategories();
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().NotBeNull();
|
||||
result.categories.Should().NotBeEmpty();
|
||||
}
|
||||
|
@ -113,10 +113,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
|||
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=history&output=json&start=0&limit=0&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
|
||||
.Returns(ReadAllText("Files", "History.txt"));
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<SabProvider>().GetHistory();
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().HaveCount(1);
|
||||
}
|
||||
|
||||
|
@ -127,10 +127,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
|||
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=history&output=json&start=0&limit=0&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
|
||||
.Returns(ReadAllText("Files","HistoryEmpty.txt"));
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<SabProvider>().GetHistory();
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeEmpty();
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
|||
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=history&output=json&start=0&limit=0&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
|
||||
.Returns(ReadAllText("Files","JsonError.txt"));
|
||||
|
||||
//Act
|
||||
|
||||
Assert.Throws<ApplicationException>(() => Mocker.Resolve<SabProvider>().GetHistory(), "API Key Incorrect");
|
||||
}
|
||||
|
||||
|
@ -154,10 +154,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
|||
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=version&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
|
||||
.Returns(response);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<SabProvider>().GetVersion("192.168.5.55", 2222, "5c770e3197e4fe763423ee7c392c25d1", "admin", "pass");
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().NotBeNull();
|
||||
result.Version.Should().Be("0.6.9");
|
||||
}
|
||||
|
@ -171,10 +171,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
|||
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=version&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
|
||||
.Returns(response);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<SabProvider>().GetVersion();
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().NotBeNull();
|
||||
result.Version.Should().Be("0.6.9");
|
||||
}
|
||||
|
@ -188,10 +188,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
|||
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=version&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
|
||||
.Returns(response);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<SabProvider>().Test("192.168.5.55", 2222, "5c770e3197e4fe763423ee7c392c25d1", "admin", "pass");
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().Be("0.6.9");
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
|||
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=1&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
|
||||
.Returns("{ \"status\": true }");
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<SabProvider>().DownloadNzb(url, title, true).Should().BeTrue();
|
||||
|
||||
Mocker.GetMock<HttpProvider>()
|
||||
|
@ -242,7 +242,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests
|
|||
.Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=-1&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass"))
|
||||
.Returns("{ \"status\": true }");
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<SabProvider>().DownloadNzb(url, title, false).Should().BeTrue();
|
||||
|
||||
Mocker.GetMock<HttpProvider>()
|
||||
|
|
|
@ -14,7 +14,7 @@ using NzbDrone.Core.Tv;
|
|||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
|
||||
namespace NzbDrone.Core.Test.ProviderTests.DownloadProviderTests
|
||||
{
|
||||
|
@ -79,11 +79,11 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadProviderTests
|
|||
|
||||
var parseResult = SetupParseResult();
|
||||
|
||||
//Act
|
||||
|
||||
Subject.DownloadReport(parseResult);
|
||||
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<SabProvider>()
|
||||
.Verify(s => s.DownloadNzb(It.IsAny<String>(), It.IsAny<String>(), true), Times.Once());
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using Moq;
|
||||
|
@ -12,13 +12,13 @@ using NzbDrone.Test.Common.AutoMoq;
|
|||
namespace NzbDrone.Core.Test.ProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class EventClientProviderTest : CoreTest
|
||||
{
|
||||
[Test]
|
||||
public void SendNotification_true()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
var header = "NzbDrone Test";
|
||||
|
@ -28,17 +28,17 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
var fakeUdp = Mocker.GetMock<UdpProvider>();
|
||||
fakeUdp.Setup(s => s.Send(address, UdpProvider.PacketType.Notification, It.IsAny<byte[]>())).Returns(true);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<EventClientProvider>().SendNotification(header, message, IconType.Jpeg, "NzbDrone.jpg", address);
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual(true, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SendNotification_false()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
var header = "NzbDrone Test";
|
||||
|
@ -48,17 +48,17 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
var fakeUdp = Mocker.GetMock<UdpProvider>();
|
||||
fakeUdp.Setup(s => s.Send(address, UdpProvider.PacketType.Notification, It.IsAny<byte[]>())).Returns(false);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<EventClientProvider>().SendNotification(header, message, IconType.Jpeg, "NzbDrone.jpg", address);
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual(false, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SendAction_Update_true()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
var path = @"C:\Test\TV\30 Rock";
|
||||
|
@ -68,17 +68,17 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
var fakeUdp = Mocker.GetMock<UdpProvider>();
|
||||
fakeUdp.Setup(s => s.Send(address, UdpProvider.PacketType.Action, It.IsAny<byte[]>())).Returns(true);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<EventClientProvider>().SendAction(address, ActionType.ExecBuiltin, command);
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual(true, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SendAction_Update_false()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
var path = @"C:\Test\TV\30 Rock";
|
||||
|
@ -88,10 +88,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
var fakeUdp = Mocker.GetMock<UdpProvider>();
|
||||
fakeUdp.Setup(s => s.Send(address, UdpProvider.PacketType.Action, It.IsAny<byte[]>())).Returns(false);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<EventClientProvider>().SendAction(address, ActionType.ExecBuiltin, command);
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual(false, result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ using NzbDrone.Core.Providers;
|
|||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common.AutoMoq;
|
||||
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
|
||||
namespace NzbDrone.Core.Test.ProviderTests
|
||||
{
|
||||
|
@ -22,52 +22,52 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void Register_should_add_new_application_to_local_growl_instance()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<GrowlProvider>().Register("localhost", 23053, "");
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNotification_should_send_a_message_to_local_growl_instance()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<GrowlProvider>().TestNotification("localhost", 23053, "");
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OnGrab_should_send_a_message_to_local_growl_instance()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<GrowlProvider>().SendNotification("Episode Grabbed", "Series Title - 1x05 - Episode Title", "GRAB", "localhost", 23053, "");
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OnDownload_should_send_a_message_to_local_growl_instance()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<GrowlProvider>().SendNotification("Episode Downloaded", "Series Title - 1x05 - Episode Title", "DOWNLOAD", "localhost", 23053, "");
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void no_misnamed_files()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
.With(s => s.Title = "SeriesTitle")
|
||||
.Build();
|
||||
|
@ -57,18 +57,18 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
.Setup(c => c.BuildFilename(new List<Episode> { episodes[1] }, It.IsAny<Series>(), episodeFiles[1]))
|
||||
.Returns("Title2");
|
||||
|
||||
//Act
|
||||
|
||||
var totalItems = 0;
|
||||
var misnamedEpisodes = Mocker.Resolve<MisnamedProvider>().MisnamedFiles(1, 10, out totalItems);
|
||||
|
||||
//Assert
|
||||
|
||||
misnamedEpisodes.Should().HaveCount(0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void all_misnamed_files()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
.With(s => s.Title = "SeriesTitle")
|
||||
.Build();
|
||||
|
@ -104,18 +104,18 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
.Setup(c => c.BuildFilename(new List<Episode> { episodes[1] }, It.IsAny<Series>(), episodeFiles[1]))
|
||||
.Returns("New Title 2");
|
||||
|
||||
//Act
|
||||
|
||||
var totalItems = 0;
|
||||
var misnamedEpisodes = Mocker.Resolve<MisnamedProvider>().MisnamedFiles(1, 10, out totalItems);
|
||||
|
||||
//Assert
|
||||
|
||||
misnamedEpisodes.Should().HaveCount(2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void one_misnamed_file()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
.With(s => s.Title = "SeriesTitle")
|
||||
.Build();
|
||||
|
@ -151,11 +151,11 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
.Setup(c => c.BuildFilename(new List<Episode> { episodes[1] }, It.IsAny<Series>(), episodeFiles[1]))
|
||||
.Returns("Title2");
|
||||
|
||||
//Act
|
||||
|
||||
var totalItems = 0;
|
||||
var misnamedEpisodes = Mocker.Resolve<MisnamedProvider>().MisnamedFiles(1, 10, out totalItems);
|
||||
|
||||
//Assert
|
||||
|
||||
misnamedEpisodes.Should().HaveCount(1);
|
||||
misnamedEpisodes[0].CurrentName.Should().Be("Title1");
|
||||
misnamedEpisodes[0].ProperName.Should().Be("New Title 1");
|
||||
|
@ -164,7 +164,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void misnamed_multi_episode_file()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
.With(s => s.Title = "SeriesTitle")
|
||||
.Build();
|
||||
|
@ -200,11 +200,11 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
.Setup(c => c.BuildFilename(new List<Episode> { episodes[2] }, It.IsAny<Series>(), episodeFiles[1]))
|
||||
.Returns("Title2");
|
||||
|
||||
//Act
|
||||
|
||||
var totalItems = 0;
|
||||
var misnamedEpisodes = Mocker.Resolve<MisnamedProvider>().MisnamedFiles(1, 10, out totalItems);
|
||||
|
||||
//Assert
|
||||
|
||||
misnamedEpisodes.Should().HaveCount(1);
|
||||
misnamedEpisodes[0].CurrentName.Should().Be("Title1");
|
||||
misnamedEpisodes[0].ProperName.Should().Be("New Title 1");
|
||||
|
@ -213,7 +213,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void no_misnamed_multi_episode_file()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
.With(s => s.Title = "SeriesTitle")
|
||||
.Build();
|
||||
|
@ -249,11 +249,11 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
.Setup(c => c.BuildFilename(new List<Episode> { episodes[2] }, It.IsAny<Series>(), episodeFiles[1]))
|
||||
.Returns("Title2");
|
||||
|
||||
//Act
|
||||
|
||||
var totalItems = 0;
|
||||
var misnamedEpisodes = Mocker.Resolve<MisnamedProvider>().MisnamedFiles(1, 10, out totalItems);
|
||||
|
||||
//Assert
|
||||
|
||||
misnamedEpisodes.Should().HaveCount(0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
@ -22,7 +22,7 @@ using NzbDrone.Test.Common.AutoMoq;
|
|||
namespace NzbDrone.Core.Test.ProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class PlexProviderTest : CoreTest
|
||||
{
|
||||
private void WithSingleClient()
|
||||
|
@ -49,7 +49,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void GetSectionKeys_should_return_single_section_key_when_only_one_show_section()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
var response = "<MediaContainer size=\"1\" mediaTagPrefix=\"/system/bundle/media/flags/\" mediaTagVersion=\"1329809559\" title1=\"Plex Library\" identifier=\"com.plexapp.plugins.library\"><Directory refreshing=\"0\" key=\"5\" type=\"show\" title=\"TV Shows\" art=\"/:/resources/show-fanart.jpg\" agent=\"com.plexapp.agents.thetvdb\" scanner=\"Plex Series Scanner\" language=\"en\" updatedAt=\"1329810350\"><Location path=\"C:/Test/TV\"/></Directory></MediaContainer>";
|
||||
Stream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(response));
|
||||
|
@ -57,10 +57,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
Mocker.GetMock<HttpProvider>().Setup(s => s.DownloadStream("http://localhost:32400/library/sections", null))
|
||||
.Returns(stream);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<PlexProvider>().GetSectionKeys("localhost:32400");
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().HaveCount(1);
|
||||
result.First().Should().Be(5);
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void GetSectionKeys_should_return_single_section_key_when_only_one_show_section_with_other_sections()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
var response = "<MediaContainer size=\"1\" mediaTagPrefix=\"/system/bundle/media/flags/\" mediaTagVersion=\"1329809559\" title1=\"Plex Library\" identifier=\"com.plexapp.plugins.library\"><Directory refreshing=\"0\" key=\"5\" type=\"show\" title=\"TV Shows\" art=\"/:/resources/show-fanart.jpg\" agent=\"com.plexapp.agents.thetvdb\" scanner=\"Plex Series Scanner\" language=\"en\" updatedAt=\"1329810350\"><Location path=\"C:/Test/TV\"/></Directory><Directory refreshing=\"0\" key=\"7\" type=\"movie\" title=\"TV Shows\" art=\"/:/resources/show-fanart.jpg\" agent=\"com.plexapp.agents.thetvdb\" scanner=\"Plex Series Scanner\" language=\"en\" updatedAt=\"1329810350\"><Location path=\"C:/Test/TV\"/></Directory></MediaContainer>";
|
||||
Stream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(response));
|
||||
|
@ -76,10 +76,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
Mocker.GetMock<HttpProvider>().Setup(s => s.DownloadStream("http://localhost:32400/library/sections", null))
|
||||
.Returns(stream);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<PlexProvider>().GetSectionKeys("localhost:32400");
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().HaveCount(1);
|
||||
result.First().Should().Be(5);
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void GetSectionKeys_should_return_multiple_section_keys_when_there_are_multiple_show_sections()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
var response = "<MediaContainer size=\"1\" mediaTagPrefix=\"/system/bundle/media/flags/\" mediaTagVersion=\"1329809559\" title1=\"Plex Library\" identifier=\"com.plexapp.plugins.library\"><Directory refreshing=\"0\" key=\"5\" type=\"show\" title=\"TV Shows\" art=\"/:/resources/show-fanart.jpg\" agent=\"com.plexapp.agents.thetvdb\" scanner=\"Plex Series Scanner\" language=\"en\" updatedAt=\"1329810350\"><Location path=\"C:/Test/TV\"/></Directory><Directory refreshing=\"0\" key=\"6\" type=\"show\" title=\"TV Shows\" art=\"/:/resources/show-fanart.jpg\" agent=\"com.plexapp.agents.thetvdb\" scanner=\"Plex Series Scanner\" language=\"en\" updatedAt=\"1329810350\"><Location path=\"C:/Test/TV\"/></Directory></MediaContainer>";
|
||||
Stream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(response));
|
||||
|
@ -95,10 +95,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
Mocker.GetMock<HttpProvider>().Setup(s => s.DownloadStream("http://localhost:32400/library/sections", null))
|
||||
.Returns(stream);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<PlexProvider>().GetSectionKeys("localhost:32400");
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().HaveCount(2);
|
||||
result.First().Should().Be(5);
|
||||
result.Last().Should().Be(6);
|
||||
|
@ -107,7 +107,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void UpdateSection_should_update_section()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
var response = "";
|
||||
Stream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(response));
|
||||
|
@ -115,17 +115,17 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
Mocker.GetMock<HttpProvider>().Setup(s => s.DownloadString("http://localhost:32400/library/sections/5/refresh"))
|
||||
.Returns(response);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<PlexProvider>().UpdateSection("localhost:32400", 5);
|
||||
|
||||
//Assert
|
||||
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Notify_should_send_notification_for_single_client_when_only_one_is_configured()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithSingleClient();
|
||||
|
||||
const string header = "Test Header";
|
||||
|
@ -137,17 +137,17 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
fakeHttp.Setup(s => s.DownloadString(expectedUrl))
|
||||
.Returns("ok");
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<PlexProvider>().Notify(header, message);
|
||||
|
||||
//Assert
|
||||
|
||||
fakeHttp.Verify(v => v.DownloadString(expectedUrl), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Notify_should_send_notifcation_to_all_configured_clients()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithMultipleClients();
|
||||
|
||||
const string header = "Test Header";
|
||||
|
@ -157,17 +157,17 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
fakeHttp.Setup(s => s.DownloadString(It.IsAny<string>()))
|
||||
.Returns("ok");
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<PlexProvider>().Notify(header, message);
|
||||
|
||||
//Assert
|
||||
|
||||
fakeHttp.Verify(v => v.DownloadString(It.IsAny<string>()), Times.Exactly(2));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Notify_should_send_notification_with_credentials_when_configured()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithSingleClient();
|
||||
WithClientCredentials();
|
||||
|
||||
|
@ -180,17 +180,17 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
fakeHttp.Setup(s => s.DownloadString(expectedUrl, "plex", "plex"))
|
||||
.Returns("ok");
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<PlexProvider>().Notify(header, message);
|
||||
|
||||
//Assert
|
||||
|
||||
fakeHttp.Verify(v => v.DownloadString(expectedUrl, "plex", "plex"), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Notify_should_send_notification_with_credentials_when_configured_for_all_clients()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithMultipleClients();
|
||||
WithClientCredentials();
|
||||
|
||||
|
@ -201,10 +201,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
fakeHttp.Setup(s => s.DownloadString(It.IsAny<string>(), "plex", "plex"))
|
||||
.Returns("ok");
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<PlexProvider>().Notify(header, message);
|
||||
|
||||
//Assert
|
||||
|
||||
fakeHttp.Verify(v => v.DownloadString(It.IsAny<string>(), "plex", "plex"), Times.Exactly(2));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
@ -12,7 +12,7 @@ using NzbDrone.Core.Test.Framework;
|
|||
namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class GetFolderNameWithStatusFixture : CoreTest
|
||||
{
|
||||
[TestCase(@"c:\_NzbDrone_InvalidEpisode_Title", @"c:\_UnknownSeries_Title", PostDownloadStatusType.UnknownSeries)]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable InconsistentNaming
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
@ -99,11 +99,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
var droppedFolder = new DirectoryInfo(TempFolder + "\\_test\\");
|
||||
droppedFolder.Create();
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>().Setup(s => s.GetByTitle(It.IsAny<String>())).Returns<Series>(null).Verifiable();
|
||||
Mocker.Resolve<PostDownloadProvider>().ProcessDownload(droppedFolder);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
ExceptionVerification.IgnoreWarns();
|
||||
}
|
||||
|
@ -118,10 +118,10 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
|
||||
Mocker.GetMock<ISeriesRepository>().Setup(s => s.GetByTitle("office")).Returns<Series>(null).Verifiable();
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<PostDownloadProvider>().ProcessDownload(droppedFolder);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
ExceptionVerification.IgnoreWarns();
|
||||
}
|
||||
|
@ -160,20 +160,20 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
[Ignore("Disabled tagging")]
|
||||
public void when_series_isnt_found_folder_should_be_tagged_as_unknown_series()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
WithOldWrite();
|
||||
var droppedFolder = new DirectoryInfo(@"C:\Test\Unsorted TV\The Office - S01E01 - Episode Title");
|
||||
|
||||
var taggedFolder = @"C:\Test\Unsorted TV\_UnknownSeries_The Office - S01E01 - Episode Title";
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>().Setup(s => s.GetByTitle("office")).Returns<Series>(null);
|
||||
Mocker.GetMock<DiskProvider>().Setup(s => s.MoveDirectory(droppedFolder.FullName, taggedFolder));
|
||||
|
||||
Mocker.Resolve<PostDownloadProvider>().ProcessDownload(droppedFolder);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
[Ignore("Disabled tagging")]
|
||||
public void when_no_files_are_imported_folder_should_be_tagged_with_parse_error()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
WithOldWrite();
|
||||
var droppedFolder = new DirectoryInfo(@"C:\Test\Unsorted TV\The Office - S01E01 - Episode Title");
|
||||
|
@ -193,7 +193,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
.With(s => s.Title = "The Office")
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>().Setup(s => s.GetByTitle("office")).Returns(fakeSeries);
|
||||
Mocker.GetMock<DiskScanProvider>().Setup(s => s.Scan(fakeSeries, droppedFolder.FullName)).Returns(new List<EpisodeFile>());
|
||||
Mocker.GetMock<DiskProvider>().Setup(s => s.MoveDirectory(droppedFolder.FullName, taggedFolder));
|
||||
|
@ -202,7 +202,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
|
||||
Mocker.Resolve<PostDownloadProvider>().ProcessDownload(droppedFolder);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
[Ignore("Disabled tagging")]
|
||||
public void when_no_file_are_imported_and_folder_size_isnt_small_enought_folder_should_be_tagged_unknown()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
WithOldWrite();
|
||||
var droppedFolder = new DirectoryInfo(@"C:\Test\Unsorted TV\The Office - Season 01");
|
||||
|
@ -228,7 +228,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
.With(f => f.SeriesId = fakeSeries.Id)
|
||||
.Build().ToList();
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>().Setup(s => s.GetByTitle("office")).Returns(fakeSeries);
|
||||
Mocker.GetMock<DiskProvider>().Setup(s => s.MoveDirectory(droppedFolder.FullName, taggedFolder));
|
||||
Mocker.GetMock<DiskProvider>().Setup(s => s.GetDirectorySize(droppedFolder.FullName)).Returns(Constants.IgnoreFileSize + 10.Megabytes());
|
||||
|
@ -237,7 +237,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
|
||||
Mocker.Resolve<PostDownloadProvider>().ProcessDownload(droppedFolder);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
@ -248,17 +248,17 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
[TestCase("\\Test\\_UnknownSeries_The Office - S01E01 - Episode Title")]
|
||||
public void folder_shouldnt_be_tagged_with_same_tag_again(string path)
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
var droppedFolder = new DirectoryInfo(TempFolder + path);
|
||||
droppedFolder.Create();
|
||||
WithOldWrite();
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>().Setup(s => s.GetByTitle(It.IsAny<String>())).Returns<Series>(null);
|
||||
Mocker.Resolve<PostDownloadProvider>().ProcessDownload(droppedFolder);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
Mocker.GetMock<DiskProvider>().Verify(c => c.MoveDirectory(It.IsAny<string>(), It.IsAny<string>()), Times.Never());
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
[Test]
|
||||
public void folder_should_not_be_tagged_if_existing_tag_is_diffrent()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithOldWrite();
|
||||
var droppedFolder = new DirectoryInfo(TempFolder + @"\_UnknownEpisode_The Office - S01E01 - Episode Title");
|
||||
droppedFolder.Create();
|
||||
|
@ -276,10 +276,10 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
|
||||
Mocker.GetMock<ISeriesRepository>().Setup(s => s.GetByTitle(It.IsAny<String>())).Returns<Series>(null);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<PostDownloadProvider>().ProcessDownload(droppedFolder);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
Mocker.GetMock<DiskProvider>().Verify(c => c.MoveDirectory(droppedFolder.FullName, taggedFolder), Times.Never());
|
||||
ExceptionVerification.IgnoreWarns();
|
||||
|
@ -288,7 +288,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
[Test]
|
||||
public void when_files_are_imported_and_folder_is_small_enough_dir_should_be_deleted()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
WithLotsOfFreeDiskSpace();
|
||||
|
||||
|
@ -304,10 +304,10 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
Mocker.GetMock<DiskProvider>().Setup(s => s.FolderExists(fakeSeries.Path)).Returns(true);
|
||||
Mocker.GetMock<DiskProvider>().Setup(s => s.IsFolderLocked(droppedFolder.FullName)).Returns(false);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<PostDownloadProvider>().ProcessDownload(droppedFolder);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
}
|
||||
|
||||
|
@ -326,10 +326,10 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
Mocker.GetMock<DiskProvider>().Setup(s => s.FolderExists(fakeSeries.Path)).Returns(true);
|
||||
Mocker.GetMock<DiskScanProvider>().Setup(s => s.Scan(fakeSeries, droppedFolder.FullName)).Returns(fakeEpisodeFiles);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<PostDownloadProvider>().ProcessDownload(droppedFolder);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<IMoveEpisodeFiles>().Verify(c => c.MoveEpisodeFile(It.IsAny<EpisodeFile>(), true),
|
||||
Times.Exactly(fakeEpisodeFiles.Count));
|
||||
Mocker.VerifyAllMocks();
|
||||
|
@ -361,11 +361,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
.Setup(s => s.FreeDiskSpace(series.Path))
|
||||
.Returns(9);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<PostDownloadProvider>().ProcessDownload(downloadName);
|
||||
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<DiskScanProvider>().Verify(c => c.Scan(series, downloadName.FullName), Times.Never());
|
||||
ExceptionVerification.ExpectedErrors(1);
|
||||
}
|
||||
|
@ -388,11 +388,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
.Setup(s => s.GetDirectorySize(downloadName.FullName))
|
||||
.Returns(8);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<PostDownloadProvider>().ProcessDownload(downloadName);
|
||||
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<DiskScanProvider>().Verify(c => c.Scan(fakeSeries, downloadName.FullName), Times.Once());
|
||||
}
|
||||
|
||||
|
@ -412,11 +412,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
.Setup(s => s.FreeDiskSpace(It.IsAny<string>()))
|
||||
.Returns(10);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<PostDownloadProvider>().ProcessDownload(downloadName);
|
||||
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<DiskScanProvider>().Verify(c => c.Scan(fakeSeries, downloadName.FullName), Times.Once());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable InconsistentNaming
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
@ -78,10 +78,10 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
.Setup(c => c.FolderExists(It.IsAny<String>()))
|
||||
.Returns(true);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<PostDownloadProvider>().ProcessDropFolder(@"C:\drop\");
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<DiskScanProvider>().Verify(c => c.Scan(It.IsAny<Series>(), subFolders[0]), Times.Once());
|
||||
Mocker.GetMock<DiskScanProvider>().Verify(c => c.Scan(It.IsAny<Series>(), subFolders[1]), Times.Never());
|
||||
Mocker.GetMock<DiskScanProvider>().Verify(c => c.Scan(It.IsAny<Series>(), subFolders[2]), Times.Once());
|
||||
|
@ -121,11 +121,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
.Setup(c => c.FolderExists(It.IsAny<String>()))
|
||||
.Returns(true);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<PostDownloadProvider>().ProcessDropFolder(@"C:\drop\");
|
||||
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<DiskScanProvider>().Verify(c => c.ImportFile(It.IsAny<Series>(), It.IsAny<String>()), Times.Exactly(4));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable InconsistentNaming
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
@ -96,11 +96,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
|
||||
var file = Path.Combine(TempFolder, "test.avi");
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>().Setup(s => s.GetByTitle(It.IsAny<String>())).Returns<Series>(null).Verifiable();
|
||||
Mocker.Resolve<PostDownloadProvider>().ProcessVideoFile(file);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>().Verify(s => s.GetByTitle(It.IsAny<String>()), Times.Once());
|
||||
ExceptionVerification.IgnoreWarns();
|
||||
}
|
||||
|
@ -112,11 +112,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
|
||||
var file = Path.Combine(TempFolder, "test.avi");
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.GetMock<ISeriesRepository>().Setup(s => s.GetByTitle(It.IsAny<String>())).Returns<Series>(null);
|
||||
Mocker.Resolve<PostDownloadProvider>().ProcessVideoFile(file);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<DiskProvider>().Verify(s => s.GetSize(It.IsAny<String>()), Times.Never());
|
||||
ExceptionVerification.IgnoreWarns();
|
||||
}
|
||||
|
@ -132,10 +132,10 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
WithValidSeries();
|
||||
WithImportedFile(file);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<PostDownloadProvider>().ProcessVideoFile(file);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<IMoveEpisodeFiles>().Verify(s => s.MoveEpisodeFile(It.IsAny<EpisodeFile>(), true), Times.Once());
|
||||
ExceptionVerification.IgnoreWarns();
|
||||
}
|
||||
|
@ -166,11 +166,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
.Setup(s => s.FolderExists(series.Path))
|
||||
.Returns(true);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<PostDownloadProvider>().ProcessVideoFile(downloadName);
|
||||
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<DiskScanProvider>().Verify(c => c.ImportFile(series, downloadName), Times.Never());
|
||||
ExceptionVerification.ExpectedErrors(1);
|
||||
}
|
||||
|
@ -191,11 +191,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
.Setup(s => s.GetSize(downloadName))
|
||||
.Returns(8);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<PostDownloadProvider>().ProcessVideoFile(downloadName);
|
||||
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<DiskScanProvider>().Verify(c => c.ImportFile(fakeSeries, downloadName), Times.Once());
|
||||
}
|
||||
|
||||
|
@ -214,11 +214,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
.Setup(s => s.FreeDiskSpace(It.IsAny<string>()))
|
||||
.Returns(10);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<PostDownloadProvider>().ProcessVideoFile(downloadName);
|
||||
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<DiskScanProvider>().Verify(c => c.ImportFile(fakeSeries, downloadName), Times.Once());
|
||||
}
|
||||
|
||||
|
@ -233,11 +233,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
.Setup(s => s.FolderExists(fakeSeries.Path))
|
||||
.Returns(false);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<PostDownloadProvider>().ProcessVideoFile(downloadName);
|
||||
|
||||
|
||||
//Assert
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
}
|
||||
|
||||
|
@ -252,11 +252,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests
|
|||
.Setup(s => s.IsFileLocked(It.Is<FileInfo>(f => f.FullName == downloadName)))
|
||||
.Returns(true);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<PostDownloadProvider>().ProcessVideoFile(downloadName);
|
||||
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<DiskScanProvider>().Verify(c => c.ImportFile(fakeSeries, downloadName), Times.Never());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ using NzbDrone.Test.Common;
|
|||
using NzbDrone.Test.Common.AutoMoq;
|
||||
using Prowlin;
|
||||
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
|
||||
namespace NzbDrone.Core.Test.ProviderTests
|
||||
{
|
||||
|
@ -28,26 +28,26 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void Verify_should_return_true_for_a_valid_apiKey()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<ProwlProvider>().Verify(_apiKey);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Verify_should_return_false_for_an_invalid_apiKey()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<ProwlProvider>().Verify(_badApiKey);
|
||||
|
||||
//Assert
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
result.Should().BeFalse();
|
||||
}
|
||||
|
@ -55,26 +55,26 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void SendNotification_should_return_true_for_a_valid_apiKey()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<ProwlProvider>().SendNotification("NzbDrone Test", "This is a test message from NzbDrone", _apiKey);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SendNotification_should_return_false_for_an_invalid_apiKey()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<ProwlProvider>().SendNotification("NzbDrone Test", "This is a test message from NzbDrone", _badApiKey);
|
||||
|
||||
//Assert
|
||||
|
||||
ExceptionVerification.ExpectedWarns(1);
|
||||
result.Should().BeFalse();
|
||||
}
|
||||
|
@ -82,65 +82,65 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void SendNotification_should_alert_with_high_priority()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<ProwlProvider>().SendNotification("NzbDrone Test", "This is a test message from NzbDrone (High)", _apiKey, NotificationPriority.High);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SendNotification_should_alert_with_VeryLow_priority()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<ProwlProvider>().SendNotification("NzbDrone Test", "This is a test message from NzbDrone (VeryLow)", _apiKey, NotificationPriority.VeryLow);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SendNotification_should_have_a_call_back_url()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<ProwlProvider>().SendNotification("NzbDrone Test", "This is a test message from NzbDrone", _apiKey, NotificationPriority.Normal, "http://www.nzbdrone.com");
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SendNotification_should_return_true_for_two_valid_apiKey()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<ProwlProvider>().SendNotification("NzbDrone Test", "This is a test message from NzbDrone", _apiKey + ", " + _apiKey2);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SendNotification_should_return_true_for_valid_apiKey_with_bad_apiKey()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<ProwlProvider>().SendNotification("NzbDrone Test", "This is a test message from NzbDrone", _apiKey + ", " + _badApiKey);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,26 +1,17 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers;
|
||||
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common.AutoMoq;
|
||||
|
||||
namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class CleanupFixture : CoreTest
|
||||
{
|
||||
private const string RecycleBin = @"C:\Test\RecycleBin";
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -20,7 +20,7 @@ using NzbDrone.Test.Common.AutoMoq;
|
|||
namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class DeleteDirectoryFixture : CoreTest
|
||||
{
|
||||
private void WithRecycleBin()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -20,7 +20,7 @@ using NzbDrone.Test.Common.AutoMoq;
|
|||
namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class DeleteFileFixture : CoreTest
|
||||
{
|
||||
private void WithRecycleBin()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -20,7 +20,7 @@ using NzbDrone.Test.Common.AutoMoq;
|
|||
namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class EmptyFixture : CoreTest
|
||||
{
|
||||
private const string RecycleBin = @"C:\Test\RecycleBin";
|
||||
|
|
|
@ -15,7 +15,7 @@ using NzbDrone.Test.Common;
|
|||
namespace NzbDrone.Core.Test.ProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class SceneMappingProviderTest : DbTest
|
||||
{
|
||||
private const string SceneMappingUrl = "http://services.nzbdrone.com/SceneMapping/Active";
|
||||
|
@ -46,7 +46,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
public void GetSceneName_exists()
|
||||
{
|
||||
|
||||
//Setup
|
||||
|
||||
var fakeMap = Builder<SceneMapping>.CreateNew()
|
||||
.With(f => f.CleanTitle = "laworder")
|
||||
.With(f => f.TvdbId = 12345)
|
||||
|
@ -56,10 +56,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
|
||||
Db.Insert(fakeMap);
|
||||
|
||||
//Act
|
||||
|
||||
var sceneName = Mocker.Resolve<SceneMappingService>().GetSceneName(fakeMap.TvdbId);
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual(fakeMap.SceneName, sceneName);
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
public void GetSeriesId_exists()
|
||||
{
|
||||
|
||||
//Setup
|
||||
|
||||
var fakeMap = Builder<SceneMapping>.CreateNew()
|
||||
.With(f => f.TvdbId = 12345)
|
||||
.With(f => f.SceneName = "Law and Order")
|
||||
|
@ -77,10 +77,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
|
||||
Db.Insert(fakeMap);
|
||||
|
||||
//Act
|
||||
|
||||
var seriesId = Mocker.Resolve<SceneMappingService>().GetTvDbId(fakeMap.CleanTitle);
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual(fakeMap.TvdbId, seriesId);
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
public void GetSceneName_null()
|
||||
{
|
||||
|
||||
//Setup
|
||||
|
||||
var fakeMap = Builder<SceneMapping>.CreateNew()
|
||||
.With(f => f.TvdbId = 12345)
|
||||
.With(f => f.SceneName = "Law and Order")
|
||||
|
@ -98,10 +98,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
|
||||
Db.Insert(fakeMap);
|
||||
|
||||
//Act
|
||||
|
||||
var sceneName = Mocker.Resolve<SceneMappingService>().GetSceneName(54321);
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual(null, sceneName);
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
public void GetSeriesId_null()
|
||||
{
|
||||
|
||||
//Setup
|
||||
|
||||
var fakeMap = Builder<SceneMapping>.CreateNew()
|
||||
.With(f => f.TvdbId = 12345)
|
||||
.With(f => f.SceneName = "Law and Order")
|
||||
|
@ -118,10 +118,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
|
||||
Db.Insert(fakeMap);
|
||||
|
||||
//Act
|
||||
|
||||
var seriesId = Mocker.Resolve<SceneMappingService>().GetTvDbId("notlaworder");
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual(null, seriesId);
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
{
|
||||
//Test that ensures a series with clean names (office, officeus) can be looked up by seriesId
|
||||
|
||||
//Setup
|
||||
|
||||
var fakeMap = Builder<SceneMapping>.CreateNew()
|
||||
.With(f => f.CleanTitle = "office")
|
||||
.With(f => f.TvdbId = 12345)
|
||||
|
@ -150,10 +150,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
Db.Insert(fakeMap);
|
||||
Db.Insert(fakeMap2);
|
||||
|
||||
//Act
|
||||
|
||||
var sceneName = Mocker.Resolve<SceneMappingService>().GetSceneName(fakeMap.TvdbId);
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual(fakeMap.SceneName, sceneName);
|
||||
}
|
||||
|
||||
|
@ -179,17 +179,17 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
{
|
||||
WithValidJson();
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<SceneMappingService>().UpdateMappings();
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.Verify<HttpProvider>(v => v.DownloadString(SceneMappingUrl), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void UpdateMappings_should_overwrite_existing_mappings()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var fakeMap = Builder<SceneMapping>.CreateNew()
|
||||
.With(f => f.TvdbId = 12345)
|
||||
.With(f => f.SceneName = "Law and Order")
|
||||
|
@ -199,17 +199,17 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
WithValidJson();
|
||||
Db.Insert(fakeMap);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<SceneMappingService>().UpdateMappings();
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.Verify<HttpProvider>(v => v.DownloadString(SceneMappingUrl), Times.Once());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void UpdateMappings_should_not_delete_if_csv_download_fails()
|
||||
{
|
||||
//Setup
|
||||
|
||||
var fakeMap = Builder<SceneMapping>.CreateNew()
|
||||
.With(f => f.TvdbId = 12345)
|
||||
.With(f => f.SceneName = "Law and Order")
|
||||
|
@ -219,10 +219,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
WithErrorDownloadingJson();
|
||||
Db.Insert(fakeMap);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<SceneMappingService>().UpdateMappings();
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.Verify<HttpProvider>(v => v.DownloadString(SceneMappingUrl), Times.Once());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Autofac;
|
||||
|
@ -15,7 +13,7 @@ using NzbDrone.Test.Common;
|
|||
namespace NzbDrone.Core.Test.ProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class TvDbProviderTest : CoreTest
|
||||
{
|
||||
private TvDbProxy tvDbProxy;
|
||||
|
@ -56,10 +54,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void no_search_result()
|
||||
{
|
||||
//act
|
||||
|
||||
var result = tvDbProxy.SearchSeries(Guid.NewGuid().ToString());
|
||||
|
||||
//assert
|
||||
|
||||
result.Should().BeEmpty();
|
||||
}
|
||||
|
||||
|
@ -67,11 +65,9 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void none_unique_season_episode_number()
|
||||
{
|
||||
//act
|
||||
|
||||
var result = tvDbProxy.GetEpisodes(75978);//Family guy
|
||||
|
||||
//Asserts that when episodes are grouped by Season/Episode each group contains maximum of
|
||||
//one item.
|
||||
result.GroupBy(e => e.SeasonNumber.ToString("000") + e.EpisodeNumber.ToString("000"))
|
||||
.Max(e => e.Count()).Should().Be(1);
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
@ -16,7 +15,7 @@ using NzbDrone.Test.Common;
|
|||
namespace NzbDrone.Core.Test.ProviderTests.TvRageProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class GetSeriesFixture : CoreTest
|
||||
{
|
||||
private const string showinfo = "http://services.tvrage.com/feeds/showinfo.php?key=NW4v0PSmQIoVmpbASLdD&sid=";
|
||||
|
@ -25,14 +24,14 @@ namespace NzbDrone.Core.Test.ProviderTests.TvRageProviderTests
|
|||
{
|
||||
Mocker.GetMock<HttpProvider>()
|
||||
.Setup(s => s.DownloadStream(It.Is<String>(u => u.StartsWith(showinfo)), null))
|
||||
.Returns(new FileStream(@".\Files\TVRage\SeriesInfo_empty.xml", FileMode.Open, FileAccess.Read, FileShare.Read));
|
||||
.Returns(OpenRead("Files", "TVRage", "SeriesInfo_empty.xml"));
|
||||
}
|
||||
|
||||
private void WithOneResult()
|
||||
{
|
||||
Mocker.GetMock<HttpProvider>()
|
||||
.Setup(s => s.DownloadStream(It.Is<String>(u => u.StartsWith(showinfo)), null))
|
||||
.Returns(new FileStream(@".\Files\TVRage\SeriesInfo_one.xml", FileMode.Open, FileAccess.Read, FileShare.Read));
|
||||
.Returns(OpenRead("Files", "TVRage", "SeriesInfo_one.xml"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -14,7 +14,7 @@ using NzbDrone.Test.Common;
|
|||
namespace NzbDrone.Core.Test.ProviderTests.TvRageProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class GetUtcOffsetFixture : CoreTest
|
||||
{
|
||||
[Test]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -16,7 +16,7 @@ using NzbDrone.Test.Common;
|
|||
namespace NzbDrone.Core.Test.ProviderTests.TvRageProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class SearchSeriesFixture : CoreTest
|
||||
{
|
||||
private const string search = "http://services.tvrage.com/feeds/full_search.php?show=";
|
||||
|
@ -25,21 +25,21 @@ namespace NzbDrone.Core.Test.ProviderTests.TvRageProviderTests
|
|||
{
|
||||
Mocker.GetMock<HttpProvider>()
|
||||
.Setup(s => s.DownloadStream(It.Is<String>(u => u.StartsWith(search)), null))
|
||||
.Returns(new FileStream(@".\Files\TVRage\SearchResults_empty.xml", FileMode.Open, FileAccess.Read, FileShare.Read));
|
||||
.Returns(OpenRead("Files", "TVRage", "SearchResults_empty.xml"));
|
||||
}
|
||||
|
||||
private void WithManyResults()
|
||||
{
|
||||
Mocker.GetMock<HttpProvider>()
|
||||
.Setup(s => s.DownloadStream(It.Is<String>(u => u.StartsWith(search)), null))
|
||||
.Returns(new FileStream(@".\Files\TVRage\SearchResults_many.xml", FileMode.Open, FileAccess.Read, FileShare.Read));
|
||||
.Returns(OpenRead("Files", "TVRage", "SearchResults_many.xml"));
|
||||
}
|
||||
|
||||
private void WithOneResult()
|
||||
{
|
||||
Mocker.GetMock<HttpProvider>()
|
||||
.Setup(s => s.DownloadStream(It.Is<String>(u => u.StartsWith(search)), null))
|
||||
.Returns(new FileStream(@".\Files\TVRage\SearchResults_one.xml", FileMode.Open, FileAccess.Read, FileShare.Read));
|
||||
.Returns(OpenRead("Files", "TVRage", "earchResults_one.xml"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
@ -19,7 +19,7 @@ using NzbDrone.Test.Common.AutoMoq;
|
|||
namespace NzbDrone.Core.Test.ProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class XbmcProviderTest : CoreTest
|
||||
{
|
||||
private string EdenActivePlayers;
|
||||
|
@ -52,42 +52,42 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void JsonError_true()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
var response = "{\"error\":{\"code\":-32601,\"message\":\"Method not found.\"},\"id\":10,\"jsonrpc\":\"2.0\"}";
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<XbmcProvider>().CheckForJsonError(response);
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual(true, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void JsonError_true_empty_response()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
var response = String.Empty;
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<XbmcProvider>().CheckForJsonError(response);
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual(true, result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void JsonError_false()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
var reposnse = "{\"id\":10,\"jsonrpc\":\"2.0\",\"result\":{\"version\":3}}";
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<XbmcProvider>().CheckForJsonError(reposnse);
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual(false, result);
|
||||
}
|
||||
|
||||
|
@ -102,10 +102,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny<string>()))
|
||||
.Returns(message);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<XbmcProvider>().GetJsonVersion("localhost:8080", "xbmc", "xbmc");
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().Be(new XbmcVersion(number));
|
||||
}
|
||||
|
||||
|
@ -122,10 +122,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny<string>()))
|
||||
.Returns(message);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<XbmcProvider>().GetJsonVersion("localhost:8080", "xbmc", "xbmc");
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().Be(new XbmcVersion(major, minor, patch));
|
||||
}
|
||||
|
||||
|
@ -138,10 +138,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny<string>()))
|
||||
.Returns(message);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<XbmcProvider>().GetJsonVersion("localhost:8080", "xbmc", "xbmc");
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().Be(new XbmcVersion(0));
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[TestCase(true, false, true)]
|
||||
public void GetActivePlayersDharma(bool audio, bool picture, bool video)
|
||||
{
|
||||
//Setup
|
||||
|
||||
var message = "{\"id\":10,\"jsonrpc\":\"2.0\",\"result\":{\"audio\":"
|
||||
+ audio.ToString().ToLower()
|
||||
+ ",\"picture\":"
|
||||
|
@ -168,10 +168,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny<string>()))
|
||||
.Returns(message);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<XbmcProvider>().GetActivePlayersDharma("localhost:8080", "xbmc", "xbmc");
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual(audio, result["audio"]);
|
||||
Assert.AreEqual(picture, result["picture"]);
|
||||
Assert.AreEqual(video, result["video"]);
|
||||
|
@ -180,34 +180,34 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void GetActivePlayersEden_should_be_empty_when_no_active_players()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithNoActivePlayers();
|
||||
|
||||
var fakeHttp = Mocker.GetMock<HttpProvider>();
|
||||
fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny<string>()))
|
||||
.Returns(EdenActivePlayers);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<XbmcProvider>().GetActivePlayersEden("localhost:8080", "xbmc", "xbmc");
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeEmpty();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetActivePlayersEden_should_have_active_video_player()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithVideoPlayerActive();
|
||||
|
||||
var fakeHttp = Mocker.GetMock<HttpProvider>();
|
||||
fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny<string>()))
|
||||
.Returns(EdenActivePlayers);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<XbmcProvider>().GetActivePlayersEden("localhost:8080", "xbmc", "xbmc");
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().HaveCount(1);
|
||||
result.First().Type.Should().Be("video");
|
||||
}
|
||||
|
@ -215,17 +215,17 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void GetActivePlayersEden_should_have_active_audio_player()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithAudioPlayerActive();
|
||||
|
||||
var fakeHttp = Mocker.GetMock<HttpProvider>();
|
||||
fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny<string>()))
|
||||
.Returns(EdenActivePlayers);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<XbmcProvider>().GetActivePlayersEden("localhost:8080", "xbmc", "xbmc");
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().HaveCount(1);
|
||||
result.First().Type.Should().Be("audio");
|
||||
}
|
||||
|
@ -233,17 +233,17 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void GetActivePlayersEden_should_have_active_picture_player()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithPicturePlayerActive();
|
||||
|
||||
var fakeHttp = Mocker.GetMock<HttpProvider>();
|
||||
fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny<string>()))
|
||||
.Returns(EdenActivePlayers);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<XbmcProvider>().GetActivePlayersEden("localhost:8080", "xbmc", "xbmc");
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().HaveCount(1);
|
||||
result.First().Type.Should().Be("picture");
|
||||
}
|
||||
|
@ -251,17 +251,17 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void GetActivePlayersEden_should_have_all_players_active()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithAllPlayersActive();
|
||||
|
||||
var fakeHttp = Mocker.GetMock<HttpProvider>();
|
||||
fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny<string>()))
|
||||
.Returns(EdenActivePlayers);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<XbmcProvider>().GetActivePlayersEden("localhost:8080", "xbmc", "xbmc");
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().HaveCount(3);
|
||||
result.Select(a => a.PlayerId).Distinct().Should().HaveCount(3);
|
||||
result.Select(a => a.Type).Distinct().Should().HaveCount(3);
|
||||
|
@ -270,7 +270,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void GetTvShowsJson()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
var message = "{\"id\":10,\"jsonrpc\":\"2.0\",\"result\":{\"limits\":{\"end\":5,\"start\":0,\"total\":5},\"tvshows\":[{\"file\":\"smb://HOMESERVER/TV/7th Heaven/\",\"imdbnumber\":\"73928\",\"label\":\"7th Heaven\",\"tvshowid\":3},{\"file\":\"smb://HOMESERVER/TV/8 Simple Rules/\",\"imdbnumber\":\"78461\",\"label\":\"8 Simple Rules\",\"tvshowid\":4},{\"file\":\"smb://HOMESERVER/TV/24-7 Penguins-Capitals- Road to the NHL Winter Classic/\",\"imdbnumber\":\"213041\",\"label\":\"24/7 Penguins/Capitals: Road to the NHL Winter Classic\",\"tvshowid\":1},{\"file\":\"smb://HOMESERVER/TV/30 Rock/\",\"imdbnumber\":\"79488\",\"label\":\"30 Rock\",\"tvshowid\":2},{\"file\":\"smb://HOMESERVER/TV/90210/\",\"imdbnumber\":\"82716\",\"label\":\"90210\",\"tvshowid\":5}]}}";
|
||||
|
@ -279,10 +279,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny<string>()))
|
||||
.Returns(message);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<XbmcProvider>().GetTvShowsJson("localhost:8080", "xbmc", "xbmc");
|
||||
|
||||
//Assert
|
||||
|
||||
Assert.AreEqual(5, result.Count);
|
||||
result.Should().Contain(s => s.ImdbNumber == 79488);
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void Notify_true()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
var header = "NzbDrone Test";
|
||||
|
@ -303,17 +303,17 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
var fakeEventClient = Mocker.GetMock<EventClientProvider>();
|
||||
fakeEventClient.Setup(s => s.SendNotification(header, message, IconType.Jpeg, "NzbDrone.jpg", "localhost")).Returns(true);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<XbmcProvider>().Notify(header, message);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SendCommand()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
var host = "localhost:8080";
|
||||
|
@ -327,10 +327,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
var fakeHttp = Mocker.GetMock<HttpProvider>();
|
||||
fakeHttp.Setup(s => s.DownloadString(url, username, password)).Returns("Ok\n");
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<XbmcProvider>().SendCommand(host, command, username, username);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
Assert.AreEqual("Ok\n", result);
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void GetXbmcSeriesPath_true()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
var queryResult = @"<xml><record><field>smb://xbmc:xbmc@HOMESERVER/TV/30 Rock/</field></record></xml>";
|
||||
|
@ -360,10 +360,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
</html>");
|
||||
fakeHttp.Setup(s => s.DownloadString(query, username, password)).Returns(queryResult);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<XbmcProvider>().GetXbmcSeriesPath(host, 79488, username, username);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
Assert.AreEqual("smb://xbmc:xbmc@HOMESERVER/TV/30 Rock/", result);
|
||||
}
|
||||
|
@ -371,7 +371,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void GetXbmcSeriesPath_false()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
var queryResult = @"<xml></xml>";
|
||||
|
@ -393,10 +393,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
</html>");
|
||||
fakeHttp.Setup(s => s.DownloadString(query, username, password)).Returns(queryResult);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<XbmcProvider>().GetXbmcSeriesPath(host, 79488, username, username);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
Assert.AreEqual("", result);
|
||||
}
|
||||
|
@ -404,7 +404,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void GetXbmcSeriesPath_special_characters()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
var queryResult = @"<xml><record><field>smb://xbmc:xbmc@HOMESERVER/TV/Law & Order- Special Victims Unit/</field></record></xml>";
|
||||
|
@ -426,10 +426,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
</html>");
|
||||
fakeHttp.Setup(s => s.DownloadString(query, username, password)).Returns(queryResult);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<XbmcProvider>().GetXbmcSeriesPath(host, 79488, username, username);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
result.Should().Be("smb://xbmc:xbmc@HOMESERVER/TV/Law & Order- Special Victims Unit/");
|
||||
}
|
||||
|
@ -437,7 +437,7 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
[Test]
|
||||
public void Clean()
|
||||
{
|
||||
//Setup
|
||||
|
||||
WithStrictMocker();
|
||||
|
||||
var fakeConfig = Mocker.GetMock<IConfigService>();
|
||||
|
@ -446,10 +446,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
var fakeEventClient = Mocker.GetMock<EventClientProvider>();
|
||||
fakeEventClient.Setup(s => s.SendAction("localhost", ActionType.ExecBuiltin, "ExecBuiltIn(CleanLibrary(video))")).Returns(true);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<XbmcProvider>().Clean();
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
}
|
||||
|
||||
|
@ -472,10 +472,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
fakeHttp.Setup(s => s.DownloadString(queryUrl, username, password)).Returns(queryResult);
|
||||
fakeHttp.Setup(s => s.DownloadString(url, username, password));
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<XbmcProvider>().UpdateWithHttp(fakeSeries, host, username, password);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
}
|
||||
|
||||
|
@ -498,17 +498,17 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
fakeHttp.Setup(s => s.DownloadString(queryUrl, username, password)).Returns(queryResult);
|
||||
fakeHttp.Setup(s => s.DownloadString(url, username, password));
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<XbmcProvider>().UpdateWithHttp(fakeSeries, host, username, password);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void UpdateWithJsonBuiltIn_Single()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
var host = "localhost:8080";
|
||||
|
@ -531,17 +531,17 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
|
||||
fakeHttp.Setup(s => s.DownloadString(url, username, password)).Returns("<html><li>OK</html>");
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<XbmcProvider>().UpdateWithJsonExecBuiltIn(fakeSeries, host, username, password);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void UpdateWithJsonBuiltIn_All()
|
||||
{
|
||||
//Setup
|
||||
|
||||
|
||||
|
||||
var host = "localhost:8080";
|
||||
|
@ -567,10 +567,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
//var fakeEventClient = Mocker.GetMock<EventClientProvider>();
|
||||
//fakeEventClient.Setup(s => s.SendAction("localhost", ActionType.ExecBuiltin, "ExecBuiltIn(UpdateLibrary(video))"));
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<XbmcProvider>().UpdateWithJsonExecBuiltIn(fakeSeries, host, username, password);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
|
@ -599,10 +599,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
.Contains("\"params\":{\"directory\":\"smb://HOMESERVER/TV/30Rock/\"}"))))
|
||||
.Returns("{\"id\":55,\"jsonrpc\":\"2.0\",\"result\":\"OK\"}");
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<XbmcProvider>().UpdateWithJsonVideoLibraryScan(fakeSeries, host, username, password);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
|
||||
|
@ -631,10 +631,10 @@ namespace NzbDrone.Core.Test.ProviderTests
|
|||
.Contains("\"params\":{\"directory\":\"smb://HOMESERVER/TV/30Rock/\"}"))))
|
||||
.Returns("{\"id\":55,\"jsonrpc\":\"2.0\",\"result\":\"OK\"}");
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<XbmcProvider>().UpdateWithJsonVideoLibraryScan(fakeSeries, host, username, password);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeTrue();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ using NzbDrone.Test.Common;
|
|||
namespace NzbDrone.Core.Test.ProviderTests.XemCommunicationProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class GetSceneTvdbMappingsFixture : CoreTest
|
||||
{
|
||||
private void WithFailureJson()
|
||||
|
|
|
@ -17,7 +17,7 @@ using NzbDrone.Test.Common;
|
|||
namespace NzbDrone.Core.Test.ProviderTests.XemCommunicationProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class GetXemSeriesIdsFixture : CoreTest
|
||||
{
|
||||
private void WithFailureJson()
|
||||
|
|
|
@ -7,7 +7,7 @@ using NzbDrone.Core.Test.Framework;
|
|||
namespace NzbDrone.Core.Test.Qualities
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class QualityFixture : CoreTest
|
||||
{
|
||||
public static object[] FromIntCases =
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
@ -14,7 +14,7 @@ using NzbDrone.Core.Test.Framework;
|
|||
namespace NzbDrone.Core.Test.Qualities
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class QualityProfileFixture : CoreTest<QualityProfileService>
|
||||
{
|
||||
[Test]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
|
@ -12,7 +12,7 @@ using NzbDrone.Core.Test.Framework;
|
|||
namespace NzbDrone.Core.Test.Qualities
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class QualitySizeServiceFixture : CoreTest<QualitySizeService>
|
||||
{
|
||||
[Test]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -16,7 +16,7 @@ using NzbDrone.Test.Common;
|
|||
namespace NzbDrone.Core.Test.RootFolderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class FreeSpaceOnDrivesFixture : CoreTest<RootFolderService>
|
||||
{
|
||||
[Test]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -15,7 +15,7 @@ using NzbDrone.Core.Test.Framework;
|
|||
namespace NzbDrone.Core.Test.RootFolderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class RootFolderServiceFixture : CoreTest<RootFolderService>
|
||||
{
|
||||
[SetUp]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -23,7 +23,7 @@ using TvdbLib.Data;
|
|||
namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class EpisodeProviderTest : ObjectDbTest
|
||||
{
|
||||
[Test]
|
||||
|
@ -38,10 +38,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
Db.Insert(fakeSeries);
|
||||
Db.InsertMany(fakeEpisodes);
|
||||
|
||||
//Act
|
||||
|
||||
var episode = Mocker.Resolve<EpisodeService>().GetEpisode(1);
|
||||
|
||||
//Assert
|
||||
|
||||
episode.ShouldHave().AllPropertiesBut(e => e.Series, e => e.EpisodeFile).EqualTo(fakeEpisodes.First());
|
||||
episode.Series.ShouldHave().AllPropertiesBut(s => s.EpisodeCount, s => s.EpisodeFileCount, s => s.SeasonCount, s => s.NextAiring).EqualTo(fakeSeries);
|
||||
}
|
||||
|
@ -62,10 +62,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
Db.Insert(fakeSeries);
|
||||
Db.Insert(fakeEpisodes);
|
||||
|
||||
//Act
|
||||
|
||||
var episode = Mocker.Resolve<EpisodeService>().GetEpisode(fakeSeries.Id, 2, 1);
|
||||
|
||||
//Assert
|
||||
|
||||
episode.ShouldHave().AllPropertiesBut(e => e.Series).EqualTo(fakeEpisodes);
|
||||
episode.Series.ShouldHave().AllPropertiesBut(s => s.EpisodeCount, s => s.EpisodeFileCount, s => s.SeasonCount, s => s.NextAiring).EqualTo(fakeSeries);
|
||||
}
|
||||
|
@ -75,10 +75,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
{
|
||||
|
||||
|
||||
//Act
|
||||
|
||||
var episode = Mocker.Resolve<EpisodeService>().GetEpisode(1, 1, 1);
|
||||
|
||||
//Assert
|
||||
|
||||
episode.Should().BeNull();
|
||||
}
|
||||
|
||||
|
@ -96,10 +96,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
Db.InsertMany(fakeEpisodes);
|
||||
Db.Insert(fakeFile);
|
||||
|
||||
//Act
|
||||
|
||||
var episode = Mocker.Resolve<EpisodeService>().GetEpisode(1);
|
||||
|
||||
//Assert
|
||||
|
||||
episode.ShouldHave().AllPropertiesBut(e => e.Series, e => e.EpisodeFile).EqualTo(fakeEpisodes.First());
|
||||
episode.Series.ShouldHave().AllPropertiesBut(s => s.EpisodeCount, s => s.EpisodeFileCount, s => s.SeasonCount, s => s.NextAiring).EqualTo(fakeSeries);
|
||||
episode.EpisodeFile.Should().NotBeNull();
|
||||
|
@ -120,7 +120,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
Db.InsertMany(fakeEpisodes);
|
||||
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().GetEpisode(1);
|
||||
}
|
||||
|
||||
|
@ -141,10 +141,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
Db.Insert(fakeSeries);
|
||||
Db.InsertMany(episodes);
|
||||
|
||||
//Act
|
||||
|
||||
var seasonEposodes = Mocker.Resolve<EpisodeService>().GetEpisodesBySeason(12, 2);
|
||||
|
||||
//Assert
|
||||
|
||||
Db.Fetch<Episode>().Should().HaveCount(10);
|
||||
seasonEposodes.Should().HaveCount(5);
|
||||
}
|
||||
|
@ -174,10 +174,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
.Setup(c => c.GetSeries(seriesId, true, false))
|
||||
.Returns(fakeEpisodes);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
|
||||
var actualCount = Mocker.Resolve<EpisodeService>().GetEpisodeBySeries(seriesId).ToList().Count;
|
||||
Mocker.GetMock<TvDbProvider>().VerifyAll();
|
||||
actualCount.Should().Be(episodeCount);
|
||||
|
@ -209,10 +209,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
.Returns(fakeEpisodes);
|
||||
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
|
||||
var storedEpisodes = Mocker.Resolve<EpisodeService>().GetEpisodeBySeries(seriesId).ToList();
|
||||
storedEpisodes.Should().HaveCount(10);
|
||||
storedEpisodes.Where(e => e.AirDate == null).Should().HaveCount(7);
|
||||
|
@ -249,10 +249,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
.Setup(c => c.GetSeries(seriesId, true, false))
|
||||
.Returns(fakeTvDbEpisodes);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
|
||||
var storedEpisodes = Mocker.Resolve<EpisodeService>().GetEpisodeBySeries(seriesId).ToList();
|
||||
storedEpisodes.Should().HaveCount(1);
|
||||
storedEpisodes.Where(e => e.AirDate == null).Should().HaveCount(1);
|
||||
|
@ -287,10 +287,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
.Returns(fakeEpisodes);
|
||||
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
|
||||
var result = Mocker.Resolve<EpisodeService>().GetEpisodeBySeries(seriesId).ToList();
|
||||
Mocker.GetMock<TvDbProvider>().VerifyAll();
|
||||
result.Should().HaveCount(episodeCount);
|
||||
|
@ -326,10 +326,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
.Returns(fakeEpisodes);
|
||||
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
|
||||
var result = Mocker.Resolve<EpisodeService>().GetEpisodeBySeries(seriesId).ToList();
|
||||
result.Should().HaveCount(episodeCount - 3);
|
||||
result.Should().OnlyContain(c => !string.IsNullOrWhiteSpace(c.Title) || c.AirDate < DateTime.Now);
|
||||
|
@ -364,10 +364,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
.Returns(fakeEpisodes);
|
||||
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
|
||||
var result = Mocker.Resolve<EpisodeService>().GetEpisodeBySeries(seriesId).ToList();
|
||||
result.Should().HaveCount(episodeCount - 3);
|
||||
result.Should().OnlyContain(c => !string.IsNullOrWhiteSpace(c.Title) || c.AirDate < DateTime.Now);
|
||||
|
@ -397,10 +397,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
.Returns(fakeEpisodes);
|
||||
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
|
||||
var result = Mocker.Resolve<EpisodeService>().GetEpisodeBySeries(seriesId).ToList();
|
||||
result.Should().HaveSameCount(fakeEpisodes.Episodes);
|
||||
}
|
||||
|
@ -430,10 +430,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
.Returns(fakeEpisodes);
|
||||
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
|
||||
var result = Mocker.Resolve<EpisodeService>().GetEpisodeBySeries(seriesId).ToList();
|
||||
result.Should().HaveSameCount(fakeEpisodes.Episodes);
|
||||
}
|
||||
|
@ -468,10 +468,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
.Setup(s => s.IsIgnored(seriesId, 0))
|
||||
.Returns(true);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
|
||||
var result = Mocker.Resolve<EpisodeService>().GetEpisodeBySeries(seriesId).ToList();
|
||||
Mocker.GetMock<TvDbProvider>().VerifyAll();
|
||||
result.Should().HaveCount(episodeCount);
|
||||
|
@ -499,10 +499,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
.Returns(currentEpisodes);
|
||||
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<IDatabase>().Verify(c => c.InsertMany(It.Is<IEnumerable<Episode>>(l => l.Count() == 5)), Times.Once());
|
||||
Mocker.GetMock<IDatabase>().Verify(c => c.Update(It.IsAny<IEnumerable<Episode>>()), Times.Never());
|
||||
|
||||
|
@ -533,10 +533,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
.Setup(d => d.Fetch<Episode, Series, EpisodeFile>(It.IsAny<String>(), It.IsAny<Object[]>()))
|
||||
.Returns(currentEpisodes);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<IDatabase>().Verify(c => c.InsertMany(It.Is<IEnumerable<Episode>>(l => l.Count() == 0)), Times.Once());
|
||||
Mocker.GetMock<IDatabase>().Verify(c => c.UpdateMany(It.Is<IEnumerable<Episode>>(l => l.Count() == 5)), Times.Once());
|
||||
Mocker.VerifyAllMocks();
|
||||
|
@ -566,10 +566,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
.Setup(c => c.GetSeries(seriesId, true, false))
|
||||
.Returns(fakeTvDbResult);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
Mocker.GetMock<IDatabase>().Verify(c => c.UpdateMany(fakeEpisodeList), Times.Once());
|
||||
}
|
||||
|
@ -607,10 +607,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
.Setup(d => d.Fetch<Episode, Series, EpisodeFile>(It.IsAny<String>(), It.IsAny<Object[]>()))
|
||||
.Returns(new List<Episode> { localEpisode });
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
Mocker.GetMock<IDatabase>().Verify(c => c.UpdateMany(new List<Episode> { localEpisode }), Times.Once());
|
||||
}
|
||||
|
@ -654,10 +654,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
.Setup(c => c.UpdateMany(It.IsAny<IEnumerable<Episode>>()))
|
||||
.Callback<IEnumerable<Episode>>(ep => updatedEpisodes = ep.ToList());
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
|
||||
updatedEpisodes.Should().HaveSameCount(tvdbSeries.Episodes);
|
||||
updatedEpisodes.Should().OnlyContain(c => c.Id == 99);
|
||||
updatedEpisodes.Should().OnlyContain(c => c.EpisodeFileId == 69);
|
||||
|
@ -703,10 +703,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
.Setup(c => c.UpdateMany(It.IsAny<IEnumerable<Episode>>()))
|
||||
.Callback<IEnumerable<Episode>>(ep => updatedEpisodes = ep.ToList());
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
|
||||
updatedEpisodes.Should().OnlyContain(c => c.EpisodeFileId == 0);
|
||||
}
|
||||
|
||||
|
@ -749,10 +749,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
.Setup(c => c.UpdateMany(It.IsAny<IEnumerable<Episode>>()))
|
||||
.Callback<IEnumerable<Episode>>(ep => updatedEpisodes = ep.ToList());
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
|
||||
updatedEpisodes.Should().OnlyContain(c => c.EpisodeFileId == 0);
|
||||
}
|
||||
|
||||
|
@ -801,10 +801,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
.Setup(s => s.IsIgnored(seriesId, It.IsAny<int>()))
|
||||
.Returns(true);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
|
||||
var result = Mocker.Resolve<EpisodeService>().GetEpisodeBySeries(seriesId).ToList();
|
||||
Mocker.GetMock<TvDbProvider>().VerifyAll();
|
||||
result.Should().HaveCount(episodeCount);
|
||||
|
@ -826,7 +826,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
var seriesRepo = Mocker.Resolve<ISeriesRepository>();
|
||||
|
||||
const int tvDbSeriesId = 71256;
|
||||
//act
|
||||
|
||||
var seriesProvider = Mocker.Resolve<SeriesService>();
|
||||
|
||||
seriesProvider.AddSeries("Test Series", "c:\\test\\", tvDbSeriesId, 1, null);
|
||||
|
@ -836,7 +836,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
var episodeProvider = Mocker.Resolve<EpisodeService>();
|
||||
episodeProvider.RefreshEpisodeInfo(seriesRepo.Get(tvDbSeriesId));
|
||||
|
||||
//assert
|
||||
|
||||
var episodes = episodeProvider.GetEpisodeBySeries(tvDbSeriesId);
|
||||
episodes.Should().NotBeEmpty();
|
||||
}
|
||||
|
@ -846,10 +846,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
{
|
||||
|
||||
|
||||
//Act
|
||||
|
||||
var episode = Mocker.Resolve<EpisodeService>().GetEpisode(1, 1, 1);
|
||||
|
||||
//Assert
|
||||
|
||||
episode.Should().BeNull();
|
||||
}
|
||||
|
||||
|
@ -867,10 +867,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
Db.InsertMany(fakeEpisodes);
|
||||
Db.Insert(fakeFile);
|
||||
|
||||
//Act
|
||||
|
||||
var episode = Mocker.Resolve<EpisodeService>().GetEpisode(1, 1, 1);
|
||||
|
||||
//Assert
|
||||
|
||||
episode.ShouldHave().AllPropertiesBut(e => e.Series, e => e.EpisodeFile).EqualTo(fakeEpisodes.First());
|
||||
episode.Series.ShouldHave().AllPropertiesBut(s => s.EpisodeCount, s => s.EpisodeFileCount, s => s.SeasonCount, s => s.NextAiring).EqualTo(fakeSeries);
|
||||
episode.EpisodeFile.Should().NotBeNull();
|
||||
|
@ -888,10 +888,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
Db.Insert(fakeSeries);
|
||||
Db.InsertMany(fakeEpisodes);
|
||||
|
||||
//Act
|
||||
|
||||
var episode = Mocker.Resolve<EpisodeService>().GetEpisode(1, 1, 1);
|
||||
|
||||
//Assert
|
||||
|
||||
episode.ShouldHave().AllPropertiesBut(e => e.Series).EqualTo(fakeEpisodes.First());
|
||||
episode.Series.ShouldHave().AllPropertiesBut(s => s.EpisodeCount, s => s.EpisodeFileCount, s => s.SeasonCount, s => s.NextAiring).EqualTo(fakeSeries);
|
||||
episode.EpisodeFile.Should().BeNull();
|
||||
|
@ -911,10 +911,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
Db.InsertMany(fakeEpisodes);
|
||||
Db.Insert(fakeFile);
|
||||
|
||||
//Act
|
||||
|
||||
var episode = Mocker.Resolve<EpisodeService>().GetEpisode(1, fakeEpisodes[0].AirDate.Value);
|
||||
|
||||
//Assert
|
||||
|
||||
episode.ShouldHave().AllPropertiesBut(e => e.Series, e => e.EpisodeFile).EqualTo(fakeEpisodes.First());
|
||||
episode.Series.ShouldHave().AllPropertiesBut(s => s.EpisodeCount, s => s.EpisodeFileCount, s => s.SeasonCount, s => s.NextAiring).EqualTo(fakeSeries);
|
||||
episode.EpisodeFile.Should().NotBeNull();
|
||||
|
@ -932,10 +932,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
Db.InsertMany(fakeEpisodes);
|
||||
Db.Insert(fakeSeries);
|
||||
|
||||
//Act
|
||||
|
||||
var episode = Mocker.Resolve<EpisodeService>().GetEpisode(1, fakeEpisodes[0].AirDate.Value);
|
||||
|
||||
//Assert
|
||||
|
||||
episode.ShouldHave().AllPropertiesBut(e => e.Series).EqualTo(fakeEpisodes.First());
|
||||
episode.Series.ShouldHave().AllPropertiesBut(s => s.EpisodeCount, s => s.EpisodeFileCount, s => s.SeasonCount, s => s.NextAiring).EqualTo(fakeSeries);
|
||||
episode.EpisodeFile.Should().BeNull();
|
||||
|
@ -983,10 +983,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
.Setup(s => s.IsIgnored(newEpisode.SeriesId, newEpisode.SeasonNumber))
|
||||
.Returns(true);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().AddEpisode(newEpisode);
|
||||
|
||||
//Assert
|
||||
|
||||
var episodesInDb = Db.Fetch<Episode>(@"SELECT * FROM Episodes");
|
||||
|
||||
episodesInDb.Should().HaveCount(5);
|
||||
|
@ -1017,10 +1017,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
.With(e => e.Ignored = false)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().AddEpisode(newEpisode);
|
||||
|
||||
//Assert
|
||||
|
||||
var episodesInDb = Db.Fetch<Episode>(@"SELECT * FROM Episodes");
|
||||
|
||||
episodesInDb.Should().HaveCount(5);
|
||||
|
@ -1053,10 +1053,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
.With(e => e.Ignored = false)
|
||||
.Build();
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().AddEpisode(newEpisode);
|
||||
|
||||
//Assert
|
||||
|
||||
var episodesInDb = Db.Fetch<Episode>(@"SELECT * FROM Episodes");
|
||||
|
||||
episodesInDb.Should().HaveCount(5);
|
||||
|
@ -1079,10 +1079,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
|
||||
episodes.ForEach(c => Db.Insert(c));
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().SetEpisodeIgnore(1, true);
|
||||
|
||||
//Assert
|
||||
|
||||
var episodesInDb = Db.Fetch<Episode>(@"SELECT * FROM Episodes");
|
||||
|
||||
episodesInDb.Should().HaveCount(4);
|
||||
|
@ -1105,10 +1105,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
|
||||
episodes.ForEach(c => Db.Insert(c));
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().SetEpisodeIgnore(1, false);
|
||||
|
||||
//Assert
|
||||
|
||||
var episodesInDb = Db.Fetch<Episode>(@"SELECT * FROM Episodes");
|
||||
|
||||
episodesInDb.Should().HaveCount(4);
|
||||
|
@ -1150,10 +1150,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
Db.InsertMany(episodes);
|
||||
Db.InsertMany(specials);
|
||||
|
||||
//Act
|
||||
|
||||
var missingFiles = Mocker.Resolve<EpisodeService>().EpisodesWithoutFiles(false);
|
||||
|
||||
//Assert
|
||||
|
||||
missingFiles.Should().HaveCount(1);
|
||||
missingFiles.Where(e => e.EpisodeFileId == 0).Should().HaveCount(1);
|
||||
|
||||
|
@ -1194,10 +1194,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
Db.InsertMany(episodes);
|
||||
Db.InsertMany(specials);
|
||||
|
||||
//Act
|
||||
|
||||
var missingFiles = Mocker.Resolve<EpisodeService>().EpisodesWithoutFiles(true);
|
||||
|
||||
//Assert
|
||||
|
||||
missingFiles.Should().HaveCount(2);
|
||||
missingFiles.Where(e => e.EpisodeFileId == 0).Should().HaveCount(2);
|
||||
|
||||
|
@ -1231,10 +1231,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
Db.Insert(episodeFile);
|
||||
Db.InsertMany(episodes);
|
||||
|
||||
//Act
|
||||
|
||||
var withFiles = Mocker.Resolve<EpisodeService>().EpisodesWithFiles();
|
||||
|
||||
//Assert
|
||||
|
||||
withFiles.Should().HaveCount(2);
|
||||
withFiles.Where(e => e.EpisodeFileId == 0).Should().HaveCount(0);
|
||||
withFiles.Where(e => e.EpisodeFile == null).Should().HaveCount(0);
|
||||
|
@ -1268,10 +1268,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
Db.Insert(series);
|
||||
Db.InsertMany(episodes);
|
||||
|
||||
//Act
|
||||
|
||||
var withFiles = Mocker.Resolve<EpisodeService>().EpisodesWithFiles();
|
||||
|
||||
//Assert
|
||||
|
||||
withFiles.Should().HaveCount(0);
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
|
@ -1296,10 +1296,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
Db.Insert(series);
|
||||
Db.InsertMany(fakeEpisodes);
|
||||
|
||||
//Act
|
||||
|
||||
var episodes = Mocker.Resolve<EpisodeService>().GetEpisodesByFileId(12345);
|
||||
|
||||
//Assert
|
||||
|
||||
episodes.Should().HaveCount(2);
|
||||
Mocker.VerifyAllMocks();
|
||||
}
|
||||
|
@ -1322,10 +1322,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
Db.Insert(series);
|
||||
Db.Insert(fakeEpisode);
|
||||
|
||||
//Act
|
||||
|
||||
var episodes = Mocker.Resolve<EpisodeService>().GetEpisodesByFileId(12345);
|
||||
|
||||
//Assert
|
||||
|
||||
episodes.Should().HaveCount(1);
|
||||
episodes.First().ShouldHave().AllPropertiesBut(e => e.Series).EqualTo(fakeEpisode);
|
||||
Mocker.VerifyAllMocks();
|
||||
|
@ -1344,10 +1344,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
|
||||
Db.InsertMany(fakeEpisodes);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<EpisodeService>().IsFirstOrLastEpisodeOfSeason(10, 1, 5);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeFalse();
|
||||
}
|
||||
|
||||
|
@ -1364,10 +1364,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
|
||||
Db.InsertMany(fakeEpisodes);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<EpisodeService>().IsFirstOrLastEpisodeOfSeason(10, 1, 1);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeFalse();
|
||||
}
|
||||
|
||||
|
@ -1384,10 +1384,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
|
||||
Db.InsertMany(fakeEpisodes);
|
||||
|
||||
//Act
|
||||
|
||||
var result = Mocker.Resolve<EpisodeService>().IsFirstOrLastEpisodeOfSeason(10, 1, 10);
|
||||
|
||||
//Assert
|
||||
|
||||
result.Should().BeFalse();
|
||||
}
|
||||
|
||||
|
@ -1418,10 +1418,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
|
||||
Mocker.GetMock<ISeriesRepository>().Setup(s => s.GetByTitle("officeus")).Returns(fakeSeries);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().SetPostDownloadStatus(fakeEpisodes.Select(e => e.Id).ToList(), postDownloadStatus);
|
||||
|
||||
//Assert
|
||||
|
||||
var result = Db.Fetch<Episode>();
|
||||
result.Where(e => e.PostDownloadStatus == postDownloadStatus).Count().Should().Be(episodeCount);
|
||||
}
|
||||
|
@ -1450,10 +1450,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
|
||||
Mocker.GetMock<ISeriesRepository>().Setup(s => s.GetByTitle("officeus")).Returns(fakeSeries);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().SetPostDownloadStatus(new List<int> { 300 }, postDownloadStatus);
|
||||
|
||||
//Assert
|
||||
|
||||
var result = Db.Fetch<Episode>();
|
||||
result.Where(e => e.PostDownloadStatus == postDownloadStatus).Count().Should().Be(0);
|
||||
}
|
||||
|
@ -1501,10 +1501,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
.Setup(c => c.GetSeries(seriesId, true, false))
|
||||
.Returns(tvdbSeries);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<EpisodeService>().RefreshEpisodeInfo(fakeSeries);
|
||||
|
||||
//Assert
|
||||
|
||||
var result = Mocker.Resolve<EpisodeService>().GetEpisodeBySeries(seriesId).ToList();
|
||||
result.Should().HaveCount(episodeCount);
|
||||
result.Where(e => e.Ignored).Should().HaveCount(episodeCount - 1);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -15,7 +15,7 @@ using NzbDrone.Test.Common;
|
|||
namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class EpisodeProviderTest_GetEpisodesByParseResult : ObjectDbTest
|
||||
{
|
||||
private IEpisodeService episodeService;
|
||||
|
@ -160,9 +160,9 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
[Test]
|
||||
public void GetEpisodeParseResult_should_return_empty_list_if_episode_list_is_null()
|
||||
{
|
||||
//Act
|
||||
|
||||
var episodes = episodeService.GetEpisodesByParseResult(new EpisodeParseResult());
|
||||
//Assert
|
||||
|
||||
episodes.Should().NotBeNull();
|
||||
episodes.Should().BeEmpty();
|
||||
}
|
||||
|
@ -170,9 +170,9 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
[Test]
|
||||
public void GetEpisodeParseResult_should_return_empty_list_if_episode_list_is_empty()
|
||||
{
|
||||
//Act
|
||||
|
||||
var episodes = episodeService.GetEpisodesByParseResult(new EpisodeParseResult { EpisodeNumbers = new List<int>() });
|
||||
//Assert
|
||||
|
||||
episodes.Should().NotBeNull();
|
||||
episodes.Should().BeEmpty();
|
||||
}
|
||||
|
@ -184,10 +184,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
Db.Insert(fakeSeries);
|
||||
Db.Insert(fakeDailyEpisode);
|
||||
|
||||
//Act
|
||||
|
||||
var episodes = episodeService.GetEpisodesByParseResult(new EpisodeParseResult { AirDate = DateTime.Today, Series = fakeDailySeries });
|
||||
|
||||
//Assert
|
||||
|
||||
episodes.Should().HaveCount(1);
|
||||
VerifyEpisode(episodes[0], fakeDailyEpisode);
|
||||
|
||||
|
@ -199,7 +199,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
|||
{
|
||||
var episodes = episodeService.GetEpisodesByParseResult(new EpisodeParseResult { AirDate = DateTime.Today, Series = fakeDailySeries });
|
||||
|
||||
//Assert
|
||||
|
||||
episodes.Should().HaveCount(0);
|
||||
Db.Fetch<Episode>().Should().HaveCount(0);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System.Linq;
|
||||
using FizzWare.NBuilder;
|
||||
|
@ -10,7 +10,7 @@ using NzbDrone.Core.Test.Framework;
|
|||
namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class GetEpisodeBySceneNumberFixture : DbTest
|
||||
{
|
||||
private Series _series;
|
||||
|
|
|
@ -8,7 +8,7 @@ using NzbDrone.Core.Test.Framework;
|
|||
namespace NzbDrone.Core.Test.TvTests
|
||||
{
|
||||
[TestFixture]
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
public class QualityModelFixture : CoreTest
|
||||
{
|
||||
[Test]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable RedundantUsingDirective
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
|
@ -57,10 +57,10 @@ namespace NzbDrone.Update.Test
|
|||
Mocker.GetMock<ProcessProvider>().Setup(c => c.GetProcessById(12))
|
||||
.Returns(new ProcessInfo() { StartPath = ProcessPath });
|
||||
|
||||
//Act
|
||||
|
||||
_program.Start(new[] { "12", "" });
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<UpdateProvider>().Verify(c => c.Start(@"C:\NzbDrone"), Times.Once());
|
||||
}
|
||||
|
||||
|
|
|
@ -59,10 +59,10 @@ namespace NzbDrone.Update.Test
|
|||
WithInstalledService();
|
||||
WithServiceRunning(true);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<UpdateProvider>().Start(TARGET_FOLDER);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<ServiceProvider>().Verify(c => c.Stop(ServiceProvider.NZBDRONE_SERVICE_NAME), Times.Once());
|
||||
}
|
||||
|
||||
|
@ -72,20 +72,20 @@ namespace NzbDrone.Update.Test
|
|||
WithInstalledService();
|
||||
WithServiceRunning(false);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<UpdateProvider>().Start(TARGET_FOLDER);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<ServiceProvider>().Verify(c => c.Stop(ServiceProvider.NZBDRONE_SERVICE_NAME), Times.Never());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_stop_nzbdrone_service_if_service_isnt_installed()
|
||||
{
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<UpdateProvider>().Start(TARGET_FOLDER);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<ServiceProvider>().Verify(c => c.Stop(It.IsAny<string>()), Times.Never());
|
||||
}
|
||||
|
||||
|
@ -98,10 +98,10 @@ namespace NzbDrone.Update.Test
|
|||
.Setup(c => c.GetProcessByName(ProcessProvider.NzbDroneProccessName))
|
||||
.Returns(proccesses);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<UpdateProvider>().Start(TARGET_FOLDER);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<ProcessProvider>().Verify(c => c.Kill(proccesses[0].Id), Times.Once());
|
||||
Mocker.GetMock<ProcessProvider>().Verify(c => c.Kill(proccesses[1].Id), Times.Once());
|
||||
}
|
||||
|
@ -113,10 +113,10 @@ namespace NzbDrone.Update.Test
|
|||
.Setup(c => c.GetProcessByName(ProcessProvider.NzbDroneProccessName))
|
||||
.Returns(new List<ProcessInfo>());
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<UpdateProvider>().Start(TARGET_FOLDER);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<ProcessProvider>().Verify(c => c.Kill(It.IsAny<int>()), Times.Never());
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ namespace NzbDrone.Update.Test
|
|||
{
|
||||
Mocker.Resolve<UpdateProvider>().Start(TARGET_FOLDER);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<IHostController>().Verify(c => c.StopServer(), Times.Once());
|
||||
}
|
||||
|
||||
|
@ -157,10 +157,10 @@ namespace NzbDrone.Update.Test
|
|||
.Setup(c => c.CopyDirectory(UPDATE_FOLDER, TARGET_FOLDER))
|
||||
.Throws(new IOException());
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<UpdateProvider>().Start(TARGET_FOLDER);
|
||||
|
||||
//Assert
|
||||
|
||||
Mocker.GetMock<DiskProvider>()
|
||||
.Verify(c => c.CopyDirectory(BACKUP_FOLDER, TARGET_FOLDER), Times.Once());
|
||||
ExceptionVerification.ExpectedFatals(1);
|
||||
|
@ -172,10 +172,10 @@ namespace NzbDrone.Update.Test
|
|||
WithInstalledService();
|
||||
WithServiceRunning(true);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<UpdateProvider>().Start(TARGET_FOLDER);
|
||||
|
||||
//Assert
|
||||
|
||||
VerifyServiceRestart();
|
||||
}
|
||||
|
||||
|
@ -185,10 +185,10 @@ namespace NzbDrone.Update.Test
|
|||
WithInstalledService();
|
||||
WithServiceRunning(false);
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<UpdateProvider>().Start(TARGET_FOLDER);
|
||||
|
||||
//Assert
|
||||
|
||||
VerifyProcessRestart();
|
||||
}
|
||||
|
||||
|
@ -202,10 +202,10 @@ namespace NzbDrone.Update.Test
|
|||
.Setup(c => c.CopyDirectory(UPDATE_FOLDER, TARGET_FOLDER))
|
||||
.Throws(new IOException());
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<UpdateProvider>().Start(TARGET_FOLDER);
|
||||
|
||||
//Assert
|
||||
|
||||
VerifyServiceRestart();
|
||||
ExceptionVerification.ExpectedFatals(1);
|
||||
}
|
||||
|
@ -220,10 +220,10 @@ namespace NzbDrone.Update.Test
|
|||
.Setup(c => c.CopyDirectory(UPDATE_FOLDER, TARGET_FOLDER))
|
||||
.Throws(new IOException());
|
||||
|
||||
//Act
|
||||
|
||||
Mocker.Resolve<UpdateProvider>().Start(TARGET_FOLDER);
|
||||
|
||||
//Assert
|
||||
|
||||
VerifyProcessRestart();
|
||||
ExceptionVerification.ExpectedFatals(1);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// ReSharper disable InconsistentNaming
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
|
|
Loading…
Reference in New Issue