mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 18:21:10 +00:00
Replaces the per fixture random generators with the shared random instance
This commit is contained in:
1 parent
ab4d596500
commit
5aa21c0c0a
9 files changed
+31
-39
No files matched your search
+5
-6
@@ -15,7 +15,6 @@ namespace Lumina.Contracts.Fixtures.Core.DTO.MediaLibrary.WrittenContentLibrary.
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class IsbnDtoFixture
|
||||
{
|
||||
private readonly Random _random = new();
|
||||
|
||||
/// <summary>
|
||||
/// Creates an <see cref="IsbnDto"/> with a random or explicitly requested format.
|
||||
@@ -50,7 +49,7 @@ public class IsbnDtoFixture
|
||||
{
|
||||
int[] digits = new int[9];
|
||||
for (int i = 0; i < 9; i++)
|
||||
digits[i] = _random.Next(0, 10);
|
||||
digits[i] = Random.Shared.Next(0, 10);
|
||||
|
||||
int sum = 0;
|
||||
for (int i = 0; i < 9; i++)
|
||||
@@ -68,10 +67,10 @@ public class IsbnDtoFixture
|
||||
/// <returns>A valid ISBN-13 value.</returns>
|
||||
private string GenerateValidIsbn13()
|
||||
{
|
||||
string prefix = _random.Next(2) == 0 ? "978" : "979";
|
||||
string group = _random.Next(0, 99999).ToString().PadLeft(5, '0');
|
||||
string publisher = _random.Next(0, 999999).ToString().PadLeft(6, '0');
|
||||
string title = _random.Next(0, 99).ToString().PadLeft(2, '0');
|
||||
string prefix = Random.Shared.Next(2) == 0 ? "978" : "979";
|
||||
string group = Random.Shared.Next(0, 99999).ToString().PadLeft(5, '0');
|
||||
string publisher = Random.Shared.Next(0, 999999).ToString().PadLeft(6, '0');
|
||||
string title = Random.Shared.Next(0, 99).ToString().PadLeft(2, '0');
|
||||
|
||||
string isbn = $"{prefix}{group[..1]}{publisher}{title}";
|
||||
int sum = 0;
|
||||
|
||||
Reference in new issue
Block a user