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