@@ -9,6 +9,11 @@ namespace DTLS.Tests;
99
1010public class OpenSslInteropTests : InteropTestBase
1111{
12+ public override void SkipUnlessInteropDependencyAvailable ( )
13+ {
14+ Skip . Unless ( IsOpensslAvailable , "openssl not found in PATH" ) ;
15+ }
16+
1217 private static readonly bool IsOpensslAvailable = CheckOpenSsl ( ) ;
1318
1419 private static bool CheckOpenSsl ( )
@@ -30,8 +35,6 @@ private static bool CheckOpenSsl()
3035 [ Test ]
3136 public async Task Client_HandshakeAndData_WithOpenSslServer ( CancellationToken cancellationToken )
3237 {
33- Skip . Unless ( IsOpensslAvailable , "openssl not found in PATH" ) ;
34-
3538 string tmpDir = Path . Combine ( Path . GetTempPath ( ) , Path . GetRandomFileName ( ) ) ;
3639 Directory . CreateDirectory ( tmpDir ) ;
3740
@@ -40,7 +43,7 @@ public async Task Client_HandshakeAndData_WithOpenSslServer(CancellationToken ca
4043 ( string certPath , string keyPath ) = ExportPem ( Cert , tmpDir ) ;
4144 int port = GetFreeUdpPort ( ) ;
4245
43- using Process server = Process . Start
46+ using Process ? server = Process . Start
4447 (
4548 new ProcessStartInfo
4649 (
@@ -53,7 +56,8 @@ public async Task Client_HandshakeAndData_WithOpenSslServer(CancellationToken ca
5356 RedirectStandardOutput = true ,
5457 CreateNoWindow = true
5558 }
56- ) ! ;
59+ ) ;
60+ Assert . NotNull ( server ) ;
5761
5862 try
5963 {
@@ -109,8 +113,6 @@ public async Task Client_HandshakeAndData_WithOpenSslServer(CancellationToken ca
109113 [ Test ]
110114 public async Task Server_HandshakeAndData_WithOpenSslClient ( CancellationToken cancellationToken )
111115 {
112- Skip . Unless ( IsOpensslAvailable , "openssl not found in PATH" ) ;
113-
114116 int port = GetFreeUdpPort ( ) ;
115117 using UdpClient udp = new ( new IPEndPoint ( IPAddress . Loopback , port ) ) ;
116118 UdpDatagramTransport transport = new ( udp ) ;
@@ -121,7 +123,7 @@ public async Task Server_HandshakeAndData_WithOpenSslClient(CancellationToken ca
121123 new DtlsServerOptions { Certificate = Cert }
122124 ) ;
123125
124- using Process opensslClient = Process . Start
126+ using Process ? opensslClient = Process . Start
125127 (
126128 new ProcessStartInfo
127129 (
@@ -133,7 +135,8 @@ public async Task Server_HandshakeAndData_WithOpenSslClient(CancellationToken ca
133135 RedirectStandardOutput = true ,
134136 CreateNoWindow = true
135137 }
136- ) ! ;
138+ ) ;
139+ Assert . NotNull ( opensslClient ) ;
137140
138141 try
139142 {
0 commit comments