コード例 #1
0
        public void CertFromUrlWorksWithSecureUrl()
        {
            var cert = CertificateHelpers.GetX509Certificate2FromUri(new Uri("https://www.example.org"));

            Assert.That(cert, Is.Not.Null, "should get a cert");
            Assert.That(cert.Subject, Is.StringContaining("example.org"), "Should get cert particular to the url");
        }
コード例 #2
0
        public void CertFromUrlWorksWithSecureUrlForWashingtonSaw()
        {
            var cert = CertificateHelpers.GetX509Certificate2FromUri(FirmaWebConfiguration.SAWEndPoint);

            Assert.That(cert, Is.Not.Null, "should get a cert");
            Assert.That(cert.Subject, Is.StringContaining(FirmaWebConfiguration.SAWEndPoint.Host), "Should get cert particular to the url");
        }
コード例 #3
0
 public void CertFromUrlGivenBadUrlHasExceptions()
 {
     Assert.Catch(() => CertificateHelpers.GetX509Certificate2FromUri(null), "Should have exception with null url");
     Assert.Catch(() => CertificateHelpers.GetX509Certificate2FromUri(new Uri("/relative")), "Should have exception with relative url");
     Assert.Catch(() => CertificateHelpers.GetX509Certificate2FromUri(new Uri("http://www.example.org")), "Should have exception with non secure url");
 }