mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-18 08:21:27 +00:00
Refactor Database class (#616)
Refactor Database into DatabaseContext Moved into separate folder so it actually has a namespace instead sitting in the root
This commit is contained in:
parent
2aff26f83d
commit
64b95e807d
246 changed files with 1211 additions and 965 deletions
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using LBPUnion.ProjectLighthouse;
|
||||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Helpers;
|
||||
using LBPUnion.ProjectLighthouse.Tests;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Profile;
|
||||
|
@ -17,7 +17,7 @@ public class AuthenticationTests : LighthouseWebTest
|
|||
[DatabaseFact]
|
||||
public async Task ShouldLoginWithPassword()
|
||||
{
|
||||
await using Database database = new();
|
||||
await using DatabaseContext database = new();
|
||||
Random random = new();
|
||||
|
||||
string password = CryptoHelper.Sha256Hash(CryptoHelper.GenerateRandomBytes(64).ToArray());
|
||||
|
@ -39,7 +39,7 @@ public class AuthenticationTests : LighthouseWebTest
|
|||
[DatabaseFact]
|
||||
public async Task ShouldNotLoginWithNoPassword()
|
||||
{
|
||||
await using Database database = new();
|
||||
await using DatabaseContext database = new();
|
||||
Random random = new();
|
||||
User user = await database.CreateUser($"unitTestUser{random.Next()}", CryptoHelper.BCryptHash("just like the hindenberg,"));
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class AuthenticationTests : LighthouseWebTest
|
|||
[DatabaseFact]
|
||||
public async Task ShouldNotLoginWithWrongPassword()
|
||||
{
|
||||
await using Database database = new();
|
||||
await using DatabaseContext database = new();
|
||||
Random random = new();
|
||||
User user = await database.CreateUser($"unitTestUser{random.Next()}", CryptoHelper.BCryptHash("i'm an engineering failure"));
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class AuthenticationTests : LighthouseWebTest
|
|||
{
|
||||
const string loggedInAsUsernameTextXPath = "/html/body/div/div/div/div/p[1]";
|
||||
|
||||
await using Database database = new();
|
||||
await using DatabaseContext database = new();
|
||||
Random random = new();
|
||||
User user = await database.CreateUser($"unitTestUser{random.Next()}", CryptoHelper.BCryptHash("i'm an engineering failure"));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue