From a221994cd73e1aa79d72066b583775c0c5476284 Mon Sep 17 00:00:00 2001 From: Keivan Beigi Date: Thu, 28 Mar 2013 15:07:09 -0700 Subject: [PATCH] test clean up. --- NzbDrone.App.Test/IISProviderFixture.cs | 4 +- .../ConfigFileProviderTest.cs | 2 +- NzbDrone.Common.Test/DiskProviderFixture.cs | 16 +- .../EnviromentProviderTest.cs | 2 +- NzbDrone.Common.Test/ProcessProviderTests.cs | 4 +- ...portingService_ReportParseError_Fixture.cs | 2 +- NzbDrone.Common.Test/ServiceProviderTests.cs | 14 +- NzbDrone.Common.Test/WebClientTests.cs | 2 +- .../Configuration/ConfigServiceFixture.cs | 4 +- .../AcceptableSizeSpecificationFixture.cs | 64 +++--- ...AllowedReleaseGroupSpecificationFixture.cs | 4 +- .../CustomStartDateSpecificationFixture.cs | 4 +- .../LanguageSpecificationFixture.cs | 4 +- .../MonitoredEpisodeSpecificationFixture.cs | 4 +- ...ityAllowedByProfileSpecificationFixture.cs | 4 +- .../QualityUpgradeSpecificationFixture.cs | 4 +- .../RetentionSpecificationFixture.cs | 4 +- .../UpgradeDiskSpecificationFixture.cs | 4 +- .../UpgradeHistorySpecificationFixture.cs | 2 +- NzbDrone.Core.Test/EpisodeParseResultTest.cs | 2 +- NzbDrone.Core.Test/EpisodeStatusTest.cs | 2 +- NzbDrone.Core.Test/FluentTest.cs | 58 +++--- NzbDrone.Core.Test/Framework/TestDbHelper.cs | 2 +- ...SortHelperFixture.cs => SortHelperTest.cs} | 13 +- .../ConvertToDayOfWeekFixture.cs | 4 +- .../XElementHelperTests/ConvertToTFixture.cs | 4 +- .../ProcessResultsFixture.cs | 16 +- .../IndexerTests/IndexerFixture.cs | 14 +- .../IndexerTests/NzbxFixture.cs | 12 +- .../Indexers/IndexerServiceTest.cs | 4 +- .../Indexers/NewznabServiceTest.cs | 2 +- .../JobTests/AppUpdateJobFixture.cs | 30 +-- .../JobTests/BacklogSearchJobTest.cs | 54 ++--- .../JobTests/DiskScanJobTest.cs | 8 +- .../JobTests/ImportNewSeriesJobTest.cs | 12 +- .../JobTests/JobRepositoryFixture.cs | 2 +- .../JobTests/RecentBacklogSearchJobTest.cs | 30 +-- NzbDrone.Core.Test/JobTests/RssSyncJobTest.cs | 2 +- .../JobTests/SeasonSearchJobTest.cs | 18 +- .../JobTests/SeriesSearchJobTest.cs | 10 +- .../MediaFileTests/EpisodeFileMoverFixture.cs | 4 +- NzbDrone.Core.Test/NzbDrone.Core.Test.csproj | 2 +- .../OrganizerTests/GetNewFilenameFixture.cs | 148 +++++++------- .../ParserTests/ParserFixture.cs | 4 +- .../ParserTests/QualityParserFixture.cs | 4 +- .../CleanUpDropFolderFixture.cs | 20 +- .../GetVideoFilesFixture.cs | 2 +- .../ImportFileFixture.cs | 46 ++--- .../DiskScanProviderTests/ScanFixture.cs | 8 +- .../SabProviderTests/QueueFixture.cs | 6 +- .../SabProviderTests/SabProviderFixture.cs | 44 ++--- .../DownloadProviderFixture.cs | 6 +- .../ProviderTests/EventClientProviderTest.cs | 28 +-- .../ProviderTests/GrowlProviderTest.cs | 26 +-- .../ProviderTests/MisnamedProviderTest.cs | 30 +-- .../ProviderTests/PlexProviderTest.cs | 52 ++--- .../GetFolderNameWithStatusFixture.cs | 4 +- .../ProcessDownloadFixture.cs | 62 +++--- .../ProcessDropDirectoryFixture.cs | 10 +- .../ProcessVideoFileFixture.cs | 34 ++-- .../ProviderTests/ProwlProviderTest.cs | 56 +++--- .../RecycleBinProviderTests/CleanupFixture.cs | 13 +- .../DeleteDirectoryFixture.cs | 4 +- .../DeleteFileFixture.cs | 4 +- .../RecycleBinProviderTests/EmptyFixture.cs | 4 +- .../ProviderTests/SceneMappingProviderTest.cs | 48 ++--- .../ProviderTests/TvDbProviderTest.cs | 14 +- .../TvRageProviderTests/GetSeriesFixture.cs | 9 +- .../GetUtcOffsetFixture.cs | 4 +- .../SearchSeriesFixture.cs | 10 +- .../ProviderTests/XbmcProviderTest.cs | 140 ++++++------- .../GetSceneTvdbMappingsFixture.cs | 2 +- .../GetXemSeriesIdsFixture.cs | 2 +- .../Qualities/QualityFixture.cs | 2 +- .../Qualities/QualityProfileFixture.cs | 4 +- .../Qualities/QualitySizeServiceFixture.cs | 4 +- .../FreeSpaceOnDrivesFixture.cs | 4 +- .../RootFolderServiceFixture.cs | 4 +- .../EpisodeProviderTest.cs | 186 +++++++++--------- ...deProviderTest_GetEpisodesByParseResult.cs | 18 +- .../GetEpisodeBySceneNumberFixture.cs | 4 +- .../TvTests/QualityModelFixture.cs | 2 +- .../TvTests/SeasonProviderTest.cs | 2 +- NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs | 2 +- .../Unity/AutoMockingBuilderStrategy.cs | 2 +- .../Unity/AutoMockingContainerExtension.cs | 2 +- NzbDrone.Test.Common/ExceptionVerification.cs | 2 +- NzbDrone.Update.Test/ProgramFixture.cs | 4 +- .../UpdateProviderStartFixture.cs | 42 ++-- .../UpdateProviderVerifyFixture.cs | 2 +- 90 files changed, 779 insertions(+), 804 deletions(-) rename NzbDrone.Core.Test/HelperTests/{SortHelperFixture.cs => SortHelperTest.cs} (74%) diff --git a/NzbDrone.App.Test/IISProviderFixture.cs b/NzbDrone.App.Test/IISProviderFixture.cs index b63e378cc..70f663b1b 100644 --- a/NzbDrone.App.Test/IISProviderFixture.cs +++ b/NzbDrone.App.Test/IISProviderFixture.cs @@ -41,10 +41,10 @@ // .Setup(c => c.Start(It.IsAny())) // .Returns(dummy); -// //act +// // Mocker.Resolve().StartServer(); -// //assert +// // Mocker.Resolve().IISProcessId.Should().Be(dummy.Id); // } diff --git a/NzbDrone.Common.Test/ConfigFileProviderTest.cs b/NzbDrone.Common.Test/ConfigFileProviderTest.cs index fa7e33a93..f2b87233d 100644 --- a/NzbDrone.Common.Test/ConfigFileProviderTest.cs +++ b/NzbDrone.Common.Test/ConfigFileProviderTest.cs @@ -10,7 +10,7 @@ using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Common.Test { [TestFixture] - // ReSharper disable InconsistentNaming + public class ConfigFileProviderTest : TestBase { [SetUp] diff --git a/NzbDrone.Common.Test/DiskProviderFixture.cs b/NzbDrone.Common.Test/DiskProviderFixture.cs index 469cc77ab..d3de043c6 100644 --- a/NzbDrone.Common.Test/DiskProviderFixture.cs +++ b/NzbDrone.Common.Test/DiskProviderFixture.cs @@ -1,6 +1,4 @@ -// ReSharper disable InconsistentNaming - -using System; +using System; using System.IO; using System.Linq; using FluentAssertions; @@ -84,11 +82,11 @@ namespace NzbDrone.Common.Test [Test] public void CopyFolder_should_copy_folder() { - //Act + var diskProvider = new DiskProvider(); diskProvider.CopyDirectory(BinFolder.FullName, BinFolderCopy.FullName); - //Assert + VerifyCopy(); } @@ -96,7 +94,7 @@ namespace NzbDrone.Common.Test [Test] public void CopyFolder_should_overright_existing_folder() { - //Act + var diskProvider = new DiskProvider(); diskProvider.CopyDirectory(BinFolder.FullName, BinFolderCopy.FullName); @@ -107,7 +105,7 @@ namespace NzbDrone.Common.Test diskProvider.CopyDirectory(BinFolder.FullName, BinFolderCopy.FullName); - //Assert + VerifyCopy(); } @@ -120,10 +118,10 @@ namespace NzbDrone.Common.Test diskProvider.CopyDirectory(BinFolder.FullName, BinFolderMove.FullName); VerifyCopy(); - //Act + diskProvider.MoveDirectory(BinFolderCopy.FullName, BinFolderMove.FullName); - //Assert + VerifyMove(); } diff --git a/NzbDrone.Common.Test/EnviromentProviderTest.cs b/NzbDrone.Common.Test/EnviromentProviderTest.cs index b02c88334..485b36375 100644 --- a/NzbDrone.Common.Test/EnviromentProviderTest.cs +++ b/NzbDrone.Common.Test/EnviromentProviderTest.cs @@ -1,4 +1,4 @@ -// ReSharper disable InconsistentNaming + using System; using System.IO; diff --git a/NzbDrone.Common.Test/ProcessProviderTests.cs b/NzbDrone.Common.Test/ProcessProviderTests.cs index ade73a3bc..b68fdcb3e 100644 --- a/NzbDrone.Common.Test/ProcessProviderTests.cs +++ b/NzbDrone.Common.Test/ProcessProviderTests.cs @@ -1,4 +1,4 @@ -// ReSharper disable InconsistentNaming + using System; using System.ComponentModel; @@ -70,7 +70,7 @@ namespace NzbDrone.Common.Test { var startInfo = new ProcessStartInfo(DummyApp.DUMMY_PROCCESS_NAME + ".exe"); - //Act/Assert + _processProvider.GetProcessByName(DummyApp.DUMMY_PROCCESS_NAME).Should() .BeEmpty("Dummy process is already running"); _processProvider.Start(startInfo).Should().NotBeNull(); diff --git a/NzbDrone.Common.Test/ReportingService_ReportParseError_Fixture.cs b/NzbDrone.Common.Test/ReportingService_ReportParseError_Fixture.cs index efe10a76e..a182e3a9f 100644 --- a/NzbDrone.Common.Test/ReportingService_ReportParseError_Fixture.cs +++ b/NzbDrone.Common.Test/ReportingService_ReportParseError_Fixture.cs @@ -7,7 +7,7 @@ using NzbDrone.Test.Common; namespace NzbDrone.Common.Test { [TestFixture] - // ReSharper disable InconsistentNaming + public class ReportingService_ReportParseError_Fixture : TestBase { [SetUp] diff --git a/NzbDrone.Common.Test/ServiceProviderTests.cs b/NzbDrone.Common.Test/ServiceProviderTests.cs index 79a69b603..9f3017547 100644 --- a/NzbDrone.Common.Test/ServiceProviderTests.cs +++ b/NzbDrone.Common.Test/ServiceProviderTests.cs @@ -1,4 +1,4 @@ -// ReSharper disable InconsistentNaming + using System.ServiceProcess; using FluentAssertions; @@ -43,7 +43,7 @@ namespace NzbDrone.Common.Test [Test] public void Exists_should_find_existing_service() { - //Act + var exists = serviceProvider.ServiceExist(ALWAYS_INSTALLED_SERVICE); exists.Should().BeTrue(); @@ -52,7 +52,7 @@ namespace NzbDrone.Common.Test [Test] public void Exists_should_not_find_random_service() { - //Act + var exists = serviceProvider.ServiceExist("random_service_name"); exists.Should().BeFalse(); @@ -62,7 +62,7 @@ namespace NzbDrone.Common.Test [Test] public void Service_should_be_installed_and_then_uninstalled() { - //Act + serviceProvider.ServiceExist(TEMP_SERVICE_NAME).Should().BeFalse("Service already installed"); serviceProvider.Install(TEMP_SERVICE_NAME); serviceProvider.ServiceExist(TEMP_SERVICE_NAME).Should().BeTrue(); @@ -76,7 +76,7 @@ namespace NzbDrone.Common.Test [Explicit] public void UnInstallService() { - //Act + serviceProvider.UnInstall(ServiceProvider.NZBDRONE_SERVICE_NAME); serviceProvider.ServiceExist(ServiceProvider.NZBDRONE_SERVICE_NAME).Should().BeFalse(); } @@ -105,10 +105,10 @@ namespace NzbDrone.Common.Test serviceProvider.GetService(ALWAYS_INSTALLED_SERVICE).Status .Should().NotBe(ServiceControllerStatus.Running); - //Act + serviceProvider.Stop(ALWAYS_INSTALLED_SERVICE); - //Assert + serviceProvider.GetService(ALWAYS_INSTALLED_SERVICE).Status .Should().Be(ServiceControllerStatus.Stopped); diff --git a/NzbDrone.Common.Test/WebClientTests.cs b/NzbDrone.Common.Test/WebClientTests.cs index dc05dbe93..c4a7b7413 100644 --- a/NzbDrone.Common.Test/WebClientTests.cs +++ b/NzbDrone.Common.Test/WebClientTests.cs @@ -1,4 +1,4 @@ -// ReSharper disable InconsistentNaming + using FluentAssertions; using NUnit.Framework; using NzbDrone.Test.Common; diff --git a/NzbDrone.Core.Test/Configuration/ConfigServiceFixture.cs b/NzbDrone.Core.Test/Configuration/ConfigServiceFixture.cs index 2772b33c1..d69e02ff9 100644 --- a/NzbDrone.Core.Test/Configuration/ConfigServiceFixture.cs +++ b/NzbDrone.Core.Test/Configuration/ConfigServiceFixture.cs @@ -66,7 +66,7 @@ namespace NzbDrone.Core.Test.Configuration Subject.SetValue(key, newValue); var result = Subject.GetValue(key, ""); - //Assert + result.Should().Be(newValue); AllStoredModels.Should().HaveCount(1); } @@ -142,7 +142,7 @@ namespace NzbDrone.Core.Test.Configuration var allProperties = typeof(ConfigService).GetProperties().Where(p => p.GetSetMethod() != null).ToList(); - //Act + foreach (var propertyInfo in allProperties) { object value = null; diff --git a/NzbDrone.Core.Test/DecisionEngineTests/AcceptableSizeSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/AcceptableSizeSpecificationFixture.cs index c0f3fc3fb..df877fbf6 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/AcceptableSizeSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/AcceptableSizeSpecificationFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System.Linq; using System; @@ -18,7 +18,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.DecisionEngineTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class AcceptableSizeSpecificationFixture : CoreTest { private EpisodeParseResult parseResultMulti; @@ -84,10 +84,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(false); - //Act + bool result = Mocker.Resolve().IsSatisfiedBy(parseResultSingle); - //Assert + result.Should().BeTrue(); } @@ -105,10 +105,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(false); - //Act + bool result = Mocker.Resolve().IsSatisfiedBy(parseResultSingle); - //Assert + result.Should().BeTrue(); } @@ -126,10 +126,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(false); - //Act + bool result = Mocker.Resolve().IsSatisfiedBy(parseResultSingle); - //Assert + result.Should().BeFalse(); } @@ -147,10 +147,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(false); - //Act + bool result = Mocker.Resolve().IsSatisfiedBy(parseResultSingle); - //Assert + result.Should().BeFalse(); } @@ -168,10 +168,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(false); - //Act + bool result = Mocker.Resolve().IsSatisfiedBy(parseResultMulti); - //Assert + result.Should().BeTrue(); } @@ -189,10 +189,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(false); - //Act + bool result = Mocker.Resolve().IsSatisfiedBy(parseResultMulti); - //Assert + result.Should().BeTrue(); } @@ -210,10 +210,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(false); - //Act + bool result = Mocker.Resolve().IsSatisfiedBy(parseResultMulti); - //Assert + result.Should().BeFalse(); } @@ -231,10 +231,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(false); - //Act + bool result = Mocker.Resolve().IsSatisfiedBy(parseResultMulti); - //Assert + result.Should().BeFalse(); } @@ -252,10 +252,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(true); - //Act + bool result = Mocker.Resolve().IsSatisfiedBy(parseResultSingle); - //Assert + result.Should().BeTrue(); } @@ -273,10 +273,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(true); - //Act + bool result = Mocker.Resolve().IsSatisfiedBy(parseResultSingle); - //Assert + result.Should().BeTrue(); } @@ -294,10 +294,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(true); - //Act + bool result = Mocker.Resolve().IsSatisfiedBy(parseResultSingle); - //Assert + result.Should().BeFalse(); } @@ -315,10 +315,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(true); - //Act + bool result = Mocker.Resolve().IsSatisfiedBy(parseResultSingle); - //Assert + result.Should().BeFalse(); } @@ -337,10 +337,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(true); - //Act + bool result = Mocker.Resolve().IsSatisfiedBy(parseResultSingle); - //Assert + result.Should().BeTrue(); } @@ -359,10 +359,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(true); - //Act + bool result = Mocker.Resolve().IsSatisfiedBy(parseResultSingle); - //Assert + result.Should().BeTrue(); } @@ -382,10 +382,10 @@ namespace NzbDrone.Core.Test.DecisionEngineTests s => s.IsFirstOrLastEpisodeOfSeason(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(true); - //Act + bool result = Mocker.Resolve().IsSatisfiedBy(parseResultSingle); - //Assert + result.Should().BeTrue(); } diff --git a/NzbDrone.Core.Test/DecisionEngineTests/AllowedReleaseGroupSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/AllowedReleaseGroupSpecificationFixture.cs index c275e06c8..ad8635965 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/AllowedReleaseGroupSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/AllowedReleaseGroupSpecificationFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System.Linq; using System; @@ -20,7 +20,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.DecisionEngineTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class AllowedReleaseGroupSpecificationFixture : CoreTest { private EpisodeParseResult parseResult; diff --git a/NzbDrone.Core.Test/DecisionEngineTests/CustomStartDateSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/CustomStartDateSpecificationFixture.cs index 23f8b4bb7..4bef7547d 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/CustomStartDateSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/CustomStartDateSpecificationFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System.Linq; using System; @@ -18,7 +18,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.DecisionEngineTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class CustomStartDateSpecificationFixture : CoreTest { private CustomStartDateSpecification _customStartDateSpecification; diff --git a/NzbDrone.Core.Test/DecisionEngineTests/LanguageSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/LanguageSpecificationFixture.cs index 1c9222856..14e9b69a8 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/LanguageSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/LanguageSpecificationFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System.Linq; using System; @@ -17,7 +17,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.DecisionEngineTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class LanguageSpecificationFixture : CoreTest { private EpisodeParseResult parseResult; diff --git a/NzbDrone.Core.Test/DecisionEngineTests/MonitoredEpisodeSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/MonitoredEpisodeSpecificationFixture.cs index dc7a32fe5..c2ea96b62 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/MonitoredEpisodeSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/MonitoredEpisodeSpecificationFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System.Linq; using System; @@ -18,7 +18,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.DecisionEngineTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class MonitoredEpisodeSpecificationFixture : CoreTest { private MonitoredEpisodeSpecification monitoredEpisodeSpecification; diff --git a/NzbDrone.Core.Test/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs index 4ee9ff65a..3f18e9e44 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/QualityAllowedByProfileSpecificationFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System.Collections.Generic; using System.Linq; @@ -16,7 +16,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.DecisionEngineTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class QualityAllowedByProfileSpecificationFixture : CoreTest { private QualityAllowedByProfileSpecification _qualityAllowedByProfile; diff --git a/NzbDrone.Core.Test/DecisionEngineTests/QualityUpgradeSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/QualityUpgradeSpecificationFixture.cs index 88d0dd626..68cd2615d 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/QualityUpgradeSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/QualityUpgradeSpecificationFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System.Linq; using FluentAssertions; @@ -13,7 +13,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.DecisionEngineTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class QualityUpgradeSpecificationFixture : CoreTest { public static object[] IsUpgradeTestCases = diff --git a/NzbDrone.Core.Test/DecisionEngineTests/RetentionSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/RetentionSpecificationFixture.cs index 056e8142b..627f3e43f 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/RetentionSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/RetentionSpecificationFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System.Linq; using System; @@ -18,7 +18,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.DecisionEngineTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class RetentionSpecificationFixture : CoreTest { private RetentionSpecification retentionSpecification; diff --git a/NzbDrone.Core.Test/DecisionEngineTests/UpgradeDiskSpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/UpgradeDiskSpecificationFixture.cs index fe574abe1..6b28557a4 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/UpgradeDiskSpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/UpgradeDiskSpecificationFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; @@ -19,7 +19,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.DecisionEngineTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class UpgradeDiskSpecificationFixture : CoreTest { private UpgradeDiskSpecification _upgradeDisk; diff --git a/NzbDrone.Core.Test/DecisionEngineTests/UpgradeHistorySpecificationFixture.cs b/NzbDrone.Core.Test/DecisionEngineTests/UpgradeHistorySpecificationFixture.cs index 9aa21c6ab..634f90959 100644 --- a/NzbDrone.Core.Test/DecisionEngineTests/UpgradeHistorySpecificationFixture.cs +++ b/NzbDrone.Core.Test/DecisionEngineTests/UpgradeHistorySpecificationFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System.Collections.Generic; using System.Linq; diff --git a/NzbDrone.Core.Test/EpisodeParseResultTest.cs b/NzbDrone.Core.Test/EpisodeParseResultTest.cs index 8f55ef387..37ea2ffcf 100644 --- a/NzbDrone.Core.Test/EpisodeParseResultTest.cs +++ b/NzbDrone.Core.Test/EpisodeParseResultTest.cs @@ -12,7 +12,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test { [TestFixture] - // ReSharper disable InconsistentNaming + public class EpisodeParseResultTest : CoreTest { [Test] diff --git a/NzbDrone.Core.Test/EpisodeStatusTest.cs b/NzbDrone.Core.Test/EpisodeStatusTest.cs index 7f30d1520..c789537c7 100644 --- a/NzbDrone.Core.Test/EpisodeStatusTest.cs +++ b/NzbDrone.Core.Test/EpisodeStatusTest.cs @@ -11,7 +11,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test { [TestFixture] - // ReSharper disable InconsistentNaming + public class EpisodeStatusTest : CoreTest { [TestCase(1, false, false, EpisodeStatusType.NotAired)] diff --git a/NzbDrone.Core.Test/FluentTest.cs b/NzbDrone.Core.Test/FluentTest.cs index 32abc1d20..8537e19f3 100644 --- a/NzbDrone.Core.Test/FluentTest.cs +++ b/NzbDrone.Core.Test/FluentTest.cs @@ -9,7 +9,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test { [TestFixture] - // ReSharper disable InconsistentNaming + public class FluentTest : CoreTest { [TestCase(null, "def", "def")] @@ -86,11 +86,11 @@ namespace NzbDrone.Core.Test [Test] public void ParentUriString_should_return_self_if_already_parent() { - //Setup + var url = "http://www.nzbdrone.com"; var uri = new Uri(url); - //Act + var result = uri.ParentUriString(); //Resolve @@ -100,11 +100,11 @@ namespace NzbDrone.Core.Test [Test] public void ParentUriString_should_return_parent_url_when_path_is_passed() { - //Setup + var url = "http://www.nzbdrone.com/test/"; var uri = new Uri(url); - //Act + var result = uri.ParentUriString(); //Resolve @@ -114,11 +114,11 @@ namespace NzbDrone.Core.Test [Test] public void ParentUriString_should_return_parent_url_when_multiple_paths_are_passed() { - //Setup + var url = "http://www.nzbdrone.com/test/test2"; var uri = new Uri(url); - //Act + var result = uri.ParentUriString(); //Resolve @@ -128,11 +128,11 @@ namespace NzbDrone.Core.Test [Test] public void ParentUriString_should_return_parent_url_when_url_with_query_string_is_passed() { - //Setup + var url = "http://www.nzbdrone.com/test.aspx?test=10"; var uri = new Uri(url); - //Act + var result = uri.ParentUriString(); //Resolve @@ -142,11 +142,11 @@ namespace NzbDrone.Core.Test [Test] public void ParentUriString_should_return_parent_url_when_url_with_path_and_query_strings_is_passed() { - //Setup + var url = "http://www.nzbdrone.com/tester/test.aspx?test=10"; var uri = new Uri(url); - //Act + var result = uri.ParentUriString(); //Resolve @@ -156,11 +156,11 @@ namespace NzbDrone.Core.Test [Test] public void ParentUriString_should_return_parent_url_when_url_with_query_strings_is_passed() { - //Setup + var url = "http://www.nzbdrone.com/test.aspx?test=10&test2=5"; var uri = new Uri(url); - //Act + var result = uri.ParentUriString(); //Resolve @@ -170,10 +170,10 @@ namespace NzbDrone.Core.Test [Test] public void MaxOrDefault_should_return_zero_when_collection_is_empty() { - //Setup + - //Act + var result = (new List()).MaxOrDefault(); //Resolve @@ -183,10 +183,10 @@ namespace NzbDrone.Core.Test [Test] public void MaxOrDefault_should_return_max_when_collection_is_not_empty() { - //Setup + var list = new List { 6, 4, 5, 3, 8, 10 }; - //Act + var result = list.MaxOrDefault(); //Resolve @@ -196,10 +196,10 @@ namespace NzbDrone.Core.Test [Test] public void MaxOrDefault_should_return_zero_when_collection_is_null() { - //Setup + List list = null; - //Act + var result = list.MaxOrDefault(); //Resolve @@ -209,10 +209,10 @@ namespace NzbDrone.Core.Test [Test] public void Truncate_should_truncate_strings_to_max_specified_number_of_bytes() { - //Setup + var str = ReadAllText("Files", "LongOverview.txt"); - //Act + var resultString = str.Truncate(1000); //Resolve @@ -223,10 +223,10 @@ namespace NzbDrone.Core.Test [Test] public void Truncate_should_not_truncate_string_shorter_than_max_bytes() { - //Setup + var str = "Hello World"; - //Act + var resultString = str.Truncate(1000); //Resolve @@ -237,10 +237,10 @@ namespace NzbDrone.Core.Test [Test] public void MinOrDefault_should_return_zero_when_collection_is_empty() { - //Setup + - //Act + var result = (new List()).MinOrDefault(); //Resolve @@ -250,10 +250,10 @@ namespace NzbDrone.Core.Test [Test] public void MinOrDefault_should_return_min_when_collection_is_not_empty() { - //Setup + var list = new List { 6, 4, 5, 3, 8, 10 }; - //Act + var result = list.MinOrDefault(); //Resolve @@ -263,10 +263,10 @@ namespace NzbDrone.Core.Test [Test] public void MinOrDefault_should_return_zero_when_collection_is_null() { - //Setup + List list = null; - //Act + var result = list.MinOrDefault(); //Resolve diff --git a/NzbDrone.Core.Test/Framework/TestDbHelper.cs b/NzbDrone.Core.Test/Framework/TestDbHelper.cs index b5bfa6bbe..bcbc6e511 100644 --- a/NzbDrone.Core.Test/Framework/TestDbHelper.cs +++ b/NzbDrone.Core.Test/Framework/TestDbHelper.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; using System.IO; diff --git a/NzbDrone.Core.Test/HelperTests/SortHelperFixture.cs b/NzbDrone.Core.Test/HelperTests/SortHelperTest.cs similarity index 74% rename from NzbDrone.Core.Test/HelperTests/SortHelperFixture.cs rename to NzbDrone.Core.Test/HelperTests/SortHelperTest.cs index 468a00582..ce2c5e5be 100644 --- a/NzbDrone.Core.Test/HelperTests/SortHelperFixture.cs +++ b/NzbDrone.Core.Test/HelperTests/SortHelperTest.cs @@ -1,21 +1,12 @@ -// ReSharper disable RedundantUsingDirective -using System; -using System.Collections.Generic; - -using FizzWare.NBuilder; -using FluentAssertions; -using Moq; +using FluentAssertions; using NUnit.Framework; using NzbDrone.Core.Helpers; -using NzbDrone.Core.Model.Notification; -using NzbDrone.Core.Providers; - using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.HelperTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class SortHelperTest : CoreTest { [TestCase("The Office (US)", "Office (US)")] diff --git a/NzbDrone.Core.Test/HelperTests/XElementHelperTests/ConvertToDayOfWeekFixture.cs b/NzbDrone.Core.Test/HelperTests/XElementHelperTests/ConvertToDayOfWeekFixture.cs index 8e7f3c1e7..734444eeb 100644 --- a/NzbDrone.Core.Test/HelperTests/XElementHelperTests/ConvertToDayOfWeekFixture.cs +++ b/NzbDrone.Core.Test/HelperTests/XElementHelperTests/ConvertToDayOfWeekFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; @@ -15,7 +15,7 @@ using NzbDrone.Test.Common; namespace NzbDrone.Core.Test.HelperTests.XElementHelperTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class ParseDayOfWeekFixture : CoreTest { [Test] diff --git a/NzbDrone.Core.Test/HelperTests/XElementHelperTests/ConvertToTFixture.cs b/NzbDrone.Core.Test/HelperTests/XElementHelperTests/ConvertToTFixture.cs index b9c0168d9..0a10e0e7a 100644 --- a/NzbDrone.Core.Test/HelperTests/XElementHelperTests/ConvertToTFixture.cs +++ b/NzbDrone.Core.Test/HelperTests/XElementHelperTests/ConvertToTFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; using System.Xml.Linq; @@ -15,7 +15,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.HelperTests.XElementHelperTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class XElementHelperTest : CoreTest { [Test] diff --git a/NzbDrone.Core.Test/IndexerSearchTests/ProcessResultsFixture.cs b/NzbDrone.Core.Test/IndexerSearchTests/ProcessResultsFixture.cs index 451b3dd99..4e9a388a5 100644 --- a/NzbDrone.Core.Test/IndexerSearchTests/ProcessResultsFixture.cs +++ b/NzbDrone.Core.Test/IndexerSearchTests/ProcessResultsFixture.cs @@ -119,10 +119,10 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests WithMisMatchedSeries(); - //Act + var result = Subject.ProcessReports(_matchingSeries, new { }, parseResults, _episodeSearchResult, _notification); - //Assert + result.SearchHistoryItems.Should().HaveCount(parseResults.Count); result.SearchHistoryItems.Should().NotContain(s => s.Success); @@ -147,10 +147,10 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests WithQualityNeeded(); WithSuccessfulDownload(); - //Act + var result = Subject.ProcessReports(_matchingSeries, new { }, parseResults, _episodeSearchResult, _notification); - //Assert + result.SearchHistoryItems.Should().HaveCount(parseResults.Count); result.SearchHistoryItems.Should().Contain(s => s.Success); @@ -182,10 +182,10 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests .Setup(s => s.DownloadReport(It.Is(d => d.Quality.Quality == Quality.SDTV))) .Returns(true); - //Act + var result = Subject.ProcessReports(_matchingSeries, new { }, parseResults, _episodeSearchResult, _notification); - //Assert + result.SearchHistoryItems.Should().HaveCount(parseResults.Count); result.SearchHistoryItems.Should().Contain(s => s.Success); @@ -215,10 +215,10 @@ namespace NzbDrone.Core.Test.ProviderTests.SearchTests .Setup(s => s.IsDownloadPermitted(It.Is(d => d.Quality.Quality == Quality.Bluray1080p))) .Returns(ReportRejectionReasons.None); - //Act + var result = Subject.ProcessReports(_matchingSeries, new { }, parseResults, _episodeSearchResult, _notification); - //Assert + result.Successes.Should().NotBeNull(); result.Successes.Should().NotBeEmpty(); diff --git a/NzbDrone.Core.Test/IndexerTests/IndexerFixture.cs b/NzbDrone.Core.Test/IndexerTests/IndexerFixture.cs index 2e558e540..4d8f0eea0 100644 --- a/NzbDrone.Core.Test/IndexerTests/IndexerFixture.cs +++ b/NzbDrone.Core.Test/IndexerTests/IndexerFixture.cs @@ -21,7 +21,7 @@ using NzbDrone.Test.Common; namespace NzbDrone.Core.Test.IndexerTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class IndexerFixture : CoreTest { private void WithConfiguredIndexers() @@ -143,7 +143,7 @@ namespace NzbDrone.Core.Test.IndexerTests .Setup(h => h.DownloadStream(It.IsAny(), It.IsAny())) .Returns(OpenRead("Files", "Rss", "SizeParsing", "nzbsrus.xml")); - //Act + var parseResults = Mocker.Resolve().FetchRss(); parseResults.Should().HaveCount(1); @@ -166,7 +166,7 @@ namespace NzbDrone.Core.Test.IndexerTests .Setup(h => h.DownloadStream(It.IsAny(), It.IsAny())) .Returns(OpenRead("Files", "Rss", "SizeParsing", "newznab.xml")); - //Act + var parseResults = Mocker.Resolve().FetchRss(); parseResults[0].Size.Should().Be(1183105773); @@ -185,7 +185,7 @@ namespace NzbDrone.Core.Test.IndexerTests .Setup(h => h.DownloadStream("http://www.nzbindex.nl/rss/alt.binaries.hdtv/?sort=agedesc&minsize=100&complete=1&max=50&more=1&q=", It.IsAny())) .Returns(OpenRead("Files", "Rss", "SizeParsing", "nzbindex.xml")); - //Act + var parseResults = Mocker.Resolve().FetchRss(); parseResults[0].Size.Should().Be(587328389); @@ -204,7 +204,7 @@ namespace NzbDrone.Core.Test.IndexerTests .Setup(h => h.DownloadStream("http://www.nzbclub.com/nzbfeed.aspx?ig=2&gid=5542&st=1&ns=1&q=", It.IsAny())) .Returns(OpenRead("Files", "Rss", "SizeParsing", "nzbclub.xml")); - //Act + var parseResults = Mocker.Resolve().FetchRss(); parseResults.Should().HaveCount(2); @@ -220,7 +220,7 @@ namespace NzbDrone.Core.Test.IndexerTests .Setup(h => h.DownloadStream("http://rss.omgwtfnzbs.org/rss-search.php?catid=19,20&user=MockedConfigValue&api=MockedConfigValue&eng=1", It.IsAny())) .Returns(OpenRead("Files", "Rss", "SizeParsing", "omgwtfnzbs.xml")); - //Act + var parseResults = Mocker.Resolve().FetchRss(); parseResults.Should().HaveCount(1); @@ -480,7 +480,7 @@ namespace NzbDrone.Core.Test.IndexerTests .Setup(h => h.DownloadStream("http://rss.omgwtfnzbs.org/rss-search.php?catid=19,20&user=MockedConfigValue&api=MockedConfigValue&eng=1", It.IsAny())) .Returns(OpenRead("Files", "Rss", "SizeParsing", "omgwtfnzbs.xml")); - //Act + var parseResults = Mocker.Resolve().FetchRss(); parseResults.Should().HaveCount(1); diff --git a/NzbDrone.Core.Test/IndexerTests/NzbxFixture.cs b/NzbDrone.Core.Test/IndexerTests/NzbxFixture.cs index aadb147fe..e93e6a80e 100644 --- a/NzbDrone.Core.Test/IndexerTests/NzbxFixture.cs +++ b/NzbDrone.Core.Test/IndexerTests/NzbxFixture.cs @@ -21,7 +21,7 @@ using NzbDrone.Test.Common; namespace NzbDrone.Core.Test.IndexerTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class NzbxFixture : CoreTest { [Test] @@ -31,7 +31,7 @@ namespace NzbDrone.Core.Test.IndexerTests .Setup(h => h.DownloadString("https://nzbx.co/api/recent?category=tv", It.IsAny())) .Returns(ReadAllText("Files", "Rss", "SizeParsing", "nzbx_recent.json")); - //Act + var parseResults = Mocker.Resolve().FetchRss(); parseResults.Should().HaveCount(1); @@ -45,7 +45,7 @@ namespace NzbDrone.Core.Test.IndexerTests .Setup(h => h.DownloadString("https://nzbx.co/api/search?q=30+Rock+S01E01", It.IsAny())) .Returns(ReadAllText("Files", "Rss", "SizeParsing", "nzbx_search.json")); - //Act + var parseResults = Mocker.Resolve().FetchEpisode("30 Rock", 1, 1); parseResults.Should().HaveCount(1); @@ -91,7 +91,7 @@ namespace NzbDrone.Core.Test.IndexerTests .Setup(h => h.DownloadString("https://nzbx.co/api/recent?category=tv", It.IsAny())) .Returns(ReadAllText("Files", "Rss", "SizeParsing", "nzbx_recent.json")); - //Act + var parseResults = Mocker.Resolve().FetchRss(); parseResults.Should().HaveCount(1); @@ -107,7 +107,7 @@ namespace NzbDrone.Core.Test.IndexerTests .Setup(h => h.DownloadString("https://nzbx.co/api/search?q=30+Rock+S01E01", It.IsAny())) .Returns(ReadAllText("Files", "Rss", "SizeParsing", "nzbx_search.json")); - //Act + var parseResults = Mocker.Resolve().FetchEpisode("30 Rock", 1, 1); parseResults.Should().HaveCount(1); @@ -121,7 +121,7 @@ namespace NzbDrone.Core.Test.IndexerTests .Setup(h => h.DownloadString("https://nzbx.co/api/recent?category=tv", It.IsAny())) .Returns(ReadAllText("Files", "Rss", "SizeParsing", "nzbx_recent.json")); - //Act + var parseResults = Mocker.Resolve().FetchRss(); parseResults.Should().HaveCount(1); diff --git a/NzbDrone.Core.Test/Indexers/IndexerServiceTest.cs b/NzbDrone.Core.Test/Indexers/IndexerServiceTest.cs index 8027c9f46..600a963d9 100644 --- a/NzbDrone.Core.Test/Indexers/IndexerServiceTest.cs +++ b/NzbDrone.Core.Test/Indexers/IndexerServiceTest.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; @@ -18,7 +18,7 @@ using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.Indexers { [TestFixture] - // ReSharper disable InconsistentNaming + public class IndexerServiceTest : CoreTest { [Test] diff --git a/NzbDrone.Core.Test/Indexers/NewznabServiceTest.cs b/NzbDrone.Core.Test/Indexers/NewznabServiceTest.cs index 119dcf673..8dca0af3e 100644 --- a/NzbDrone.Core.Test/Indexers/NewznabServiceTest.cs +++ b/NzbDrone.Core.Test/Indexers/NewznabServiceTest.cs @@ -14,7 +14,7 @@ using NzbDrone.Test.Common; namespace NzbDrone.Core.Test.Indexers { [TestFixture] - // ReSharper disable InconsistentNaming + public class NewznabProviderTest : CoreTest { private void WithInvalidName() diff --git a/NzbDrone.Core.Test/JobTests/AppUpdateJobFixture.cs b/NzbDrone.Core.Test/JobTests/AppUpdateJobFixture.cs index efc2a30c0..a0b90d7ee 100644 --- a/NzbDrone.Core.Test/JobTests/AppUpdateJobFixture.cs +++ b/NzbDrone.Core.Test/JobTests/AppUpdateJobFixture.cs @@ -44,10 +44,10 @@ namespace NzbDrone.Core.Test.JobTests { Mocker.GetMock().Setup(c => c.FolderExists(SANDBOX_FOLDER)).Returns(true); - //Act + StartUpdate(); - //Assert + Mocker.GetMock().Verify(c => c.DeleteFolder(SANDBOX_FOLDER, true)); } @@ -56,10 +56,10 @@ namespace NzbDrone.Core.Test.JobTests { Mocker.GetMock().Setup(c => c.FolderExists(SANDBOX_FOLDER)).Returns(false); - //Act + StartUpdate(); - //Assert + Mocker.GetMock().Verify(c => c.DeleteFolder(SANDBOX_FOLDER, true), Times.Never()); } @@ -69,10 +69,10 @@ namespace NzbDrone.Core.Test.JobTests { var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName); - //Act + StartUpdate(); - //Assert + Mocker.GetMock().Verify( c => c.DownloadFile(updatePackage.Url, updateArchive)); } @@ -82,10 +82,10 @@ namespace NzbDrone.Core.Test.JobTests { var updateArchive = Path.Combine(SANDBOX_FOLDER, updatePackage.FileName); - //Act + StartUpdate(); - //Assert + Mocker.GetMock().Verify( c => c.ExtractArchive(updateArchive, SANDBOX_FOLDER)); } @@ -95,10 +95,10 @@ namespace NzbDrone.Core.Test.JobTests { var updateClientFolder = Mocker.GetMock().Object.GetUpdateClientFolder(); - //Act + StartUpdate(); - //Assert + Mocker.GetMock().Verify( c => c.MoveDirectory(updateClientFolder, SANDBOX_FOLDER)); } @@ -106,16 +106,16 @@ namespace NzbDrone.Core.Test.JobTests [Test] public void should_start_update_client() { - //Setup + var updateClientPath = Mocker.GetMock().Object.GetUpdateClientExePath(); Mocker.GetMock() .SetupGet(c => c.NzbDroneProcessIdFromEnviroment).Returns(12); - //Act + StartUpdate(); - //Assert + Mocker.GetMock().Verify( c => c.Start(It.Is(p => p.FileName == updateClientPath && @@ -143,7 +143,7 @@ namespace NzbDrone.Core.Test.JobTests var updateSubFolder = new DirectoryInfo(Mocker.GetMock().Object.GetUpdateSandboxFolder()); - //Act + updateSubFolder.Exists.Should().BeFalse(); Mocker.Resolve(); @@ -151,7 +151,7 @@ namespace NzbDrone.Core.Test.JobTests Mocker.Resolve(); StartUpdate(); updateSubFolder.Refresh(); - //Assert + updateSubFolder.Exists.Should().BeTrue(); updateSubFolder.GetDirectories("nzbdrone").Should().HaveCount(1); diff --git a/NzbDrone.Core.Test/JobTests/BacklogSearchJobTest.cs b/NzbDrone.Core.Test/JobTests/BacklogSearchJobTest.cs index c77733fe5..8dc93b826 100644 --- a/NzbDrone.Core.Test/JobTests/BacklogSearchJobTest.cs +++ b/NzbDrone.Core.Test/JobTests/BacklogSearchJobTest.cs @@ -28,7 +28,7 @@ namespace NzbDrone.Core.Test.JobTests [Test] public void no_missing_epsiodes_should_not_trigger_any_search() { - //Setup + var notification = new ProgressNotification("Backlog Search Job Test"); var episodes = new List(); @@ -39,10 +39,10 @@ namespace NzbDrone.Core.Test.JobTests Mocker.GetMock() .Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes); - //Act + Subject.Start(notification, null); - //Assert + Mocker.GetMock().Verify(c => c.Start(notification, new { SeriesId = It.IsAny(), SeasonNumber = It.IsAny() }), Times.Never()); @@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.JobTests [Test] public void individual_missing_episode() { - //Setup + var notification = new ProgressNotification("Backlog Search Job Test"); var series = Builder.CreateNew() @@ -74,10 +74,10 @@ namespace NzbDrone.Core.Test.JobTests Mocker.GetMock() .Setup(s => s.Start(notification, It.Is(d => d.GetPropertyValue("EpisodeId") == 1))); - //Act + Subject.Start(notification, null); - //Assert + Mocker.GetMock().Verify(c => c.Start(notification, It.Is(d => d.GetPropertyValue("EpisodeId") >= 0)), Times.Once()); } @@ -85,7 +85,7 @@ namespace NzbDrone.Core.Test.JobTests [Test] public void individual_missing_episodes_only() { - //Setup + var notification = new ProgressNotification("Backlog Search Job Test"); var series = Builder.CreateNew() @@ -103,10 +103,10 @@ namespace NzbDrone.Core.Test.JobTests Mocker.GetMock() .Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes); - //Act + Subject.Start(notification, null); - //Assert + Mocker.GetMock().Verify(c => c.Start(notification, It.Is(d => d.GetPropertyValue("EpisodeId") >= 0)), Times.Exactly(episodes.Count)); } @@ -114,7 +114,7 @@ namespace NzbDrone.Core.Test.JobTests [Test] public void series_season_missing_episodes_only_mismatch_count() { - //Setup + var notification = new ProgressNotification("Backlog Search Job Test"); var series = Builder.CreateNew() @@ -136,10 +136,10 @@ namespace NzbDrone.Core.Test.JobTests Mocker.GetMock() .Setup(s => s.GetEpisodeNumbersBySeason(1, 1)).Returns(new List { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }); - //Act + Subject.Start(notification, null); - //Assert + Mocker.GetMock().Verify(c => c.Start(notification, It.Is(d => d.GetPropertyValue("EpisodeId") >= 0)), Times.Exactly(episodes.Count)); } @@ -147,7 +147,7 @@ namespace NzbDrone.Core.Test.JobTests [Test] public void series_season_missing_episodes_only() { - //Setup + var notification = new ProgressNotification("Backlog Search Job Test"); var series = Builder.CreateNew() @@ -170,10 +170,10 @@ namespace NzbDrone.Core.Test.JobTests Mocker.GetMock() .Setup(s => s.GetEpisodeNumbersBySeason(1, 1)).Returns(episodes.Select(e => e.EpisodeNumber).ToList()); - //Act + Subject.Start(notification, null); - //Assert + Mocker.GetMock().Verify(c => c.Start(notification, It.Is(d => d.GetPropertyValue("SeriesId") >= 0 && d.GetPropertyValue("SeasonNumber") >= 0)), Times.Once()); @@ -182,7 +182,7 @@ namespace NzbDrone.Core.Test.JobTests [Test] public void multiple_missing_episodes() { - //Setup + var notification = new ProgressNotification("Backlog Search Job Test"); var series = Builder.CreateNew() @@ -212,10 +212,10 @@ namespace NzbDrone.Core.Test.JobTests Mocker.GetMock() .Setup(s => s.GetEpisodeNumbersBySeason(1, 1)).Returns(new List { 1, 2, 3, 4, 5 }); - //Act + Subject.Start(notification, null); - //Assert + Mocker.GetMock().Verify(c => c.Start(notification, It.Is(d => d.GetPropertyValue("SeriesId") >= 0 && d.GetPropertyValue("SeasonNumber") >= 0)), Times.Once()); @@ -227,7 +227,7 @@ namespace NzbDrone.Core.Test.JobTests [Test] public void GetMissingForEnabledSeries_should_only_return_episodes_for_monitored_series() { - //Setup + var series = Builder.CreateListOfSize(2) .TheFirst(1) .With(s => s.Monitored = false) @@ -250,10 +250,10 @@ namespace NzbDrone.Core.Test.JobTests Mocker.GetMock() .Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes); - //Act + var result = Subject.GetMissingForEnabledSeries(); - //Assert + result.Should().NotBeEmpty(); result.Should().Contain(s => s.Series.Monitored); result.Should().NotContain(s => !s.Series.Monitored); @@ -262,7 +262,7 @@ namespace NzbDrone.Core.Test.JobTests [Test] public void GetMissingForEnabledSeries_should_only_return_explicity_enabled_series_when_backlog_searching_is_ignored() { - //Setup + var series = Builder.CreateListOfSize(3) .TheFirst(1) .With(s => s.Monitored = true) @@ -289,10 +289,10 @@ namespace NzbDrone.Core.Test.JobTests Mocker.GetMock() .Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes); - //Act + var result = Subject.GetMissingForEnabledSeries(); - //Assert + result.Should().NotBeEmpty(); result.Should().Contain(s => s.Series.BacklogSetting == BacklogSettingType.Enable); result.Should().NotContain(s => s.Series.BacklogSetting == BacklogSettingType.Disable); @@ -302,7 +302,7 @@ namespace NzbDrone.Core.Test.JobTests [Test] public void GetMissingForEnabledSeries_should_return_explicity_enabled_and_inherit_series_when_backlog_searching_is_enabled() { - //Setup + var series = Builder.CreateListOfSize(3) .TheFirst(1) .With(s => s.Monitored = true) @@ -329,10 +329,10 @@ namespace NzbDrone.Core.Test.JobTests Mocker.GetMock() .Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes); - //Act + var result = Subject.GetMissingForEnabledSeries(); - //Assert + result.Should().NotBeEmpty(); result.Should().Contain(s => s.Series.BacklogSetting == BacklogSettingType.Enable); result.Should().NotContain(s => s.Series.BacklogSetting == BacklogSettingType.Disable); diff --git a/NzbDrone.Core.Test/JobTests/DiskScanJobTest.cs b/NzbDrone.Core.Test/JobTests/DiskScanJobTest.cs index 31a3f2abc..a32188e5c 100644 --- a/NzbDrone.Core.Test/JobTests/DiskScanJobTest.cs +++ b/NzbDrone.Core.Test/JobTests/DiskScanJobTest.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; @@ -21,7 +21,7 @@ using System.Linq; namespace NzbDrone.Core.Test.JobTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class DiskScanJobTest : CoreTest { [Test] @@ -39,10 +39,10 @@ namespace NzbDrone.Core.Test.JobTests .Setup(p => p.Scan(series)) .Returns(new List()); - //Act + Mocker.Resolve().Start(new ProgressNotification("Test"), new { SeriesId = series.Id }); - //Assert + Mocker.VerifyAllMocks(); } diff --git a/NzbDrone.Core.Test/JobTests/ImportNewSeriesJobTest.cs b/NzbDrone.Core.Test/JobTests/ImportNewSeriesJobTest.cs index 392889815..61620ebeb 100644 --- a/NzbDrone.Core.Test/JobTests/ImportNewSeriesJobTest.cs +++ b/NzbDrone.Core.Test/JobTests/ImportNewSeriesJobTest.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; @@ -20,7 +20,7 @@ using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.JobTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class ImportNewSeriesJobTest : CoreTest { [Test] @@ -69,10 +69,10 @@ namespace NzbDrone.Core.Test.JobTests Mocker.GetMock() .Setup(s => s.GetFilesBySeries(It.IsAny())).Returns(new List()); - //Act + Mocker.Resolve().Start(notification, null); - //Assert + Mocker.GetMock().Verify(j => j.Start(notification, It.Is(d => d.GetPropertyValue("SeriesId") == series[0].Id)), Times.Once()); Mocker.GetMock().Verify(j => j.Start(notification, It.Is(d => d.GetPropertyValue("SeriesId") == series[1].Id)), Times.Once()); @@ -123,10 +123,10 @@ namespace NzbDrone.Core.Test.JobTests Mocker.GetMock() .Setup(j => j.Start(notification, It.Is(d => d.GetPropertyValue("SeriesId") == series[0].Id))); - //Act + Mocker.Resolve().Start(notification, null); - //Assert + Mocker.GetMock().Verify(j => j.Start(notification, It.Is(d => d.GetPropertyValue("SeriesId") == series[0].Id)), Times.Once()); Mocker.GetMock().Verify(j => j.Start(notification, It.Is(d => d.GetPropertyValue("SeriesId") == series[1].Id)), Times.Once()); diff --git a/NzbDrone.Core.Test/JobTests/JobRepositoryFixture.cs b/NzbDrone.Core.Test/JobTests/JobRepositoryFixture.cs index c1f98f1c1..25f50dff2 100644 --- a/NzbDrone.Core.Test/JobTests/JobRepositoryFixture.cs +++ b/NzbDrone.Core.Test/JobTests/JobRepositoryFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System.Linq; using System; diff --git a/NzbDrone.Core.Test/JobTests/RecentBacklogSearchJobTest.cs b/NzbDrone.Core.Test/JobTests/RecentBacklogSearchJobTest.cs index 3fc864f77..33a191eaa 100644 --- a/NzbDrone.Core.Test/JobTests/RecentBacklogSearchJobTest.cs +++ b/NzbDrone.Core.Test/JobTests/RecentBacklogSearchJobTest.cs @@ -37,16 +37,16 @@ namespace NzbDrone.Core.Test.JobTests [Test] public void no_missing_epsiodes_should_not_trigger_any_search() { - //Setup + var episodes = new List(); Mocker.GetMock() .Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes); - //Act + Mocker.Resolve().Start(MockNotification, null); - //Assert + Mocker.GetMock().Verify(c => c.Start(MockNotification, new { EpisodeId = It.IsAny() }), Times.Never()); } @@ -61,7 +61,7 @@ namespace NzbDrone.Core.Test.JobTests .With(s => s.BacklogSetting = BacklogSettingType.Enable) .Build(); - //Setup + var episodes = Builder.CreateListOfSize(50) .All() .With(e => e.Series = series) @@ -92,10 +92,10 @@ namespace NzbDrone.Core.Test.JobTests Mocker.GetMock().Setup(c => c.Start(It.IsAny(), It.Is(d => d.GetPropertyValue("EpisodeId") >= 0))); - //Act + Mocker.Resolve().Start(MockNotification, null); - //Assert + Mocker.GetMock().Verify(c => c.Start(It.IsAny(), It.Is(d => d.GetPropertyValue("EpisodeId") >= 0)), Times.Exactly(40)); } @@ -103,7 +103,7 @@ namespace NzbDrone.Core.Test.JobTests [Test] public void GetMissingForEnabledSeries_should_only_return_episodes_for_monitored_series() { - //Setup + var series = Builder.CreateListOfSize(2) .TheFirst(1) .With(s => s.Monitored = false) @@ -126,10 +126,10 @@ namespace NzbDrone.Core.Test.JobTests Mocker.GetMock() .Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes); - //Act + var result = Mocker.Resolve().GetMissingForEnabledSeries(); - //Assert + result.Should().NotBeEmpty(); result.Should().Contain(s => s.Series.Monitored); result.Should().NotContain(s => !s.Series.Monitored); @@ -138,7 +138,7 @@ namespace NzbDrone.Core.Test.JobTests [Test] public void GetMissingForEnabledSeries_should_only_return_explicity_enabled_series_when_backlog_searching_is_ignored() { - //Setup + var series = Builder.CreateListOfSize(3) .TheFirst(1) .With(s => s.Monitored = true) @@ -165,10 +165,10 @@ namespace NzbDrone.Core.Test.JobTests Mocker.GetMock() .Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes); - //Act + var result = Mocker.Resolve().GetMissingForEnabledSeries(); - //Assert + result.Should().NotBeEmpty(); result.Should().Contain(s => s.Series.BacklogSetting == BacklogSettingType.Enable); result.Should().NotContain(s => s.Series.BacklogSetting == BacklogSettingType.Disable); @@ -178,7 +178,7 @@ namespace NzbDrone.Core.Test.JobTests [Test] public void GetMissingForEnabledSeries_should_return_explicity_enabled_and_inherit_series_when_backlog_searching_is_enabled() { - //Setup + var series = Builder.CreateListOfSize(3) .TheFirst(1) .With(s => s.Monitored = true) @@ -205,10 +205,10 @@ namespace NzbDrone.Core.Test.JobTests Mocker.GetMock() .Setup(s => s.EpisodesWithoutFiles(true)).Returns(episodes); - //Act + var result = Mocker.Resolve().GetMissingForEnabledSeries(); - //Assert + result.Should().NotBeEmpty(); result.Should().Contain(s => s.Series.BacklogSetting == BacklogSettingType.Enable); result.Should().NotContain(s => s.Series.BacklogSetting == BacklogSettingType.Disable); diff --git a/NzbDrone.Core.Test/JobTests/RssSyncJobTest.cs b/NzbDrone.Core.Test/JobTests/RssSyncJobTest.cs index c8e5a66cb..e98f2eef2 100644 --- a/NzbDrone.Core.Test/JobTests/RssSyncJobTest.cs +++ b/NzbDrone.Core.Test/JobTests/RssSyncJobTest.cs @@ -14,7 +14,7 @@ using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.JobTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class RssSyncJobTest : CoreTest { public void WithMinutes(int minutes) diff --git a/NzbDrone.Core.Test/JobTests/SeasonSearchJobTest.cs b/NzbDrone.Core.Test/JobTests/SeasonSearchJobTest.cs index f6aa16d40..51f4732ed 100644 --- a/NzbDrone.Core.Test/JobTests/SeasonSearchJobTest.cs +++ b/NzbDrone.Core.Test/JobTests/SeasonSearchJobTest.cs @@ -16,7 +16,7 @@ using NzbDrone.Test.Common; namespace NzbDrone.Core.Test.JobTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class SeasonSearchJobTest : CoreTest { private List _episodes; @@ -47,10 +47,10 @@ namespace NzbDrone.Core.Test.JobTests .Setup(c => c.PartialSeasonSearch(notification, 1, 1)) .Returns(_episodes.Select(e => e.EpisodeNumber).ToList()); - //Act + Mocker.Resolve().Start(notification, new { SeriesId = 1, SeasonNumber = 1 }); - //Assert + Mocker.VerifyAllMocks(); Mocker.GetMock().Verify(c => c.PartialSeasonSearch(notification, 1, 1), Times.Once()); Mocker.GetMock().Verify(c => c.Start(notification, new { EpisodeId = It.IsAny() }), Times.Never()); @@ -63,10 +63,10 @@ namespace NzbDrone.Core.Test.JobTests .Setup(c => c.PartialSeasonSearch(notification, 1, 1)) .Returns(new List()); - //Act + Mocker.Resolve().Start(notification, new { SeriesId = 1, SeasonNumber = 1 }); - //Assert + Mocker.GetMock().Verify(c => c.PartialSeasonSearch(notification, 1, 1), Times.Once()); } @@ -91,10 +91,10 @@ namespace NzbDrone.Core.Test.JobTests .Returns(new List{1}); - //Act + Mocker.Resolve().Start(notification, new { SeriesId = 1, SeasonNumber = 1 }); - //Assert + Mocker.VerifyAllMocks(); Mocker.GetMock().Verify(c => c.PartialSeasonSearch(notification, 1, 1), Times.Once()); } @@ -105,10 +105,10 @@ namespace NzbDrone.Core.Test.JobTests Mocker.GetMock() .Setup(c => c.PartialSeasonSearch(notification, 1, 0)).Returns(new List()); - //Act + Mocker.Resolve().Start(notification, new { SeriesId = 1, SeasonNumber = 0 }); - //Assert + Mocker.GetMock().Verify(c => c.PartialSeasonSearch(notification, 1, 1), Times.Never()); Mocker.GetMock().Verify(c => c.Start(notification, new { EpisodeId = It.IsAny() }), Times.Never()); diff --git a/NzbDrone.Core.Test/JobTests/SeriesSearchJobTest.cs b/NzbDrone.Core.Test/JobTests/SeriesSearchJobTest.cs index f125473d7..53978bf70 100644 --- a/NzbDrone.Core.Test/JobTests/SeriesSearchJobTest.cs +++ b/NzbDrone.Core.Test/JobTests/SeriesSearchJobTest.cs @@ -14,7 +14,7 @@ using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.JobTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class SeriesSearchJobTest : CoreTest { [Test] @@ -35,10 +35,10 @@ namespace NzbDrone.Core.Test.JobTests Mocker.GetMock() .Setup(c => c.Start(notification, It.Is(d => d.GetPropertyValue("SeriesId") == 1 && d.GetPropertyValue("SeasonNumber") >= 0))).Verifiable(); - //Act + Mocker.Resolve().Start(notification, new { SeriesId = 1 }); - //Assert + Mocker.VerifyAllMocks(); Mocker.GetMock().Verify(c => c.Start(notification, It.Is(d => d.GetPropertyValue("SeriesId") == 1 && d.GetPropertyValue("SeasonNumber") >= 0)), Times.Exactly(seasons.Count)); @@ -56,10 +56,10 @@ namespace NzbDrone.Core.Test.JobTests Mocker.GetMock() .Setup(c => c.GetSeasonNumbers(1)).Returns(seasons); - //Act + Mocker.Resolve().Start(notification, new { SeriesId = 1 }); - //Assert + Mocker.VerifyAllMocks(); Mocker.GetMock().Verify(c => c.Start(notification, new { SeriesId = 1, SeasonNumber = It.IsAny() }), Times.Never()); diff --git a/NzbDrone.Core.Test/MediaFileTests/EpisodeFileMoverFixture.cs b/NzbDrone.Core.Test/MediaFileTests/EpisodeFileMoverFixture.cs index ba74c8fd2..8e1063e9d 100644 --- a/NzbDrone.Core.Test/MediaFileTests/EpisodeFileMoverFixture.cs +++ b/NzbDrone.Core.Test/MediaFileTests/EpisodeFileMoverFixture.cs @@ -55,10 +55,10 @@ namespace NzbDrone.Core.Test.MediaFileTests .Setup(e => e.BuildFilePath(It.IsAny(), fakeEpisode.First().SeasonNumber, filename, ".avi")) .Returns(fi); - //Act + var result = Subject.MoveEpisodeFile(file, false); - //Assert + result.Should().BeNull(); } diff --git a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj index 69cc4fc9b..8e639705a 100644 --- a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj +++ b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj @@ -219,7 +219,7 @@ - + diff --git a/NzbDrone.Core.Test/OrganizerTests/GetNewFilenameFixture.cs b/NzbDrone.Core.Test/OrganizerTests/GetNewFilenameFixture.cs index 4f8ae9c40..0f3b20624 100644 --- a/NzbDrone.Core.Test/OrganizerTests/GetNewFilenameFixture.cs +++ b/NzbDrone.Core.Test/OrganizerTests/GetNewFilenameFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; using System.IO; @@ -17,7 +17,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.OrganizerTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class MediaFileProvider_GetNewFilenameTest : CoreTest { private Series _series; @@ -45,7 +45,7 @@ namespace NzbDrone.Core.Test.OrganizerTests [Test] public void GetNewFilename_Series_Episode_Quality_S01E05_Dash() { - //Setup + @@ -62,17 +62,17 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.EpisodeNumber = 6) .Build(); - //Act + string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false }); - //Assert + Assert.AreEqual("South Park - S15E06 - City Sushi [HDTV-720p]", result); } [Test] public void GetNewFilename_Episode_Quality_1x05_Dash() { - //Setup + @@ -89,17 +89,17 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.EpisodeNumber = 6) .Build(); - //Act + string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false }); - //Assert + Assert.AreEqual("15x06 - City Sushi [HDTV-720p]", result); } [Test] public void GetNewFilename_Series_Quality_01x05_Space() { - //Setup + @@ -116,17 +116,17 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.EpisodeNumber = 6) .Build(); - //Act + string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false }); - //Assert + Assert.AreEqual("South Park 05x06 [HDTV-720p]", result); } [Test] public void GetNewFilename_Series_s01e05_Space() { - //Setup + @@ -144,17 +144,17 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.EpisodeNumber = 6) .Build(); - //Act + string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false }); - //Assert + Assert.AreEqual("South Park s05e06", result); } [Test] public void GetNewFilename_Series_Episode_s01e05_Periods() { - //Setup + @@ -171,17 +171,17 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.EpisodeNumber = 6) .Build(); - //Act + string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false }); - //Assert + Assert.AreEqual("South.Park.s05e06.City.Sushi", result); } [Test] public void GetNewFilename_Series_Episode_s01e05_Dash_Periods_Quality() { - //Setup + @@ -198,17 +198,17 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.EpisodeNumber = 6) .Build(); - //Act + string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false }); - //Assert + Assert.AreEqual("South.Park.-.s05e06.-.City.Sushi.[HDTV-720p]", result); } [Test] public void GetNewFilename_S01E05_Dash() { - //Setup + @@ -226,17 +226,17 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.EpisodeNumber = 6) .Build(); - //Act + string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false }); - //Assert + Assert.AreEqual("S15E06", result); } [Test] public void GetNewFilename_multi_Series_Episode_Quality_S01E05_Scene_Dash() { - //Setup + @@ -260,17 +260,17 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.EpisodeNumber = 24) .Build(); - //Act + string result = Subject.BuildFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false }); - //Assert + Assert.AreEqual("The Mentalist - S03E23-E24 - Strawberries and Cream [HDTV-720p]", result); } [Test] public void GetNewFilename_multi_Episode_Quality_1x05_Repeat_Dash() { - //Setup + @@ -294,17 +294,17 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.EpisodeNumber = 24) .Build(); - //Act + string result = Subject.BuildFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false }); - //Assert + Assert.AreEqual("3x23x24 - Strawberries and Cream [HDTV-720p]", result); } [Test] public void GetNewFilename_multi_Episode_Quality_01x05_Repeat_Space() { - //Setup + @@ -328,17 +328,17 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.EpisodeNumber = 24) .Build(); - //Act + string result = Subject.BuildFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false }); - //Assert + Assert.AreEqual("3x23x24 Strawberries and Cream [HDTV-720p]", result); } [Test] public void GetNewFilename_multi_Series_Episode_s01e05_Duplicate_Period() { - //Setup + @@ -362,17 +362,17 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.EpisodeNumber = 24) .Build(); - //Act + string result = Subject.BuildFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false }); - //Assert + Assert.AreEqual("The.Mentalist.s03e23.s03e24.Strawberries.and.Cream", result); } [Test] public void GetNewFilename_multi_Series_S01E05_Extend_Dash_Period() { - //Setup + @@ -396,17 +396,17 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.EpisodeNumber = 24) .Build(); - //Act + string result = Subject.BuildFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false }); - //Assert + Assert.AreEqual("The.Mentalist.-.S03E23-24", result); } [Test] public void GetNewFilename_multi_1x05_Repeat_Dash_Period() { - //Setup + @@ -430,17 +430,17 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.EpisodeNumber = 24) .Build(); - //Act + string result = Subject.BuildFilename(new List { episodeOne, episodeTwo }, new Series { Title = "The Mentalist" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false }); - //Assert + Assert.AreEqual("3x23x24", result); } [Test] public void GetNewFilename_should_append_proper_when_proper_and_append_quality_is_true() { - //Setup + nameSpecification.IncludeSeriesName = true; nameSpecification.IncludeEpisodeTitle = true; @@ -455,17 +455,17 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.EpisodeNumber = 6) .Build(); - //Act + string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = true }); - //Assert + result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p] [Proper]"); } [Test] public void GetNewFilename_should_not_append_proper_when_not_proper_and_append_quality_is_true() { - //Setup + nameSpecification.IncludeSeriesName = true; nameSpecification.IncludeEpisodeTitle = true; @@ -480,17 +480,17 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.EpisodeNumber = 6) .Build(); - //Act + string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false }); - //Assert + result.Should().Be("South Park - S15E06 - City Sushi [HDTV-720p]"); } [Test] public void GetNewFilename_should_not_append_proper_when_proper_and_append_quality_is_false() { - //Setup + nameSpecification.IncludeSeriesName = true; nameSpecification.IncludeEpisodeTitle = true; @@ -505,17 +505,17 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.EpisodeNumber = 6) .Build(); - //Act + string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = true }); - //Assert + result.Should().Be("South Park - S15E06 - City Sushi"); } [Test] public void GetNewFilename_should_order_multiple_episode_files_in_numerical_order() { - //Setup + nameSpecification.IncludeSeriesName = true; nameSpecification.IncludeEpisodeTitle = true; @@ -537,17 +537,17 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.EpisodeNumber = 7) .Build(); - //Act + string result = Subject.BuildFilename(new List { episode2, episode }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false }); - //Assert + result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!"); } [Test] public void GetNewFilename_Series_Episode_Quality_S01E05_Period() { - //Setup + @@ -564,17 +564,17 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.EpisodeNumber = 6) .Build(); - //Act + string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false }); - //Assert + Assert.AreEqual("South Park.S15E06.City Sushi [HDTV-720p]", result); } [Test] public void GetNewFilename_Episode_Quality_1x05_Period() { - //Setup + @@ -591,17 +591,17 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.EpisodeNumber = 6) .Build(); - //Act + string result = Subject.BuildFilename(new List { episode }, _series, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false }); - //Assert + Assert.AreEqual("15x06.City Sushi [HDTV-720p]", result); } [Test] public void GetNewFilename_UseSceneName_when_sceneName_isNull() { - //Setup + nameSpecification.IncludeSeriesName = false; nameSpecification.IncludeEpisodeTitle = true; @@ -622,17 +622,17 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.Path = @"C:\Test\TV\30 Rock - S01E01 - Test") .Build(); - //Act + string result = Subject.BuildFilename(new List { episode }, _series, episodeFile); - //Assert + result.Should().Be(Path.GetFileNameWithoutExtension(episodeFile.Path)); } [Test] public void GetNewFilename_UseSceneName_when_sceneName_isNotNull() { - //Setup + nameSpecification.IncludeSeriesName = false; nameSpecification.IncludeEpisodeTitle = true; @@ -653,17 +653,17 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.Path = @"C:\Test\TV\30 Rock - S01E01 - Test") .Build(); - //Act + string result = Subject.BuildFilename(new List { episode }, _series, episodeFile); - //Assert + result.Should().Be(episodeFile.SceneName); } [Test] public void should_only_have_one_episodeTitle_when_episode_titles_are_the_same() { - //Setup + nameSpecification.IncludeSeriesName = true; nameSpecification.IncludeEpisodeTitle = true; @@ -685,17 +685,17 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.EpisodeNumber = 7) .Build(); - //Act + string result = Subject.BuildFilename(new List { episode2, episode }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false }); - //Assert + result.Should().Be("30 Rock - S06E06-E07 - Hey, Baby, What's Wrong!"); } [Test] public void should_have_two_episodeTitles_when_episode_titles_are_not_the_same() { - //Setup + nameSpecification.IncludeSeriesName = true; nameSpecification.IncludeEpisodeTitle = true; @@ -717,17 +717,17 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.EpisodeNumber = 7) .Build(); - //Act + string result = Subject.BuildFilename(new List { episode2, episode }, new Series { Title = "30 Rock" }, new EpisodeFile { Quality = Quality.HDTV720p, Proper = false }); - //Assert + result.Should().Be("30 Rock - S06E06-E07 - Hello + World"); } [Test] public void should_have_two_episodeTitles_when_distinct_count_is_two() { - //Setup + nameSpecification.IncludeSeriesName = true; nameSpecification.IncludeEpisodeTitle = true; @@ -755,10 +755,10 @@ namespace NzbDrone.Core.Test.OrganizerTests .With(e => e.EpisodeNumber = 8) .Build(); - //Act + string result = Subject.BuildFilename(new List { episode, 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"); } diff --git a/NzbDrone.Core.Test/ParserTests/ParserFixture.cs b/NzbDrone.Core.Test/ParserTests/ParserFixture.cs index 4531450f9..aaa87703a 100644 --- a/NzbDrone.Core.Test/ParserTests/ParserFixture.cs +++ b/NzbDrone.Core.Test/ParserTests/ParserFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Linq; @@ -12,7 +12,7 @@ using NzbDrone.Test.Common; namespace NzbDrone.Core.Test.ParserTests { - // ReSharper disable InconsistentNaming + [TestFixture] public class ParserFixture : CoreTest { diff --git a/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs b/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs index 75c8ff519..188684785 100644 --- a/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs +++ b/NzbDrone.Core.Test/ParserTests/QualityParserFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Linq; @@ -10,7 +10,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.ParserTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class QualityParserFixture : CoreTest { public static object[] QualityParserCases = diff --git a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/CleanUpDropFolderFixture.cs b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/CleanUpDropFolderFixture.cs index c36af0a5f..f8334d458 100644 --- a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/CleanUpDropFolderFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/CleanUpDropFolderFixture.cs @@ -21,29 +21,29 @@ using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests { - // ReSharper disable InconsistentNaming + public class CleanUpDropFolderFixture : CoreTest { [Test] public void should_do_nothing_if_no_files_are_found() { - //Setup + var folder = @"C:\Test\DropDir\The Office"; Mocker.GetMock().Setup(s => s.GetFiles(folder, SearchOption.AllDirectories)) .Returns(new string[0]); - //Act + Mocker.Resolve().CleanUpDropFolder(folder); - //Assert + Mocker.GetMock().Verify(v => v.GetFileByPath(It.IsAny()), Times.Never()); } [Test] public void should_do_nothing_if_no_conflicting_files_are_found() { - //Setup + var folder = @"C:\Test\DropDir\The Office"; var filename = Path.Combine(folder, "NotAProblem.avi"); @@ -58,10 +58,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests Mocker.GetMock().Setup(s => s.GetFileByPath(filename)) .Returns(() => null); - //Act + Mocker.Resolve().CleanUpDropFolder(folder); - //Assert + Mocker.GetMock().Verify(v => v.GetFileByPath(filename), Times.Once()); Mocker.GetMock().Verify(v => v.Get(It.IsAny()), Times.Never()); } @@ -69,7 +69,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests [Test] public void should_move_file_if_a_conflict_is_found() { - //Setup + var folder = @"C:\Test\DropDir\The Office"; var filename = Path.Combine(folder, "Problem.avi"); var seriesId = 12345; @@ -119,10 +119,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests Mocker.GetMock().Setup(s => s.MoveFile(episodeFile.Path, newFilePath)); - //Act + Mocker.Resolve().CleanUpDropFolder(folder); - //Assert + Mocker.GetMock().Verify(v => v.GetFileByPath(filename), Times.Once()); Mocker.GetMock().Verify(v => v.MoveFile(filename.NormalizePath(), newFilePath), Times.Once()); } diff --git a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/GetVideoFilesFixture.cs b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/GetVideoFilesFixture.cs index 8319476e2..69f51be6c 100644 --- a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/GetVideoFilesFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/GetVideoFilesFixture.cs @@ -17,7 +17,7 @@ using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests { - // ReSharper disable InconsistentNaming + public class GetVideoFilesFixture : CoreTest { private string[] _files; diff --git a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ImportFileFixture.cs b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ImportFileFixture.cs index 7ab472114..c6038714a 100644 --- a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ImportFileFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ImportFileFixture.cs @@ -18,7 +18,7 @@ using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests { - // ReSharper disable InconsistentNaming + public class ImportFileFixture : CoreTest { public static object[] ImportTestCases = @@ -70,10 +70,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests Mocker.GetMock() .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode }); - //Act + var result = Mocker.Resolve().ImportFile(fakeSeries, newFile); - //Assert + VerifyFileImport(result, Mocker, fakeEpisode, SIZE); } @@ -97,10 +97,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests Mocker.GetMock() .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode }); - //Act + var result = Mocker.Resolve().ImportFile(fakeSeries, newFile); - //Assert + VerifyFileImport(result, Mocker, fakeEpisode, SIZE); } @@ -127,10 +127,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests Mocker.GetMock() .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode }); - //Act + var result = Mocker.Resolve().ImportFile(fakeSeries, fileName); - //Assert + VerifySkipImport(result, Mocker); } @@ -146,10 +146,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests With80MBFile(); - //Act + var result = Mocker.Resolve().ImportFile(fakeSeries, fileName); - //Assert + VerifySkipImport(result, Mocker); ExceptionVerification.ExpectedWarns(1); } @@ -168,10 +168,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests With80MBFile(); - //Act + var result = Mocker.Resolve().ImportFile(fakeSeries, fileName); - //Assert + VerifySkipImport(result, Mocker); } @@ -199,10 +199,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests .Returns(new List()); - //Act + var result = Mocker.Resolve().ImportFile(fakeSeries, fileName); - //Assert + VerifySkipImport(result, Mocker); } @@ -228,10 +228,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests Mocker.GetMock() .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode }); - //Act + var result = Mocker.Resolve().ImportFile(fakeSeries, fileName); - //Assert + VerifyFileImport(result, Mocker, fakeEpisode, SIZE); Mocker.GetMock().Verify(p => p.DeleteFile(It.IsAny()), Times.Once()); } @@ -260,10 +260,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests Mocker.GetMock() .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(fakeEpisodes); - //Act + var result = Mocker.Resolve().ImportFile(fakeSeries, fileName); - //Assert + VerifyFileImport(result, Mocker, fakeEpisodes[0], SIZE); Mocker.GetMock().Verify(p => p.DeleteFile(It.IsAny()), Times.Once()); } @@ -293,10 +293,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests Mocker.GetMock() .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(fakeEpisodes); - //Act + var result = Mocker.Resolve().ImportFile(fakeSeries, fileName); - //Assert + VerifySkipImport(result, Mocker); } @@ -331,10 +331,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests Mocker.GetMock() .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode1, fakeEpisode2 }); - //Act + var result = Mocker.Resolve().ImportFile(fakeSeries, fileName); - //Assert + VerifyFileImport(result, Mocker, fakeEpisode1, SIZE); Mocker.GetMock().Verify(p => p.DeleteFile(It.IsAny()), Times.Exactly(2)); } @@ -360,10 +360,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests Mocker.GetMock() .Setup(e => e.GetEpisodesByParseResult(It.IsAny())).Returns(new List { fakeEpisode}); - //Act + var result = Mocker.Resolve().ImportFile(fakeSeries, fileName); - //Assert + VerifyFileImport(result, Mocker, fakeEpisode, SIZE); Mocker.GetMock().Verify(p => p.DeleteFile(It.IsAny()), Times.Never()); } diff --git a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ScanFixture.cs b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ScanFixture.cs index d7bd6d020..382c02641 100644 --- a/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ScanFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/DiskScanProviderTests/ScanFixture.cs @@ -12,7 +12,7 @@ using NzbDrone.Test.Common; namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests { - // ReSharper disable InconsistentNaming + public class ScanFixture : CoreTest { [Test] @@ -44,7 +44,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests [Test] public void series_should_log_warning_if_path_doesnt_exist_on_disk() { - //Setup + WithStrictMocker(); var series = Builder.CreateNew() @@ -56,10 +56,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DiskScanProviderTests .Setup(c => c.FolderExists(series.Path)) .Returns(false); - //Act + Mocker.Resolve().Scan(series, series.Path); - //Assert + Mocker.VerifyAllMocks(); ExceptionVerification.ExpectedWarns(1); } diff --git a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/QueueFixture.cs b/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/QueueFixture.cs index 022b597bb..a27643ed4 100644 --- a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/QueueFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/QueueFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; @@ -21,13 +21,13 @@ using NzbDrone.Test.Common; namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class QueueFixture : CoreTest { [SetUp] public void Setup() { - //Setup + string sabHost = "192.168.5.55"; int sabPort = 2222; string apikey = "5c770e3197e4fe763423ee7c392c25d1"; diff --git a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/SabProviderFixture.cs b/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/SabProviderFixture.cs index c6d3bf65e..8973b761a 100644 --- a/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/SabProviderFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/DownloadClientTests/SabProviderTests/SabProviderFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; @@ -21,7 +21,7 @@ using NzbDrone.Test.Common; namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class SabProviderFixture : CoreTest { private const string url = "http://www.nzbclub.com/nzb_download.aspx?mid=1950232"; @@ -53,7 +53,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=0&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns("{ \"status\": true }"); - //Act + Mocker.Resolve().DownloadNzb(url, title, false).Should().BeTrue(); } @@ -62,7 +62,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests { WithFailResponse(); - //Act + Assert.Throws(() => Mocker.Resolve().DownloadNzb(url, title, false).Should().BeFalse()); //ExceptionVerification.ExpectedErrors(1); } @@ -70,7 +70,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests [Test] public void should_be_able_to_get_categories_when_config_is_passed_in() { - //Setup + const string host = "192.168.5.22"; const int port = 1111; const string apikey = "5c770e3197e4fe763423ee7c392c25d2"; @@ -83,10 +83,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests .Setup(s => s.DownloadString("http://192.168.5.22:1111/api?mode=get_cats&output=json&apikey=5c770e3197e4fe763423ee7c392c25d2&ma_username=admin2&ma_password=pass2")) .Returns(ReadAllText("Files","Categories_json.txt")); - //Act + var result = Mocker.Resolve().GetCategories(host, port, apikey, username, password); - //Assert + result.Should().NotBeNull(); result.categories.Should().NotBeEmpty(); } @@ -98,10 +98,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=get_cats&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns(ReadAllText("Files","Categories_json.txt")); - //Act + var result = Mocker.Resolve().GetCategories(); - //Assert + result.Should().NotBeNull(); result.categories.Should().NotBeEmpty(); } @@ -113,10 +113,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=history&output=json&start=0&limit=0&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns(ReadAllText("Files", "History.txt")); - //Act + var result = Mocker.Resolve().GetHistory(); - //Assert + result.Should().HaveCount(1); } @@ -127,10 +127,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=history&output=json&start=0&limit=0&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns(ReadAllText("Files","HistoryEmpty.txt")); - //Act + var result = Mocker.Resolve().GetHistory(); - //Assert + result.Should().BeEmpty(); } @@ -141,7 +141,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=history&output=json&start=0&limit=0&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns(ReadAllText("Files","JsonError.txt")); - //Act + Assert.Throws(() => Mocker.Resolve().GetHistory(), "API Key Incorrect"); } @@ -154,10 +154,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=version&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns(response); - //Act + var result = Mocker.Resolve().GetVersion("192.168.5.55", 2222, "5c770e3197e4fe763423ee7c392c25d1", "admin", "pass"); - //Assert + result.Should().NotBeNull(); result.Version.Should().Be("0.6.9"); } @@ -171,10 +171,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=version&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns(response); - //Act + var result = Mocker.Resolve().GetVersion(); - //Assert + result.Should().NotBeNull(); result.Version.Should().Be("0.6.9"); } @@ -188,10 +188,10 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=version&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns(response); - //Act + var result = Mocker.Resolve().Test("192.168.5.55", 2222, "5c770e3197e4fe763423ee7c392c25d1", "admin", "pass"); - //Assert + result.Should().Be("0.6.9"); } @@ -220,7 +220,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=1&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns("{ \"status\": true }"); - //Act + Mocker.Resolve().DownloadNzb(url, title, true).Should().BeTrue(); Mocker.GetMock() @@ -242,7 +242,7 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadClientTests.SabProviderTests .Setup(s => s.DownloadString("http://192.168.5.55:2222/api?mode=addurl&name=http://www.nzbclub.com/nzb_download.aspx?mid=1950232&priority=-1&pp=3&cat=tv&nzbname=My+Series+Name+-+5x2-5x3+-+My+title+%5bBluray720p%5d+%5bProper%5d&output=json&apikey=5c770e3197e4fe763423ee7c392c25d1&ma_username=admin&ma_password=pass")) .Returns("{ \"status\": true }"); - //Act + Mocker.Resolve().DownloadNzb(url, title, false).Should().BeTrue(); Mocker.GetMock() diff --git a/NzbDrone.Core.Test/ProviderTests/DownloadProviderTests/DownloadProviderFixture.cs b/NzbDrone.Core.Test/ProviderTests/DownloadProviderTests/DownloadProviderFixture.cs index d5e6fd7bd..0903a6128 100644 --- a/NzbDrone.Core.Test/ProviderTests/DownloadProviderTests/DownloadProviderFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/DownloadProviderTests/DownloadProviderFixture.cs @@ -14,7 +14,7 @@ using NzbDrone.Core.Tv; using NzbDrone.Core.Model; using NzbDrone.Core.Test.Framework; -// ReSharper disable InconsistentNaming + namespace NzbDrone.Core.Test.ProviderTests.DownloadProviderTests { @@ -79,11 +79,11 @@ namespace NzbDrone.Core.Test.ProviderTests.DownloadProviderTests var parseResult = SetupParseResult(); - //Act + Subject.DownloadReport(parseResult); - //Assert + Mocker.GetMock() .Verify(s => s.DownloadNzb(It.IsAny(), It.IsAny(), true), Times.Once()); diff --git a/NzbDrone.Core.Test/ProviderTests/EventClientProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/EventClientProviderTest.cs index f3302767a..d259a3a08 100644 --- a/NzbDrone.Core.Test/ProviderTests/EventClientProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/EventClientProviderTest.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using Moq; @@ -12,13 +12,13 @@ using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class EventClientProviderTest : CoreTest { [Test] public void SendNotification_true() { - //Setup + var header = "NzbDrone Test"; @@ -28,17 +28,17 @@ namespace NzbDrone.Core.Test.ProviderTests var fakeUdp = Mocker.GetMock(); fakeUdp.Setup(s => s.Send(address, UdpProvider.PacketType.Notification, It.IsAny())).Returns(true); - //Act + var result = Mocker.Resolve().SendNotification(header, message, IconType.Jpeg, "NzbDrone.jpg", address); - //Assert + Assert.AreEqual(true, result); } [Test] public void SendNotification_false() { - //Setup + var header = "NzbDrone Test"; @@ -48,17 +48,17 @@ namespace NzbDrone.Core.Test.ProviderTests var fakeUdp = Mocker.GetMock(); fakeUdp.Setup(s => s.Send(address, UdpProvider.PacketType.Notification, It.IsAny())).Returns(false); - //Act + var result = Mocker.Resolve().SendNotification(header, message, IconType.Jpeg, "NzbDrone.jpg", address); - //Assert + Assert.AreEqual(false, result); } [Test] public void SendAction_Update_true() { - //Setup + var path = @"C:\Test\TV\30 Rock"; @@ -68,17 +68,17 @@ namespace NzbDrone.Core.Test.ProviderTests var fakeUdp = Mocker.GetMock(); fakeUdp.Setup(s => s.Send(address, UdpProvider.PacketType.Action, It.IsAny())).Returns(true); - //Act + var result = Mocker.Resolve().SendAction(address, ActionType.ExecBuiltin, command); - //Assert + Assert.AreEqual(true, result); } [Test] public void SendAction_Update_false() { - //Setup + var path = @"C:\Test\TV\30 Rock"; @@ -88,10 +88,10 @@ namespace NzbDrone.Core.Test.ProviderTests var fakeUdp = Mocker.GetMock(); fakeUdp.Setup(s => s.Send(address, UdpProvider.PacketType.Action, It.IsAny())).Returns(false); - //Act + var result = Mocker.Resolve().SendAction(address, ActionType.ExecBuiltin, command); - //Assert + Assert.AreEqual(false, result); } } diff --git a/NzbDrone.Core.Test/ProviderTests/GrowlProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/GrowlProviderTest.cs index 2061b4b68..9efaadc70 100644 --- a/NzbDrone.Core.Test/ProviderTests/GrowlProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/GrowlProviderTest.cs @@ -11,7 +11,7 @@ using NzbDrone.Core.Providers; using NzbDrone.Core.Test.Framework; using NzbDrone.Test.Common.AutoMoq; -// ReSharper disable InconsistentNaming + namespace NzbDrone.Core.Test.ProviderTests { @@ -22,52 +22,52 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void Register_should_add_new_application_to_local_growl_instance() { - //Setup + WithStrictMocker(); - //Act + Mocker.Resolve().Register("localhost", 23053, ""); - //Assert + Mocker.VerifyAllMocks(); } [Test] public void TestNotification_should_send_a_message_to_local_growl_instance() { - //Setup + WithStrictMocker(); - //Act + Mocker.Resolve().TestNotification("localhost", 23053, ""); - //Assert + Mocker.VerifyAllMocks(); } [Test] public void OnGrab_should_send_a_message_to_local_growl_instance() { - //Setup + WithStrictMocker(); - //Act + Mocker.Resolve().SendNotification("Episode Grabbed", "Series Title - 1x05 - Episode Title", "GRAB", "localhost", 23053, ""); - //Assert + Mocker.VerifyAllMocks(); } [Test] public void OnDownload_should_send_a_message_to_local_growl_instance() { - //Setup + WithStrictMocker(); - //Act + Mocker.Resolve().SendNotification("Episode Downloaded", "Series Title - 1x05 - Episode Title", "DOWNLOAD", "localhost", 23053, ""); - //Assert + Mocker.VerifyAllMocks(); } } diff --git a/NzbDrone.Core.Test/ProviderTests/MisnamedProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/MisnamedProviderTest.cs index 8061e4be4..e0f4b4cf4 100644 --- a/NzbDrone.Core.Test/ProviderTests/MisnamedProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/MisnamedProviderTest.cs @@ -21,7 +21,7 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void no_misnamed_files() { - //Setup + var series = Builder.CreateNew() .With(s => s.Title = "SeriesTitle") .Build(); @@ -57,18 +57,18 @@ namespace NzbDrone.Core.Test.ProviderTests .Setup(c => c.BuildFilename(new List { episodes[1] }, It.IsAny(), episodeFiles[1])) .Returns("Title2"); - //Act + var totalItems = 0; var misnamedEpisodes = Mocker.Resolve().MisnamedFiles(1, 10, out totalItems); - //Assert + misnamedEpisodes.Should().HaveCount(0); } [Test] public void all_misnamed_files() { - //Setup + var series = Builder.CreateNew() .With(s => s.Title = "SeriesTitle") .Build(); @@ -104,18 +104,18 @@ namespace NzbDrone.Core.Test.ProviderTests .Setup(c => c.BuildFilename(new List { episodes[1] }, It.IsAny(), episodeFiles[1])) .Returns("New Title 2"); - //Act + var totalItems = 0; var misnamedEpisodes = Mocker.Resolve().MisnamedFiles(1, 10, out totalItems); - //Assert + misnamedEpisodes.Should().HaveCount(2); } [Test] public void one_misnamed_file() { - //Setup + var series = Builder.CreateNew() .With(s => s.Title = "SeriesTitle") .Build(); @@ -151,11 +151,11 @@ namespace NzbDrone.Core.Test.ProviderTests .Setup(c => c.BuildFilename(new List { episodes[1] }, It.IsAny(), episodeFiles[1])) .Returns("Title2"); - //Act + var totalItems = 0; var misnamedEpisodes = Mocker.Resolve().MisnamedFiles(1, 10, out totalItems); - //Assert + misnamedEpisodes.Should().HaveCount(1); misnamedEpisodes[0].CurrentName.Should().Be("Title1"); misnamedEpisodes[0].ProperName.Should().Be("New Title 1"); @@ -164,7 +164,7 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void misnamed_multi_episode_file() { - //Setup + var series = Builder.CreateNew() .With(s => s.Title = "SeriesTitle") .Build(); @@ -200,11 +200,11 @@ namespace NzbDrone.Core.Test.ProviderTests .Setup(c => c.BuildFilename(new List { episodes[2] }, It.IsAny(), episodeFiles[1])) .Returns("Title2"); - //Act + var totalItems = 0; var misnamedEpisodes = Mocker.Resolve().MisnamedFiles(1, 10, out totalItems); - //Assert + misnamedEpisodes.Should().HaveCount(1); misnamedEpisodes[0].CurrentName.Should().Be("Title1"); misnamedEpisodes[0].ProperName.Should().Be("New Title 1"); @@ -213,7 +213,7 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void no_misnamed_multi_episode_file() { - //Setup + var series = Builder.CreateNew() .With(s => s.Title = "SeriesTitle") .Build(); @@ -249,11 +249,11 @@ namespace NzbDrone.Core.Test.ProviderTests .Setup(c => c.BuildFilename(new List { episodes[2] }, It.IsAny(), episodeFiles[1])) .Returns("Title2"); - //Act + var totalItems = 0; var misnamedEpisodes = Mocker.Resolve().MisnamedFiles(1, 10, out totalItems); - //Assert + misnamedEpisodes.Should().HaveCount(0); } } diff --git a/NzbDrone.Core.Test/ProviderTests/PlexProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/PlexProviderTest.cs index 746a0165d..91c5d725f 100644 --- a/NzbDrone.Core.Test/ProviderTests/PlexProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/PlexProviderTest.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.IO; @@ -22,7 +22,7 @@ using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class PlexProviderTest : CoreTest { private void WithSingleClient() @@ -49,7 +49,7 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void GetSectionKeys_should_return_single_section_key_when_only_one_show_section() { - //Setup + var response = ""; Stream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(response)); @@ -57,10 +57,10 @@ namespace NzbDrone.Core.Test.ProviderTests Mocker.GetMock().Setup(s => s.DownloadStream("http://localhost:32400/library/sections", null)) .Returns(stream); - //Act + var result = Mocker.Resolve().GetSectionKeys("localhost:32400"); - //Assert + result.Should().HaveCount(1); result.First().Should().Be(5); } @@ -68,7 +68,7 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void GetSectionKeys_should_return_single_section_key_when_only_one_show_section_with_other_sections() { - //Setup + var response = ""; Stream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(response)); @@ -76,10 +76,10 @@ namespace NzbDrone.Core.Test.ProviderTests Mocker.GetMock().Setup(s => s.DownloadStream("http://localhost:32400/library/sections", null)) .Returns(stream); - //Act + var result = Mocker.Resolve().GetSectionKeys("localhost:32400"); - //Assert + result.Should().HaveCount(1); result.First().Should().Be(5); } @@ -87,7 +87,7 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void GetSectionKeys_should_return_multiple_section_keys_when_there_are_multiple_show_sections() { - //Setup + var response = ""; Stream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(response)); @@ -95,10 +95,10 @@ namespace NzbDrone.Core.Test.ProviderTests Mocker.GetMock().Setup(s => s.DownloadStream("http://localhost:32400/library/sections", null)) .Returns(stream); - //Act + var result = Mocker.Resolve().GetSectionKeys("localhost:32400"); - //Assert + result.Should().HaveCount(2); result.First().Should().Be(5); result.Last().Should().Be(6); @@ -107,7 +107,7 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void UpdateSection_should_update_section() { - //Setup + var response = ""; Stream stream = new MemoryStream(ASCIIEncoding.Default.GetBytes(response)); @@ -115,17 +115,17 @@ namespace NzbDrone.Core.Test.ProviderTests Mocker.GetMock().Setup(s => s.DownloadString("http://localhost:32400/library/sections/5/refresh")) .Returns(response); - //Act + Mocker.Resolve().UpdateSection("localhost:32400", 5); - //Assert + } [Test] public void Notify_should_send_notification_for_single_client_when_only_one_is_configured() { - //Setup + WithSingleClient(); const string header = "Test Header"; @@ -137,17 +137,17 @@ namespace NzbDrone.Core.Test.ProviderTests fakeHttp.Setup(s => s.DownloadString(expectedUrl)) .Returns("ok"); - //Act + Mocker.Resolve().Notify(header, message); - //Assert + fakeHttp.Verify(v => v.DownloadString(expectedUrl), Times.Once()); } [Test] public void Notify_should_send_notifcation_to_all_configured_clients() { - //Setup + WithMultipleClients(); const string header = "Test Header"; @@ -157,17 +157,17 @@ namespace NzbDrone.Core.Test.ProviderTests fakeHttp.Setup(s => s.DownloadString(It.IsAny())) .Returns("ok"); - //Act + Mocker.Resolve().Notify(header, message); - //Assert + fakeHttp.Verify(v => v.DownloadString(It.IsAny()), Times.Exactly(2)); } [Test] public void Notify_should_send_notification_with_credentials_when_configured() { - //Setup + WithSingleClient(); WithClientCredentials(); @@ -180,17 +180,17 @@ namespace NzbDrone.Core.Test.ProviderTests fakeHttp.Setup(s => s.DownloadString(expectedUrl, "plex", "plex")) .Returns("ok"); - //Act + Mocker.Resolve().Notify(header, message); - //Assert + fakeHttp.Verify(v => v.DownloadString(expectedUrl, "plex", "plex"), Times.Once()); } [Test] public void Notify_should_send_notification_with_credentials_when_configured_for_all_clients() { - //Setup + WithMultipleClients(); WithClientCredentials(); @@ -201,10 +201,10 @@ namespace NzbDrone.Core.Test.ProviderTests fakeHttp.Setup(s => s.DownloadString(It.IsAny(), "plex", "plex")) .Returns("ok"); - //Act + Mocker.Resolve().Notify(header, message); - //Assert + fakeHttp.Verify(v => v.DownloadString(It.IsAny(), "plex", "plex"), Times.Exactly(2)); } } diff --git a/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/GetFolderNameWithStatusFixture.cs b/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/GetFolderNameWithStatusFixture.cs index 1e45f27ba..9ec85097b 100644 --- a/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/GetFolderNameWithStatusFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/GetFolderNameWithStatusFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System.Linq; using System; @@ -12,7 +12,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class GetFolderNameWithStatusFixture : CoreTest { [TestCase(@"c:\_NzbDrone_InvalidEpisode_Title", @"c:\_UnknownSeries_Title", PostDownloadStatusType.UnknownSeries)] diff --git a/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/ProcessDownloadFixture.cs b/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/ProcessDownloadFixture.cs index 098f82102..2da99d67d 100644 --- a/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/ProcessDownloadFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/ProcessDownloadFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable InconsistentNaming + using System; using System.Collections.Generic; using System.IO; @@ -99,11 +99,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests var droppedFolder = new DirectoryInfo(TempFolder + "\\_test\\"); droppedFolder.Create(); - //Act + Mocker.GetMock().Setup(s => s.GetByTitle(It.IsAny())).Returns(null).Verifiable(); Mocker.Resolve().ProcessDownload(droppedFolder); - //Assert + Mocker.VerifyAllMocks(); ExceptionVerification.IgnoreWarns(); } @@ -118,10 +118,10 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests Mocker.GetMock().Setup(s => s.GetByTitle("office")).Returns(null).Verifiable(); - //Act + Mocker.Resolve().ProcessDownload(droppedFolder); - //Assert + Mocker.VerifyAllMocks(); ExceptionVerification.IgnoreWarns(); } @@ -160,20 +160,20 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests [Ignore("Disabled tagging")] public void when_series_isnt_found_folder_should_be_tagged_as_unknown_series() { - //Setup + WithStrictMocker(); WithOldWrite(); var droppedFolder = new DirectoryInfo(@"C:\Test\Unsorted TV\The Office - S01E01 - Episode Title"); var taggedFolder = @"C:\Test\Unsorted TV\_UnknownSeries_The Office - S01E01 - Episode Title"; - //Act + Mocker.GetMock().Setup(s => s.GetByTitle("office")).Returns(null); Mocker.GetMock().Setup(s => s.MoveDirectory(droppedFolder.FullName, taggedFolder)); Mocker.Resolve().ProcessDownload(droppedFolder); - //Assert + Mocker.VerifyAllMocks(); ExceptionVerification.ExpectedWarns(1); } @@ -182,7 +182,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests [Ignore("Disabled tagging")] public void when_no_files_are_imported_folder_should_be_tagged_with_parse_error() { - //Setup + WithStrictMocker(); WithOldWrite(); var droppedFolder = new DirectoryInfo(@"C:\Test\Unsorted TV\The Office - S01E01 - Episode Title"); @@ -193,7 +193,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests .With(s => s.Title = "The Office") .Build(); - //Act + Mocker.GetMock().Setup(s => s.GetByTitle("office")).Returns(fakeSeries); Mocker.GetMock().Setup(s => s.Scan(fakeSeries, droppedFolder.FullName)).Returns(new List()); Mocker.GetMock().Setup(s => s.MoveDirectory(droppedFolder.FullName, taggedFolder)); @@ -202,7 +202,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests Mocker.Resolve().ProcessDownload(droppedFolder); - //Assert + Mocker.VerifyAllMocks(); ExceptionVerification.ExpectedWarns(1); } @@ -212,7 +212,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests [Ignore("Disabled tagging")] public void when_no_file_are_imported_and_folder_size_isnt_small_enought_folder_should_be_tagged_unknown() { - //Setup + WithStrictMocker(); WithOldWrite(); var droppedFolder = new DirectoryInfo(@"C:\Test\Unsorted TV\The Office - Season 01"); @@ -228,7 +228,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests .With(f => f.SeriesId = fakeSeries.Id) .Build().ToList(); - //Act + Mocker.GetMock().Setup(s => s.GetByTitle("office")).Returns(fakeSeries); Mocker.GetMock().Setup(s => s.MoveDirectory(droppedFolder.FullName, taggedFolder)); Mocker.GetMock().Setup(s => s.GetDirectorySize(droppedFolder.FullName)).Returns(Constants.IgnoreFileSize + 10.Megabytes()); @@ -237,7 +237,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests Mocker.Resolve().ProcessDownload(droppedFolder); - //Assert + Mocker.VerifyAllMocks(); ExceptionVerification.ExpectedWarns(1); } @@ -248,17 +248,17 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests [TestCase("\\Test\\_UnknownSeries_The Office - S01E01 - Episode Title")] public void folder_shouldnt_be_tagged_with_same_tag_again(string path) { - //Setup + var droppedFolder = new DirectoryInfo(TempFolder + path); droppedFolder.Create(); WithOldWrite(); - //Act + Mocker.GetMock().Setup(s => s.GetByTitle(It.IsAny())).Returns(null); Mocker.Resolve().ProcessDownload(droppedFolder); - //Assert + Mocker.VerifyAllMocks(); Mocker.GetMock().Verify(c => c.MoveDirectory(It.IsAny(), It.IsAny()), Times.Never()); } @@ -266,7 +266,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests [Test] public void folder_should_not_be_tagged_if_existing_tag_is_diffrent() { - //Setup + WithOldWrite(); var droppedFolder = new DirectoryInfo(TempFolder + @"\_UnknownEpisode_The Office - S01E01 - Episode Title"); droppedFolder.Create(); @@ -276,10 +276,10 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests Mocker.GetMock().Setup(s => s.GetByTitle(It.IsAny())).Returns(null); - //Act + Mocker.Resolve().ProcessDownload(droppedFolder); - //Assert + Mocker.VerifyAllMocks(); Mocker.GetMock().Verify(c => c.MoveDirectory(droppedFolder.FullName, taggedFolder), Times.Never()); ExceptionVerification.IgnoreWarns(); @@ -288,7 +288,7 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests [Test] public void when_files_are_imported_and_folder_is_small_enough_dir_should_be_deleted() { - //Setup + WithStrictMocker(); WithLotsOfFreeDiskSpace(); @@ -304,10 +304,10 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests Mocker.GetMock().Setup(s => s.FolderExists(fakeSeries.Path)).Returns(true); Mocker.GetMock().Setup(s => s.IsFolderLocked(droppedFolder.FullName)).Returns(false); - //Act + Mocker.Resolve().ProcessDownload(droppedFolder); - //Assert + Mocker.VerifyAllMocks(); } @@ -326,10 +326,10 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests Mocker.GetMock().Setup(s => s.FolderExists(fakeSeries.Path)).Returns(true); Mocker.GetMock().Setup(s => s.Scan(fakeSeries, droppedFolder.FullName)).Returns(fakeEpisodeFiles); - //Act + Mocker.Resolve().ProcessDownload(droppedFolder); - //Assert + Mocker.GetMock().Verify(c => c.MoveEpisodeFile(It.IsAny(), true), Times.Exactly(fakeEpisodeFiles.Count)); Mocker.VerifyAllMocks(); @@ -361,11 +361,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests .Setup(s => s.FreeDiskSpace(series.Path)) .Returns(9); - //Act + Mocker.Resolve().ProcessDownload(downloadName); - //Assert + Mocker.GetMock().Verify(c => c.Scan(series, downloadName.FullName), Times.Never()); ExceptionVerification.ExpectedErrors(1); } @@ -388,11 +388,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests .Setup(s => s.GetDirectorySize(downloadName.FullName)) .Returns(8); - //Act + Mocker.Resolve().ProcessDownload(downloadName); - //Assert + Mocker.GetMock().Verify(c => c.Scan(fakeSeries, downloadName.FullName), Times.Once()); } @@ -412,11 +412,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests .Setup(s => s.FreeDiskSpace(It.IsAny())) .Returns(10); - //Act + Mocker.Resolve().ProcessDownload(downloadName); - //Assert + Mocker.GetMock().Verify(c => c.Scan(fakeSeries, downloadName.FullName), Times.Once()); } diff --git a/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/ProcessDropDirectoryFixture.cs b/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/ProcessDropDirectoryFixture.cs index 4b74214e1..5be2e75c6 100644 --- a/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/ProcessDropDirectoryFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/ProcessDropDirectoryFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable InconsistentNaming + using System; using System.Collections.Generic; using System.IO; @@ -78,10 +78,10 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests .Setup(c => c.FolderExists(It.IsAny())) .Returns(true); - //Act + Mocker.Resolve().ProcessDropFolder(@"C:\drop\"); - //Assert + Mocker.GetMock().Verify(c => c.Scan(It.IsAny(), subFolders[0]), Times.Once()); Mocker.GetMock().Verify(c => c.Scan(It.IsAny(), subFolders[1]), Times.Never()); Mocker.GetMock().Verify(c => c.Scan(It.IsAny(), subFolders[2]), Times.Once()); @@ -121,11 +121,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests .Setup(c => c.FolderExists(It.IsAny())) .Returns(true); - //Act + Mocker.Resolve().ProcessDropFolder(@"C:\drop\"); - //Assert + Mocker.GetMock().Verify(c => c.ImportFile(It.IsAny(), It.IsAny()), Times.Exactly(4)); } } diff --git a/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/ProcessVideoFileFixture.cs b/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/ProcessVideoFileFixture.cs index 128755675..78741b11b 100644 --- a/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/ProcessVideoFileFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/PostDownloadProviderTests/ProcessVideoFileFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable InconsistentNaming + using System; using System.Collections.Generic; using System.IO; @@ -96,11 +96,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests var file = Path.Combine(TempFolder, "test.avi"); - //Act + Mocker.GetMock().Setup(s => s.GetByTitle(It.IsAny())).Returns(null).Verifiable(); Mocker.Resolve().ProcessVideoFile(file); - //Assert + Mocker.GetMock().Verify(s => s.GetByTitle(It.IsAny()), Times.Once()); ExceptionVerification.IgnoreWarns(); } @@ -112,11 +112,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests var file = Path.Combine(TempFolder, "test.avi"); - //Act + Mocker.GetMock().Setup(s => s.GetByTitle(It.IsAny())).Returns(null); Mocker.Resolve().ProcessVideoFile(file); - //Assert + Mocker.GetMock().Verify(s => s.GetSize(It.IsAny()), Times.Never()); ExceptionVerification.IgnoreWarns(); } @@ -132,10 +132,10 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests WithValidSeries(); WithImportedFile(file); - //Act + Mocker.Resolve().ProcessVideoFile(file); - //Assert + Mocker.GetMock().Verify(s => s.MoveEpisodeFile(It.IsAny(), true), Times.Once()); ExceptionVerification.IgnoreWarns(); } @@ -166,11 +166,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests .Setup(s => s.FolderExists(series.Path)) .Returns(true); - //Act + Mocker.Resolve().ProcessVideoFile(downloadName); - //Assert + Mocker.GetMock().Verify(c => c.ImportFile(series, downloadName), Times.Never()); ExceptionVerification.ExpectedErrors(1); } @@ -191,11 +191,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests .Setup(s => s.GetSize(downloadName)) .Returns(8); - //Act + Mocker.Resolve().ProcessVideoFile(downloadName); - //Assert + Mocker.GetMock().Verify(c => c.ImportFile(fakeSeries, downloadName), Times.Once()); } @@ -214,11 +214,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests .Setup(s => s.FreeDiskSpace(It.IsAny())) .Returns(10); - //Act + Mocker.Resolve().ProcessVideoFile(downloadName); - //Assert + Mocker.GetMock().Verify(c => c.ImportFile(fakeSeries, downloadName), Times.Once()); } @@ -233,11 +233,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests .Setup(s => s.FolderExists(fakeSeries.Path)) .Returns(false); - //Act + Mocker.Resolve().ProcessVideoFile(downloadName); - //Assert + ExceptionVerification.ExpectedWarns(1); } @@ -252,11 +252,11 @@ namespace NzbDrone.Core.Test.ProviderTests.PostDownloadProviderTests .Setup(s => s.IsFileLocked(It.Is(f => f.FullName == downloadName))) .Returns(true); - //Act + Mocker.Resolve().ProcessVideoFile(downloadName); - //Assert + Mocker.GetMock().Verify(c => c.ImportFile(fakeSeries, downloadName), Times.Never()); } } diff --git a/NzbDrone.Core.Test/ProviderTests/ProwlProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/ProwlProviderTest.cs index e5f21d137..1d63e8b84 100644 --- a/NzbDrone.Core.Test/ProviderTests/ProwlProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/ProwlProviderTest.cs @@ -12,7 +12,7 @@ using NzbDrone.Test.Common; using NzbDrone.Test.Common.AutoMoq; using Prowlin; -// ReSharper disable InconsistentNaming + namespace NzbDrone.Core.Test.ProviderTests { @@ -28,26 +28,26 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void Verify_should_return_true_for_a_valid_apiKey() { - //Setup + WithStrictMocker(); - //Act + var result = Mocker.Resolve().Verify(_apiKey); - //Assert + result.Should().BeTrue(); } [Test] public void Verify_should_return_false_for_an_invalid_apiKey() { - //Setup + WithStrictMocker(); - //Act + var result = Mocker.Resolve().Verify(_badApiKey); - //Assert + ExceptionVerification.ExpectedWarns(1); result.Should().BeFalse(); } @@ -55,26 +55,26 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void SendNotification_should_return_true_for_a_valid_apiKey() { - //Setup + WithStrictMocker(); - //Act + var result = Mocker.Resolve().SendNotification("NzbDrone Test", "This is a test message from NzbDrone", _apiKey); - //Assert + result.Should().BeTrue(); } [Test] public void SendNotification_should_return_false_for_an_invalid_apiKey() { - //Setup + WithStrictMocker(); - //Act + var result = Mocker.Resolve().SendNotification("NzbDrone Test", "This is a test message from NzbDrone", _badApiKey); - //Assert + ExceptionVerification.ExpectedWarns(1); result.Should().BeFalse(); } @@ -82,65 +82,65 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void SendNotification_should_alert_with_high_priority() { - //Setup + WithStrictMocker(); - //Act + var result = Mocker.Resolve().SendNotification("NzbDrone Test", "This is a test message from NzbDrone (High)", _apiKey, NotificationPriority.High); - //Assert + result.Should().BeTrue(); } [Test] public void SendNotification_should_alert_with_VeryLow_priority() { - //Setup + WithStrictMocker(); - //Act + var result = Mocker.Resolve().SendNotification("NzbDrone Test", "This is a test message from NzbDrone (VeryLow)", _apiKey, NotificationPriority.VeryLow); - //Assert + result.Should().BeTrue(); } [Test] public void SendNotification_should_have_a_call_back_url() { - //Setup + WithStrictMocker(); - //Act + var result = Mocker.Resolve().SendNotification("NzbDrone Test", "This is a test message from NzbDrone", _apiKey, NotificationPriority.Normal, "http://www.nzbdrone.com"); - //Assert + result.Should().BeTrue(); } [Test] public void SendNotification_should_return_true_for_two_valid_apiKey() { - //Setup + WithStrictMocker(); - //Act + var result = Mocker.Resolve().SendNotification("NzbDrone Test", "This is a test message from NzbDrone", _apiKey + ", " + _apiKey2); - //Assert + result.Should().BeTrue(); } [Test] public void SendNotification_should_return_true_for_valid_apiKey_with_bad_apiKey() { - //Setup + WithStrictMocker(); - //Act + var result = Mocker.Resolve().SendNotification("NzbDrone Test", "This is a test message from NzbDrone", _apiKey + ", " + _badApiKey); - //Assert + result.Should().BeTrue(); } } diff --git a/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/CleanupFixture.cs b/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/CleanupFixture.cs index 268ee332e..e2d52c603 100644 --- a/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/CleanupFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/CleanupFixture.cs @@ -1,26 +1,17 @@ -// ReSharper disable RedundantUsingDirective - -using System; -using System.Collections.Generic; +using System; using System.IO; -using System.Linq; - -using FizzWare.NBuilder; -using FluentAssertions; using Moq; using NUnit.Framework; using NzbDrone.Common; using NzbDrone.Core.Configuration; -using NzbDrone.Core.Model; using NzbDrone.Core.Providers; using NzbDrone.Core.Test.Framework; -using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class CleanupFixture : CoreTest { private const string RecycleBin = @"C:\Test\RecycleBin"; diff --git a/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteDirectoryFixture.cs b/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteDirectoryFixture.cs index b314119de..331280199 100644 --- a/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteDirectoryFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteDirectoryFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; @@ -20,7 +20,7 @@ using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class DeleteDirectoryFixture : CoreTest { private void WithRecycleBin() diff --git a/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteFileFixture.cs b/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteFileFixture.cs index 47dfae565..58a9e5211 100644 --- a/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteFileFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/DeleteFileFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; @@ -20,7 +20,7 @@ using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class DeleteFileFixture : CoreTest { private void WithRecycleBin() diff --git a/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/EmptyFixture.cs b/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/EmptyFixture.cs index 3509788bd..3f26467d2 100644 --- a/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/EmptyFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/RecycleBinProviderTests/EmptyFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; @@ -20,7 +20,7 @@ using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests.RecycleBinProviderTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class EmptyFixture : CoreTest { private const string RecycleBin = @"C:\Test\RecycleBin"; diff --git a/NzbDrone.Core.Test/ProviderTests/SceneMappingProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/SceneMappingProviderTest.cs index d45cd4697..e1afb1f0b 100644 --- a/NzbDrone.Core.Test/ProviderTests/SceneMappingProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/SceneMappingProviderTest.cs @@ -15,7 +15,7 @@ using NzbDrone.Test.Common; namespace NzbDrone.Core.Test.ProviderTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class SceneMappingProviderTest : DbTest { private const string SceneMappingUrl = "http://services.nzbdrone.com/SceneMapping/Active"; @@ -46,7 +46,7 @@ namespace NzbDrone.Core.Test.ProviderTests public void GetSceneName_exists() { - //Setup + var fakeMap = Builder.CreateNew() .With(f => f.CleanTitle = "laworder") .With(f => f.TvdbId = 12345) @@ -56,10 +56,10 @@ namespace NzbDrone.Core.Test.ProviderTests Db.Insert(fakeMap); - //Act + var sceneName = Mocker.Resolve().GetSceneName(fakeMap.TvdbId); - //Assert + Assert.AreEqual(fakeMap.SceneName, sceneName); } @@ -67,7 +67,7 @@ namespace NzbDrone.Core.Test.ProviderTests public void GetSeriesId_exists() { - //Setup + var fakeMap = Builder.CreateNew() .With(f => f.TvdbId = 12345) .With(f => f.SceneName = "Law and Order") @@ -77,10 +77,10 @@ namespace NzbDrone.Core.Test.ProviderTests Db.Insert(fakeMap); - //Act + var seriesId = Mocker.Resolve().GetTvDbId(fakeMap.CleanTitle); - //Assert + Assert.AreEqual(fakeMap.TvdbId, seriesId); } @@ -88,7 +88,7 @@ namespace NzbDrone.Core.Test.ProviderTests public void GetSceneName_null() { - //Setup + var fakeMap = Builder.CreateNew() .With(f => f.TvdbId = 12345) .With(f => f.SceneName = "Law and Order") @@ -98,10 +98,10 @@ namespace NzbDrone.Core.Test.ProviderTests Db.Insert(fakeMap); - //Act + var sceneName = Mocker.Resolve().GetSceneName(54321); - //Assert + Assert.AreEqual(null, sceneName); } @@ -109,7 +109,7 @@ namespace NzbDrone.Core.Test.ProviderTests public void GetSeriesId_null() { - //Setup + var fakeMap = Builder.CreateNew() .With(f => f.TvdbId = 12345) .With(f => f.SceneName = "Law and Order") @@ -118,10 +118,10 @@ namespace NzbDrone.Core.Test.ProviderTests Db.Insert(fakeMap); - //Act + var seriesId = Mocker.Resolve().GetTvDbId("notlaworder"); - //Assert + Assert.AreEqual(null, seriesId); } @@ -130,7 +130,7 @@ namespace NzbDrone.Core.Test.ProviderTests { //Test that ensures a series with clean names (office, officeus) can be looked up by seriesId - //Setup + var fakeMap = Builder.CreateNew() .With(f => f.CleanTitle = "office") .With(f => f.TvdbId = 12345) @@ -150,10 +150,10 @@ namespace NzbDrone.Core.Test.ProviderTests Db.Insert(fakeMap); Db.Insert(fakeMap2); - //Act + var sceneName = Mocker.Resolve().GetSceneName(fakeMap.TvdbId); - //Assert + Assert.AreEqual(fakeMap.SceneName, sceneName); } @@ -179,17 +179,17 @@ namespace NzbDrone.Core.Test.ProviderTests { WithValidJson(); - //Act + Mocker.Resolve().UpdateMappings(); - //Assert + Mocker.Verify(v => v.DownloadString(SceneMappingUrl), Times.Once()); } [Test] public void UpdateMappings_should_overwrite_existing_mappings() { - //Setup + var fakeMap = Builder.CreateNew() .With(f => f.TvdbId = 12345) .With(f => f.SceneName = "Law and Order") @@ -199,17 +199,17 @@ namespace NzbDrone.Core.Test.ProviderTests WithValidJson(); Db.Insert(fakeMap); - //Act + Mocker.Resolve().UpdateMappings(); - //Assert + Mocker.Verify(v => v.DownloadString(SceneMappingUrl), Times.Once()); } [Test] public void UpdateMappings_should_not_delete_if_csv_download_fails() { - //Setup + var fakeMap = Builder.CreateNew() .With(f => f.TvdbId = 12345) .With(f => f.SceneName = "Law and Order") @@ -219,10 +219,10 @@ namespace NzbDrone.Core.Test.ProviderTests WithErrorDownloadingJson(); Db.Insert(fakeMap); - //Act + Mocker.Resolve().UpdateMappings(); - //Assert + Mocker.Verify(v => v.DownloadString(SceneMappingUrl), Times.Once()); } diff --git a/NzbDrone.Core.Test/ProviderTests/TvDbProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/TvDbProviderTest.cs index 4a25f5fb2..a437aed8a 100644 --- a/NzbDrone.Core.Test/ProviderTests/TvDbProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/TvDbProviderTest.cs @@ -1,6 +1,4 @@ -// ReSharper disable RedundantUsingDirective - -using System; +using System; using System.Collections.Generic; using System.Linq; using Autofac; @@ -15,7 +13,7 @@ using NzbDrone.Test.Common; namespace NzbDrone.Core.Test.ProviderTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class TvDbProviderTest : CoreTest { private TvDbProxy tvDbProxy; @@ -56,10 +54,10 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void no_search_result() { - //act + var result = tvDbProxy.SearchSeries(Guid.NewGuid().ToString()); - //assert + result.Should().BeEmpty(); } @@ -67,11 +65,9 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void none_unique_season_episode_number() { - //act + var result = tvDbProxy.GetEpisodes(75978);//Family guy - //Asserts that when episodes are grouped by Season/Episode each group contains maximum of - //one item. result.GroupBy(e => e.SeasonNumber.ToString("000") + e.EpisodeNumber.ToString("000")) .Max(e => e.Count()).Should().Be(1); diff --git a/NzbDrone.Core.Test/ProviderTests/TvRageProviderTests/GetSeriesFixture.cs b/NzbDrone.Core.Test/ProviderTests/TvRageProviderTests/GetSeriesFixture.cs index d36c001e7..93916c4c3 100644 --- a/NzbDrone.Core.Test/ProviderTests/TvRageProviderTests/GetSeriesFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/TvRageProviderTests/GetSeriesFixture.cs @@ -1,5 +1,4 @@ -// ReSharper disable RedundantUsingDirective - + using System; using System.Collections.Generic; using System.IO; @@ -16,7 +15,7 @@ using NzbDrone.Test.Common; namespace NzbDrone.Core.Test.ProviderTests.TvRageProviderTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class GetSeriesFixture : CoreTest { private const string showinfo = "http://services.tvrage.com/feeds/showinfo.php?key=NW4v0PSmQIoVmpbASLdD&sid="; @@ -25,14 +24,14 @@ namespace NzbDrone.Core.Test.ProviderTests.TvRageProviderTests { Mocker.GetMock() .Setup(s => s.DownloadStream(It.Is(u => u.StartsWith(showinfo)), null)) - .Returns(new FileStream(@".\Files\TVRage\SeriesInfo_empty.xml", FileMode.Open, FileAccess.Read, FileShare.Read)); + .Returns(OpenRead("Files", "TVRage", "SeriesInfo_empty.xml")); } private void WithOneResult() { Mocker.GetMock() .Setup(s => s.DownloadStream(It.Is(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] diff --git a/NzbDrone.Core.Test/ProviderTests/TvRageProviderTests/GetUtcOffsetFixture.cs b/NzbDrone.Core.Test/ProviderTests/TvRageProviderTests/GetUtcOffsetFixture.cs index 0401f80f6..5105fbaf1 100644 --- a/NzbDrone.Core.Test/ProviderTests/TvRageProviderTests/GetUtcOffsetFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/TvRageProviderTests/GetUtcOffsetFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; @@ -14,7 +14,7 @@ using NzbDrone.Test.Common; namespace NzbDrone.Core.Test.ProviderTests.TvRageProviderTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class GetUtcOffsetFixture : CoreTest { [Test] diff --git a/NzbDrone.Core.Test/ProviderTests/TvRageProviderTests/SearchSeriesFixture.cs b/NzbDrone.Core.Test/ProviderTests/TvRageProviderTests/SearchSeriesFixture.cs index d5ed6e73d..534a51c7b 100644 --- a/NzbDrone.Core.Test/ProviderTests/TvRageProviderTests/SearchSeriesFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/TvRageProviderTests/SearchSeriesFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; @@ -16,7 +16,7 @@ using NzbDrone.Test.Common; namespace NzbDrone.Core.Test.ProviderTests.TvRageProviderTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class SearchSeriesFixture : CoreTest { private const string search = "http://services.tvrage.com/feeds/full_search.php?show="; @@ -25,21 +25,21 @@ namespace NzbDrone.Core.Test.ProviderTests.TvRageProviderTests { Mocker.GetMock() .Setup(s => s.DownloadStream(It.Is(u => u.StartsWith(search)), null)) - .Returns(new FileStream(@".\Files\TVRage\SearchResults_empty.xml", FileMode.Open, FileAccess.Read, FileShare.Read)); + .Returns(OpenRead("Files", "TVRage", "SearchResults_empty.xml")); } private void WithManyResults() { Mocker.GetMock() .Setup(s => s.DownloadStream(It.Is(u => u.StartsWith(search)), null)) - .Returns(new FileStream(@".\Files\TVRage\SearchResults_many.xml", FileMode.Open, FileAccess.Read, FileShare.Read)); + .Returns(OpenRead("Files", "TVRage", "SearchResults_many.xml")); } private void WithOneResult() { Mocker.GetMock() .Setup(s => s.DownloadStream(It.Is(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] diff --git a/NzbDrone.Core.Test/ProviderTests/XbmcProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/XbmcProviderTest.cs index 46746bc54..3d29f418c 100644 --- a/NzbDrone.Core.Test/ProviderTests/XbmcProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/XbmcProviderTest.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Linq; @@ -19,7 +19,7 @@ using NzbDrone.Test.Common.AutoMoq; namespace NzbDrone.Core.Test.ProviderTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class XbmcProviderTest : CoreTest { private string EdenActivePlayers; @@ -52,42 +52,42 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void JsonError_true() { - //Setup + var response = "{\"error\":{\"code\":-32601,\"message\":\"Method not found.\"},\"id\":10,\"jsonrpc\":\"2.0\"}"; - //Act + var result = Mocker.Resolve().CheckForJsonError(response); - //Assert + Assert.AreEqual(true, result); } [Test] public void JsonError_true_empty_response() { - //Setup + var response = String.Empty; - //Act + var result = Mocker.Resolve().CheckForJsonError(response); - //Assert + Assert.AreEqual(true, result); } [Test] public void JsonError_false() { - //Setup + var reposnse = "{\"id\":10,\"jsonrpc\":\"2.0\",\"result\":{\"version\":3}}"; - //Act + var result = Mocker.Resolve().CheckForJsonError(reposnse); - //Assert + Assert.AreEqual(false, result); } @@ -102,10 +102,10 @@ namespace NzbDrone.Core.Test.ProviderTests fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny())) .Returns(message); - //Act + var result = Mocker.Resolve().GetJsonVersion("localhost:8080", "xbmc", "xbmc"); - //Assert + result.Should().Be(new XbmcVersion(number)); } @@ -122,10 +122,10 @@ namespace NzbDrone.Core.Test.ProviderTests fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny())) .Returns(message); - //Act + var result = Mocker.Resolve().GetJsonVersion("localhost:8080", "xbmc", "xbmc"); - //Assert + result.Should().Be(new XbmcVersion(major, minor, patch)); } @@ -138,10 +138,10 @@ namespace NzbDrone.Core.Test.ProviderTests fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny())) .Returns(message); - //Act + var result = Mocker.Resolve().GetJsonVersion("localhost:8080", "xbmc", "xbmc"); - //Assert + result.Should().Be(new XbmcVersion(0)); } @@ -155,7 +155,7 @@ namespace NzbDrone.Core.Test.ProviderTests [TestCase(true, false, true)] public void GetActivePlayersDharma(bool audio, bool picture, bool video) { - //Setup + var message = "{\"id\":10,\"jsonrpc\":\"2.0\",\"result\":{\"audio\":" + audio.ToString().ToLower() + ",\"picture\":" @@ -168,10 +168,10 @@ namespace NzbDrone.Core.Test.ProviderTests fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny())) .Returns(message); - //Act + var result = Mocker.Resolve().GetActivePlayersDharma("localhost:8080", "xbmc", "xbmc"); - //Assert + Assert.AreEqual(audio, result["audio"]); Assert.AreEqual(picture, result["picture"]); Assert.AreEqual(video, result["video"]); @@ -180,34 +180,34 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void GetActivePlayersEden_should_be_empty_when_no_active_players() { - //Setup + WithNoActivePlayers(); var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny())) .Returns(EdenActivePlayers); - //Act + var result = Mocker.Resolve().GetActivePlayersEden("localhost:8080", "xbmc", "xbmc"); - //Assert + result.Should().BeEmpty(); } [Test] public void GetActivePlayersEden_should_have_active_video_player() { - //Setup + WithVideoPlayerActive(); var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny())) .Returns(EdenActivePlayers); - //Act + var result = Mocker.Resolve().GetActivePlayersEden("localhost:8080", "xbmc", "xbmc"); - //Assert + result.Should().HaveCount(1); result.First().Type.Should().Be("video"); } @@ -215,17 +215,17 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void GetActivePlayersEden_should_have_active_audio_player() { - //Setup + WithAudioPlayerActive(); var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny())) .Returns(EdenActivePlayers); - //Act + var result = Mocker.Resolve().GetActivePlayersEden("localhost:8080", "xbmc", "xbmc"); - //Assert + result.Should().HaveCount(1); result.First().Type.Should().Be("audio"); } @@ -233,17 +233,17 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void GetActivePlayersEden_should_have_active_picture_player() { - //Setup + WithPicturePlayerActive(); var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny())) .Returns(EdenActivePlayers); - //Act + var result = Mocker.Resolve().GetActivePlayersEden("localhost:8080", "xbmc", "xbmc"); - //Assert + result.Should().HaveCount(1); result.First().Type.Should().Be("picture"); } @@ -251,17 +251,17 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void GetActivePlayersEden_should_have_all_players_active() { - //Setup + WithAllPlayersActive(); var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny())) .Returns(EdenActivePlayers); - //Act + var result = Mocker.Resolve().GetActivePlayersEden("localhost:8080", "xbmc", "xbmc"); - //Assert + result.Should().HaveCount(3); result.Select(a => a.PlayerId).Distinct().Should().HaveCount(3); result.Select(a => a.Type).Distinct().Should().HaveCount(3); @@ -270,7 +270,7 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void GetTvShowsJson() { - //Setup + var message = "{\"id\":10,\"jsonrpc\":\"2.0\",\"result\":{\"limits\":{\"end\":5,\"start\":0,\"total\":5},\"tvshows\":[{\"file\":\"smb://HOMESERVER/TV/7th Heaven/\",\"imdbnumber\":\"73928\",\"label\":\"7th Heaven\",\"tvshowid\":3},{\"file\":\"smb://HOMESERVER/TV/8 Simple Rules/\",\"imdbnumber\":\"78461\",\"label\":\"8 Simple Rules\",\"tvshowid\":4},{\"file\":\"smb://HOMESERVER/TV/24-7 Penguins-Capitals- Road to the NHL Winter Classic/\",\"imdbnumber\":\"213041\",\"label\":\"24/7 Penguins/Capitals: Road to the NHL Winter Classic\",\"tvshowid\":1},{\"file\":\"smb://HOMESERVER/TV/30 Rock/\",\"imdbnumber\":\"79488\",\"label\":\"30 Rock\",\"tvshowid\":2},{\"file\":\"smb://HOMESERVER/TV/90210/\",\"imdbnumber\":\"82716\",\"label\":\"90210\",\"tvshowid\":5}]}}"; @@ -279,10 +279,10 @@ namespace NzbDrone.Core.Test.ProviderTests fakeHttp.Setup(s => s.PostCommand("localhost:8080", "xbmc", "xbmc", It.IsAny())) .Returns(message); - //Act + var result = Mocker.Resolve().GetTvShowsJson("localhost:8080", "xbmc", "xbmc"); - //Assert + Assert.AreEqual(5, result.Count); result.Should().Contain(s => s.ImdbNumber == 79488); } @@ -290,7 +290,7 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void Notify_true() { - //Setup + WithStrictMocker(); var header = "NzbDrone Test"; @@ -303,17 +303,17 @@ namespace NzbDrone.Core.Test.ProviderTests var fakeEventClient = Mocker.GetMock(); fakeEventClient.Setup(s => s.SendNotification(header, message, IconType.Jpeg, "NzbDrone.jpg", "localhost")).Returns(true); - //Act + Mocker.Resolve().Notify(header, message); - //Assert + Mocker.VerifyAllMocks(); } [Test] public void SendCommand() { - //Setup + WithStrictMocker(); var host = "localhost:8080"; @@ -327,10 +327,10 @@ namespace NzbDrone.Core.Test.ProviderTests var fakeHttp = Mocker.GetMock(); fakeHttp.Setup(s => s.DownloadString(url, username, password)).Returns("Ok\n"); - //Act + var result = Mocker.Resolve().SendCommand(host, command, username, username); - //Assert + Mocker.VerifyAllMocks(); Assert.AreEqual("Ok\n", result); } @@ -338,7 +338,7 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void GetXbmcSeriesPath_true() { - //Setup + WithStrictMocker(); var queryResult = @"smb://xbmc:xbmc@HOMESERVER/TV/30 Rock/"; @@ -360,10 +360,10 @@ namespace NzbDrone.Core.Test.ProviderTests "); fakeHttp.Setup(s => s.DownloadString(query, username, password)).Returns(queryResult); - //Act + var result = Mocker.Resolve().GetXbmcSeriesPath(host, 79488, username, username); - //Assert + Mocker.VerifyAllMocks(); Assert.AreEqual("smb://xbmc:xbmc@HOMESERVER/TV/30 Rock/", result); } @@ -371,7 +371,7 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void GetXbmcSeriesPath_false() { - //Setup + WithStrictMocker(); var queryResult = @""; @@ -393,10 +393,10 @@ namespace NzbDrone.Core.Test.ProviderTests "); fakeHttp.Setup(s => s.DownloadString(query, username, password)).Returns(queryResult); - //Act + var result = Mocker.Resolve().GetXbmcSeriesPath(host, 79488, username, username); - //Assert + Mocker.VerifyAllMocks(); Assert.AreEqual("", result); } @@ -404,7 +404,7 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void GetXbmcSeriesPath_special_characters() { - //Setup + WithStrictMocker(); var queryResult = @"smb://xbmc:xbmc@HOMESERVER/TV/Law & Order- Special Victims Unit/"; @@ -426,10 +426,10 @@ namespace NzbDrone.Core.Test.ProviderTests "); fakeHttp.Setup(s => s.DownloadString(query, username, password)).Returns(queryResult); - //Act + var result = Mocker.Resolve().GetXbmcSeriesPath(host, 79488, username, username); - //Assert + Mocker.VerifyAllMocks(); result.Should().Be("smb://xbmc:xbmc@HOMESERVER/TV/Law & Order- Special Victims Unit/"); } @@ -437,7 +437,7 @@ namespace NzbDrone.Core.Test.ProviderTests [Test] public void Clean() { - //Setup + WithStrictMocker(); var fakeConfig = Mocker.GetMock(); @@ -446,10 +446,10 @@ namespace NzbDrone.Core.Test.ProviderTests var fakeEventClient = Mocker.GetMock(); fakeEventClient.Setup(s => s.SendAction("localhost", ActionType.ExecBuiltin, "ExecBuiltIn(CleanLibrary(video))")).Returns(true); - //Act + Mocker.Resolve().Clean(); - //Assert + Mocker.VerifyAllMocks(); } @@ -472,10 +472,10 @@ namespace NzbDrone.Core.Test.ProviderTests fakeHttp.Setup(s => s.DownloadString(queryUrl, username, password)).Returns(queryResult); fakeHttp.Setup(s => s.DownloadString(url, username, password)); - //Act + Mocker.Resolve().UpdateWithHttp(fakeSeries, host, username, password); - //Assert + Mocker.VerifyAllMocks(); } @@ -498,17 +498,17 @@ namespace NzbDrone.Core.Test.ProviderTests fakeHttp.Setup(s => s.DownloadString(queryUrl, username, password)).Returns(queryResult); fakeHttp.Setup(s => s.DownloadString(url, username, password)); - //Act + Mocker.Resolve().UpdateWithHttp(fakeSeries, host, username, password); - //Assert + Mocker.VerifyAllMocks(); } [Test] public void UpdateWithJsonBuiltIn_Single() { - //Setup + var host = "localhost:8080"; @@ -531,17 +531,17 @@ namespace NzbDrone.Core.Test.ProviderTests fakeHttp.Setup(s => s.DownloadString(url, username, password)).Returns("
  • OK"); - //Act + var result = Mocker.Resolve().UpdateWithJsonExecBuiltIn(fakeSeries, host, username, password); - //Assert + result.Should().BeTrue(); } [Test] public void UpdateWithJsonBuiltIn_All() { - //Setup + var host = "localhost:8080"; @@ -567,10 +567,10 @@ namespace NzbDrone.Core.Test.ProviderTests //var fakeEventClient = Mocker.GetMock(); //fakeEventClient.Setup(s => s.SendAction("localhost", ActionType.ExecBuiltin, "ExecBuiltIn(UpdateLibrary(video))")); - //Act + var result = Mocker.Resolve().UpdateWithJsonExecBuiltIn(fakeSeries, host, username, password); - //Assert + result.Should().BeTrue(); } @@ -599,10 +599,10 @@ namespace NzbDrone.Core.Test.ProviderTests .Contains("\"params\":{\"directory\":\"smb://HOMESERVER/TV/30Rock/\"}")))) .Returns("{\"id\":55,\"jsonrpc\":\"2.0\",\"result\":\"OK\"}"); - //Act + var result = Mocker.Resolve().UpdateWithJsonVideoLibraryScan(fakeSeries, host, username, password); - //Assert + result.Should().BeTrue(); } @@ -631,10 +631,10 @@ namespace NzbDrone.Core.Test.ProviderTests .Contains("\"params\":{\"directory\":\"smb://HOMESERVER/TV/30Rock/\"}")))) .Returns("{\"id\":55,\"jsonrpc\":\"2.0\",\"result\":\"OK\"}"); - //Act + var result = Mocker.Resolve().UpdateWithJsonVideoLibraryScan(fakeSeries, host, username, password); - //Assert + result.Should().BeTrue(); } } diff --git a/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetSceneTvdbMappingsFixture.cs b/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetSceneTvdbMappingsFixture.cs index 6a589db61..b9e87cb3a 100644 --- a/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetSceneTvdbMappingsFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetSceneTvdbMappingsFixture.cs @@ -17,7 +17,7 @@ using NzbDrone.Test.Common; namespace NzbDrone.Core.Test.ProviderTests.XemCommunicationProviderTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class GetSceneTvdbMappingsFixture : CoreTest { private void WithFailureJson() diff --git a/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetXemSeriesIdsFixture.cs b/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetXemSeriesIdsFixture.cs index 224dc145e..fa01b243b 100644 --- a/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetXemSeriesIdsFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/XemCommunicationProviderTests/GetXemSeriesIdsFixture.cs @@ -17,7 +17,7 @@ using NzbDrone.Test.Common; namespace NzbDrone.Core.Test.ProviderTests.XemCommunicationProviderTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class GetXemSeriesIdsFixture : CoreTest { private void WithFailureJson() diff --git a/NzbDrone.Core.Test/Qualities/QualityFixture.cs b/NzbDrone.Core.Test/Qualities/QualityFixture.cs index 141c6fd37..08fb95802 100644 --- a/NzbDrone.Core.Test/Qualities/QualityFixture.cs +++ b/NzbDrone.Core.Test/Qualities/QualityFixture.cs @@ -7,7 +7,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.Qualities { [TestFixture] - // ReSharper disable InconsistentNaming + public class QualityFixture : CoreTest { public static object[] FromIntCases = diff --git a/NzbDrone.Core.Test/Qualities/QualityProfileFixture.cs b/NzbDrone.Core.Test/Qualities/QualityProfileFixture.cs index 34c001304..f46cc2401 100644 --- a/NzbDrone.Core.Test/Qualities/QualityProfileFixture.cs +++ b/NzbDrone.Core.Test/Qualities/QualityProfileFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System.Linq; using System; @@ -14,7 +14,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.Qualities { [TestFixture] - // ReSharper disable InconsistentNaming + public class QualityProfileFixture : CoreTest { [Test] diff --git a/NzbDrone.Core.Test/Qualities/QualitySizeServiceFixture.cs b/NzbDrone.Core.Test/Qualities/QualitySizeServiceFixture.cs index 945b18363..e59cb1ba5 100644 --- a/NzbDrone.Core.Test/Qualities/QualitySizeServiceFixture.cs +++ b/NzbDrone.Core.Test/Qualities/QualitySizeServiceFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System.Linq; using System.Collections.Generic; @@ -12,7 +12,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.Qualities { [TestFixture] - // ReSharper disable InconsistentNaming + public class QualitySizeServiceFixture : CoreTest { [Test] diff --git a/NzbDrone.Core.Test/RootFolderTests/FreeSpaceOnDrivesFixture.cs b/NzbDrone.Core.Test/RootFolderTests/FreeSpaceOnDrivesFixture.cs index 53425554b..94f5bde79 100644 --- a/NzbDrone.Core.Test/RootFolderTests/FreeSpaceOnDrivesFixture.cs +++ b/NzbDrone.Core.Test/RootFolderTests/FreeSpaceOnDrivesFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; @@ -16,7 +16,7 @@ using NzbDrone.Test.Common; namespace NzbDrone.Core.Test.RootFolderTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class FreeSpaceOnDrivesFixture : CoreTest { [Test] diff --git a/NzbDrone.Core.Test/RootFolderTests/RootFolderServiceFixture.cs b/NzbDrone.Core.Test/RootFolderTests/RootFolderServiceFixture.cs index f64087a44..a6017e3f8 100644 --- a/NzbDrone.Core.Test/RootFolderTests/RootFolderServiceFixture.cs +++ b/NzbDrone.Core.Test/RootFolderTests/RootFolderServiceFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; @@ -15,7 +15,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.RootFolderTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class RootFolderServiceFixture : CoreTest { [SetUp] diff --git a/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest.cs b/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest.cs index c457b9fd1..3f243402e 100644 --- a/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest.cs +++ b/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest.cs @@ -1,5 +1,5 @@ /* -// ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; @@ -23,7 +23,7 @@ using TvdbLib.Data; namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class EpisodeProviderTest : ObjectDbTest { [Test] @@ -38,10 +38,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests Db.Insert(fakeSeries); Db.InsertMany(fakeEpisodes); - //Act + var episode = Mocker.Resolve().GetEpisode(1); - //Assert + episode.ShouldHave().AllPropertiesBut(e => e.Series, e => e.EpisodeFile).EqualTo(fakeEpisodes.First()); episode.Series.ShouldHave().AllPropertiesBut(s => s.EpisodeCount, s => s.EpisodeFileCount, s => s.SeasonCount, s => s.NextAiring).EqualTo(fakeSeries); } @@ -62,10 +62,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests Db.Insert(fakeSeries); Db.Insert(fakeEpisodes); - //Act + var episode = Mocker.Resolve().GetEpisode(fakeSeries.Id, 2, 1); - //Assert + episode.ShouldHave().AllPropertiesBut(e => e.Series).EqualTo(fakeEpisodes); episode.Series.ShouldHave().AllPropertiesBut(s => s.EpisodeCount, s => s.EpisodeFileCount, s => s.SeasonCount, s => s.NextAiring).EqualTo(fakeSeries); } @@ -75,10 +75,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests { - //Act + var episode = Mocker.Resolve().GetEpisode(1, 1, 1); - //Assert + episode.Should().BeNull(); } @@ -96,10 +96,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests Db.InsertMany(fakeEpisodes); Db.Insert(fakeFile); - //Act + var episode = Mocker.Resolve().GetEpisode(1); - //Assert + episode.ShouldHave().AllPropertiesBut(e => e.Series, e => e.EpisodeFile).EqualTo(fakeEpisodes.First()); episode.Series.ShouldHave().AllPropertiesBut(s => s.EpisodeCount, s => s.EpisodeFileCount, s => s.SeasonCount, s => s.NextAiring).EqualTo(fakeSeries); episode.EpisodeFile.Should().NotBeNull(); @@ -120,7 +120,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests Db.InsertMany(fakeEpisodes); - //Act + Mocker.Resolve().GetEpisode(1); } @@ -141,10 +141,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests Db.Insert(fakeSeries); Db.InsertMany(episodes); - //Act + var seasonEposodes = Mocker.Resolve().GetEpisodesBySeason(12, 2); - //Assert + Db.Fetch().Should().HaveCount(10); seasonEposodes.Should().HaveCount(5); } @@ -174,10 +174,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests .Setup(c => c.GetSeries(seriesId, true, false)) .Returns(fakeEpisodes); - //Act + Mocker.Resolve().RefreshEpisodeInfo(fakeSeries); - //Assert + var actualCount = Mocker.Resolve().GetEpisodeBySeries(seriesId).ToList().Count; Mocker.GetMock().VerifyAll(); actualCount.Should().Be(episodeCount); @@ -209,10 +209,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests .Returns(fakeEpisodes); - //Act + Mocker.Resolve().RefreshEpisodeInfo(fakeSeries); - //Assert + var storedEpisodes = Mocker.Resolve().GetEpisodeBySeries(seriesId).ToList(); storedEpisodes.Should().HaveCount(10); storedEpisodes.Where(e => e.AirDate == null).Should().HaveCount(7); @@ -249,10 +249,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests .Setup(c => c.GetSeries(seriesId, true, false)) .Returns(fakeTvDbEpisodes); - //Act + Mocker.Resolve().RefreshEpisodeInfo(fakeSeries); - //Assert + var storedEpisodes = Mocker.Resolve().GetEpisodeBySeries(seriesId).ToList(); storedEpisodes.Should().HaveCount(1); storedEpisodes.Where(e => e.AirDate == null).Should().HaveCount(1); @@ -287,10 +287,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests .Returns(fakeEpisodes); - //Act + Mocker.Resolve().RefreshEpisodeInfo(fakeSeries); - //Assert + var result = Mocker.Resolve().GetEpisodeBySeries(seriesId).ToList(); Mocker.GetMock().VerifyAll(); result.Should().HaveCount(episodeCount); @@ -326,10 +326,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests .Returns(fakeEpisodes); - //Act + Mocker.Resolve().RefreshEpisodeInfo(fakeSeries); - //Assert + var result = Mocker.Resolve().GetEpisodeBySeries(seriesId).ToList(); result.Should().HaveCount(episodeCount - 3); result.Should().OnlyContain(c => !string.IsNullOrWhiteSpace(c.Title) || c.AirDate < DateTime.Now); @@ -364,10 +364,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests .Returns(fakeEpisodes); - //Act + Mocker.Resolve().RefreshEpisodeInfo(fakeSeries); - //Assert + var result = Mocker.Resolve().GetEpisodeBySeries(seriesId).ToList(); result.Should().HaveCount(episodeCount - 3); result.Should().OnlyContain(c => !string.IsNullOrWhiteSpace(c.Title) || c.AirDate < DateTime.Now); @@ -397,10 +397,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests .Returns(fakeEpisodes); - //Act + Mocker.Resolve().RefreshEpisodeInfo(fakeSeries); - //Assert + var result = Mocker.Resolve().GetEpisodeBySeries(seriesId).ToList(); result.Should().HaveSameCount(fakeEpisodes.Episodes); } @@ -430,10 +430,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests .Returns(fakeEpisodes); - //Act + Mocker.Resolve().RefreshEpisodeInfo(fakeSeries); - //Assert + var result = Mocker.Resolve().GetEpisodeBySeries(seriesId).ToList(); result.Should().HaveSameCount(fakeEpisodes.Episodes); } @@ -468,10 +468,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests .Setup(s => s.IsIgnored(seriesId, 0)) .Returns(true); - //Act + Mocker.Resolve().RefreshEpisodeInfo(fakeSeries); - //Assert + var result = Mocker.Resolve().GetEpisodeBySeries(seriesId).ToList(); Mocker.GetMock().VerifyAll(); result.Should().HaveCount(episodeCount); @@ -499,10 +499,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests .Returns(currentEpisodes); - //Act + Mocker.Resolve().RefreshEpisodeInfo(fakeSeries); - //Assert + Mocker.GetMock().Verify(c => c.InsertMany(It.Is>(l => l.Count() == 5)), Times.Once()); Mocker.GetMock().Verify(c => c.Update(It.IsAny>()), Times.Never()); @@ -533,10 +533,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests .Setup(d => d.Fetch(It.IsAny(), It.IsAny())) .Returns(currentEpisodes); - //Act + Mocker.Resolve().RefreshEpisodeInfo(fakeSeries); - //Assert + Mocker.GetMock().Verify(c => c.InsertMany(It.Is>(l => l.Count() == 0)), Times.Once()); Mocker.GetMock().Verify(c => c.UpdateMany(It.Is>(l => l.Count() == 5)), Times.Once()); Mocker.VerifyAllMocks(); @@ -566,10 +566,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests .Setup(c => c.GetSeries(seriesId, true, false)) .Returns(fakeTvDbResult); - //Act + Mocker.Resolve().RefreshEpisodeInfo(fakeSeries); - //Assert + Mocker.VerifyAllMocks(); Mocker.GetMock().Verify(c => c.UpdateMany(fakeEpisodeList), Times.Once()); } @@ -607,10 +607,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests .Setup(d => d.Fetch(It.IsAny(), It.IsAny())) .Returns(new List { localEpisode }); - //Act + Mocker.Resolve().RefreshEpisodeInfo(fakeSeries); - //Assert + Mocker.VerifyAllMocks(); Mocker.GetMock().Verify(c => c.UpdateMany(new List { localEpisode }), Times.Once()); } @@ -654,10 +654,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests .Setup(c => c.UpdateMany(It.IsAny>())) .Callback>(ep => updatedEpisodes = ep.ToList()); - //Act + Mocker.Resolve().RefreshEpisodeInfo(fakeSeries); - //Assert + updatedEpisodes.Should().HaveSameCount(tvdbSeries.Episodes); updatedEpisodes.Should().OnlyContain(c => c.Id == 99); updatedEpisodes.Should().OnlyContain(c => c.EpisodeFileId == 69); @@ -703,10 +703,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests .Setup(c => c.UpdateMany(It.IsAny>())) .Callback>(ep => updatedEpisodes = ep.ToList()); - //Act + Mocker.Resolve().RefreshEpisodeInfo(fakeSeries); - //Assert + updatedEpisodes.Should().OnlyContain(c => c.EpisodeFileId == 0); } @@ -749,10 +749,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests .Setup(c => c.UpdateMany(It.IsAny>())) .Callback>(ep => updatedEpisodes = ep.ToList()); - //Act + Mocker.Resolve().RefreshEpisodeInfo(fakeSeries); - //Assert + updatedEpisodes.Should().OnlyContain(c => c.EpisodeFileId == 0); } @@ -801,10 +801,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests .Setup(s => s.IsIgnored(seriesId, It.IsAny())) .Returns(true); - //Act + Mocker.Resolve().RefreshEpisodeInfo(fakeSeries); - //Assert + var result = Mocker.Resolve().GetEpisodeBySeries(seriesId).ToList(); Mocker.GetMock().VerifyAll(); result.Should().HaveCount(episodeCount); @@ -826,7 +826,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests var seriesRepo = Mocker.Resolve(); const int tvDbSeriesId = 71256; - //act + var seriesProvider = Mocker.Resolve(); seriesProvider.AddSeries("Test Series", "c:\\test\\", tvDbSeriesId, 1, null); @@ -836,7 +836,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests var episodeProvider = Mocker.Resolve(); episodeProvider.RefreshEpisodeInfo(seriesRepo.Get(tvDbSeriesId)); - //assert + var episodes = episodeProvider.GetEpisodeBySeries(tvDbSeriesId); episodes.Should().NotBeEmpty(); } @@ -846,10 +846,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests { - //Act + var episode = Mocker.Resolve().GetEpisode(1, 1, 1); - //Assert + episode.Should().BeNull(); } @@ -867,10 +867,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests Db.InsertMany(fakeEpisodes); Db.Insert(fakeFile); - //Act + var episode = Mocker.Resolve().GetEpisode(1, 1, 1); - //Assert + episode.ShouldHave().AllPropertiesBut(e => e.Series, e => e.EpisodeFile).EqualTo(fakeEpisodes.First()); episode.Series.ShouldHave().AllPropertiesBut(s => s.EpisodeCount, s => s.EpisodeFileCount, s => s.SeasonCount, s => s.NextAiring).EqualTo(fakeSeries); episode.EpisodeFile.Should().NotBeNull(); @@ -888,10 +888,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests Db.Insert(fakeSeries); Db.InsertMany(fakeEpisodes); - //Act + var episode = Mocker.Resolve().GetEpisode(1, 1, 1); - //Assert + episode.ShouldHave().AllPropertiesBut(e => e.Series).EqualTo(fakeEpisodes.First()); episode.Series.ShouldHave().AllPropertiesBut(s => s.EpisodeCount, s => s.EpisodeFileCount, s => s.SeasonCount, s => s.NextAiring).EqualTo(fakeSeries); episode.EpisodeFile.Should().BeNull(); @@ -911,10 +911,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests Db.InsertMany(fakeEpisodes); Db.Insert(fakeFile); - //Act + var episode = Mocker.Resolve().GetEpisode(1, fakeEpisodes[0].AirDate.Value); - //Assert + episode.ShouldHave().AllPropertiesBut(e => e.Series, e => e.EpisodeFile).EqualTo(fakeEpisodes.First()); episode.Series.ShouldHave().AllPropertiesBut(s => s.EpisodeCount, s => s.EpisodeFileCount, s => s.SeasonCount, s => s.NextAiring).EqualTo(fakeSeries); episode.EpisodeFile.Should().NotBeNull(); @@ -932,10 +932,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests Db.InsertMany(fakeEpisodes); Db.Insert(fakeSeries); - //Act + var episode = Mocker.Resolve().GetEpisode(1, fakeEpisodes[0].AirDate.Value); - //Assert + episode.ShouldHave().AllPropertiesBut(e => e.Series).EqualTo(fakeEpisodes.First()); episode.Series.ShouldHave().AllPropertiesBut(s => s.EpisodeCount, s => s.EpisodeFileCount, s => s.SeasonCount, s => s.NextAiring).EqualTo(fakeSeries); episode.EpisodeFile.Should().BeNull(); @@ -983,10 +983,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests .Setup(s => s.IsIgnored(newEpisode.SeriesId, newEpisode.SeasonNumber)) .Returns(true); - //Act + Mocker.Resolve().AddEpisode(newEpisode); - //Assert + var episodesInDb = Db.Fetch(@"SELECT * FROM Episodes"); episodesInDb.Should().HaveCount(5); @@ -1017,10 +1017,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests .With(e => e.Ignored = false) .Build(); - //Act + Mocker.Resolve().AddEpisode(newEpisode); - //Assert + var episodesInDb = Db.Fetch(@"SELECT * FROM Episodes"); episodesInDb.Should().HaveCount(5); @@ -1053,10 +1053,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests .With(e => e.Ignored = false) .Build(); - //Act + Mocker.Resolve().AddEpisode(newEpisode); - //Assert + var episodesInDb = Db.Fetch(@"SELECT * FROM Episodes"); episodesInDb.Should().HaveCount(5); @@ -1079,10 +1079,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests episodes.ForEach(c => Db.Insert(c)); - //Act + Mocker.Resolve().SetEpisodeIgnore(1, true); - //Assert + var episodesInDb = Db.Fetch(@"SELECT * FROM Episodes"); episodesInDb.Should().HaveCount(4); @@ -1105,10 +1105,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests episodes.ForEach(c => Db.Insert(c)); - //Act + Mocker.Resolve().SetEpisodeIgnore(1, false); - //Assert + var episodesInDb = Db.Fetch(@"SELECT * FROM Episodes"); episodesInDb.Should().HaveCount(4); @@ -1150,10 +1150,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests Db.InsertMany(episodes); Db.InsertMany(specials); - //Act + var missingFiles = Mocker.Resolve().EpisodesWithoutFiles(false); - //Assert + missingFiles.Should().HaveCount(1); missingFiles.Where(e => e.EpisodeFileId == 0).Should().HaveCount(1); @@ -1194,10 +1194,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests Db.InsertMany(episodes); Db.InsertMany(specials); - //Act + var missingFiles = Mocker.Resolve().EpisodesWithoutFiles(true); - //Assert + missingFiles.Should().HaveCount(2); missingFiles.Where(e => e.EpisodeFileId == 0).Should().HaveCount(2); @@ -1231,10 +1231,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests Db.Insert(episodeFile); Db.InsertMany(episodes); - //Act + var withFiles = Mocker.Resolve().EpisodesWithFiles(); - //Assert + withFiles.Should().HaveCount(2); withFiles.Where(e => e.EpisodeFileId == 0).Should().HaveCount(0); withFiles.Where(e => e.EpisodeFile == null).Should().HaveCount(0); @@ -1268,10 +1268,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests Db.Insert(series); Db.InsertMany(episodes); - //Act + var withFiles = Mocker.Resolve().EpisodesWithFiles(); - //Assert + withFiles.Should().HaveCount(0); Mocker.VerifyAllMocks(); @@ -1296,10 +1296,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests Db.Insert(series); Db.InsertMany(fakeEpisodes); - //Act + var episodes = Mocker.Resolve().GetEpisodesByFileId(12345); - //Assert + episodes.Should().HaveCount(2); Mocker.VerifyAllMocks(); } @@ -1322,10 +1322,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests Db.Insert(series); Db.Insert(fakeEpisode); - //Act + var episodes = Mocker.Resolve().GetEpisodesByFileId(12345); - //Assert + episodes.Should().HaveCount(1); episodes.First().ShouldHave().AllPropertiesBut(e => e.Series).EqualTo(fakeEpisode); Mocker.VerifyAllMocks(); @@ -1344,10 +1344,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests Db.InsertMany(fakeEpisodes); - //Act + var result = Mocker.Resolve().IsFirstOrLastEpisodeOfSeason(10, 1, 5); - //Assert + result.Should().BeFalse(); } @@ -1364,10 +1364,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests Db.InsertMany(fakeEpisodes); - //Act + var result = Mocker.Resolve().IsFirstOrLastEpisodeOfSeason(10, 1, 1); - //Assert + result.Should().BeFalse(); } @@ -1384,10 +1384,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests Db.InsertMany(fakeEpisodes); - //Act + var result = Mocker.Resolve().IsFirstOrLastEpisodeOfSeason(10, 1, 10); - //Assert + result.Should().BeFalse(); } @@ -1418,10 +1418,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests Mocker.GetMock().Setup(s => s.GetByTitle("officeus")).Returns(fakeSeries); - //Act + Mocker.Resolve().SetPostDownloadStatus(fakeEpisodes.Select(e => e.Id).ToList(), postDownloadStatus); - //Assert + var result = Db.Fetch(); result.Where(e => e.PostDownloadStatus == postDownloadStatus).Count().Should().Be(episodeCount); } @@ -1450,10 +1450,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests Mocker.GetMock().Setup(s => s.GetByTitle("officeus")).Returns(fakeSeries); - //Act + Mocker.Resolve().SetPostDownloadStatus(new List { 300 }, postDownloadStatus); - //Assert + var result = Db.Fetch(); result.Where(e => e.PostDownloadStatus == postDownloadStatus).Count().Should().Be(0); } @@ -1501,10 +1501,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests .Setup(c => c.GetSeries(seriesId, true, false)) .Returns(tvdbSeries); - //Act + Mocker.Resolve().RefreshEpisodeInfo(fakeSeries); - //Assert + var result = Mocker.Resolve().GetEpisodeBySeries(seriesId).ToList(); result.Should().HaveCount(episodeCount); result.Where(e => e.Ignored).Should().HaveCount(episodeCount - 1); diff --git a/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest_GetEpisodesByParseResult.cs b/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest_GetEpisodesByParseResult.cs index f2749a215..6af23ea4e 100644 --- a/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest_GetEpisodesByParseResult.cs +++ b/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/EpisodeProviderTest_GetEpisodesByParseResult.cs @@ -1,5 +1,5 @@ /* -// ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; @@ -15,7 +15,7 @@ using NzbDrone.Test.Common; namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class EpisodeProviderTest_GetEpisodesByParseResult : ObjectDbTest { private IEpisodeService episodeService; @@ -160,9 +160,9 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests [Test] public void GetEpisodeParseResult_should_return_empty_list_if_episode_list_is_null() { - //Act + var episodes = episodeService.GetEpisodesByParseResult(new EpisodeParseResult()); - //Assert + episodes.Should().NotBeNull(); episodes.Should().BeEmpty(); } @@ -170,9 +170,9 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests [Test] public void GetEpisodeParseResult_should_return_empty_list_if_episode_list_is_empty() { - //Act + var episodes = episodeService.GetEpisodesByParseResult(new EpisodeParseResult { EpisodeNumbers = new List() }); - //Assert + episodes.Should().NotBeNull(); episodes.Should().BeEmpty(); } @@ -184,10 +184,10 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests Db.Insert(fakeSeries); Db.Insert(fakeDailyEpisode); - //Act + var episodes = episodeService.GetEpisodesByParseResult(new EpisodeParseResult { AirDate = DateTime.Today, Series = fakeDailySeries }); - //Assert + episodes.Should().HaveCount(1); VerifyEpisode(episodes[0], fakeDailyEpisode); @@ -199,7 +199,7 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests { var episodes = episodeService.GetEpisodesByParseResult(new EpisodeParseResult { AirDate = DateTime.Today, Series = fakeDailySeries }); - //Assert + episodes.Should().HaveCount(0); Db.Fetch().Should().HaveCount(0); } diff --git a/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/GetEpisodeBySceneNumberFixture.cs b/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/GetEpisodeBySceneNumberFixture.cs index 8d4718022..46e48cc05 100644 --- a/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/GetEpisodeBySceneNumberFixture.cs +++ b/NzbDrone.Core.Test/TvTests/EpisodeProviderTests/GetEpisodeBySceneNumberFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System.Linq; using FizzWare.NBuilder; @@ -10,7 +10,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.TvTests.EpisodeProviderTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class GetEpisodeBySceneNumberFixture : DbTest { private Series _series; diff --git a/NzbDrone.Core.Test/TvTests/QualityModelFixture.cs b/NzbDrone.Core.Test/TvTests/QualityModelFixture.cs index dff878d98..edf88002a 100644 --- a/NzbDrone.Core.Test/TvTests/QualityModelFixture.cs +++ b/NzbDrone.Core.Test/TvTests/QualityModelFixture.cs @@ -8,7 +8,7 @@ using NzbDrone.Core.Test.Framework; namespace NzbDrone.Core.Test.TvTests { [TestFixture] - // ReSharper disable InconsistentNaming + public class QualityModelFixture : CoreTest { [Test] diff --git a/NzbDrone.Core.Test/TvTests/SeasonProviderTest.cs b/NzbDrone.Core.Test/TvTests/SeasonProviderTest.cs index 4668b8a78..6b47264c2 100644 --- a/NzbDrone.Core.Test/TvTests/SeasonProviderTest.cs +++ b/NzbDrone.Core.Test/TvTests/SeasonProviderTest.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Linq; diff --git a/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs b/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs index b29339844..59411b743 100644 --- a/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs +++ b/NzbDrone.Test.Common/AutoMoq/AutoMoqer.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; diff --git a/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingBuilderStrategy.cs b/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingBuilderStrategy.cs index 79f2b422f..d0a1186ea 100644 --- a/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingBuilderStrategy.cs +++ b/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingBuilderStrategy.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; diff --git a/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingContainerExtension.cs b/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingContainerExtension.cs index 91777b155..0e468c6a6 100644 --- a/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingContainerExtension.cs +++ b/NzbDrone.Test.Common/AutoMoq/Unity/AutoMockingContainerExtension.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System.Linq; using System; diff --git a/NzbDrone.Test.Common/ExceptionVerification.cs b/NzbDrone.Test.Common/ExceptionVerification.cs index 069227ff9..6d98c912f 100644 --- a/NzbDrone.Test.Common/ExceptionVerification.cs +++ b/NzbDrone.Test.Common/ExceptionVerification.cs @@ -1,4 +1,4 @@ -// ReSharper disable RedundantUsingDirective + using System; using System.Collections.Generic; diff --git a/NzbDrone.Update.Test/ProgramFixture.cs b/NzbDrone.Update.Test/ProgramFixture.cs index 5dd13ef2e..a8e9ab5dc 100644 --- a/NzbDrone.Update.Test/ProgramFixture.cs +++ b/NzbDrone.Update.Test/ProgramFixture.cs @@ -57,10 +57,10 @@ namespace NzbDrone.Update.Test Mocker.GetMock().Setup(c => c.GetProcessById(12)) .Returns(new ProcessInfo() { StartPath = ProcessPath }); - //Act + _program.Start(new[] { "12", "" }); - //Assert + Mocker.GetMock().Verify(c => c.Start(@"C:\NzbDrone"), Times.Once()); } diff --git a/NzbDrone.Update.Test/UpdateProviderStartFixture.cs b/NzbDrone.Update.Test/UpdateProviderStartFixture.cs index fd5ff433a..37e59a598 100644 --- a/NzbDrone.Update.Test/UpdateProviderStartFixture.cs +++ b/NzbDrone.Update.Test/UpdateProviderStartFixture.cs @@ -59,10 +59,10 @@ namespace NzbDrone.Update.Test WithInstalledService(); WithServiceRunning(true); - //Act + Mocker.Resolve().Start(TARGET_FOLDER); - //Assert + Mocker.GetMock().Verify(c => c.Stop(ServiceProvider.NZBDRONE_SERVICE_NAME), Times.Once()); } @@ -72,20 +72,20 @@ namespace NzbDrone.Update.Test WithInstalledService(); WithServiceRunning(false); - //Act + Mocker.Resolve().Start(TARGET_FOLDER); - //Assert + Mocker.GetMock().Verify(c => c.Stop(ServiceProvider.NZBDRONE_SERVICE_NAME), Times.Never()); } [Test] public void should_not_stop_nzbdrone_service_if_service_isnt_installed() { - //Act + Mocker.Resolve().Start(TARGET_FOLDER); - //Assert + Mocker.GetMock().Verify(c => c.Stop(It.IsAny()), Times.Never()); } @@ -98,10 +98,10 @@ namespace NzbDrone.Update.Test .Setup(c => c.GetProcessByName(ProcessProvider.NzbDroneProccessName)) .Returns(proccesses); - //Act + Mocker.Resolve().Start(TARGET_FOLDER); - //Assert + Mocker.GetMock().Verify(c => c.Kill(proccesses[0].Id), Times.Once()); Mocker.GetMock().Verify(c => c.Kill(proccesses[1].Id), Times.Once()); } @@ -113,10 +113,10 @@ namespace NzbDrone.Update.Test .Setup(c => c.GetProcessByName(ProcessProvider.NzbDroneProccessName)) .Returns(new List()); - //Act + Mocker.Resolve().Start(TARGET_FOLDER); - //Assert + Mocker.GetMock().Verify(c => c.Kill(It.IsAny()), Times.Never()); } @@ -125,7 +125,7 @@ namespace NzbDrone.Update.Test { Mocker.Resolve().Start(TARGET_FOLDER); - //Assert + Mocker.GetMock().Verify(c => c.StopServer(), Times.Once()); } @@ -157,10 +157,10 @@ namespace NzbDrone.Update.Test .Setup(c => c.CopyDirectory(UPDATE_FOLDER, TARGET_FOLDER)) .Throws(new IOException()); - //Act + Mocker.Resolve().Start(TARGET_FOLDER); - //Assert + Mocker.GetMock() .Verify(c => c.CopyDirectory(BACKUP_FOLDER, TARGET_FOLDER), Times.Once()); ExceptionVerification.ExpectedFatals(1); @@ -172,10 +172,10 @@ namespace NzbDrone.Update.Test WithInstalledService(); WithServiceRunning(true); - //Act + Mocker.Resolve().Start(TARGET_FOLDER); - //Assert + VerifyServiceRestart(); } @@ -185,10 +185,10 @@ namespace NzbDrone.Update.Test WithInstalledService(); WithServiceRunning(false); - //Act + Mocker.Resolve().Start(TARGET_FOLDER); - //Assert + VerifyProcessRestart(); } @@ -202,10 +202,10 @@ namespace NzbDrone.Update.Test .Setup(c => c.CopyDirectory(UPDATE_FOLDER, TARGET_FOLDER)) .Throws(new IOException()); - //Act + Mocker.Resolve().Start(TARGET_FOLDER); - //Assert + VerifyServiceRestart(); ExceptionVerification.ExpectedFatals(1); } @@ -220,10 +220,10 @@ namespace NzbDrone.Update.Test .Setup(c => c.CopyDirectory(UPDATE_FOLDER, TARGET_FOLDER)) .Throws(new IOException()); - //Act + Mocker.Resolve().Start(TARGET_FOLDER); - //Assert + VerifyProcessRestart(); ExceptionVerification.ExpectedFatals(1); } diff --git a/NzbDrone.Update.Test/UpdateProviderVerifyFixture.cs b/NzbDrone.Update.Test/UpdateProviderVerifyFixture.cs index 238af56ef..54f1a5c8b 100644 --- a/NzbDrone.Update.Test/UpdateProviderVerifyFixture.cs +++ b/NzbDrone.Update.Test/UpdateProviderVerifyFixture.cs @@ -1,4 +1,4 @@ -// ReSharper disable InconsistentNaming + using System; using System.IO;