2012-02-07 05:08:07 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Linq;
|
2012-02-04 05:28:50 +00:00
|
|
|
|
using FluentAssertions;
|
2012-02-07 05:08:07 +00:00
|
|
|
|
using NLog;
|
2012-02-04 05:28:50 +00:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using Ninject;
|
2012-02-07 05:08:07 +00:00
|
|
|
|
using NzbDrone.Common;
|
2012-02-04 05:28:50 +00:00
|
|
|
|
using NzbDrone.Core.Providers;
|
|
|
|
|
using NzbDrone.Core.Providers.Core;
|
|
|
|
|
using NzbDrone.Core.Repository;
|
|
|
|
|
using NzbDrone.Core.Test.Framework;
|
|
|
|
|
using PetaPoco;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Core.Test.Integeration
|
|
|
|
|
{
|
|
|
|
|
[TestFixture(Category = "ServiceIngeneration")]
|
|
|
|
|
public class ServiceIntegerationFixture : CoreTest
|
|
|
|
|
{
|
|
|
|
|
private KernelBase _kernel;
|
|
|
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
|
public void Setup()
|
|
|
|
|
{
|
|
|
|
|
WithRealDb();
|
|
|
|
|
_kernel = new StandardKernel();
|
|
|
|
|
_kernel.Bind<IDatabase>().ToConstant(Db);
|
|
|
|
|
|
|
|
|
|
Mocker.GetMock<ConfigProvider>().SetupGet(s => s.ServiceRootUrl)
|
2012-04-14 00:57:31 +00:00
|
|
|
|
.Returns("http://services.nzbdrone.com");
|
2012-02-04 05:28:50 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_be_able_to_update_scene_mapping()
|
|
|
|
|
{
|
|
|
|
|
_kernel.Get<SceneMappingProvider>().UpdateMappings();
|
|
|
|
|
var mappings = Db.Fetch<SceneMapping>();
|
|
|
|
|
|
|
|
|
|
mappings.Should().NotBeEmpty();
|
|
|
|
|
|
|
|
|
|
mappings.Should().OnlyContain(c => !string.IsNullOrWhiteSpace(c.CleanTitle));
|
|
|
|
|
mappings.Should().OnlyContain(c => !string.IsNullOrWhiteSpace(c.SceneName));
|
|
|
|
|
mappings.Should().OnlyContain(c => c.SeriesId > 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void should_be_able_to_get_daily_series_ids()
|
|
|
|
|
{
|
|
|
|
|
var dailySeries = _kernel.Get<ReferenceDataProvider>().GetDailySeriesIds();
|
|
|
|
|
|
|
|
|
|
dailySeries.Should().NotBeEmpty();
|
|
|
|
|
dailySeries.Should().OnlyContain(c => c > 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-02-07 05:08:07 +00:00
|
|
|
|
[Test]
|
|
|
|
|
public void should_be_able_to_submit_exceptions()
|
|
|
|
|
{
|
2012-04-30 01:24:24 +00:00
|
|
|
|
ReportingService.SetupExceptronDriver();
|
2012-02-07 05:08:07 +00:00
|
|
|
|
|
2012-04-30 01:24:24 +00:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
ThrowException();
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
var log = new LogEventInfo
|
|
|
|
|
{
|
|
|
|
|
LoggerName = "LoggerName.LoggerName.LoggerName.LoggerName",
|
|
|
|
|
Exception = e,
|
|
|
|
|
Message = "New message string. New message string.",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var hash = ReportingService.ReportException(log);
|
|
|
|
|
|
|
|
|
|
hash.Should().HaveLength(8);
|
|
|
|
|
}
|
2012-02-07 05:08:07 +00:00
|
|
|
|
|
2012-04-22 23:30:18 +00:00
|
|
|
|
|
2012-02-07 05:08:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-02-04 05:28:50 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|