public void TestLoadAllCertificates(
            CertificateSource certificateSource,
            string container,
            string referenceOrValue)
        {
            List <CertificateDescription> certDescriptions = CreateCertificateDescriptions(
                certificateSource,
                container,
                referenceOrValue).ToList();

            certDescriptions.Add(new CertificateDescription
            {
                SourceType       = certificateSource,
                Container        = container,
                ReferenceOrValue = referenceOrValue,
            });

            certDescriptions.Add(CertificateDescription.FromCertificate(null));

            IEnumerable <X509Certificate2> certificates = DefaultCertificateLoader.LoadAllCertificates(certDescriptions);

            Assert.NotNull(certificates);
            Assert.Equal(2, certificates.Count());
            Assert.Equal(3, certDescriptions.Count);
            Assert.Equal("CN=ACS2ClientCertificate", certificates.First().Issuer);
            Assert.Equal("CN=ACS2ClientCertificate", certificates.Last().Issuer);
            Assert.Null(certDescriptions.ElementAt(2).Certificate);
        }
Esempio n. 2
0
 public void TestFromCertificate()
 {
     using (X509Certificate2 certificate2 = new X509Certificate2())
     {
         CertificateDescription certificateDescription =
             CertificateDescription.FromCertificate(certificate2);
     }
 }