public void ValidatorShouldReturnFalseWhenSslPolicyErrorsIsRemoteCertificateNotAvailable() { var instance = new CertificateThumbprintValidator(new string[1]); bool result = instance.Validate(null, null, null, SslPolicyErrors.RemoteCertificateNotAvailable); result.ShouldBe(false); }
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); }
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); }
public void ValidatorShouldReturnTrueWhenPassedATrustedCertificateWhichHasItsThumbprintWhiteListed() { var instance = new CertificateThumbprintValidator(new[] { KatanaTestThumbprint }); var certificateChain = new X509Chain(); certificateChain.Build(Chained); certificateChain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck; bool result = instance.Validate(null, Chained, certificateChain, SslPolicyErrors.None); result.ShouldBe(true); }
public void ConstructorShouldNotThrowWithValidValues() { var instance = new CertificateThumbprintValidator(new string[1]); instance.ShouldNotBe(null); }