Skip to content

Commit 875311b

Browse files
Address test issue
1 parent 886718d commit 875311b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Fixtures/CertificateFixtureBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ protected static X509Certificate2 CreateCertificate(string subjectName, IEnumera
5050

5151
rnd.NextBytes(passwordBytes);
5252
password = Convert.ToBase64String(passwordBytes);
53-
#if NET
53+
#if NET9_0_OR_GREATER
5454
X500DistinguishedNameBuilder subjectBuilder = new X500DistinguishedNameBuilder();
5555
SubjectAlternativeNameBuilder sanBuilder = new SubjectAlternativeNameBuilder();
5656
RSA rsaKey = RSA.Create(2048);

src/Microsoft.Data.SqlClient/tests/tools/Microsoft.Data.SqlClient.TestUtilities/Fixtures/ColumnEncryptionCertificateFixture.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ public ColumnEncryptionCertificateFixture()
2727
using (X509Certificate2 createdCertificate = CreateCertificate(nameof(CertificateWithoutPrivateKey), Array.Empty<string>(), Array.Empty<string>()))
2828
{
2929
// This will strip the private key away from the created certificate
30+
#if NET9_0_OR_GREATER
3031
CertificateWithoutPrivateKey = X509CertificateLoader.LoadCertificate(createdCertificate.Export(X509ContentType.Cert));
31-
32+
#else
33+
CertificateWithoutPrivateKey = new X509Certificate2(createdCertificate.Export(X509ContentType.Cert));
34+
#endif
3235
AddToStore(CertificateWithoutPrivateKey, StoreLocation.CurrentUser, StoreName.My);
3336
}
3437

0 commit comments

Comments
 (0)