1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-10 23:31:13 -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

@ -1,36 +1,32 @@
using FakeItEasy;
using IW4MAdmin;
using IW4MAdmin.Application;
using IW4MAdmin.Application.EventParsers;
using NUnit.Framework;
using SharedLibraryCore.Configuration;
using SharedLibraryCore.Interfaces;
using System;
using System.Diagnostics;
using Microsoft.Extensions.Logging;
using SharedLibraryCore;
using Microsoft.Extensions.DependencyInjection;
using ILogger = Microsoft.Extensions.Logging.ILogger;
namespace ApplicationTests
{
[TestFixture]
public class ServerTests
{
private IServiceProvider _serviceProvider;
[SetUp]
public void Setup()
{
_serviceProvider = new ServiceCollection()
.BuildBase()
.BuildServiceProvider();
}
[Test]
public void GameTimeFalseQuitTest()
{
var mgr = A.Fake<IManager>();
var server = new IW4MServer(mgr,
new SharedLibraryCore.Configuration.ServerConfiguration() { IPAddress = "127.0.0.1", Port = 28960 },
A.Fake<ITranslationLookup>(), A.Fake<IRConConnectionFactory>(),
A.Fake<IGameLogReaderFactory>(), A.Fake<IMetaService>(), A.Fake<ILogger<Server>>());
var server = _serviceProvider.GetRequiredService<IW4MServer>();
var parser = new BaseEventParser(A.Fake<IParserRegexFactory>(), A.Fake<ILogger>(), A.Fake<ApplicationConfiguration>());
parser.Configuration.GuidNumberStyle = System.Globalization.NumberStyles.Integer;
@ -50,13 +46,7 @@ namespace ApplicationTests
[Test]
public void LogFileReplay()
{
var mgr = A.Fake<IManager>();
var server = new IW4MServer(mgr,
new SharedLibraryCore.Configuration.ServerConfiguration() { IPAddress = "127.0.0.1", Port = 28960 },
A.Fake<ITranslationLookup>(), A.Fake<IRConConnectionFactory>(), A.Fake<IGameLogReaderFactory>(), A.Fake<IMetaService>(),
A.Fake<ILogger<Server>>());
var server = _serviceProvider.GetRequiredService<IW4MServer>();
var parser = new BaseEventParser(A.Fake<IParserRegexFactory>(), A.Fake<ILogger>(), A.Fake<ApplicationConfiguration>());
parser.Configuration.GuidNumberStyle = System.Globalization.NumberStyles.Integer;