Lidarr/src/NzbDrone.Common.Test/ServiceFactoryFixture.cs

32 lines
951 B
C#
Raw Normal View History

2014-02-10 19:40:13 +00:00
using System.Linq;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Common.EnvironmentInfo;
2015-05-03 23:30:16 +00:00
using NzbDrone.Core.Datastore;
2014-02-10 19:40:13 +00:00
using NzbDrone.Core.Lifecycle;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Host;
using NzbDrone.Test.Common;
2014-10-18 05:47:00 +00:00
namespace NzbDrone.Common.Test
2014-02-10 19:40:13 +00:00
{
[TestFixture]
public class ServiceFactoryFixture : TestBase<ServiceFactory>
{
[Test]
public void event_handlers_should_be_unique()
{
2014-10-18 05:47:00 +00:00
var container = MainAppContainerBuilder.BuildContainer(new StartupContext());
2015-05-03 23:30:16 +00:00
container.Register<IMainDatabase>(new MainDatabase(null));
2014-10-18 05:47:00 +00:00
container.Resolve<IAppFolderFactory>().Register();
Mocker.SetConstant(container);
2015-05-03 23:30:16 +00:00
var handlers = Subject.BuildAll<IHandle<ApplicationStartedEvent>>()
2014-02-10 19:40:13 +00:00
.Select(c => c.GetType().FullName);
handlers.Should().OnlyHaveUniqueItems();
}
}
}