mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-23 13:41:31 +00:00
Fix unit tests breaking due to config changes
This commit is contained in:
parent
177befde91
commit
cbe8fbc2b4
3 changed files with 6 additions and 0 deletions
|
@ -8,6 +8,7 @@ namespace LBPUnion.ProjectLighthouse.Tests
|
||||||
{
|
{
|
||||||
public DatabaseFact()
|
public DatabaseFact()
|
||||||
{
|
{
|
||||||
|
ServerSettings.Instance = new ServerSettings();
|
||||||
ServerSettings.Instance.DbConnectionString = "server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse";
|
ServerSettings.Instance.DbConnectionString = "server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse";
|
||||||
if (!ServerStatics.DbConnected)
|
if (!ServerStatics.DbConnected)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,6 +13,8 @@ namespace LBPUnion.ProjectLighthouse.Types.Settings
|
||||||
{
|
{
|
||||||
static ServerSettings()
|
static ServerSettings()
|
||||||
{
|
{
|
||||||
|
if (ServerStatics.IsUnitTesting) return; // Unit testing, we don't want to read configurations here since the tests will provide their own
|
||||||
|
|
||||||
if (File.Exists(ConfigFileName))
|
if (File.Exists(ConfigFileName))
|
||||||
{
|
{
|
||||||
string configFile = File.ReadAllText(ConfigFileName);
|
string configFile = File.ReadAllText(ConfigFileName);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#nullable enable
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using Kettu;
|
using Kettu;
|
||||||
using LBPUnion.ProjectLighthouse.Logging;
|
using LBPUnion.ProjectLighthouse.Logging;
|
||||||
|
|
||||||
|
@ -29,5 +30,7 @@ namespace LBPUnion.ProjectLighthouse.Types.Settings
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsUnitTesting => AppDomain.CurrentDomain.GetAssemblies().Any(assembly => assembly.FullName.StartsWith("xunit"));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue