92a26600af
fix rare bug with shared guid kicker plugin allow hiding of the connection lost notification
38 lines
1.4 KiB
C#
38 lines
1.4 KiB
C#
using ApplicationTests.Fixtures;
|
|
using FakeItEasy;
|
|
using IW4MAdmin;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using SharedLibraryCore.Interfaces;
|
|
using SharedLibraryCore.Services;
|
|
|
|
namespace ApplicationTests
|
|
{
|
|
static class DepedencyInjectionExtensions
|
|
{
|
|
public static IServiceCollection BuildBase(this IServiceCollection serviceCollection)
|
|
{
|
|
var manager = A.Fake<IManager>();
|
|
var logger = A.Fake<ILogger>();
|
|
A.CallTo(() => manager.GetLogger(A<long>.Ignored))
|
|
.Returns(logger);
|
|
|
|
serviceCollection.AddSingleton(logger)
|
|
.AddSingleton(manager)
|
|
.AddSingleton(A.Fake<IRConConnectionFactory>())
|
|
.AddSingleton(A.Fake<IRConConnection>())
|
|
.AddSingleton(A.Fake<ITranslationLookup>())
|
|
.AddSingleton(A.Fake<IRConParser>())
|
|
.AddSingleton(A.Fake<IParserRegexFactory>())
|
|
.AddSingleton(A.Fake<ClientService>());
|
|
|
|
serviceCollection.AddSingleton(_sp => new IW4MServer(_sp.GetRequiredService<IManager>(), ConfigurationGenerators.CreateServerConfiguration(),
|
|
_sp.GetRequiredService<ITranslationLookup>(), _sp.GetRequiredService<IRConConnectionFactory>())
|
|
{
|
|
RconParser = _sp.GetRequiredService<IRConParser>()
|
|
});
|
|
|
|
return serviceCollection;
|
|
}
|
|
}
|
|
}
|