Skip to content

Commit f123d27

Browse files
committed
Modify ListCertificates_AlwaysReturnsTheCertificate_WithHighestVersion to create 3 certs
1 parent a859ba3 commit f123d27

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/Tools/FirstRunCertGenerator/test/CertificateManagerTests.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,7 @@ public void ListCertificates_AlwaysReturnsTheCertificate_WithHighestVersion()
478478
var now = DateTimeOffset.UtcNow;
479479
now = new DateTimeOffset(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second, 0, now.Offset);
480480
_manager.AspNetHttpsCertificateVersion = 1;
481+
_manager.MinimumAspNetHttpsCertificateVersion = 1;
481482
var creation = _manager.EnsureAspNetCoreHttpsDevelopmentCertificate(now, now.AddYears(1), path: null, trust: false, isInteractive: false);
482483
Output.WriteLine(creation.ToString());
483484
ListCertificates();
@@ -488,7 +489,13 @@ public void ListCertificates_AlwaysReturnsTheCertificate_WithHighestVersion()
488489
Output.WriteLine(creation.ToString());
489490
ListCertificates();
490491

491-
_manager.MinimumAspNetHttpsCertificateVersion = 1;
492+
_manager.AspNetHttpsCertificateVersion = 3;
493+
_manager.MinimumAspNetHttpsCertificateVersion = 3;
494+
creation = _manager.EnsureAspNetCoreHttpsDevelopmentCertificate(now, now.AddYears(1), path: null, trust: false, isInteractive: false);
495+
Output.WriteLine(creation.ToString());
496+
ListCertificates();
497+
498+
_manager.MinimumAspNetHttpsCertificateVersion = 2;
492499
var httpsCertificateList = _manager.ListCertificates(StoreName.My, StoreLocation.CurrentUser, isValid: true);
493500
Assert.Equal(2, httpsCertificateList.Count);
494501

@@ -499,13 +506,13 @@ public void ListCertificates_AlwaysReturnsTheCertificate_WithHighestVersion()
499506
firstCertificate.Extensions.OfType<X509Extension>(),
500507
e => e.Critical == false &&
501508
e.Oid.Value == CertificateManager.AspNetHttpsOid &&
502-
e.RawData[0] == 2);
509+
e.RawData[0] == 3);
503510

504511
Assert.Contains(
505512
secondCertificate.Extensions.OfType<X509Extension>(),
506513
e => e.Critical == false &&
507514
e.Oid.Value == CertificateManager.AspNetHttpsOid &&
508-
e.RawData[0] == 1);
515+
e.RawData[0] == 2);
509516
}
510517

511518
[ConditionalFact]

0 commit comments

Comments
 (0)