Skip to content

Commit 5f9fec9

Browse files
authored
Fix test sensitivity to PKCS7 certificate ordering (#59818)
Android exports PKCS7 certificates in a different order, and the xunit assertion is sensitive to order. So we sort them first. Fixes #59777.
1 parent 565ff52 commit 5f9fec9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/libraries/System.Security.Cryptography.X509Certificates/tests/CollectionTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1745,7 +1745,9 @@ static void AssertPem(X509Certificate2Collection expected, ReadOnlySpan<char> pe
17451745

17461746
using (ImportedCollection imported = Cert.Import(data))
17471747
{
1748-
Assert.Equal(expected.ToArray(), imported.Collection.ToArray(), new X509Certificate2EqualityComparer());
1748+
X509Certificate2[] expectedCollection = expected.OrderBy(c => c.Thumbprint).ToArray();
1749+
X509Certificate2[] actualCollection = imported.Collection.OrderBy(c => c.Thumbprint).ToArray();
1750+
Assert.Equal(expectedCollection, actualCollection, new X509Certificate2EqualityComparer());
17491751
}
17501752
}
17511753

0 commit comments

Comments
 (0)