mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Some MO2Installer.CheckValidInstallPath unit tests
This commit is contained in:
parent
46b8f97bd0
commit
477622f7ca
76
Wabbajack.Test/MO2Tests.cs
Normal file
76
Wabbajack.Test/MO2Tests.cs
Normal file
@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Lib;
|
||||
|
||||
namespace Wabbajack.Test
|
||||
{
|
||||
[TestClass]
|
||||
public class MO2Tests
|
||||
{
|
||||
#region CheckValidInstallPath
|
||||
[TestMethod]
|
||||
public void CheckValidInstallPath_Empty()
|
||||
{
|
||||
using (var tempDir = new TempFolder())
|
||||
{
|
||||
Assert.IsTrue(MO2Installer.CheckValidInstallPath(tempDir.Dir.FullName).Succeeded);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CheckValidInstallPath_DoesNotExist()
|
||||
{
|
||||
using (var tempDir = new TempFolder())
|
||||
{
|
||||
Assert.IsTrue(MO2Installer.CheckValidInstallPath(Path.Combine(tempDir.Dir.FullName, "Subfolder")).Succeeded);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CheckValidInstallPath_Invalid()
|
||||
{
|
||||
using (var tempDir = new TempFolder())
|
||||
{
|
||||
Assert.IsFalse(MO2Installer.CheckValidInstallPath($"{tempDir.Dir.FullName}/*").Succeeded);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CheckValidInstallPath_HasModlist()
|
||||
{
|
||||
using (var tempDir = new TempFolder())
|
||||
{
|
||||
File.Create(Path.Combine(tempDir.Dir.FullName, $"ModOrganizer.exe"));
|
||||
File.Create(Path.Combine(tempDir.Dir.FullName, $"modlist{ExtensionManager.Extension}"));
|
||||
Assert.IsFalse(MO2Installer.CheckValidInstallPath(tempDir.Dir.FullName).Succeeded);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CheckValidInstallPath_ProperOverwrite()
|
||||
{
|
||||
using (var tempDir = new TempFolder())
|
||||
{
|
||||
File.Create(Path.Combine(tempDir.Dir.FullName, $"ModOrganizer.exe"));
|
||||
Assert.IsTrue(MO2Installer.CheckValidInstallPath(tempDir.Dir.FullName).Succeeded);
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void CheckValidInstallPath_ImproperOverwrite()
|
||||
{
|
||||
using (var tempDir = new TempFolder())
|
||||
{
|
||||
File.Create(Path.Combine(tempDir.Dir.FullName, $"someFile.txt"));
|
||||
Assert.IsFalse(MO2Installer.CheckValidInstallPath(tempDir.Dir.FullName).Succeeded);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -107,6 +107,7 @@
|
||||
<Compile Include="Extensions.cs" />
|
||||
<Compile Include="FilePickerTests.cs" />
|
||||
<Compile Include="MiscTests.cs" />
|
||||
<Compile Include="MO2Tests.cs" />
|
||||
<Compile Include="ModlistMetadataTests.cs" />
|
||||
<Compile Include="RestartingDownloadsTests.cs" />
|
||||
<Compile Include="SimpleHTTPServer.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user