@@ -64,14 +64,8 @@ public void ErrorOccurredIsRaisedOnce()
64
64
65
65
var connectionException = ( SshConnectionException ) exception ;
66
66
Assert . AreEqual ( DisconnectReason . ConnectionLost , connectionException . DisconnectReason ) ;
67
-
68
- var innerException = exception . InnerException ;
69
- Assert . IsNotNull ( innerException ) ;
70
- Assert . AreEqual ( typeof ( SocketException ) , innerException . GetType ( ) ) ;
71
-
72
- var socketException = ( SocketException ) innerException ;
73
- Assert . AreSame ( connectionException . Message , socketException . Message ) ;
74
- Assert . AreEqual ( SocketError . ConnectionReset , socketException . SocketErrorCode ) ;
67
+ Assert . IsNull ( connectionException . InnerException ) ;
68
+ Assert . AreEqual ( "An established connection was aborted by the server." , connectionException . Message ) ;
75
69
}
76
70
77
71
[ TestMethod ]
@@ -140,7 +134,7 @@ public void ISession_TrySendMessageShouldReturnFalse()
140
134
}
141
135
142
136
[ TestMethod ]
143
- public void ISession_WaitOnHandle_WaitHandle_ShouldThrowSshConnectionExceptionDetailingConnectionReset ( )
137
+ public void ISession_WaitOnHandle_WaitHandle_ShouldThrowSshConnectionException ( )
144
138
{
145
139
var session = ( ISession ) Session ;
146
140
var waitHandle = new ManualResetEvent ( false ) ;
@@ -152,22 +146,14 @@ public void ISession_WaitOnHandle_WaitHandle_ShouldThrowSshConnectionExceptionDe
152
146
}
153
147
catch ( SshConnectionException ex )
154
148
{
149
+ Assert . AreEqual ( "An established connection was aborted by the server." , ex . Message ) ;
150
+ Assert . IsNull ( ex . InnerException ) ;
155
151
Assert . AreEqual ( DisconnectReason . ConnectionLost , ex . DisconnectReason ) ;
156
-
157
- var innerException = ex . InnerException ;
158
- Assert . IsNotNull ( innerException ) ;
159
- Assert . AreEqual ( typeof ( SocketException ) , innerException . GetType ( ) ) ;
160
-
161
- var socketException = ( SocketException ) ex . InnerException ;
162
- Assert . IsNotNull ( socketException ) ;
163
- Assert . IsNull ( socketException . InnerException ) ;
164
- Assert . AreSame ( innerException . Message , ex . Message ) ;
165
- Assert . AreEqual ( SocketError . ConnectionReset , socketException . SocketErrorCode ) ;
166
152
}
167
153
}
168
154
169
155
[ TestMethod ]
170
- public void ISession_WaitOnHandle_WaitHandleAndTimeout_ShouldThrowSshConnectionExceptionDetailingConnectionReset ( )
156
+ public void ISession_WaitOnHandle_WaitHandleAndTimeout_ShouldThrowSshConnectionException ( )
171
157
{
172
158
var session = ( ISession ) Session ;
173
159
var waitHandle = new ManualResetEvent ( false ) ;
@@ -180,16 +166,8 @@ public void ISession_WaitOnHandle_WaitHandleAndTimeout_ShouldThrowSshConnectionE
180
166
catch ( SshConnectionException ex )
181
167
{
182
168
Assert . AreEqual ( DisconnectReason . ConnectionLost , ex . DisconnectReason ) ;
183
-
184
- var innerException = ex . InnerException ;
185
- Assert . IsNotNull ( innerException ) ;
186
- Assert . AreEqual ( typeof ( SocketException ) , innerException . GetType ( ) ) ;
187
-
188
- var socketException = ( SocketException ) ex . InnerException ;
189
- Assert . IsNotNull ( socketException ) ;
190
- Assert . IsNull ( socketException . InnerException ) ;
191
- Assert . AreSame ( innerException . Message , socketException . Message ) ;
192
- Assert . AreEqual ( SocketError . ConnectionReset , socketException . SocketErrorCode ) ;
169
+ Assert . IsNull ( ex . InnerException ) ;
170
+ Assert . AreEqual ( "An established connection was aborted by the server." , ex . Message ) ;
193
171
}
194
172
}
195
173
0 commit comments