put the tests back, I think it was a message box error

This commit is contained in:
Timothy Baldridge 2019-10-02 21:23:11 -06:00
parent 609bb6289c
commit 14eb3e697e
5 changed files with 28 additions and 11 deletions

View File

@ -7,10 +7,11 @@ namespace Wabbajack.Common
{ {
public static class Consts public static class Consts
{ {
public static bool TestMode { get; set; } = false;
public static string ModlistExtension = ".modlist_v1"; public static string ModlistExtension = ".modlist_v1";
public static string GameFolderFilesDir = "Game Folder Files"; public static string GameFolderFilesDir = "Game Folder Files";
public static string LOOTFolderFilesDir = "LOOT Config Files"; public static string LOOTFolderFilesDir = "LOOT Config Files";
public static string ModListMagic = "Celebration!, Cheese for Everyone!";
public static string BSACreationDir = "TEMP_BSA_FILES"; public static string BSACreationDir = "TEMP_BSA_FILES";
public static string MegaPrefix = "https://mega.nz/#!"; public static string MegaPrefix = "https://mega.nz/#!";

View File

@ -1,9 +1,11 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection;
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Alphaleonis.Win32.Filesystem;
using Microsoft.Win32; using Microsoft.Win32;
namespace Wabbajack.Common namespace Wabbajack.Common
@ -26,10 +28,20 @@ namespace Wabbajack.Common
public string MO2Name { get; internal set; } public string MO2Name { get; internal set; }
public string GameLocationRegistryKey { get; internal set; } public string GameLocationRegistryKey { get; internal set; }
public string GameLocation => public string GameLocation
(string)Registry.GetValue(GameLocationRegistryKey, "installed path", null) {
?? get
(string)Registry.GetValue(GameLocationRegistryKey.Replace(@"HKEY_LOCAL_MACHINE\SOFTWARE\", @"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\"), "installed path", null); {
if (Consts.TestMode)
return Directory.GetCurrentDirectory();
return (string) Registry.GetValue(GameLocationRegistryKey, "installed path", null)
??
(string) Registry.GetValue(
GameLocationRegistryKey.Replace(@"HKEY_LOCAL_MACHINE\SOFTWARE\",
@"HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\"), "installed path", null);
}
}
} }
public class GameRegistry public class GameRegistry

View File

@ -236,6 +236,12 @@ namespace Wabbajack.Test
Assert.AreEqual(errors.Count(), 0); Assert.AreEqual(errors.Count(), 0);
} }
[TestMethod]
public void CanLoadFromGithub()
{
new ValidateModlist().LoadListsFromGithub();
}
} }

View File

@ -2,12 +2,11 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime; using System.Runtime;
using Alphaleonis.Win32.Filesystem;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudio.TestTools.UnitTesting.Logging; using Microsoft.VisualStudio.TestTools.UnitTesting.Logging;
using VFS; using VFS;
using Wabbajack.Common; using Wabbajack.Common;
using Wabbajack.Validation;
using File = Alphaleonis.Win32.Filesystem.File;
namespace Wabbajack.Test namespace Wabbajack.Test
{ {
@ -21,7 +20,8 @@ namespace Wabbajack.Test
[TestInitialize] [TestInitialize]
public void TestInitialize() public void TestInitialize()
{ {
ValidateModlist.TestMode = true; Consts.TestMode = true;
utils = new TestUtils(); utils = new TestUtils();
utils.GameName = "Skyrim Special Edition"; utils.GameName = "Skyrim Special Edition";

View File

@ -19,7 +19,6 @@ namespace Wabbajack.Validation
/// </summary> /// </summary>
public class ValidateModlist public class ValidateModlist
{ {
public static bool TestMode { get; set; } = false;
public Dictionary<string, Author> AuthorPermissions { get; set; } = new Dictionary<string, Author>(); public Dictionary<string, Author> AuthorPermissions { get; set; } = new Dictionary<string, Author>();
public ServerWhitelist ServerWhitelist { get; set; } = new ServerWhitelist(); public ServerWhitelist ServerWhitelist { get; set; } = new ServerWhitelist();
@ -65,8 +64,7 @@ namespace Wabbajack.Validation
{ {
var validator = new ValidateModlist(); var validator = new ValidateModlist();
if (!TestMode) validator.LoadListsFromGithub();
validator.LoadListsFromGithub();
Utils.Log("Running validation checks"); Utils.Log("Running validation checks");
var errors = validator.Validate(modlist); var errors = validator.Validate(modlist);