mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-10 09:15:47 +00:00
f5e6ce710c
* Bump the dependencies group with 11 updates Bumps coverlet.collector from 6.0.4 to 10.0.1 Bumps coverlet.msbuild from 6.0.4 to 10.0.1 Bumps GitHubActionsTestLogger from 3.0.1 to 3.0.4 Bumps Meziantou.Analyzer from 3.0.18 to 3.0.114 Bumps Microsoft.Bcl.Cryptography from 10.0.3 to 10.0.9 Bumps Microsoft.Extensions.Logging.Console from 10.0.3 to 10.0.9 Bumps MSTest from 4.1.0 to 4.2.3 Bumps PolySharp from 1.15.0 to 1.16.0 Bumps SonarAnalyzer.CSharp from 10.20.0.135146 to 10.27.0.140913 Bumps System.Formats.Asn1 from 10.0.3 to 10.0.9 Bumps Testcontainers from 4.10.0 to 4.12.0 Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Robert Hague <rh@johnstreetcapital.com>
87 lines
2.5 KiB
C#
87 lines
2.5 KiB
C#
using System;
|
|
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
using Renci.SshNet.Tests.Common;
|
|
using Renci.SshNet.Tests.Properties;
|
|
|
|
namespace Renci.SshNet.Tests.Classes
|
|
{
|
|
/// <summary>
|
|
/// Provides functionality for local port forwarding
|
|
/// </summary>
|
|
[TestClass]
|
|
public class ForwardedPortLocalTest : TestBase
|
|
{
|
|
[TestMethod]
|
|
public void ConstructorShouldThrowArgumentNullExceptionWhenBoundHostIsNull()
|
|
{
|
|
try
|
|
{
|
|
_ = new ForwardedPortLocal(null, 8080, Resources.HOST, 80);
|
|
Assert.Fail();
|
|
}
|
|
catch (ArgumentNullException ex)
|
|
{
|
|
Assert.IsNull(ex.InnerException);
|
|
Assert.AreEqual("boundHost", ex.ParamName);
|
|
}
|
|
}
|
|
|
|
[TestMethod]
|
|
public void ConstructorShouldNotThrowExceptionWhenBoundHostIsEmpty()
|
|
{
|
|
var boundHost = string.Empty;
|
|
|
|
var forwardedPort = new ForwardedPortLocal(boundHost, 8080, Resources.HOST, 80);
|
|
|
|
Assert.AreSame(boundHost, forwardedPort.BoundHost);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void ConstructorShouldNotThrowExceptionWhenBoundHostIsInvalidDnsName()
|
|
{
|
|
const string boundHost = "in_valid_host.";
|
|
|
|
var forwardedPort = new ForwardedPortLocal(boundHost, 8080, Resources.HOST, 80);
|
|
|
|
Assert.AreSame(boundHost, forwardedPort.BoundHost);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void ConstructorShouldThrowArgumentNullExceptionWhenHostIsNull()
|
|
{
|
|
try
|
|
{
|
|
_ = new ForwardedPortLocal(Resources.HOST, 8080, null, 80);
|
|
Assert.Fail();
|
|
}
|
|
catch (ArgumentNullException ex)
|
|
{
|
|
Assert.IsNull(ex.InnerException);
|
|
Assert.AreEqual("host", ex.ParamName);
|
|
}
|
|
}
|
|
|
|
[TestMethod]
|
|
public void ConstructorShouldNotThrowExceptionWhenHostIsEmpty()
|
|
{
|
|
var host = string.Empty;
|
|
|
|
var forwardedPort = new ForwardedPortLocal(Resources.HOST, 8080, string.Empty, 80);
|
|
|
|
Assert.AreSame(host, forwardedPort.Host);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void ConstructorShouldNotThrowExceptionWhenHostIsInvalidDnsName()
|
|
{
|
|
const string host = "in_valid_host.";
|
|
|
|
var forwardedPort = new ForwardedPortLocal(Resources.HOST, 8080, host, 80);
|
|
|
|
Assert.AreSame(host, forwardedPort.Host);
|
|
}
|
|
}
|
|
}
|