コード例 #1
0
        public void ValidatorShouldReturnFalseWhenSslPolicyErrorsIsRemoteCertificateNotAvailable()
        {
            var  instance = new CertificateThumbprintValidator(new string[1]);
            bool result   = instance.Validate(null, null, null, SslPolicyErrors.RemoteCertificateNotAvailable);

            result.ShouldBe(false);
        }
コード例 #2
0
        public void ValidatorShouldReturnFalseWhenPassedATrustedCertificateWhichDoesNotHaveAWhitelistedThumbprint()
        {
            var instance         = new CertificateThumbprintValidator(new string[1]);
            var certificateChain = new X509Chain();

            certificateChain.Build(Chained);
            certificateChain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck;

            bool result = instance.Validate(null, Chained, certificateChain, SslPolicyErrors.None);

            result.ShouldBe(false);
        }
コード例 #3
0
        public void ValidatorShouldReturnTrueWhenPassedATrustedCertificateWhichHasAChainElementThumbprintWhiteListed()
        {
            var instance         = new CertificateThumbprintValidator(new[] { MicrosoftInternetAuthorityThumbprint });
            var certificateChain = new X509Chain();

            certificateChain.Build(Chained);
            certificateChain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck;

            bool result = instance.Validate(null, Chained, certificateChain, SslPolicyErrors.None);

            result.ShouldBe(true);
        }
コード例 #4
0
        public void ConstructorShouldNotThrowWithValidValues()
        {
            var instance = new CertificateThumbprintValidator(new string[1]);

            instance.ShouldNotBe(null);
        }