mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
9051d28822
Swapped the callback registration systems for Rx subjects exposing observables
69 lines
1.9 KiB
C#
69 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using VFS;
|
|
using Wabbajack.Common;
|
|
using Wabbajack.Lib;
|
|
|
|
namespace Wabbajack.Test
|
|
{
|
|
public abstract class ACompilerTest
|
|
{
|
|
public TestContext TestContext { get; set; }
|
|
protected TestUtils utils { get; set; }
|
|
|
|
[TestInitialize]
|
|
public void TestInitialize()
|
|
{
|
|
Consts.TestMode = true;
|
|
|
|
utils = new TestUtils();
|
|
utils.GameName = "Skyrim Special Edition";
|
|
|
|
Utils.LogMessages.Subscribe(f => TestContext.WriteLine(f));
|
|
|
|
}
|
|
|
|
[TestCleanup]
|
|
public void TestCleanup()
|
|
{
|
|
utils.Dispose();
|
|
}
|
|
|
|
protected Compiler ConfigureAndRunCompiler(string profile)
|
|
{
|
|
var compiler = MakeCompiler();
|
|
compiler.VFS.Reset();
|
|
compiler.MO2Profile = profile;
|
|
compiler.ShowReportWhenFinished = false;
|
|
Assert.IsTrue(compiler.Compile());
|
|
return compiler;
|
|
}
|
|
|
|
protected Compiler MakeCompiler()
|
|
{
|
|
VirtualFileSystem.Reconfigure(utils.TestFolder);
|
|
var compiler = new Compiler(utils.MO2Folder);
|
|
return compiler;
|
|
}
|
|
protected ModList CompileAndInstall(string profile)
|
|
{
|
|
var compiler = ConfigureAndRunCompiler(profile);
|
|
Install(compiler);
|
|
return compiler.ModList;
|
|
}
|
|
|
|
protected void Install(Compiler compiler)
|
|
{
|
|
var modlist = Installer.LoadFromFile(compiler.ModListOutputFile);
|
|
var installer = new Installer(compiler.ModListOutputFile, modlist, utils.InstallFolder);
|
|
installer.DownloadFolder = utils.DownloadsFolder;
|
|
installer.GameFolder = utils.GameFolder;
|
|
installer.Install();
|
|
}
|
|
}
|
|
}
|