Fix the damn tests

This commit is contained in:
hulkhan22
2025-05-31 01:40:47 +02:00
parent a2d2a44a2f
commit 18bd0957fd
7 changed files with 79 additions and 16 deletions
@@ -11,6 +11,7 @@ public class JsonUtil
{
private static JsonSerializerOptions? jsonSerializerOptionsNoIndent;
private static JsonSerializerOptions? jsonSerializerOptionsIndented;
private static readonly Lock _lock = new();
public JsonUtil(
IEnumerable<IJsonConverterRegistrator> registrators
@@ -28,14 +29,20 @@ public class JsonUtil
{
foreach (var converter in registrator.GetJsonConverters())
{
jsonSerializerOptionsNoIndent.Converters.Add(converter);
lock (_lock)
{
jsonSerializerOptionsNoIndent.Converters.Add(converter);
}
}
}
jsonSerializerOptionsIndented = new JsonSerializerOptions(jsonSerializerOptionsNoIndent)
lock (_lock)
{
WriteIndented = true
};
jsonSerializerOptionsIndented = new JsonSerializerOptions(jsonSerializerOptionsNoIndent)
{
WriteIndented = true
};
}
}
/// <summary>
@@ -400,7 +400,7 @@ public class RandomUtil(ISptLogger<RandomUtil> _logger, ICloner _cloner)
while (currentIndex != 0)
{
var randomIndex = GetInt(0, currentIndex);
var randomIndex = GetInt(0, currentIndex, true);
currentIndex--;
// Swap it with the current element.