wabbajack/Wabbajack.FileExtractor.Test/Startup.cs

30 lines
1.1 KiB
C#
Raw Normal View History

2021-09-27 12:42:46 +00:00
using System;
using System.Text.Json;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Wabbajack.DTOs;
using Wabbajack.Paths.IO;
using Wabbajack.RateLimiter;
using Xunit.DependencyInjection;
using Xunit.DependencyInjection.Logging;
2021-10-23 16:51:17 +00:00
namespace Wabbajack.FileExtractor.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.AddSingleton<TemporaryFileManager, TemporaryFileManager>();
service.AddSingleton(new ParallelOptions {MaxDegreeOfParallelism = Environment.ProcessorCount});
service.AddAllSingleton<IResource, IResource<FileExtractor>, Resource<FileExtractor>>(s =>
new Resource<FileExtractor>("File Extractor", 2));
service.AddSingleton<FileExtractor>();
service.AddSingleton(new JsonSerializerOptions());
}
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
}
}