mirror of
https://github.com/bitwarden/server
synced 2025-12-28 14:13:48 +00:00
20 lines
615 B
C#
20 lines
615 B
C#
namespace Bit.Seeder;
|
|
|
|
/// <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
|
|
Value = Random.Shared.NextInt64().ToString("x").Substring(0, 8);
|
|
}
|
|
|
|
public override string ToString() => Value;
|
|
}
|