Files
server/util/Seeder/MangleId.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
615 B
C#
Raw Normal View History

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;
}