Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions test/UnitTests/S3ecImplementedCryptographicOperationsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ public class S3ecImplementedCryptographicOperationsTest
public static void EqualReturnsTrue(int byteLength)
{
byte[] testArray = new byte[byteLength];
#if BCL35
var rng = RandomNumberGenerator.Create();
rng.GetBytes(testArray);
#else
using (var rng = RandomNumberGenerator.Create())
{
rng.GetBytes(testArray);
}
#endif

byte[] testArray2 = new byte[byteLength];
Array.Copy(testArray, testArray2, byteLength);
Expand All @@ -45,10 +50,15 @@ public static void EqualReturnsTrue(int byteLength)
public static void UnequalReturnsFalse(int byteLength)
{
byte[] testArray = new byte[byteLength];
#if BCL35
var rng = RandomNumberGenerator.Create();
rng.GetBytes(testArray);
#else
using (var rng = RandomNumberGenerator.Create())
{
rng.GetBytes(testArray);
}
#endif

byte[] testArray2 = new byte[byteLength];
Array.Copy(testArray, testArray2, byteLength);
Expand All @@ -72,10 +82,15 @@ public static void UnequalReturnsFalse(int byteLength)
public static void DifferentLengthsReturnFalse(int byteLength)
{
byte[] testArray = new byte[byteLength];
#if BCL35
var rng = RandomNumberGenerator.Create();
rng.GetBytes(testArray);
#else
using (var rng = RandomNumberGenerator.Create())
{
rng.GetBytes(testArray);
}
#endif

byte[] testArray2 = new byte[byteLength];
Array.Copy(testArray, testArray2, byteLength);
Expand All @@ -93,6 +108,7 @@ public static void DifferentLengthsReturnFalse(int byteLength)
Assert.False(isEqualB, "value missing last byte, value");
}

#if BCL35
[Fact]
public static void HasCorrectMethodImpl()
{
Expand All @@ -106,5 +122,6 @@ public static void HasCorrectMethodImpl()
MethodImplAttributes.NoInlining | MethodImplAttributes.NoOptimization,
mi.MethodImplementationFlags);
}
#endif
}
}
Loading