event aggregator is singleton to prevent it from being disposed.

pull/23/head
kay.one 12 years ago
parent f2886d89de
commit af3282630f

@ -26,7 +26,7 @@ namespace NzbDrone.Common.Eventing
{
_logger.Debug("{0} -> {1}", message.GetType().Name, handler.GetType().Name);
handler.Handle(message);
_logger.Debug("{0} -#> {1}", message.GetType().Name, handler.GetType().Name);
_logger.Debug("{0} <- {1}", message.GetType().Name, handler.GetType().Name);
}
@ -37,7 +37,7 @@ namespace NzbDrone.Common.Eventing
{
_logger.Debug("{0} ~> {1}", message.GetType().Name, handlerLocal.GetType().Name);
handlerLocal.HandleAsync(message);
_logger.Debug("{0} ~#> {1}", message.GetType().Name, handlerLocal.GetType().Name);
_logger.Debug("{0} <~ {1}", message.GetType().Name, handlerLocal.GetType().Name);
});
}
}

@ -245,7 +245,7 @@
<Compile Include="ProviderTests\DownloadClientTests\SabProviderTests\SabProviderFixture.cs" />
<Compile Include="ProviderTests\SceneMappingProviderTest.cs" />
<Compile Include="TvTests\SeriesProviderTest.cs" />
<Compile Include="ProviderTests\TvDbProviderTest.cs" />
<Compile Include="ProviderTests\TvDbProxyFixture.cs" />
<Compile Include="XbmcVersionTests.cs" />
</ItemGroup>
<ItemGroup>

@ -9,7 +9,7 @@ namespace NzbDrone.Core.Test.ProviderTests
{
[TestFixture]
public class TvDbProviderTest : CoreTest<TvDbProxy>
public class TvDbProxyFixture : CoreTest<TvDbProxy>
{
[TestCase("The Simpsons")]
[TestCase("Family Guy")]
@ -50,5 +50,12 @@ namespace NzbDrone.Core.Test.ProviderTests
details.Should().NotBeNull();
details.Covers.Value.Should().NotBeEmpty();
}
[Test]
public void should_be_able_to_get_list_of_episodes()
{
var details = Subject.GetEpisodes(75978);
details.Should().NotBeEmpty();
}
}
}

@ -4,6 +4,7 @@ using System.Reflection;
using Autofac;
using NLog;
using NzbDrone.Common;
using NzbDrone.Common.Eventing;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.ExternalNotification;
using NzbDrone.Core.IndexerSearch;
@ -23,7 +24,11 @@ namespace NzbDrone.Core
containerBuilder.RegisterAssembly("NzbDrone.Core");
containerBuilder.InitDatabase();
containerBuilder.RegisterType<EventAggregator>()
.As<IEventAggregator>().SingleInstance();
containerBuilder.RegisterModule<LogInjectionModule>();
}

@ -40,7 +40,8 @@ namespace NzbDrone.Core.Tv
public class EpisodeService : IEpisodeService,
IHandle<EpisodeGrabbedEvent>,
IHandle<EpisodeFileDeletedEvent>,
IHandleAsync<SeriesDeletedEvent>
IHandleAsync<SeriesDeletedEvent>,
IHandleAsync<SeriesAddedEvent>
{
private static readonly Logger logger = LogManager.GetCurrentClassLogger();
@ -399,5 +400,10 @@ namespace NzbDrone.Core.Tv
UpdateEpisode(episode);
}
}
public void HandleAsync(SeriesAddedEvent message)
{
RefreshEpisodeInfo(message.Series);
}
}
}

@ -80,7 +80,9 @@ namespace NzbDrone.Core.Tv
try
{
if (series.TvRageId == 0)
{
series = _tvRageMappingProvider.FindMatchingTvRageSeries(series);
}
}
catch (Exception ex)

Loading…
Cancel
Save