2026-01-14 15:02:49 +01:00
|
|
|
|
using System.Globalization;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Bit.Seeder;
|
2026-01-13 18:10:01 +01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Helper for generating unique identifier suffixes to prevent collisions in test data.
|
|
|
|
|
|
/// "Mangling" adds a random suffix to test data identifiers (usernames, emails, org names, etc.)
|
|
|
|
|
|
/// to ensure uniqueness across multiple test runs and parallel test executions.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public class MangleId
|
|
|
|
|
|
{
|
|
|
|
|
|
public readonly string Value;
|
|
|
|
|
|
|
|
|
|
|
|
public MangleId()
|
|
|
|
|
|
{
|
|
|
|
|
|
// Generate a short random string (6 char) to use as the mangle ID
|
2026-01-14 15:02:49 +01:00
|
|
|
|
Value = Random.Shared.NextInt64().ToString("x", CultureInfo.InvariantCulture).Substring(0, 8);
|
2026-01-13 18:10:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override string ToString() => Value;
|
|
|
|
|
|
}
|