Skip to content

Commit

Permalink
Hack to fix threading issue in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gavbrennan committed Apr 23, 2019
1 parent 38f7c5e commit 6f9051e
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions test/Qwack.Serialization.Test/ArraySerializationFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,23 @@ public static BasicArraysObject Create()
ShortArray = new short[1024],
UShortArray = new ushort[1024],
FloatArray = new float[1024],
StringArray = new [] {string.Empty, null, "Test1", "Test 2 Test", string.Empty, "Test 3 Test", null},
StringArray = new[] { string.Empty, null, "Test1", "Test 2 Test", string.Empty, "Test 3 Test", null },
};
_random.NextBytes(obj.ByteArray);
for(var i = 0; i < obj.UIntArray.Length;i++)
{
obj.UIntArray[i] = (uint)_random.Next(0, int.MaxValue);
obj.IntArray[i] = _random.Next();
obj.DoubleArray[i] = _random.NextDouble();
obj.UShortArray[i] = (ushort)_random.Next(ushort.MinValue, ushort.MaxValue);
obj.ShortArray[i] = (short)_random.Next(short.MinValue, short.MaxValue);
obj.FloatArray[i] = (float)_random.NextDouble();
}

var random = new Random();

random.NextBytes(obj.ByteArray);

for (var i = 0; i < obj.UIntArray.Length; i++)
{
obj.UIntArray[i] = (uint)random.Next(0, int.MaxValue);
obj.IntArray[i] = random.Next();
obj.DoubleArray[i] = random.NextDouble();
obj.UShortArray[i] = (ushort)random.Next(ushort.MinValue, ushort.MaxValue);
obj.ShortArray[i] = (short)random.Next(short.MinValue, short.MaxValue);
obj.FloatArray[i] = (float)random.NextDouble();
}

return obj;
}

Expand Down

0 comments on commit 6f9051e

Please sign in to comment.