Skip to content

Commit d53b7ad

Browse files
committed
Account for exception message changes between .NET Framework and .NET Core
1 parent 4a3cc2f commit d53b7ad

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Microsoft.Data.SqlClient/tests/FunctionalTests/AlwaysEncryptedTests/ExceptionsCertStore.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,21 @@ public void CertificateNotFound()
4242
[Fact]
4343
public void CertificateWithNoPrivateKey()
4444
{
45+
#if NET
46+
string expectedMessage = string.Format("Certificate specified in key path '{0}' does not have a private key to encrypt a column encryption key. Verify the certificate is imported correctly. (Parameter 'masterKeyPath')", ExceptionCertFixture.masterKeyPathNPK);
47+
#else
4548
string expectedMessage = string.Format("Certificate specified in key path '{0}' does not have a private key to encrypt a column encryption key. Verify the certificate is imported correctly.\r\nParameter name: masterKeyPath", ExceptionCertFixture.masterKeyPathNPK);
49+
#endif
4650
ArgumentException e = Assert.Throws<ArgumentException>(() =>
4751
ExceptionCertFixture.certStoreProvider.EncryptColumnEncryptionKey(
4852
ExceptionCertFixture.masterKeyPathNPK, masterKeyEncAlgo, ExceptionCertFixture.encryptedCek));
4953
Assert.Contains(expectedMessage, e.Message);
5054

55+
#if NET
56+
expectedMessage = string.Format("Certificate specified in key path '{0}' does not have a private key to decrypt a column encryption key. Verify the certificate is imported correctly. (Parameter 'masterKeyPath')", ExceptionCertFixture.masterKeyPathNPK);
57+
#else
5158
expectedMessage = string.Format("Certificate specified in key path '{0}' does not have a private key to decrypt a column encryption key. Verify the certificate is imported correctly.\r\nParameter name: masterKeyPath", ExceptionCertFixture.masterKeyPathNPK);
59+
#endif
5260
e = Assert.Throws<ArgumentException>(() =>
5361
ExceptionCertFixture.certStoreProvider.DecryptColumnEncryptionKey(
5462
ExceptionCertFixture.masterKeyPathNPK, masterKeyEncAlgo, ExceptionCertFixture.encryptedCek));

0 commit comments

Comments
 (0)