mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-06-01 05:32:27 +00:00
- Renamed HashHelper to CryptoHelper - Moved CryptoHelper.GenerateRandomBytes to RandomHelper - Documented RandomHelper
27 lines
No EOL
855 B
C#
27 lines
No EOL
855 B
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using LBPUnion.ProjectLighthouse;
|
|
using LBPUnion.ProjectLighthouse.Helpers;
|
|
using LBPUnion.ProjectLighthouse.Tests;
|
|
using LBPUnion.ProjectLighthouse.Types;
|
|
using Xunit;
|
|
|
|
namespace ProjectLighthouse.Tests.GameApiTests;
|
|
|
|
public class DatabaseTests : LighthouseServerTest
|
|
{
|
|
[DatabaseFact]
|
|
public async Task CanCreateUserTwice()
|
|
{
|
|
await using Database database = new();
|
|
int rand = new Random().Next();
|
|
|
|
User userA = await database.CreateUser("unitTestUser" + rand, CryptoHelper.GenerateAuthToken());
|
|
User userB = await database.CreateUser("unitTestUser" + rand, CryptoHelper.GenerateAuthToken());
|
|
|
|
Assert.NotNull(userA);
|
|
Assert.NotNull(userB);
|
|
|
|
await database.RemoveUser(userA); // Only remove userA since userA and userB are the same user
|
|
}
|
|
} |