2018-08-28 17:32:59 -04:00
|
|
|
|
using IW4MAdmin.Application;
|
2020-04-01 15:11:56 -04:00
|
|
|
|
using IW4MAdmin.Application.Factories;
|
2020-02-11 17:44:06 -05:00
|
|
|
|
using IW4MAdmin.Application.Misc;
|
2018-08-28 17:32:59 -04:00
|
|
|
|
using SharedLibraryCore.Configuration;
|
|
|
|
|
using SharedLibraryCore.Interfaces;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
namespace Tests
|
|
|
|
|
{
|
|
|
|
|
public class ManagerFixture : IDisposable
|
|
|
|
|
{
|
|
|
|
|
public ApplicationManager Manager { get; private set; }
|
|
|
|
|
|
|
|
|
|
public ManagerFixture()
|
|
|
|
|
{
|
2019-06-24 12:01:34 -04:00
|
|
|
|
string logFile = @"X:\IW4MAdmin\Plugins\Tests\bin\Debug\netcoreapp2.2\test_mp.log";
|
2018-08-28 17:32:59 -04:00
|
|
|
|
|
2019-06-24 12:01:34 -04:00
|
|
|
|
File.WriteAllText(logFile, Environment.NewLine);
|
2018-10-12 22:28:22 -04:00
|
|
|
|
|
2020-01-13 21:06:57 -05:00
|
|
|
|
Manager = null;
|
2018-08-28 17:32:59 -04:00
|
|
|
|
|
|
|
|
|
var config = new ApplicationConfiguration
|
|
|
|
|
{
|
2020-01-17 18:31:53 -05:00
|
|
|
|
Servers = new[]
|
2018-08-28 17:32:59 -04:00
|
|
|
|
{
|
|
|
|
|
new ServerConfiguration()
|
|
|
|
|
{
|
|
|
|
|
IPAddress = "127.0.0.1",
|
|
|
|
|
Password = "test",
|
2019-06-24 12:01:34 -04:00
|
|
|
|
Port = 28960,
|
|
|
|
|
RConParserVersion = "test",
|
|
|
|
|
EventParserVersion = "IW4x (v0.6.0)",
|
|
|
|
|
ManualLogPath = logFile
|
2018-08-28 17:32:59 -04:00
|
|
|
|
}
|
|
|
|
|
},
|
2019-06-24 12:01:34 -04:00
|
|
|
|
RConPollRate = int.MaxValue
|
2018-08-28 17:32:59 -04:00
|
|
|
|
};
|
2019-06-24 12:01:34 -04:00
|
|
|
|
|
2019-04-05 22:15:17 -04:00
|
|
|
|
Manager.ConfigHandler = new BaseConfigurationHandler<ApplicationConfiguration>("test");
|
2018-08-28 17:32:59 -04:00
|
|
|
|
Manager.ConfigHandler.Set(config);
|
|
|
|
|
|
|
|
|
|
Manager.Init().Wait();
|
2018-10-12 22:28:22 -04:00
|
|
|
|
|
2018-08-28 17:32:59 -04:00
|
|
|
|
Task.Run(() => Manager.Start());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Dispose()
|
|
|
|
|
{
|
|
|
|
|
Manager.Stop();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[CollectionDefinition("ManagerCollection")]
|
|
|
|
|
public class ManagerCollection : ICollectionFixture<ManagerFixture>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|