@@ -42,10 +42,13 @@ namespace Test.Integration
4242 public class TestSsl : IntegrationFixture
4343 {
4444 private readonly SslEnv _sslEnv ;
45+ private readonly string _certPath ;
4546
4647 public TestSsl ( ITestOutputHelper output ) : base ( output )
4748 {
4849 _sslEnv = new SslEnv ( ) ;
50+ _certPath = _sslEnv . CertPath ;
51+ Assert . True ( File . Exists ( _certPath ) ) ;
4952 }
5053
5154 public override Task InitializeAsync ( )
@@ -64,7 +67,7 @@ public async Task TestServerVerifiedIgnoringNameMismatch()
6467 ConnectionFactory cf = CreateConnectionFactory ( ) ;
6568 cf . Port = 5671 ;
6669 cf . Ssl . ServerName = "*" ;
67- cf . Ssl . CertPath = certPath ;
70+ cf . Ssl . CertPath = _certPath ;
6871 cf . Ssl . AcceptablePolicyErrors = SslPolicyErrors . RemoteCertificateNameMismatch ;
6972 cf . Ssl . Enabled = true ;
7073
@@ -79,7 +82,7 @@ public async Task TestServerVerified()
7982 ConnectionFactory cf = CreateConnectionFactory ( ) ;
8083 cf . Port = 5671 ;
8184 cf . Ssl . ServerName = _sslEnv . Hostname ;
82- cf . Ssl . CertPath = certPath ;
85+ cf . Ssl . CertPath = _certPath ;
8386 cf . Ssl . Enabled = true ;
8487
8588 await SendReceiveAsync ( cf ) ;
@@ -90,13 +93,10 @@ public async Task TestClientAndServerVerified()
9093 {
9194 Skip . IfNot ( _sslEnv . IsSslConfigured , "SSL_CERTS_DIR and/or PASSWORD are not configured, skipping test" ) ;
9295
93- string certPath = _sslEnv . CertPath ;
94- Assert . True ( File . Exists ( certPath ) ) ;
95-
9696 ConnectionFactory cf = CreateConnectionFactory ( ) ;
9797 cf . Port = 5671 ;
9898 cf . Ssl . ServerName = _sslEnv . Hostname ;
99- cf . Ssl . CertPath = certPath ;
99+ cf . Ssl . CertPath = _certPath ;
100100 cf . Ssl . CertPassphrase = _sslEnv . CertPassphrase ;
101101 cf . Ssl . Enabled = true ;
102102
@@ -108,14 +108,11 @@ public async Task TestWithClientCertificate()
108108 {
109109 Skip . IfNot ( _sslEnv . IsSslConfigured , "SSL_CERTS_DIR and/or PASSWORD are not configured, skipping test" ) ;
110110
111- string certPath = _sslEnv . CertPath ;
112- Assert . True ( File . Exists ( certPath ) ) ;
113-
114111 ConnectionFactory cf = CreateConnectionFactory ( ) ;
115112 cf . Port = 5671 ;
116113 cf . Ssl = new SslOption ( )
117114 {
118- CertPath = certPath ,
115+ CertPath = _certPath ,
119116 Enabled = true ,
120117 ServerName = _sslEnv . Hostname ,
121118 Version = SslProtocols . None ,
0 commit comments