5529858edd
properly hide broadcast failure messages if ignore connection lost is turned on fix concurent issue for update stats history that happened with new event processing make get/set additional property thread safe add ellipse to truncated chat messages on home
42 lines
1.5 KiB
C#
42 lines
1.5 KiB
C#
using ApplicationTests.Fixtures;
|
|
using ApplicationTests.Mocks;
|
|
using FakeItEasy;
|
|
using IW4MAdmin;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using SharedLibraryCore.Database;
|
|
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<IDatabaseContextFactory, DatabaseContextFactoryMock>()
|
|
.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;
|
|
}
|
|
}
|
|
}
|