event aggregator is singleton to prevent it from being disposed.

This commit is contained in:
kay.one 2013-03-30 15:43:19 -07:00
parent f2886d89de
commit af3282630f
6 changed files with 26 additions and 6 deletions

View File

@ -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);
});
}
}

View File

@ -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>

View File

@ -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();
}
}
}

View File

@ -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;
@ -24,6 +25,10 @@ namespace NzbDrone.Core
containerBuilder.InitDatabase();
containerBuilder.RegisterType<EventAggregator>()
.As<IEventAggregator>().SingleInstance();
containerBuilder.RegisterModule<LogInjectionModule>();
}

View File

@ -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);
}
}
}

View File

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