Skip to content

Commit 3f3380c

Browse files
author
Javad Rahnama
authored
Test | Address XUnit failure on Windows Principal functionality is not supported on this platform (#2469)
1 parent 4bce7de commit 3f3380c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Collections.Generic;
77
using System.Linq;
88
using System.Reflection;
9+
using System.Runtime.InteropServices;
910
using System.Security.Cryptography.X509Certificates;
1011
using System.Security.Principal;
1112
using System.Text;
@@ -495,22 +496,24 @@ public override IEnumerable<Object[]> GetData(MethodInfo testMethod)
495496
{
496497
yield return new object[2] { StoreLocation.CurrentUser, CurrentUserMyPathPrefix };
497498
// use localmachine cert path only when current user is Admin.
498-
if (CertificateFixture.IsAdmin)
499+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && CertificateFixture.IsAdmin)
499500
{
500501
yield return new object[2] { StoreLocation.LocalMachine, LocalMachineMyPathPrefix };
501502
}
502503
}
503504
}
504505

506+
505507
public class ValidCertificatePathsParameters : DataAttribute
506508
{
509+
507510
public override IEnumerable<Object[]> GetData(MethodInfo testMethod)
508511
{
509512
yield return new object[2] { CurrentUserMyPathPrefix, StoreLocation.CurrentUser };
510513
yield return new object[2] { MyPathPrefix, null };
511514
yield return new object[2] { @"", null };
512515
// use localmachine cert path only when current user is Admin.
513-
if (CertificateFixture.IsAdmin)
516+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && CertificateFixture.IsAdmin)
514517
{
515518
yield return new object[2] { LocalMachineMyPathPrefix, StoreLocation.LocalMachine };
516519
}
@@ -653,7 +656,7 @@ public CertificateFixture()
653656
AddCertificateToStore(certificate1, StoreLocation.CurrentUser);
654657
AddCertificateToStore(certificate2, StoreLocation.CurrentUser);
655658
AddCertificateToStore(certificate3, StoreLocation.CurrentUser);
656-
if (IsAdmin)
659+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && IsAdmin)
657660
{
658661
AddCertificateToStore(certificate3, StoreLocation.LocalMachine);
659662
}

0 commit comments

Comments
 (0)