test(auth): give sign-in test players sequential ids

This commit is contained in:
Alexa
2026-10-25 16:55:57 +02:00
parent c7a087eea1
commit d4ce92f1b4
+3 -1
View File
@@ -23,6 +23,8 @@ namespace DorkNet.Server.Tests;
public sealed class ExternalSignInTests : IClassFixture<DorkNetServerFactory> public sealed class ExternalSignInTests : IClassFixture<DorkNetServerFactory>
{ {
private const string Issuer = "https://idp.example.com"; private const string Issuer = "https://idp.example.com";
// Test player ids: sequential, in a range no other test uses.
private static long _nextPlayerId = 9_600_000;
private readonly DorkNetServerFactory _factory; private readonly DorkNetServerFactory _factory;
public ExternalSignInTests(DorkNetServerFactory factory) => _factory = factory; public ExternalSignInTests(DorkNetServerFactory factory) => _factory = factory;
@@ -200,7 +202,7 @@ public sealed class ExternalSignInTests : IClassFixture<DorkNetServerFactory>
var password = "pw-" + Guid.NewGuid().ToString("N")[..12]; var password = "pw-" + Guid.NewGuid().ToString("N")[..12];
var player = new PlayerEntity var player = new PlayerEntity
{ {
Id = 9_400_000 + Random.Shared.Next(1, 99_999), Id = Interlocked.Increment(ref _nextPlayerId),
Username = "sso" + Guid.NewGuid().ToString("N")[..10], Username = "sso" + Guid.NewGuid().ToString("N")[..10],
DisplayName = "SSO test", DisplayName = "SSO test",
PasswordHash = BCrypt.Net.BCrypt.HashPassword(password), PasswordHash = BCrypt.Net.BCrypt.HashPassword(password),