Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 00de558

Browse files
committed
Consolidate all of the cryptography tests onto one copy of ByteUtils.
1 parent 87fe10e commit 00de558

File tree

20 files changed

+30
-59
lines changed

20 files changed

+30
-59
lines changed

src/Common/tests/Cryptography/AlgorithmImplementations/RSA/TestData.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

44
using System.Text;
5+
using Test.Cryptography;
56

67
namespace System.Security.Cryptography.Rsa.Tests
78
{

src/System.Security.Cryptography.Algorithms/tests/ByteUtils.cs renamed to src/Common/tests/Cryptography/ByteUtils.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33

44
using System.Globalization;
55

6-
// Temporarily placing ByteUtils in System.Security.Cryptography so that all of the merged tests
7-
// see it as within their implicit resolution scope.
8-
namespace System.Security.Cryptography
6+
namespace Test.Cryptography
97
{
108
internal static class ByteUtils
119
{
@@ -21,7 +19,7 @@ internal static byte[] AsciiBytes(string s)
2119
return bytes;
2220
}
2321

24-
internal static byte[] HexToByteArray(string hexString)
22+
internal static byte[] HexToByteArray(this string hexString)
2523
{
2624
byte[] bytes = new byte[hexString.Length / 2];
2725

src/System.Security.Cryptography.Algorithms/tests/HashAlgorithmTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

44
using System.IO;
5+
using Test.Cryptography;
56
using Xunit;
67

78
namespace System.Security.Cryptography.Hashing.Algorithms.Tests

src/System.Security.Cryptography.Algorithms/tests/HmacTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft. All rights reserved.
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4+
using Test.Cryptography;
45
using Xunit;
56

67
namespace System.Security.Cryptography.Hashing.Algorithms.Tests
@@ -57,4 +58,4 @@ protected void VerifyHmac(
5758
Assert.Equal(digestBytes, computedDigest);
5859
}
5960
}
60-
}
61+
}

src/System.Security.Cryptography.Algorithms/tests/Rfc2202HmacTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) Microsoft. All rights reserved.
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4+
using Test.Cryptography;
5+
46
namespace System.Security.Cryptography.Hashing.Algorithms.Tests
57
{
68
public abstract class Rfc2202HmacTests : HmacTests
@@ -34,4 +36,4 @@ protected Rfc2202HmacTests() :
3436
{
3537
}
3638
}
37-
}
39+
}

src/System.Security.Cryptography.Algorithms/tests/Rfc4231HmacTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright (c) Microsoft. All rights reserved.
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4+
using Test.Cryptography;
5+
46
namespace System.Security.Cryptography.Hashing.Algorithms.Tests
57
{
68
public abstract class Rfc4231HmacTests : HmacTests
@@ -34,4 +36,4 @@ protected Rfc4231HmacTests() :
3436
{
3537
}
3638
}
37-
}
39+
}

src/System.Security.Cryptography.Algorithms/tests/System.Security.Cryptography.Algorithms.Tests.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
<Compile Include="AesCipherTests.cs" />
2525
<Compile Include="AesContractTests.cs" />
2626
<Compile Include="AesModeTests.cs" />
27-
<Compile Include="ByteUtils.cs" />
2827
<Compile Include="DecryptorReusability.cs" />
2928
<Compile Include="HashAlgorithmTest.cs" />
3029
<Compile Include="InvalidUsageTests.cs" />
@@ -43,6 +42,9 @@
4342
<Compile Include="Sha256Tests.cs" />
4443
<Compile Include="Sha384Tests.cs" />
4544
<Compile Include="Sha512Tests.cs" />
45+
<Compile Include="$(CommonTestPath)\Cryptography\ByteUtils.cs">
46+
<Link>CommonTest\Cryptography\ByteUtils.cs</Link>
47+
</Compile>
4648
</ItemGroup>
4749
<ItemGroup>
4850
<None Include="project.json" />

src/System.Security.Cryptography.Csp/tests/ByteUtils.cs

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/System.Security.Cryptography.Csp/tests/ImportExportCspBlob.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Microsoft. All rights reserved.
22
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
33

4+
using Test.Cryptography;
45
using Xunit;
56

67
namespace System.Security.Cryptography.Rsa.Tests

src/System.Security.Cryptography.Csp/tests/System.Security.Cryptography.Csp.Tests.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@
2525
</ProjectReference>
2626
</ItemGroup>
2727
<ItemGroup>
28-
<Compile Include="ByteUtils.cs" />
2928
<Compile Include="ImportExportCspBlob.cs" />
3029
<Compile Include="$(CommonTestPath)\Cryptography\AlgorithmImplementations\RSA\EncryptDecrypt.cs" />
3130
<Compile Include="$(CommonTestPath)\Cryptography\AlgorithmImplementations\RSA\ImportExport.cs" />
3231
<Compile Include="$(CommonTestPath)\Cryptography\AlgorithmImplementations\RSA\KeyGeneration.cs" />
3332
<Compile Include="$(CommonTestPath)\Cryptography\AlgorithmImplementations\RSA\SignVerify.cs" />
3433
<Compile Include="$(CommonTestPath)\Cryptography\AlgorithmImplementations\RSA\TestData.cs" />
3534
<Compile Include="$(CommonTestPath)\Streams\PositionValueStream.cs" />
35+
<Compile Include="$(CommonTestPath)\Cryptography\ByteUtils.cs">
36+
<Link>CommonTest\Cryptography\ByteUtils.cs</Link>
37+
</Compile>
3638
</ItemGroup>
3739
<ItemGroup>
3840
<None Include="project.json" />

0 commit comments

Comments
 (0)