wabbajack/Wabbajack.Downloaders.Dispatcher.Test/Startup.cs

30 lines
919 B
C#
Raw Permalink Normal View History

2021-09-27 12:42:46 +00:00
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
2022-06-08 03:51:39 +00:00
using Wabbajack.DTOs.Interventions;
2021-09-27 12:42:46 +00:00
using Wabbajack.Services.OSIntegrated;
using Xunit.DependencyInjection;
using Xunit.DependencyInjection.Logging;
2021-10-23 16:51:17 +00:00
namespace Wabbajack.Downloaders.Dispatcher.Test;
public class Startup
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
public void ConfigureServices(IServiceCollection service)
2021-09-27 12:42:46 +00:00
{
2021-10-23 16:51:17 +00:00
service.AddOSIntegrated();
2022-06-08 03:51:39 +00:00
service.AddSingleton<IUserInterventionHandler, CancellingInterventionHandler>();
2021-10-23 16:51:17 +00:00
}
2021-09-27 12:42:46 +00:00
2021-10-23 16:51:17 +00:00
public void Configure(ILoggerFactory loggerFactory, ITestOutputHelperAccessor accessor)
{
loggerFactory.AddProvider(new XunitTestOutputLoggerProvider(accessor, delegate { return true; }));
2021-09-27 12:42:46 +00:00
}
2022-06-08 03:51:39 +00:00
private class CancellingInterventionHandler : IUserInterventionHandler
{
public void Raise(IUserIntervention intervention)
{
intervention.Cancel();
}
}
2021-09-27 12:42:46 +00:00
}