1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-26 22:46:53 -04:00

New: Use native dotnet host and DryIoc

(cherry picked from commit d6170dbfedf27a6218afe242a0fae2eb8b368aec)
(cherry picked from commit 7fe36a7e9222e830f4920e09a85115df0bdbf190)
This commit is contained in:
ta264
2021-10-21 21:04:26 +01:00
committed by Qstick
parent 2d53ec24f8
commit 06e2d5b3c3
77 changed files with 940 additions and 5133 deletions
@@ -1,8 +1,13 @@
using System.Linq;
using System.Linq;
using DryIoc;
using DryIoc.Microsoft.DependencyInjection;
using FluentAssertions;
using Microsoft.Extensions.DependencyInjection;
using NUnit.Framework;
using NzbDrone.Common.Composition.Extensions;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Core.Datastore;
using NzbDrone.Common.Instrumentation.Extensions;
using NzbDrone.Core.Datastore.Extensions;
using NzbDrone.Core.Lifecycle;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Test.Common;
@@ -16,12 +21,16 @@ namespace NzbDrone.Common.Test
[Test]
public void event_handlers_should_be_unique()
{
var container = MainAppContainerBuilder.BuildContainer(new StartupContext());
container.Register<IMainDatabase>(new MainDatabase(null));
container.Register<ILogDatabase>(new LogDatabase(null));
container.Resolve<IAppFolderFactory>().Register();
var container = new Container(rules => rules.WithNzbDroneRules())
.AddNzbDroneLogger()
.AutoAddServices(Bootstrap.ASSEMBLIES)
.AddDummyDatabase()
.AddStartupContext(new StartupContext("first", "second"))
.GetServiceProvider();
Mocker.SetConstant(container);
container.GetRequiredService<IAppFolderFactory>().Register();
Mocker.SetConstant<System.IServiceProvider>(container);
var handlers = Subject.BuildAll<IHandle<ApplicationStartedEvent>>()
.Select(c => c.GetType().FullName);