mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Created Vortex Test for StackSerialization
This commit is contained in:
parent
9fad28f70a
commit
f391254f1d
Wabbajack.Lib
Wabbajack.Test
@ -21,9 +21,9 @@ namespace Wabbajack.Lib
|
||||
public Game Game { get; }
|
||||
public string GameName { get; }
|
||||
|
||||
public string VortexFolder { get; }
|
||||
public string StagingFolder { get; }
|
||||
public string DownloadsFolder { get; }
|
||||
public string VortexFolder { get; set; }
|
||||
public string StagingFolder { get; set; }
|
||||
public string DownloadsFolder { get; set; }
|
||||
|
||||
public bool IgnoreMissingFiles { get; set; }
|
||||
|
||||
|
71
Wabbajack.Test/AVortexCompilerTest.cs
Normal file
71
Wabbajack.Test/AVortexCompilerTest.cs
Normal file
@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using VFS;
|
||||
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
|
||||
{
|
||||
GameName = "darkestdungeon"
|
||||
};
|
||||
|
||||
Utils.LogMessages.Subscribe(f => TestContext.WriteLine(f));
|
||||
}
|
||||
|
||||
[TestCleanup]
|
||||
public void TestCleanup()
|
||||
{
|
||||
utils.Dispose();
|
||||
}
|
||||
|
||||
protected VortexCompiler ConfigureAndRunCompiler()
|
||||
{
|
||||
var vortexCompiler = MakeCompiler();
|
||||
vortexCompiler.VFS.Reset();
|
||||
vortexCompiler.DownloadsFolder = utils.DownloadsFolder;
|
||||
vortexCompiler.StagingFolder = utils.InstallFolder;
|
||||
Directory.CreateDirectory(utils.InstallFolder);
|
||||
Assert.IsTrue(vortexCompiler.Compile());
|
||||
return vortexCompiler;
|
||||
}
|
||||
|
||||
protected VortexCompiler MakeCompiler()
|
||||
{
|
||||
VirtualFileSystem.Reconfigure(utils.TestFolder);
|
||||
var vortexCompiler = new VortexCompiler(utils.GameName, utils.GameFolder);
|
||||
return vortexCompiler;
|
||||
}
|
||||
|
||||
protected ModList CompileAndInstall()
|
||||
{
|
||||
var vortexCompiler = ConfigureAndRunCompiler();
|
||||
Install(vortexCompiler);
|
||||
return vortexCompiler.ModList;
|
||||
}
|
||||
|
||||
protected void Install(VortexCompiler vortexCompiler)
|
||||
{
|
||||
var modList = Installer.LoadFromFile(vortexCompiler.ModListOutputFile);
|
||||
var installer = new Installer(vortexCompiler.ModListOutputFile, modList, utils.InstallFolder)
|
||||
{
|
||||
DownloadFolder = utils.DownloadsFolder,
|
||||
GameFolder = utils.GameFolder,
|
||||
};
|
||||
installer.Install();
|
||||
}
|
||||
}
|
||||
}
|
25
Wabbajack.Test/VortexTests.cs
Normal file
25
Wabbajack.Test/VortexTests.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Wabbajack.Lib.CompilationSteps;
|
||||
|
||||
namespace Wabbajack.Test
|
||||
{
|
||||
[TestClass]
|
||||
public class VortexTests : AVortexCompilerTest
|
||||
{
|
||||
[TestMethod]
|
||||
public void TestVortexStackSerialization()
|
||||
{
|
||||
utils.AddMod("test");
|
||||
utils.Configure();
|
||||
|
||||
var vortexCompiler = ConfigureAndRunCompiler();
|
||||
var stack = vortexCompiler.MakeStack();
|
||||
|
||||
var serialized = Serialization.Serialize(stack);
|
||||
var rounded = Serialization.Serialize(Serialization.Deserialize(serialized, vortexCompiler));
|
||||
|
||||
Assert.AreEqual(serialized, rounded);
|
||||
Assert.IsNotNull(vortexCompiler.GetStack());
|
||||
}
|
||||
}
|
||||
}
|
@ -94,6 +94,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ACompilerTest.cs" />
|
||||
<Compile Include="AVortexCompilerTest.cs" />
|
||||
<Compile Include="CSP\ChannelTests.cs" />
|
||||
<Compile Include="CSP\CSPTests.cs" />
|
||||
<Compile Include="DownloaderTests.cs" />
|
||||
@ -105,6 +106,7 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ContentRightsManagementTests.cs" />
|
||||
<Compile Include="CompilationStackTests.cs" />
|
||||
<Compile Include="VortexTests.cs" />
|
||||
<Compile Include="WebAutomationTests.cs" />
|
||||
<Compile Include="zEditIntegrationTests.cs" />
|
||||
</ItemGroup>
|
||||
|
Loading…
x
Reference in New Issue
Block a user