mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-14 11:23:42 +02:00
Removed excluded source files.
This commit is contained in:
parent
a7f2c07998
commit
b453d48fee
@ -1,9 +0,0 @@
|
||||
namespace NzbDrone.Common.EnvironmentInfo
|
||||
{
|
||||
public interface IOperatingSystemVersionInfo
|
||||
{
|
||||
string Version { get; }
|
||||
string Name { get; }
|
||||
string FullName { get; }
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using NLog;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.Framework.AutoMoq
|
||||
{
|
||||
[TestFixture]
|
||||
class TestBaseTests : TestBase
|
||||
{
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
[Test]
|
||||
public void Test_should_pass_when_no_exceptions_are_logged()
|
||||
{
|
||||
Logger.Info("Everything is fine and dandy!");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_should_pass_when_errors_are_excpected()
|
||||
{
|
||||
Logger.Error("I knew this would happer");
|
||||
ExceptionVerification.ExcpectedErrors(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_should_pass_when_warns_are_excpected()
|
||||
{
|
||||
Logger.Warn("I knew this would happer");
|
||||
ExceptionVerification.ExcpectedWarns(1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_should_pass_when_warns_are_ignored()
|
||||
{
|
||||
Logger.Warn("I knew this would happer");
|
||||
Logger.Warn("I knew this would happer");
|
||||
Logger.Warn("I knew this would happer");
|
||||
ExceptionVerification.IgnoreWarns();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_should_pass_when_errors_are_ignored()
|
||||
{
|
||||
Logger.Error("I knew this would happer");
|
||||
Logger.Error("I knew this would happer");
|
||||
Logger.Error("I knew this would happer");
|
||||
ExceptionVerification.IgnoreErrors();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Test_should_pass_when_exception_type_is_ignored()
|
||||
{
|
||||
Logger.ErrorException("bad exception", new WebException("Test"));
|
||||
ExceptionVerification.MarkInconclusive(typeof(WebException));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.DecisionEngine;
|
||||
using NzbDrone.Core.IndexerSearch;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Indexers.Newznab;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.IndexerSearchTests
|
||||
{
|
||||
public class NzbSearchServiceFixture : CoreTest<NzbSearchService>
|
||||
{
|
||||
private List<IIndexer> _indexers;
|
||||
|
||||
private Series _searchTargetSeries;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
|
||||
_searchTargetSeries = Builder<Series>.CreateNew().BuildNew();
|
||||
|
||||
_indexers = new List<IIndexer>();
|
||||
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
|
||||
Mocker.SetConstant<IEnumerable<IIndexer>>(_indexers);
|
||||
|
||||
Mocker.GetMock<ISeriesService>().Setup(c => c.GetSeries(It.IsAny<int>()))
|
||||
.Returns(_searchTargetSeries);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_call_fetch_on_all_indexers_at_the_same_time()
|
||||
{
|
||||
|
||||
var counter = new ConcurrencyCounter(_indexers.Count);
|
||||
|
||||
Mocker.GetMock<IFetchFeedFromIndexers>().Setup(c => c.Fetch(It.IsAny<IIndexer>(), It.IsAny<SingleEpisodeSearchDefinition>()))
|
||||
.Returns(new List<ReportInfo>())
|
||||
.Callback((() => counter.SimulateWork(500)));
|
||||
|
||||
Mocker.GetMock<IIndexerService>().Setup(c => c.GetAvailableIndexers()).Returns(_indexers);
|
||||
|
||||
Mocker.GetMock<IMakeDownloadDecision>()
|
||||
.Setup(c => c.GetSearchDecision(It.IsAny<IEnumerable<ReportInfo>>(), It.IsAny<SearchDefinitionBase>()))
|
||||
.Returns(new List<DownloadDecision>());
|
||||
|
||||
Subject.SearchSingle(0, 0, 0);
|
||||
|
||||
counter.WaitForAllItems();
|
||||
|
||||
counter.MaxThreads.Should().Be(_indexers.Count);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Indexers;
|
||||
using NzbDrone.Core.Indexers.Newznab;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.IndexerTests
|
||||
{
|
||||
public class FetchAndParseRssServiceFixture : CoreTest<FetchAndParseRssService>
|
||||
{
|
||||
private List<IIndexer> _indexers;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_indexers = new List<IIndexer>();
|
||||
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
_indexers.Add(new Newznab());
|
||||
|
||||
Mocker.SetConstant<IEnumerable<IIndexer>>(_indexers);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Explicit]
|
||||
public void should_call_fetch_on_all_indexers_at_the_same_time()
|
||||
{
|
||||
|
||||
var counter = new ConcurrencyCounter(_indexers.Count);
|
||||
|
||||
Mocker.GetMock<IFetchFeedFromIndexers>().Setup(c => c.FetchRss(It.IsAny<IIndexer>()))
|
||||
.Returns(new List<ReportInfo>())
|
||||
.Callback((() => counter.SimulateWork(500)));
|
||||
|
||||
Mocker.GetMock<IIndexerService>().Setup(c => c.GetAvailableIndexers()).Returns(_indexers);
|
||||
|
||||
Subject.Fetch();
|
||||
|
||||
counter.WaitForAllItems();
|
||||
|
||||
counter.MaxThreads.Should().Be(_indexers.Count);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Notifications.Growl;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Test.NotificationTests
|
||||
{
|
||||
[Explicit]
|
||||
[TestFixture]
|
||||
public class GrowlProviderTest : CoreTest
|
||||
{
|
||||
[Test]
|
||||
public void Register_should_add_new_application_to_local_growl_instance()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
Mocker.Resolve<GrowlProvider>().Register("localhost", 23053, "");
|
||||
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNotification_should_send_a_message_to_local_growl_instance()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
Mocker.Resolve<GrowlProvider>().TestNotification("localhost", 23053, "");
|
||||
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OnGrab_should_send_a_message_to_local_growl_instance()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
Mocker.Resolve<GrowlProvider>().SendNotification("Episode Grabbed", "Series Title - 1x05 - Episode Title", "GRAB", "localhost", 23053, "");
|
||||
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OnDownload_should_send_a_message_to_local_growl_instance()
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
Mocker.Resolve<GrowlProvider>().SendNotification("Episode Downloaded", "Series Title - 1x05 - Episode Title", "DOWNLOAD", "localhost", 23053, "");
|
||||
|
||||
|
||||
Mocker.VerifyAllMocks();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Organizer;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Core.Tv.Events;
|
||||
|
||||
namespace NzbDrone.Core.Test.TvTests.SeriesServiceTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class AddSeriesFixture : CoreTest<SeriesService>
|
||||
{
|
||||
private Series fakeSeries;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
fakeSeries = Builder<Series>.CreateNew().Build();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void series_added_event_should_have_proper_path()
|
||||
{
|
||||
fakeSeries.Path = null;
|
||||
fakeSeries.RootFolderPath = @"C:\Test\TV";
|
||||
|
||||
Mocker.GetMock<IBuildFileNames>()
|
||||
.Setup(s => s.GetSeriesFolder(fakeSeries, null))
|
||||
.Returns(fakeSeries.Title);
|
||||
|
||||
var series = Subject.AddSeries(fakeSeries);
|
||||
|
||||
series.Path.Should().NotBeNull();
|
||||
|
||||
VerifyEventPublished<SeriesAddedEvent>();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
using NLog;
|
||||
using NzbDrone.Core.Languages;
|
||||
using NzbDrone.Core.Profiles;
|
||||
using NzbDrone.Core.Qualities;
|
||||
|
||||
namespace NzbDrone.Core.DecisionEngine
|
||||
{
|
||||
public interface ILanguageUpgradableSpecification
|
||||
{
|
||||
bool IsUpgradable(Profile profile, LanguageModel currentLanguage, LanguageModel newLanguage = null);
|
||||
bool CutoffNotMet(Profile profile, LanguageModel currentLanguage, LanguageModel newLanguage = null);
|
||||
bool IsRevisionUpgrade(LanguageModel currentLanguage, LanguageModel newLanguage);
|
||||
}
|
||||
|
||||
public class LanguageUpgradableSpecification : ILanguageUpgradableSpecification
|
||||
{
|
||||
private readonly Logger _logger;
|
||||
|
||||
public LanguageUpgradableSpecification(Logger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public bool IsUpgradable(Profile profile, LanguageModel currentLanguage, LanguageModel newLanguage = null)
|
||||
{
|
||||
if (newLanguage != null)
|
||||
{
|
||||
int compare = new LanguageModelComparer(profile).Compare(newLanguage, currentLanguage);
|
||||
if (compare <= 0)
|
||||
{
|
||||
_logger.Debug("existing item has better or equal language. skipping");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (IsRevisionUpgrade(currentLanguage, newLanguage))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CutoffNotMet(Profile profile, LanguageModel currentLanguage, LanguageModel newLanguage = null)
|
||||
{
|
||||
int compare = new LanguageModelComparer(profile).Compare(currentLanguage.Language, profile.Languages.Find(v => v.Allowed == true).Language);
|
||||
|
||||
if (compare >= 0)
|
||||
{
|
||||
if (newLanguage != null && IsRevisionUpgrade(currentLanguage, newLanguage))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
_logger.Debug("Existing item meets cut-off. skipping.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool IsRevisionUpgrade(LanguageModel currentLanguage, LanguageModel newLanguage)
|
||||
{
|
||||
int compare = newLanguage.Revision.CompareTo(currentLanguage.Revision);
|
||||
|
||||
if (currentLanguage.Language == newLanguage.Language && compare > 0)
|
||||
{
|
||||
_logger.Debug("New language is a better revision for existing quality");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Core.IndexerSearch.Definitions;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
|
||||
namespace NzbDrone.Core.DecisionEngine.Specifications.Search
|
||||
{
|
||||
public class SingleEpisodeMatchSpecification : IDecisionEngineSpecification
|
||||
{
|
||||
private readonly Logger _logger;
|
||||
|
||||
public SingleEpisodeMatchSpecification(Logger logger)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public string RejectionReason
|
||||
{
|
||||
get
|
||||
{
|
||||
return "Episode doesn't match";
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsSatisfiedBy(RemoteEpisode remoteEpisode, SearchDefinitionBase searchDefinitionBase)
|
||||
{
|
||||
var singleEpisodeSpec = searchDefinitionBase as SingleEpisodeSearchDefinition;
|
||||
if (singleEpisodeSpec == null) return true;
|
||||
|
||||
if (singleEpisodeSpec.SeasonNumber != remoteEpisode.ParsedEpisodeInfo.SeasonNumber)
|
||||
{
|
||||
_logger.Trace("Season number does not match searched season number, skipping.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!remoteEpisode.Episodes.Select(c => c.EpisodeNumber).Contains(singleEpisodeSpec.EpisodeNumber))
|
||||
{
|
||||
_logger.Trace("Episode number does not match searched episode number, skipping.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using FluentValidation;
|
||||
using FluentValidation.Results;
|
||||
|
||||
namespace NzbDrone.Core.Validation
|
||||
{
|
||||
public abstract class NzbDroneValidator<T> : AbstractValidator<T>
|
||||
{
|
||||
public override ValidationResult Validate(T instance)
|
||||
{
|
||||
return new NzbDroneValidationResult(base.Validate(instance).Errors);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user