1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 15:20:48 -05:00

update unit tests

This commit is contained in:
RaidMax
2020-11-12 19:46:17 -06:00
parent 3e1db4b00a
commit f5c2f92652
10 changed files with 52 additions and 58 deletions

View File

@ -6,8 +6,7 @@ using Microsoft.Extensions.DependencyInjection;
using SharedLibraryCore.Configuration;
using SharedLibraryCore.Interfaces;
using System;
using Microsoft.Extensions.Logging;
using SharedLibraryCore;
using ILogger = Microsoft.Extensions.Logging.ILogger;
namespace ApplicationTests
{
@ -28,7 +27,6 @@ namespace ApplicationTests
}
var manager = A.Fake<IManager>();
var logger = A.Fake<ILogger>();
var transLookup = A.Fake<ITranslationLookup>();
A.CallTo(() => transLookup[A<string>.Ignored])
@ -37,8 +35,11 @@ namespace ApplicationTests
serviceCollection
.AddLogging()
.AddSingleton(A.Fake<ILogger>())
.AddSingleton(A.Fake<SharedLibraryCore.Interfaces.ILogger>())
.AddSingleton(new ServerConfiguration { IPAddress = "127.0.0.1", Port = 28960 })
.AddSingleton(manager)
.AddSingleton<IDatabaseContextFactory, DatabaseContextFactoryMock>()
.AddSingleton<IW4MServer>()
.AddSingleton(A.Fake<IRConConnectionFactory>())
.AddSingleton(A.Fake<IRConConnection>())
.AddSingleton(transLookup)
@ -52,17 +53,6 @@ namespace ApplicationTests
.AddSingleton(ConfigurationGenerators.CreateCommandConfiguration())
.AddSingleton<IConfigurationHandler<ApplicationConfiguration>, ApplicationConfigurationHandlerMock>();
serviceCollection.AddSingleton(_sp => new IW4MServer(_sp.GetRequiredService<IManager>(),
ConfigurationGenerators.CreateServerConfiguration(),
_sp.GetRequiredService<ITranslationLookup>(),
_sp.GetRequiredService<IRConConnectionFactory>(),
_sp.GetRequiredService<IGameLogReaderFactory>(),
_sp.GetRequiredService<IMetaService>(),
_sp.GetRequiredService<ILogger<Server>>())
{
RconParser = _sp.GetRequiredService<IRConParser>()
});
return serviceCollection;
}