2019-11-12 17:54:48 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
|
using Wabbajack.Common;
|
|
|
|
|
using Wabbajack.Lib;
|
|
|
|
|
|
|
|
|
|
namespace Wabbajack.Test
|
|
|
|
|
{
|
|
|
|
|
public abstract class AVortexCompilerTest
|
|
|
|
|
{
|
|
|
|
|
public TestContext TestContext { get; set; }
|
|
|
|
|
protected TestUtils utils { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[TestInitialize]
|
|
|
|
|
public void TestInitialize()
|
|
|
|
|
{
|
|
|
|
|
Consts.TestMode = true;
|
|
|
|
|
|
|
|
|
|
utils = new TestUtils
|
|
|
|
|
{
|
2019-11-16 22:02:36 +00:00
|
|
|
|
Game = Game.DarkestDungeon
|
2019-11-12 17:54:48 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Utils.LogMessages.Subscribe(f => TestContext.WriteLine(f));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestCleanup]
|
|
|
|
|
public void TestCleanup()
|
|
|
|
|
{
|
|
|
|
|
utils.Dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected VortexCompiler ConfigureAndRunCompiler()
|
|
|
|
|
{
|
|
|
|
|
var vortexCompiler = MakeCompiler();
|
|
|
|
|
vortexCompiler.DownloadsFolder = utils.DownloadsFolder;
|
|
|
|
|
vortexCompiler.StagingFolder = utils.InstallFolder;
|
|
|
|
|
Directory.CreateDirectory(utils.InstallFolder);
|
2019-11-17 23:48:32 +00:00
|
|
|
|
Assert.IsTrue(vortexCompiler.Begin().Result);
|
2019-11-12 17:54:48 +00:00
|
|
|
|
return vortexCompiler;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected VortexCompiler MakeCompiler()
|
|
|
|
|
{
|
2019-11-16 22:10:13 +00:00
|
|
|
|
return new VortexCompiler(
|
|
|
|
|
game: utils.Game,
|
|
|
|
|
gamePath: utils.GameFolder,
|
|
|
|
|
vortexFolder: VortexCompiler.TypicalVortexFolder(),
|
|
|
|
|
downloadsFolder: VortexCompiler.RetrieveDownloadLocation(utils.Game),
|
|
|
|
|
stagingFolder: VortexCompiler.RetrieveStagingLocation(utils.Game));
|
2019-11-12 17:54:48 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected ModList CompileAndInstall()
|
|
|
|
|
{
|
|
|
|
|
var vortexCompiler = ConfigureAndRunCompiler();
|
|
|
|
|
Install(vortexCompiler);
|
|
|
|
|
return vortexCompiler.ModList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void Install(VortexCompiler vortexCompiler)
|
|
|
|
|
{
|
2019-11-21 15:05:10 +00:00
|
|
|
|
var modList = AInstaller.LoadFromFile(vortexCompiler.ModListOutputFile);
|
2019-11-18 00:17:06 +00:00
|
|
|
|
var installer = new MO2Installer(vortexCompiler.ModListOutputFile, modList, utils.InstallFolder)
|
2019-11-12 17:54:48 +00:00
|
|
|
|
{
|
|
|
|
|
DownloadFolder = utils.DownloadsFolder,
|
|
|
|
|
GameFolder = utils.GameFolder,
|
|
|
|
|
};
|
2019-11-17 23:48:32 +00:00
|
|
|
|
installer.Begin().Wait();
|
2019-11-12 17:54:48 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|