2018-08-28 17:32:59 -04:00
|
|
|
|
using IW4MAdmin.Application;
|
|
|
|
|
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()
|
|
|
|
|
{
|
2018-10-02 13:39:08 -04:00
|
|
|
|
File.WriteAllText("test_mp.log", "test_log_file");
|
2018-08-28 17:32:59 -04:00
|
|
|
|
|
2018-10-12 22:28:22 -04:00
|
|
|
|
IW4MAdmin.Application.Localization.Configure.Initialize("en-US");
|
|
|
|
|
|
|
|
|
|
Manager = ApplicationManager.GetInstance();
|
2018-08-28 17:32:59 -04:00
|
|
|
|
|
|
|
|
|
var config = new ApplicationConfiguration
|
|
|
|
|
{
|
|
|
|
|
Servers = new List<ServerConfiguration>()
|
|
|
|
|
{
|
|
|
|
|
new ServerConfiguration()
|
|
|
|
|
{
|
|
|
|
|
AutoMessages = new List<string>(),
|
|
|
|
|
IPAddress = "127.0.0.1",
|
|
|
|
|
Password = "test",
|
|
|
|
|
Port = 28963,
|
|
|
|
|
Rules = new List<string>(),
|
2018-09-29 22:49:12 -04:00
|
|
|
|
ManualLogPath = "http://google.com"
|
2018-08-28 17:32:59 -04:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
AutoMessages = new List<string>(),
|
|
|
|
|
GlobalRules = new List<string>(),
|
|
|
|
|
Maps = new List<MapConfiguration>(),
|
|
|
|
|
RConPollRate = 10000
|
|
|
|
|
};
|
2018-10-02 13:39:08 -04:00
|
|
|
|
Manager.ConfigHandler = new BaseConfigurationHandler<ApplicationConfiguration>("test.json");
|
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>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|