mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-05 18:22:27 +00:00
23 lines
No EOL
726 B
C#
23 lines
No EOL
726 B
C#
using LBPUnion.ProjectLighthouse.Types.Settings;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Xunit;
|
|
|
|
namespace LBPUnion.ProjectLighthouse.Tests;
|
|
|
|
public sealed class DatabaseFactAttribute : FactAttribute
|
|
{
|
|
private static readonly object migrateLock = new();
|
|
|
|
public DatabaseFactAttribute()
|
|
{
|
|
ServerSettings.Instance = new ServerSettings();
|
|
ServerSettings.Instance.DbConnectionString = "server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse";
|
|
if (!ServerStatics.DbConnected) this.Skip = "Database not available";
|
|
else
|
|
lock(migrateLock)
|
|
{
|
|
using Database database = new();
|
|
database.Database.Migrate();
|
|
}
|
|
}
|
|
} |