Fixed: Restarting windows service from UI

This commit is contained in:
ta264
2021-11-22 21:14:29 +00:00
committed by Qstick
parent 2e103d6dba
commit 02ecc04526
6 changed files with 24 additions and 19 deletions

View File

@@ -3,6 +3,8 @@ using DryIoc;
using DryIoc.Microsoft.DependencyInjection;
using FluentAssertions;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Moq;
using NUnit.Framework;
using NzbDrone.Common.Composition.Extensions;
using NzbDrone.Common.EnvironmentInfo;
@@ -25,12 +27,15 @@ namespace NzbDrone.Common.Test
.AddNzbDroneLogger()
.AutoAddServices(Bootstrap.ASSEMBLIES)
.AddDummyDatabase()
.AddStartupContext(new StartupContext("first", "second"))
.GetServiceProvider();
.AddStartupContext(new StartupContext("first", "second"));
container.GetRequiredService<IAppFolderFactory>().Register();
container.RegisterInstance<IHostLifetime>(new Mock<IHostLifetime>().Object);
Mocker.SetConstant<System.IServiceProvider>(container);
var serviceProvider = container.GetServiceProvider();
serviceProvider.GetRequiredService<IAppFolderFactory>().Register();
Mocker.SetConstant<System.IServiceProvider>(serviceProvider);
var handlers = Subject.BuildAll<IHandle<ApplicationStartedEvent>>()
.Select(c => c.GetType().FullName);