예제 #1
0
 public void ConfigureSslCert_CertHasExpiredOutsideRenewThreshold_Renewed()
 {
     DeleteConDepCertificates();
     try
     {
         var certificate = CreateCertificate(-8);
         AddToStore(certificate);
         CertificateHandler.ConfigureSslCert("https://localhost:4444/ConDepNode/");
         var certificatesFromStore = GetCertificates();
         var renewedCertificate    = certificatesFromStore[0];
         Assert.AreNotEqual(renewedCertificate.Thumbprint, certificate.Thumbprint);
     }
     finally
     {
         DeleteConDepCertificates();
     }
 }
예제 #2
0
 public void ConfigureSslCert_IfCertDoesNotExpireWithin7Days_NotRenewed()
 {
     DeleteConDepCertificates();
     try
     {
         var certificate = CreateCertificate(8);
         AddToStore(certificate);
         CertificateHandler.ConfigureSslCert("https://localhost:4444/ConDepNode/");
         var certificatesFromStore = GetCertificates();
         Console.WriteLine("certificatesFromStore.Count: " + certificatesFromStore.Count);
         var certificateFromStore = certificatesFromStore[0];
         Assert.AreEqual(certificate.Thumbprint, certificateFromStore.Thumbprint);
     }
     finally
     {
         DeleteConDepCertificates();
     }
 }
예제 #3
0
 public void ConfigureSslCert_IfCertExpiresWithin7Days_Renewed()
 {
     DeleteConDepCertificates();
     try
     {
         var certificate = CreateCertificate(5);
         AddToStore(certificate);
         CertificateHandler.ConfigureSslCert("https://localhost:4444/ConDepNode/");
         var certificatesFromStore           = GetCertificates();
         var expiryDateOfCertificate         = certificatesFromStore[0].NotAfter;
         var expectedExpiryDateOfCertificate = expiryDateOfCertificate.AddDays(365);
         Assert.That(Math.Abs((expectedExpiryDateOfCertificate - expiryDateOfCertificate).TotalDays - 365) < Epsilon);
         Assert.That(certificatesFromStore.Count == 1);
     }
     finally
     {
         DeleteConDepCertificates();
     }
 }