Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
using System.Globalization;
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using Moq;

using Renci.SshNet.Common;
using Renci.SshNet.Tests.Common;

namespace Renci.SshNet.Tests.Classes.Connection
{
Expand Down Expand Up @@ -72,23 +70,26 @@ protected override void Act()
}
}

[TestMethodForPlatform(nameof(OSPlatform.Windows))]
[TestMethod]
[OSCondition(OperatingSystems.Windows)]
public void ConnectShouldHaveThrownSshOperationTimeoutExceptionOnWindows()
{
Assert.IsNull(_actualException.InnerException);
Assert.IsInstanceOfType<SshOperationTimeoutException>(_actualException);
Assert.AreEqual(string.Format(CultureInfo.InvariantCulture, "Connection failed to establish within {0} milliseconds.", _connectionInfo.Timeout.TotalMilliseconds), _actualException.Message);
}

[TestMethodForPlatform(nameof(OSPlatform.Linux))]
[TestMethod]
[OSCondition(OperatingSystems.Linux)]
public void ConnectShouldHaveThrownSocketExceptionOnLinux()
{
Assert.IsNull(_actualException.InnerException);
Assert.IsInstanceOfType<SocketException>(_actualException);
Assert.AreEqual("Connection refused", _actualException.Message);
}

[TestMethodForPlatform(nameof(OSPlatform.Windows))]
[TestMethod]
[OSCondition(OperatingSystems.Windows)]
public void ConnectShouldHaveRespectedTimeoutOnWindows()
{
var errorText = string.Format("Elapsed: {0}, Timeout: {1}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@
using System.Globalization;
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using Moq;

using Renci.SshNet.Common;
using Renci.SshNet.Tests.Common;

namespace Renci.SshNet.Tests.Classes.Connection
{
Expand Down Expand Up @@ -82,23 +80,26 @@ protected override void Act()
}
}

[TestMethodForPlatform(nameof(OSPlatform.Windows))]
[TestMethod]
[OSCondition(OperatingSystems.Windows)]
public void ConnectShouldHaveThrownSshOperationTimeoutExceptionOnWindows()
{
Assert.IsNull(_actualException.InnerException);
Assert.IsInstanceOfType<SshOperationTimeoutException>(_actualException);
Assert.AreEqual(string.Format(CultureInfo.InvariantCulture, "Connection failed to establish within {0} milliseconds.", _connectionInfo.Timeout.TotalMilliseconds), _actualException.Message);
}

[TestMethodForPlatform(nameof(OSPlatform.Linux))]
[TestMethod]
[OSCondition(OperatingSystems.Linux)]
public void ConnectShouldHaveThrownSshOperationTimeoutExceptionOnLinux()
{
Assert.IsNull(_actualException.InnerException);
Assert.IsInstanceOfType<SocketException>(_actualException);
Assert.AreEqual("Connection refused", _actualException.Message);
}

[TestMethodForPlatform(nameof(OSPlatform.Windows))]
[TestMethod]
[OSCondition(OperatingSystems.Windows)]
public void ConnectShouldHaveRespectedTimeoutOnWindows()
{
var errorText = string.Format("Elapsed: {0}, Timeout: {1}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
using System.Diagnostics;
using System.Globalization;
using System.Net.Sockets;
using System.Runtime.InteropServices;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using Moq;

using Renci.SshNet.Common;
using Renci.SshNet.Tests.Common;

namespace Renci.SshNet.Tests.Classes.Connection
{
Expand Down Expand Up @@ -70,23 +68,26 @@ protected override void Act()
}
}

[TestMethodForPlatform(nameof(OSPlatform.Windows))]
[TestMethod]
[OSCondition(OperatingSystems.Windows)]
public void ConnectShouldHaveThrownSshOperationTimeoutExceptionOnWindows()
{
Assert.IsNull(_actualException.InnerException);
Assert.IsInstanceOfType<SshOperationTimeoutException>(_actualException);
Assert.AreEqual(string.Format(CultureInfo.InvariantCulture, "Connection failed to establish within {0} milliseconds.", _connectionInfo.Timeout.TotalMilliseconds), _actualException.Message);
}

[TestMethodForPlatform(nameof(OSPlatform.Linux))]
[TestMethod]
[OSCondition(OperatingSystems.Linux)]
public void ConnectShouldHaveThrownSshOperationTimeoutExceptionOnLinux()
{
Assert.IsNull(_actualException.InnerException);
Assert.IsInstanceOfType<SocketException>(_actualException);
Assert.AreEqual("Connection refused", _actualException.Message);
}

[TestMethodForPlatform(nameof(OSPlatform.Windows))]
[TestMethod]
[OSCondition(OperatingSystems.Windows)]
public void ConnectShouldHaveRespectedTimeoutOnWindows()
{
var errorText = string.Format("Elapsed: {0}, Timeout: {1}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@
using System.Diagnostics;
using System.Globalization;
using System.Net.Sockets;
using System.Runtime.InteropServices;

using Microsoft.VisualStudio.TestTools.UnitTesting;

using Moq;

using Renci.SshNet.Common;
using Renci.SshNet.Tests.Common;

namespace Renci.SshNet.Tests.Classes.Connection
{
Expand Down Expand Up @@ -71,23 +69,26 @@ protected override void Act()
}
}

[TestMethodForPlatform(nameof(OSPlatform.Windows))]
[TestMethod]
[OSCondition(OperatingSystems.Windows)]
public void ConnectShouldHaveThrownSshOperationTimeoutExceptionOnWindows()
{
Assert.IsNull(_actualException.InnerException);
Assert.IsInstanceOfType<SshOperationTimeoutException>(_actualException);
Assert.AreEqual(string.Format(CultureInfo.InvariantCulture, "Connection failed to establish within {0} milliseconds.", _connectionInfo.Timeout.TotalMilliseconds), _actualException.Message);
}

[TestMethodForPlatform(nameof(OSPlatform.Linux))]
[TestMethod]
[OSCondition(OperatingSystems.Linux)]
public void ConnectShouldHaveThrownSshOperationTimeoutExceptionOnLinux()
{
Assert.IsNull(_actualException.InnerException);
Assert.IsInstanceOfType<SocketException>(_actualException);
Assert.AreEqual("Connection refused", _actualException.Message);
}

[TestMethodForPlatform(nameof(OSPlatform.Windows))]
[TestMethod]
[OSCondition(OperatingSystems.Windows)]
public void ConnectShouldHaveRespectedTimeoutOnWindows()
{
var errorText = string.Format("Elapsed: {0}, Timeout: {1}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Threading;

using Microsoft.Extensions.Logging.Abstractions;
Expand All @@ -12,7 +11,6 @@

using Renci.SshNet.Channels;
using Renci.SshNet.Common;
using Renci.SshNet.Tests.Common;

namespace Renci.SshNet.Tests.Classes
{
Expand Down Expand Up @@ -108,7 +106,8 @@ public void ForwardedPortShouldRefuseNewConnections()
}

// TODO We should investigate why this method doesn't work on Linux
[TestMethodForPlatform(nameof(OSPlatform.Windows))]
[TestMethod]
[OSCondition(OperatingSystems.Windows)]
public void ExistingConnectionShouldBeClosed()
{
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Threading;

using Microsoft.Extensions.Logging.Abstractions;
Expand All @@ -12,7 +11,6 @@

using Renci.SshNet.Channels;
using Renci.SshNet.Common;
using Renci.SshNet.Tests.Common;

namespace Renci.SshNet.Tests.Classes
{
Expand Down Expand Up @@ -112,7 +110,8 @@ public void ForwardedPortShouldRefuseNewConnections()
}

// TODO We should investigate why this method doesn't work on Linux
[TestMethodForPlatform(nameof(OSPlatform.Windows))]
[TestMethod]
[OSCondition(OperatingSystems.Windows)]
public void ExistingConnectionShouldBeClosed()
{
try
Expand Down

This file was deleted.