Skip to content

Commit 19f9d2f

Browse files
committed
Fix embarrassing last-minute test failures
1 parent 49fdfee commit 19f9d2f

6 files changed

+12
-7
lines changed

test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingHttpContent.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ protected override void Act()
119119
[TestMethod]
120120
public void ConnectShouldHaveThrownSshOperationTimeoutException()
121121
{
122-
Assert.IsNull(_actualException.InnerException);
122+
Assert.IsInstanceOfType<SshOperationTimeoutException>(_actualException);
123+
Assert.IsInstanceOfType<SocketException>(_actualException.InnerException);
123124
Assert.AreEqual(string.Format(CultureInfo.InvariantCulture, "Socket read operation has timed out after {0:F0} milliseconds.", _connectionInfo.Timeout.TotalMilliseconds), _actualException.Message);
124125
}
125126

test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingStatusLine.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ protected override void Act()
9595
[TestMethod]
9696
public void ConnectShouldHaveThrownSshOperationTimeoutException()
9797
{
98-
Assert.IsNull(_actualException.InnerException);
98+
Assert.IsInstanceOfType<SshOperationTimeoutException>(_actualException);
99+
Assert.IsInstanceOfType<SocketException>(_actualException.InnerException);
99100
Assert.AreEqual(string.Format(CultureInfo.InvariantCulture, "Socket read operation has timed out after {0:F0} milliseconds.", _connectionInfo.Timeout.TotalMilliseconds), _actualException.Message);
100101
}
101102

test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_TimeoutReadingIdentificationString.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ protected void Act()
9393
[TestMethod]
9494
public void StartShouldHaveThrownSshOperationTimeoutException()
9595
{
96-
Assert.IsNotNull(_actualException);
97-
Assert.IsNull(_actualException.InnerException);
96+
Assert.IsInstanceOfType<SshOperationTimeoutException>(_actualException);
97+
Assert.IsInstanceOfType<SocketException>(_actualException.InnerException);
9898
Assert.AreEqual(string.Format("Socket read operation has timed out after {0} milliseconds.", _timeout.TotalMilliseconds), _actualException.Message);
9999
}
100100

test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingDestinationAddress.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ protected override void Act()
9797
[TestMethod]
9898
public void ConnectShouldHaveThrownSshOperationTimeoutException()
9999
{
100-
Assert.IsNull(_actualException.InnerException);
100+
Assert.IsInstanceOfType<SshOperationTimeoutException>(_actualException);
101+
Assert.IsInstanceOfType<SocketException>(_actualException.InnerException);
101102
Assert.AreEqual(string.Format(CultureInfo.InvariantCulture, "Socket read operation has timed out after {0:F0} milliseconds.", _connectionInfo.Timeout.TotalMilliseconds), _actualException.Message);
102103
}
103104

test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyCode.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ protected override void Act()
9393
[TestMethod]
9494
public void ConnectShouldHaveThrownSshOperationTimeoutException()
9595
{
96-
Assert.IsNull(_actualException.InnerException);
96+
Assert.IsInstanceOfType<SshOperationTimeoutException>(_actualException);
97+
Assert.IsInstanceOfType<SocketException>(_actualException.InnerException);
9798
Assert.AreEqual(string.Format(CultureInfo.InvariantCulture, "Socket read operation has timed out after {0:F0} milliseconds.", _connectionInfo.Timeout.TotalMilliseconds), _actualException.Message);
9899
}
99100

test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyVersion.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ protected override void Act()
8282
[TestMethod]
8383
public void ConnectShouldHaveThrownSshOperationTimeoutException()
8484
{
85-
Assert.IsNull(_actualException.InnerException);
85+
Assert.IsInstanceOfType<SshOperationTimeoutException>(_actualException);
86+
Assert.IsInstanceOfType<SocketException>(_actualException.InnerException);
8687
Assert.AreEqual(string.Format(CultureInfo.InvariantCulture, "Socket read operation has timed out after {0:F0} milliseconds.", _connectionInfo.Timeout.TotalMilliseconds), _actualException.Message);
8788
}
8889

0 commit comments

Comments
 (0)