Skip to content

Commit 3c547e2

Browse files
committed
Fix test
1 parent 569abaa commit 3c547e2

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/DataProtection/Cryptography.KeyDerivation/test/Pbkdf2Tests.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ public void RunTest_Normal_NetCore(string password, KeyDerivationPrf prf, int it
3737
}
3838

3939
// Act & assert
40+
#if NET461
41+
TestProvider<ManagedPbkdf2Provider>(password, salt, prf, iterationCount, numBytesRequested, expectedValueAsBase64);
42+
#elif NETCOREAPP
4043
TestProvider<NetCorePbkdf2Provider>(password, salt, prf, iterationCount, numBytesRequested, expectedValueAsBase64);
44+
#else
45+
#error Update target frameworks
46+
#endif
4147
}
4248

4349
[Fact]
@@ -47,15 +53,28 @@ public void RunTest_WithLongPassword_NetCore_FallbackToManaged()
4753
byte[] salt = Encoding.UTF8.GetBytes("salt");
4854
const string expectedDerivedKeyBase64 = "Sc+V/c3fiZq5Z5qH3iavAiojTsW97FAp2eBNmCQAwCNzA8hfhFFYyQLIMK65qPnBFHOHXQPwAxNQNhaEAH9hzfiaNBSRJpF9V4rpl02d5ZpI6cZbsQFF7TJW7XJzQVpYoPDgJlg0xVmYLhn1E9qMtUVUuXsBjOOdd7K1M+ZI00c=";
4955

56+
#if NET461
57+
RunTest_WithLongPassword_Impl<ManagedPbkdf2Provider>(salt, expectedDerivedKeyBase64);
58+
#elif NETCOREAPP
5059
RunTest_WithLongPassword_Impl<NetCorePbkdf2Provider>(salt, expectedDerivedKeyBase64);
60+
#else
61+
#error Update target frameworks
62+
#endif
5163
}
5264

5365
[Fact]
5466
public void RunTest_WithLongPassword_NetCore()
5567
{
5668
// salt longer than 8 bytes
5769
var salt = Encoding.UTF8.GetBytes("abcdefghijkl");
70+
71+
#if NET461
72+
RunTest_WithLongPassword_Impl<ManagedPbkdf2Provider>(salt, "NGJtFzYUaaSxu+3ZsMeZO5d/qPJDUYW4caLkFlaY0cLSYdh1PN4+nHUVp4pUUubJWu3UeXNMnHKNDfnn8GMfnDVrAGTv1lldszsvUJ0JQ6p4+daQEYBc//Tj/ejuB3luwW0IinyE7U/ViOQKbfi5pCZFMQ0FFx9I+eXRlyT+I74=");
73+
#elif NETCOREAPP
5874
RunTest_WithLongPassword_Impl<NetCorePbkdf2Provider>(salt, "NGJtFzYUaaSxu+3ZsMeZO5d/qPJDUYW4caLkFlaY0cLSYdh1PN4+nHUVp4pUUubJWu3UeXNMnHKNDfnn8GMfnDVrAGTv1lldszsvUJ0JQ6p4+daQEYBc//Tj/ejuB3luwW0IinyE7U/ViOQKbfi5pCZFMQ0FFx9I+eXRlyT+I74=");
75+
#else
76+
#error Update target frameworks
77+
#endif
5978
}
6079

6180
// The 'numBytesRequested' parameters below are chosen to exercise code paths where

0 commit comments

Comments
 (0)