Skip to content

Commit ec0e59d

Browse files
committed
Add a few missing ReusabilityFacts cases
1 parent 120aae5 commit ec0e59d

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

tests/OpenGost.Security.Cryptography.Tests/ReusabilityFacts.cs

+9-12
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,21 @@
33
public class ReusabilityFacts
44
{
55
[Theory]
6-
[MemberData(nameof(ReusabilityHashAlgorithms))]
7-
public void ReuseHashAlgorithm(Func<HashAlgorithm> hashAlgorithmFactory)
6+
[InlineData(typeof(CMACGrasshopper))]
7+
[InlineData(typeof(CMACMagma))]
8+
[InlineData(typeof(HMACStreebog256))]
9+
[InlineData(typeof(HMACStreebog512))]
10+
[InlineData(typeof(Streebog256Managed))]
11+
[InlineData(typeof(Streebog512Managed))]
12+
public void ReuseHashAlgorithm(Type hashAlgorithmType)
813
{
9-
using var hashAlgorithm = hashAlgorithmFactory.Invoke();
14+
using var hashAlgorithm = (HashAlgorithm)Activator.CreateInstance(hashAlgorithmType)!;
1015
byte[] input = [0x08, 0x06, 0x07, 0x05, 0x03, 0x00, 0x09];
1116

1217
var hash1 = hashAlgorithm.ComputeHash(input);
1318
var hash2 = hashAlgorithm.ComputeHash(input);
1419

1520
Assert.Equal(hash1, hash2);
21+
Assert.NotSame(hash1, hash2);
1622
}
17-
18-
public static TheoryData<Func<HashAlgorithm>> ReusabilityHashAlgorithms()
19-
=> new()
20-
{
21-
{ () => new Streebog256Managed() },
22-
{ () => new Streebog512Managed() },
23-
{ () => new CMACGrasshopper() },
24-
{ () => new CMACMagma() },
25-
};
2623
}

0 commit comments

Comments
 (0)