mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-10 01:05:42 +00:00
Bump dependencies (#1682)
* Bump the dependencies group with 4 updates Bumps BouncyCastle.Cryptography from 2.6.1 to 2.6.2 Bumps Meziantou.Analyzer from 2.0.205 to 2.0.210 Bumps MSTest from 3.9.3 to 3.10.0 Bumps SonarAnalyzer.CSharp from 10.13.0.120203 to 10.15.0.120848 Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Rob Hague <rob.hague00@gmail.com>
This commit is contained in:
@@ -5,19 +5,19 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageVersion Include="BenchmarkDotNet" Version="0.15.2" />
|
||||
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.6.1" />
|
||||
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.6.2" />
|
||||
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
|
||||
<PackageVersion Include="coverlet.msbuild" Version="6.0.4" />
|
||||
<PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1" />
|
||||
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.205" />
|
||||
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.210" />
|
||||
<!-- Should stay on LTS .NET releases. -->
|
||||
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.3" />
|
||||
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="9.0.7" />
|
||||
<PackageVersion Include="MSTest" Version="3.9.3" />
|
||||
<PackageVersion Include="MSTest" Version="3.10.0" />
|
||||
<PackageVersion Include="Moq" Version="4.20.72" />
|
||||
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.7.115" />
|
||||
<PackageVersion Include="PolySharp" Version="1.15.0" />
|
||||
<PackageVersion Include="SonarAnalyzer.CSharp" Version="10.13.0.120203" />
|
||||
<PackageVersion Include="SonarAnalyzer.CSharp" Version="10.15.0.120848" />
|
||||
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
|
||||
<!-- Should stay on LTS .NET releases. -->
|
||||
<PackageVersion Include="System.Formats.Asn1" Version="8.0.2" />
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
using (var client = new SshClient(SshServerHostName, SshServerPort, User.UserName, User.Password))
|
||||
{
|
||||
using var port1 = new ForwardedPortLocal("localhost", 8084, "www.renci.org", 80);
|
||||
Assert.ThrowsException<SshConnectionException>(() => client.AddForwardedPort(port1));
|
||||
Assert.ThrowsExactly<SshConnectionException>(() => client.AddForwardedPort(port1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+8
-8
@@ -14,7 +14,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
using (var sftp = new SftpClient(SshServerHostName, SshServerPort, User.UserName, User.Password))
|
||||
{
|
||||
sftp.Connect();
|
||||
Assert.ThrowsException<SftpPathNotFoundException>(() => sftp.ChangeDirectory("/asdasd"));
|
||||
Assert.ThrowsExactly<SftpPathNotFoundException>(() => sftp.ChangeDirectory("/asdasd"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
await sftp.ConnectAsync(CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
await Assert.ThrowsExceptionAsync<SftpPathNotFoundException>(
|
||||
await Assert.ThrowsExactlyAsync<SftpPathNotFoundException>(
|
||||
() => sftp.ChangeDirectoryAsync("/asdasd", CancellationToken.None));
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
using (var sftp = new SftpClient(SshServerHostName, SshServerPort, User.UserName, User.Password))
|
||||
{
|
||||
sftp.Connect();
|
||||
Assert.ThrowsException<SftpPathNotFoundException>(() => sftp.ChangeDirectory("/asdasd/"));
|
||||
Assert.ThrowsExactly<SftpPathNotFoundException>(() => sftp.ChangeDirectory("/asdasd/"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
await sftp.ConnectAsync(CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
await Assert.ThrowsExceptionAsync<SftpPathNotFoundException>(
|
||||
await Assert.ThrowsExactlyAsync<SftpPathNotFoundException>(
|
||||
() => sftp.ChangeDirectoryAsync("/asdasd/", CancellationToken.None));
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
using (var sftp = new SftpClient(SshServerHostName, SshServerPort, User.UserName, User.Password))
|
||||
{
|
||||
sftp.Connect();
|
||||
Assert.ThrowsException<SftpPathNotFoundException>(() => sftp.ChangeDirectory("/asdasd/sssddds"));
|
||||
Assert.ThrowsExactly<SftpPathNotFoundException>(() => sftp.ChangeDirectory("/asdasd/sssddds"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
await sftp.ConnectAsync(CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
await Assert.ThrowsExceptionAsync<SftpPathNotFoundException>(
|
||||
await Assert.ThrowsExactlyAsync<SftpPathNotFoundException>(
|
||||
() => sftp.ChangeDirectoryAsync("/asdasd/sssddds", CancellationToken.None));
|
||||
}
|
||||
}
|
||||
@@ -86,7 +86,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
using (var sftp = new SftpClient(SshServerHostName, SshServerPort, User.UserName, User.Password))
|
||||
{
|
||||
sftp.Connect();
|
||||
Assert.ThrowsException<SftpPathNotFoundException>(() => sftp.ChangeDirectory("/asdasd/sssddds/"));
|
||||
Assert.ThrowsExactly<SftpPathNotFoundException>(() => sftp.ChangeDirectory("/asdasd/sssddds/"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
await sftp.ConnectAsync(CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
await Assert.ThrowsExceptionAsync<SftpPathNotFoundException>(
|
||||
await Assert.ThrowsExactlyAsync<SftpPathNotFoundException>(
|
||||
() => sftp.ChangeDirectoryAsync("/asdasd/sssddds/", CancellationToken.None));
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -30,7 +30,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
sftp.Connect();
|
||||
|
||||
Assert.ThrowsException<SftpPermissionDeniedException>(() => sftp.CreateDirectory("/sbin/test"));
|
||||
Assert.ThrowsExactly<SftpPermissionDeniedException>(() => sftp.CreateDirectory("/sbin/test"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
sftp.Connect();
|
||||
|
||||
Assert.ThrowsException<SftpPathNotFoundException>(() => sftp.CreateDirectory("/abcdefg/abcefg"));
|
||||
Assert.ThrowsExactly<SftpPathNotFoundException>(() => sftp.CreateDirectory("/abcdefg/abcefg"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
|
||||
sftp.CreateDirectory("test");
|
||||
|
||||
Assert.ThrowsException<SshException>(() => sftp.CreateDirectory("test"));
|
||||
Assert.ThrowsExactly<SshException>(() => sftp.CreateDirectory("test"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -15,7 +15,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
sftp.Connect();
|
||||
|
||||
Assert.ThrowsException<SftpPathNotFoundException>(() => sftp.DeleteDirectory("abcdef"));
|
||||
Assert.ThrowsExactly<SftpPathNotFoundException>(() => sftp.DeleteDirectory("abcdef"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
sftp.Connect();
|
||||
|
||||
Assert.ThrowsException<SftpPermissionDeniedException>(() => sftp.DeleteDirectory("/usr"));
|
||||
Assert.ThrowsExactly<SftpPermissionDeniedException>(() => sftp.DeleteDirectory("/usr"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
sftp.Connect();
|
||||
|
||||
Assert.ThrowsException<ArgumentNullException>(() => sftp.DeleteDirectory(null));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => sftp.DeleteDirectory(null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
sftp.Connect();
|
||||
|
||||
Assert.ThrowsException<SftpPermissionDeniedException>(() => sftp.DownloadFile("/root/.profile", Stream.Null));
|
||||
Assert.ThrowsExactly<SftpPermissionDeniedException>(() => sftp.DownloadFile("/root/.profile", Stream.Null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
sftp.Connect();
|
||||
|
||||
Assert.ThrowsException<SftpPathNotFoundException>(() => sftp.DownloadFile("/xxx/eee/yyy", Stream.Null));
|
||||
Assert.ThrowsExactly<SftpPathNotFoundException>(() => sftp.DownloadFile("/xxx/eee/yyy", Stream.Null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
await sftp.ConnectAsync(CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
await Assert.ThrowsExceptionAsync<SftpPermissionDeniedException>(() => sftp.DownloadFileAsync("/root/.profile", Stream.Null));
|
||||
await Assert.ThrowsExactlyAsync<SftpPermissionDeniedException>(() => sftp.DownloadFileAsync("/root/.profile", Stream.Null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
await sftp.ConnectAsync(CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
await Assert.ThrowsExceptionAsync<SftpPathNotFoundException>(() => sftp.DownloadFileAsync("/xxx/eee/yyy", Stream.Null));
|
||||
await Assert.ThrowsExactlyAsync<SftpPathNotFoundException>(() => sftp.DownloadFileAsync("/xxx/eee/yyy", Stream.Null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
|
||||
var cancelledToken = new CancellationToken(true);
|
||||
|
||||
await Assert.ThrowsExceptionAsync<OperationCanceledException>(() => sftp.DownloadFileAsync("/xxx/eee/yyy", Stream.Null, cancelledToken));
|
||||
await Assert.ThrowsExactlyAsync<OperationCanceledException>(() => sftp.DownloadFileAsync("/xxx/eee/yyy", Stream.Null, cancelledToken));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
sftp.Connect();
|
||||
|
||||
Assert.ThrowsException<ArgumentNullException>(() => sftp.BeginDownloadFile("aaaa", null, null, null));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => sftp.BeginDownloadFile("aaaa", null, null, null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
sftp.Connect();
|
||||
|
||||
Assert.ThrowsException<ArgumentException>(() => sftp.BeginDownloadFile(" ", Stream.Null, null, null));
|
||||
Assert.ThrowsExactly<ArgumentException>(() => sftp.BeginDownloadFile(" ", Stream.Null, null, null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
sftp.Connect();
|
||||
|
||||
Assert.ThrowsException<ArgumentNullException>(() => sftp.BeginDownloadFile(null, Stream.Null, null, null));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => sftp.BeginDownloadFile(null, Stream.Null, null, null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
var async1 = sftp.BeginListDirectory("/", null, null);
|
||||
var async2 = sftp.BeginDownloadFile("test123", new MemoryStream(), null, null);
|
||||
|
||||
Assert.ThrowsException<ArgumentException>(() => sftp.EndDownloadFile(async1));
|
||||
Assert.ThrowsExactly<ArgumentException>(() => sftp.EndDownloadFile(async1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -12,7 +12,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
sftp.Connect();
|
||||
|
||||
Assert.ThrowsException<SftpPathNotFoundException>(() => sftp.GetAttributes("/asdfgh"));
|
||||
Assert.ThrowsExactly<SftpPathNotFoundException>(() => sftp.GetAttributes("/asdfgh"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
sftp.Connect();
|
||||
|
||||
Assert.ThrowsException<ArgumentNullException>(() => sftp.GetAttributes(null));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => sftp.GetAttributes(null));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -18,7 +18,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
|
||||
await sftp.ConnectAsync(cts.Token);
|
||||
|
||||
await Assert.ThrowsExceptionAsync<SftpPathNotFoundException>(async () => await sftp.GetAttributesAsync("/asdfgh", cts.Token));
|
||||
await Assert.ThrowsExactlyAsync<SftpPathNotFoundException>(async () => await sftp.GetAttributesAsync("/asdfgh", cts.Token));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
|
||||
await sftp.ConnectAsync(cts.Token);
|
||||
|
||||
await Assert.ThrowsExceptionAsync<ArgumentNullException>(async () => await sftp.GetAttributesAsync(null, cts.Token));
|
||||
await Assert.ThrowsExactlyAsync<ArgumentNullException>(async () => await sftp.GetAttributesAsync(null, cts.Token));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -17,7 +17,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
sftp.Connect();
|
||||
|
||||
Assert.ThrowsException<SftpPermissionDeniedException>(() => sftp.ListDirectory("/root"));
|
||||
Assert.ThrowsExactly<SftpPermissionDeniedException>(() => sftp.ListDirectory("/root"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
sftp.Connect();
|
||||
|
||||
Assert.ThrowsException<SftpPathNotFoundException>(() => sftp.ListDirectory("/asdfgh"));
|
||||
Assert.ThrowsExactly<SftpPathNotFoundException>(() => sftp.ListDirectory("/asdfgh"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
sftp.Connect();
|
||||
|
||||
Assert.ThrowsException<ArgumentNullException>(() => sftp.ListDirectory(null));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => sftp.ListDirectory(null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
sftp.Connect();
|
||||
|
||||
Assert.ThrowsException<ArgumentNullException>(() => sftp.ChangeDirectory(null));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => sftp.ChangeDirectory(null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
await sftp.ConnectAsync(CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
await Assert.ThrowsExceptionAsync<ArgumentNullException>(() => sftp.ChangeDirectoryAsync(null));
|
||||
await Assert.ThrowsExactlyAsync<ArgumentNullException>(() => sftp.ChangeDirectoryAsync(null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
var result = sftp.EndListDirectory(ar);
|
||||
|
||||
// TODO there is no reason that this should throw
|
||||
Assert.ThrowsException<ArgumentException>(() => sftp.EndListDirectory(ar));
|
||||
Assert.ThrowsExactly<ArgumentException>(() => sftp.EndListDirectory(ar));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
{
|
||||
sftp.Connect();
|
||||
|
||||
Assert.ThrowsException<ArgumentNullException>(() => sftp.RenameFile(null, null));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => sftp.RenameFile(null, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@
|
||||
{
|
||||
await sftp.ConnectAsync(default);
|
||||
|
||||
await Assert.ThrowsExceptionAsync<ArgumentNullException>(() => sftp.RenameFileAsync(null, null, default));
|
||||
await Assert.ThrowsExactlyAsync<ArgumentNullException>(() => sftp.RenameFileAsync(null, null, default));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
|
||||
using (var file = File.OpenRead(uploadedFileName))
|
||||
{
|
||||
Assert.ThrowsException<SftpPermissionDeniedException>(() => sftp.UploadFile(file, remoteFileName));
|
||||
Assert.ThrowsExactly<SftpPermissionDeniedException>(() => sftp.UploadFile(file, remoteFileName));
|
||||
}
|
||||
|
||||
sftp.Disconnect();
|
||||
@@ -395,7 +395,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
sftp.Connect();
|
||||
|
||||
Assert.ThrowsException<ArgumentNullException>(() => sftp.BeginUploadFile(null, "aaaaa", null, null));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => sftp.BeginUploadFile(null, "aaaaa", null, null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,7 +408,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
sftp.Connect();
|
||||
|
||||
Assert.ThrowsException<ArgumentException>(() => sftp.BeginUploadFile(new MemoryStream(), " ", null, null));
|
||||
Assert.ThrowsExactly<ArgumentException>(() => sftp.BeginUploadFile(new MemoryStream(), " ", null, null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,7 +421,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
sftp.Connect();
|
||||
|
||||
Assert.ThrowsException<ArgumentNullException>(() => sftp.BeginUploadFile(new MemoryStream(), null, null, null));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => sftp.BeginUploadFile(new MemoryStream(), null, null, null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -438,7 +438,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
using var fileStream = File.OpenRead(filename);
|
||||
var async2 = sftp.BeginUploadFile(fileStream, "test", null, null);
|
||||
|
||||
Assert.ThrowsException<ArgumentException>(() => sftp.EndUploadFile(async1));
|
||||
Assert.ThrowsExactly<ArgumentException>(() => sftp.EndUploadFile(async1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
sftp.Connect();
|
||||
|
||||
Assert.ThrowsException<SftpPathNotFoundException>(() => sftp.Get("/xyz"));
|
||||
Assert.ThrowsExactly<SftpPathNotFoundException>(() => sftp.Get("/xyz"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
sftp.Connect();
|
||||
|
||||
Assert.ThrowsException<ArgumentNullException>(() => sftp.Get(null));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => sftp.Get(null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
await sftp.ConnectAsync(CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
await Assert.ThrowsExceptionAsync<SftpPathNotFoundException>(() => sftp.GetAsync("/xyz", default));
|
||||
await Assert.ThrowsExactlyAsync<SftpPathNotFoundException>(() => sftp.GetAsync("/xyz", default));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
await sftp.ConnectAsync(CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
await Assert.ThrowsExceptionAsync<ArgumentNullException>(() => sftp.GetAsync(null, default));
|
||||
await Assert.ThrowsExactlyAsync<ArgumentNullException>(() => sftp.GetAsync(null, default));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
|
||||
cmd.CancelAsync();
|
||||
|
||||
var tce = Assert.ThrowsException<TaskCanceledException>(() => cmd.EndExecute(asyncResult));
|
||||
var tce = Assert.ThrowsExactly<TaskCanceledException>(() => cmd.EndExecute(asyncResult));
|
||||
Assert.AreEqual(CancellationToken.None, tce.CancellationToken);
|
||||
Assert.IsTrue(asyncResult.IsCompleted);
|
||||
Assert.IsTrue(asyncResult.AsyncWaitHandle.WaitOne(0));
|
||||
@@ -90,7 +90,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
|
||||
cmd.CancelAsync(forceKill: true);
|
||||
|
||||
var tce = await Assert.ThrowsExceptionAsync<TaskCanceledException>(() => executeTask);
|
||||
var tce = await Assert.ThrowsExactlyAsync<TaskCanceledException>(() => executeTask);
|
||||
Assert.AreEqual(CancellationToken.None, tce.CancellationToken);
|
||||
Assert.IsTrue(asyncResult.IsCompleted);
|
||||
Assert.IsTrue(asyncResult.AsyncWaitHandle.WaitOne(0));
|
||||
@@ -135,7 +135,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
|
||||
await cts.CancelAsync();
|
||||
|
||||
var tce = await Assert.ThrowsExceptionAsync<TaskCanceledException>(() => executeTask);
|
||||
var tce = await Assert.ThrowsExactlyAsync<TaskCanceledException>(() => executeTask);
|
||||
Assert.AreSame(executeTask, tce.Task);
|
||||
Assert.AreEqual(cts.Token, tce.CancellationToken);
|
||||
Assert.AreEqual(string.Empty, cmd.Result);
|
||||
@@ -171,7 +171,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
client.Connect();
|
||||
using var cmd = client.CreateCommand("sleep 10s");
|
||||
cmd.CommandTimeout = TimeSpan.FromSeconds(2);
|
||||
Assert.ThrowsException<SshOperationTimeoutException>(cmd.Execute);
|
||||
Assert.ThrowsExactly<SshOperationTimeoutException>(cmd.Execute);
|
||||
client.Disconnect();
|
||||
}
|
||||
}
|
||||
@@ -189,7 +189,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
|
||||
Assert.IsTrue(((IAsyncResult)executeTask).AsyncWaitHandle.WaitOne(TimeSpan.FromSeconds(3)));
|
||||
|
||||
await Assert.ThrowsExceptionAsync<SshOperationTimeoutException>(() => executeTask);
|
||||
await Assert.ThrowsExactlyAsync<SshOperationTimeoutException>(() => executeTask);
|
||||
client.Disconnect();
|
||||
}
|
||||
}
|
||||
@@ -209,7 +209,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
client.Disconnect();
|
||||
|
||||
// Waiting for timeout is not optimal here, but better than hanging indefinitely.
|
||||
await Assert.ThrowsExceptionAsync<SshOperationTimeoutException>(() => executeTask);
|
||||
await Assert.ThrowsExactlyAsync<SshOperationTimeoutException>(() => executeTask);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,7 +403,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
{
|
||||
client.Connect();
|
||||
using var cmd = client.CreateCommand("ls -l");
|
||||
Assert.ThrowsException<ArgumentNullException>(() => cmd.EndExecute(null));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => cmd.EndExecute(null));
|
||||
client.Disconnect();
|
||||
}
|
||||
}
|
||||
@@ -510,7 +510,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
|
||||
|
||||
Assert.IsTrue(asyncResult.AsyncWaitHandle.WaitOne(0));
|
||||
|
||||
Assert.ThrowsException<ObjectDisposedException>(() => cmd.EndExecute(asyncResult));
|
||||
Assert.ThrowsExactly<ObjectDisposedException>(() => cmd.EndExecute(asyncResult));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
_remotePathTransformation = RemotePathTransformation.ShellQuote;
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DynamicData(nameof(GetScpDownloadStreamDirectoryDoesNotExistData), DynamicDataSourceType.Method)]
|
||||
public void Scp_Download_Stream_DirectoryDoesNotExist(IRemotePathTransformation remotePathTransformation,
|
||||
string remotePath,
|
||||
@@ -93,7 +93,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
}
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DynamicData(nameof(GetScpDownloadStreamFileDoesNotExistData), DynamicDataSourceType.Method)]
|
||||
public void Scp_Download_Stream_FileDoesNotExist(IRemotePathTransformation remotePathTransformation,
|
||||
string remotePath,
|
||||
@@ -169,7 +169,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
}
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DynamicData(nameof(GetScpDownloadDirectoryInfoDirectoryDoesNotExistData), DynamicDataSourceType.Method)]
|
||||
public void Scp_Download_DirectoryInfo_DirectoryDoesNotExist(IRemotePathTransformation remotePathTransformation,
|
||||
string remotePath)
|
||||
@@ -227,7 +227,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
}
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DynamicData(nameof(GetScpDownloadDirectoryInfoExistingFileData), DynamicDataSourceType.Method)]
|
||||
public void Scp_Download_DirectoryInfo_ExistingFile(IRemotePathTransformation remotePathTransformation,
|
||||
string remotePath)
|
||||
@@ -290,7 +290,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
}
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DynamicData(nameof(GetScpDownloadDirectoryInfoExistingDirectoryData), DynamicDataSourceType.Method)]
|
||||
public void Scp_Download_DirectoryInfo_ExistingDirectory(IRemotePathTransformation remotePathTransformation,
|
||||
string remotePath)
|
||||
@@ -433,7 +433,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
}
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DynamicData(nameof(GetScpDownloadFileInfoDirectoryDoesNotExistData), DynamicDataSourceType.Method)]
|
||||
public void Scp_Download_FileInfo_DirectoryDoesNotExist(IRemotePathTransformation remotePathTransformation,
|
||||
string remotePath,
|
||||
@@ -505,7 +505,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
}
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DynamicData(nameof(GetScpDownloadFileInfoFileDoesNotExistData), DynamicDataSourceType.Method)]
|
||||
public void Scp_Download_FileInfo_FileDoesNotExist(IRemotePathTransformation remotePathTransformation,
|
||||
string remotePath,
|
||||
@@ -579,7 +579,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
}
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DynamicData(nameof(GetScpDownloadFileInfoExistingDirectoryData), DynamicDataSourceType.Method)]
|
||||
public void Scp_Download_FileInfo_ExistingDirectory(IRemotePathTransformation remotePathTransformation,
|
||||
string remotePath)
|
||||
@@ -648,7 +648,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
}
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DynamicData(nameof(GetScpDownloadFileInfoExistingFileData), DynamicDataSourceType.Method)]
|
||||
public void Scp_Download_FileInfo_ExistingFile(IRemotePathTransformation remotePathTransformation,
|
||||
string remotePath,
|
||||
@@ -740,7 +740,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
}
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DynamicData(nameof(GetScpDownloadStreamExistingDirectoryData), DynamicDataSourceType.Method)]
|
||||
public void Scp_Download_Stream_ExistingDirectory(IRemotePathTransformation remotePathTransformation,
|
||||
string remotePath)
|
||||
@@ -808,7 +808,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
}
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DynamicData(nameof(GetScpDownloadStreamExistingFileData), DynamicDataSourceType.Method)]
|
||||
public void Scp_Download_Stream_ExistingFile(IRemotePathTransformation remotePathTransformation,
|
||||
string remotePath,
|
||||
@@ -895,7 +895,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
}
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DynamicData(nameof(GetScpUploadFileStreamDirectoryDoesNotExistData), DynamicDataSourceType.Method)]
|
||||
public void Scp_Upload_FileStream_DirectoryDoesNotExist(IRemotePathTransformation remotePathTransformation,
|
||||
string remotePath,
|
||||
@@ -965,7 +965,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
}
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DynamicData(nameof(GetScpUploadFileStreamExistingDirectoryData), DynamicDataSourceType.Method)]
|
||||
public void Scp_Upload_FileStream_ExistingDirectory(IRemotePathTransformation remotePathTransformation,
|
||||
string remoteFile)
|
||||
@@ -1028,7 +1028,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
}
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DynamicData(nameof(ScpUploadFileStreamExistingFileData), DynamicDataSourceType.Method)]
|
||||
public void Scp_Upload_FileStream_ExistingFile(IRemotePathTransformation remotePathTransformation,
|
||||
string remoteFile)
|
||||
@@ -1097,7 +1097,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
}
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DynamicData(nameof(GetScpUploadFileStreamFileDoesNotExistData), DynamicDataSourceType.Method)]
|
||||
public void Scp_Upload_FileStream_FileDoesNotExist(IRemotePathTransformation remotePathTransformation,
|
||||
string remotePath,
|
||||
@@ -1196,7 +1196,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
/// <summary>
|
||||
/// https://github.com/sshnet/SSH.NET/issues/289
|
||||
/// </summary>
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DynamicData(nameof(GetScpUploadFileInfoDirectoryDoesNotExistData), DynamicDataSourceType.Method)]
|
||||
public void Scp_Upload_FileInfo_DirectoryDoesNotExist(IRemotePathTransformation remotePathTransformation,
|
||||
string remotePath,
|
||||
@@ -1276,7 +1276,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
/// <summary>
|
||||
/// https://github.com/sshnet/SSH.NET/issues/286
|
||||
/// </summary>
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DynamicData(nameof(GetScpUploadFileInfoExistingDirectoryData), DynamicDataSourceType.Method)]
|
||||
public void Scp_Upload_FileInfo_ExistingDirectory(IRemotePathTransformation remotePathTransformation,
|
||||
string remoteFile)
|
||||
@@ -1338,7 +1338,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
}
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DynamicData(nameof(GetScpUploadFileInfoExistingFileData), DynamicDataSourceType.Method)]
|
||||
public void Scp_Upload_FileInfo_ExistingFile(IRemotePathTransformation remotePathTransformation,
|
||||
string remoteFile)
|
||||
@@ -1416,7 +1416,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
}
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DynamicData(nameof(GetScpUploadFileInfoFileDoesNotExistData), DynamicDataSourceType.Method)]
|
||||
public void Scp_Upload_FileInfo_FileDoesNotExist(IRemotePathTransformation remotePathTransformation,
|
||||
string remotePath,
|
||||
@@ -1521,7 +1521,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
}
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DynamicData(nameof(GetScpUploadDirectoryInfoDirectoryDoesNotExistData), DynamicDataSourceType.Method)]
|
||||
public void Scp_Upload_DirectoryInfo_DirectoryDoesNotExist(IRemotePathTransformation remotePathTransformation,
|
||||
string remoteDirectory)
|
||||
@@ -1586,7 +1586,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
}
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DynamicData(nameof(GetScpUploadDirectoryInfoExistingDirectoryData), DynamicDataSourceType.Method)]
|
||||
public void Scp_Upload_DirectoryInfo_ExistingDirectory(IRemotePathTransformation remotePathTransformation,
|
||||
string remoteDirectory)
|
||||
@@ -1790,7 +1790,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
}
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DynamicData(nameof(GetScpUploadDirectoryInfoExistingFileData), DynamicDataSourceType.Method)]
|
||||
public void Scp_Upload_DirectoryInfo_ExistingFile(IRemotePathTransformation remotePathTransformation,
|
||||
string remoteDirectory)
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
[TestMethod]
|
||||
public void Test_Sftp_ListDirectory_Permission_Denied()
|
||||
{
|
||||
Assert.ThrowsException<SftpPermissionDeniedException>(() => _sftpClient.ListDirectory("/root"));
|
||||
Assert.ThrowsExactly<SftpPermissionDeniedException>(() => _sftpClient.ListDirectory("/root"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
_remotePathTransformation = RemotePathTransformation.ShellQuote;
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DynamicData(nameof(GetSftpUploadFileFileStreamData), DynamicDataSourceType.Method)]
|
||||
public void Sftp_UploadFile_FileStream(int size)
|
||||
{
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
{
|
||||
var command = _sshClient.CreateCommand("ls");
|
||||
|
||||
Assert.ThrowsException<InvalidOperationException>(command.CreateInputStream);
|
||||
Assert.ThrowsExactly<InvalidOperationException>(command.CreateInputStream);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -106,7 +106,7 @@ namespace Renci.SshNet.IntegrationTests
|
||||
var asyncResult = command.BeginExecute();
|
||||
command.EndExecute(asyncResult);
|
||||
|
||||
Assert.ThrowsException<InvalidOperationException>(command.CreateInputStream);
|
||||
Assert.ThrowsExactly<InvalidOperationException>(command.CreateInputStream);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
[TestMethod]
|
||||
public void ThreadAbstraction_ExecuteThread_ShouldThrowArgumentNullExceptionWhenActionIsNull()
|
||||
{
|
||||
var ex = Assert.ThrowsException<ArgumentNullException>(() => ThreadAbstraction.ExecuteThread(null));
|
||||
var ex = Assert.ThrowsExactly<ArgumentNullException>(() => ThreadAbstraction.ExecuteThread(null));
|
||||
|
||||
Assert.IsNull(ex.InnerException);
|
||||
Assert.AreEqual("action", ex.ParamName);
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
[TestMethod]
|
||||
public async Task ConnectAsyncWithTimeoutThrowsSshTimeoutException()
|
||||
{
|
||||
await Assert.ThrowsExceptionAsync<SshOperationTimeoutException>(() => _client.ConnectAsync(CancellationToken.None));
|
||||
await Assert.ThrowsExactlyAsync<SshOperationTimeoutException>(() => _client.ConnectAsync(CancellationToken.None));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -56,7 +56,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
{
|
||||
using var cancellationTokenSource = new CancellationTokenSource();
|
||||
await cancellationTokenSource.CancelAsync();
|
||||
await Assert.ThrowsExceptionAsync<OperationCanceledException>(() => _client.ConnectAsync(cancellationTokenSource.Token));
|
||||
await Assert.ThrowsExactlyAsync<OperationCanceledException>(() => _client.ConnectAsync(cancellationTokenSource.Token));
|
||||
}
|
||||
|
||||
[TestCleanup]
|
||||
|
||||
@@ -24,14 +24,14 @@ namespace Renci.SshNet.Tests.Classes.Common
|
||||
public void AsTimeout_NegativeTimeSpan_ThrowsArgumentOutOfRangeException()
|
||||
{
|
||||
var timeSpan = TimeSpan.FromSeconds(-1);
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => timeSpan.AsTimeout());
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => timeSpan.AsTimeout());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void AsTimeout_TimeSpanExceedingMaxValue_ThrowsArgumentOutOfRangeException()
|
||||
{
|
||||
var timeSpan = TimeSpan.FromMilliseconds((double)int.MaxValue + 1);
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => timeSpan.AsTimeout());
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => timeSpan.AsTimeout());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -63,14 +63,14 @@ namespace Renci.SshNet.Tests.Classes.Common
|
||||
public void EnsureValidTimeout_NegativeTimeSpan_ThrowsArgumentOutOfRangeException()
|
||||
{
|
||||
var timeSpan = TimeSpan.FromSeconds(-1);
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => timeSpan.EnsureValidTimeout());
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => timeSpan.EnsureValidTimeout());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void EnsureValidTimeout_TimeSpanExceedingMaxValue_ThrowsArgumentOutOfRangeException()
|
||||
{
|
||||
var timeSpan = TimeSpan.FromMilliseconds((double)int.MaxValue + 1);
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => timeSpan.EnsureValidTimeout());
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => timeSpan.EnsureValidTimeout());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
||||
@@ -15,13 +15,13 @@ namespace Renci.SshNet.Tests.Classes
|
||||
[TestMethod]
|
||||
public void Keyboard_Test_Pass_Null()
|
||||
{
|
||||
Assert.ThrowsException<ArgumentNullException>(() => new KeyboardInteractiveAuthenticationMethod(null));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => new KeyboardInteractiveAuthenticationMethod(null));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Keyboard_Test_Pass_Whitespace()
|
||||
{
|
||||
Assert.ThrowsException<ArgumentException>(() => new KeyboardInteractiveAuthenticationMethod(string.Empty));
|
||||
Assert.ThrowsExactly<ArgumentException>(() => new KeyboardInteractiveAuthenticationMethod(string.Empty));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,13 +16,13 @@ namespace Renci.SshNet.Tests.Classes
|
||||
[TestMethod]
|
||||
public void None_Test_Pass_Null()
|
||||
{
|
||||
Assert.ThrowsException<ArgumentNullException>(() => new NoneAuthenticationMethod(null));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => new NoneAuthenticationMethod(null));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void None_Test_Pass_Whitespace()
|
||||
{
|
||||
Assert.ThrowsException<ArgumentException>(() => new NoneAuthenticationMethod(string.Empty));
|
||||
Assert.ThrowsExactly<ArgumentException>(() => new NoneAuthenticationMethod(string.Empty));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
||||
@@ -86,22 +86,22 @@ namespace Renci.SshNet.Tests.Classes
|
||||
{
|
||||
OrderedDictionary<string, int> o = new() { { "a", 4 } };
|
||||
|
||||
Assert.ThrowsException<ArgumentNullException>(() => o[null]);
|
||||
Assert.ThrowsException<ArgumentNullException>(() => o.Add(null, 1));
|
||||
Assert.ThrowsException<ArgumentNullException>(() => ((ICollection<KeyValuePair<string, int>>)o).Add(new KeyValuePair<string, int>(null, 1)));
|
||||
Assert.ThrowsException<ArgumentNullException>(() => ((ICollection<KeyValuePair<string, int>>)o).Contains(new KeyValuePair<string, int>(null, 1)));
|
||||
Assert.ThrowsException<ArgumentNullException>(() => o.ContainsKey(null));
|
||||
Assert.ThrowsException<ArgumentNullException>(() => o.IndexOf(null));
|
||||
Assert.ThrowsException<ArgumentNullException>(() => o.Insert(0, null, 1));
|
||||
Assert.ThrowsException<ArgumentNullException>(() => o.Remove(null, out _));
|
||||
Assert.ThrowsException<ArgumentNullException>(() => o.Remove(null));
|
||||
Assert.ThrowsException<ArgumentNullException>(() => ((ICollection<KeyValuePair<string, int>>)o).Remove(new KeyValuePair<string, int>(null, 1)));
|
||||
Assert.ThrowsException<ArgumentNullException>(() => o.SetAt(0, null, 1));
|
||||
Assert.ThrowsException<ArgumentNullException>(() => o.SetPosition(null, 0));
|
||||
Assert.ThrowsException<ArgumentNullException>(() => o.TryAdd(null, 1));
|
||||
Assert.ThrowsException<ArgumentNullException>(() => o.TryAdd(null, 1, out _));
|
||||
Assert.ThrowsException<ArgumentNullException>(() => o.TryGetValue(null, out _));
|
||||
Assert.ThrowsException<ArgumentNullException>(() => o.TryGetValue(null, out _, out _));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => o[null]);
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => o.Add(null, 1));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => ((ICollection<KeyValuePair<string, int>>)o).Add(new KeyValuePair<string, int>(null, 1)));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => ((ICollection<KeyValuePair<string, int>>)o).Contains(new KeyValuePair<string, int>(null, 1)));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => o.ContainsKey(null));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => o.IndexOf(null));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => o.Insert(0, null, 1));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => o.Remove(null, out _));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => o.Remove(null));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => ((ICollection<KeyValuePair<string, int>>)o).Remove(new KeyValuePair<string, int>(null, 1)));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => o.SetAt(0, null, 1));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => o.SetPosition(null, 0));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => o.TryAdd(null, 1));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => o.TryAdd(null, 1, out _));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => o.TryGetValue(null, out _));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => o.TryGetValue(null, out _, out _));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -127,7 +127,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
{
|
||||
OrderedDictionary<string, int> o = new() { { "a", 4 } };
|
||||
|
||||
Assert.ThrowsException<KeyNotFoundException>(() => o["b"]);
|
||||
Assert.ThrowsExactly<KeyNotFoundException>(() => o["b"]);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -145,8 +145,8 @@ namespace Renci.SshNet.Tests.Classes
|
||||
{
|
||||
OrderedDictionary<string, int> o = new() { { "a", 4 } };
|
||||
|
||||
Assert.ThrowsException<ArgumentException>(() => o.Add("a", 8));
|
||||
Assert.ThrowsException<ArgumentException>(() => ((ICollection<KeyValuePair<string, int>>)o).Add(new KeyValuePair<string, int>("a", 8)));
|
||||
Assert.ThrowsExactly<ArgumentException>(() => o.Add("a", 8));
|
||||
Assert.ThrowsExactly<ArgumentException>(() => ((ICollection<KeyValuePair<string, int>>)o).Add(new KeyValuePair<string, int>("a", 8)));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -164,20 +164,20 @@ namespace Renci.SshNet.Tests.Classes
|
||||
{
|
||||
OrderedDictionary<string, int> o = new() { { "a", 4 }, { "b", 8 } };
|
||||
|
||||
Assert.ThrowsException<ArgumentNullException>(() => ((ICollection<KeyValuePair<string, int>>)o).CopyTo(null, 0));
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => ((ICollection<KeyValuePair<string, int>>)o).CopyTo(new KeyValuePair<string, int>[3], -1));
|
||||
Assert.ThrowsException<ArgumentException>(() => ((ICollection<KeyValuePair<string, int>>)o).CopyTo(new KeyValuePair<string, int>[3], 3));
|
||||
Assert.ThrowsException<ArgumentException>(() => ((ICollection<KeyValuePair<string, int>>)o).CopyTo(new KeyValuePair<string, int>[3], 2));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => ((ICollection<KeyValuePair<string, int>>)o).CopyTo(null, 0));
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => ((ICollection<KeyValuePair<string, int>>)o).CopyTo(new KeyValuePair<string, int>[3], -1));
|
||||
Assert.ThrowsExactly<ArgumentException>(() => ((ICollection<KeyValuePair<string, int>>)o).CopyTo(new KeyValuePair<string, int>[3], 3));
|
||||
Assert.ThrowsExactly<ArgumentException>(() => ((ICollection<KeyValuePair<string, int>>)o).CopyTo(new KeyValuePair<string, int>[3], 2));
|
||||
|
||||
Assert.ThrowsException<ArgumentNullException>(() => o.Keys.CopyTo(null, 0));
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.Keys.CopyTo(new string[3], -1));
|
||||
Assert.ThrowsException<ArgumentException>(() => o.Keys.CopyTo(new string[3], 3));
|
||||
Assert.ThrowsException<ArgumentException>(() => o.Keys.CopyTo(new string[3], 2));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => o.Keys.CopyTo(null, 0));
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.Keys.CopyTo(new string[3], -1));
|
||||
Assert.ThrowsExactly<ArgumentException>(() => o.Keys.CopyTo(new string[3], 3));
|
||||
Assert.ThrowsExactly<ArgumentException>(() => o.Keys.CopyTo(new string[3], 2));
|
||||
|
||||
Assert.ThrowsException<ArgumentNullException>(() => o.Values.CopyTo(null, 0));
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.Values.CopyTo(new int[3], -1));
|
||||
Assert.ThrowsException<ArgumentException>(() => o.Values.CopyTo(new int[3], 3));
|
||||
Assert.ThrowsException<ArgumentException>(() => o.Values.CopyTo(new int[3], 2));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => o.Values.CopyTo(null, 0));
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.Values.CopyTo(new int[3], -1));
|
||||
Assert.ThrowsExactly<ArgumentException>(() => o.Values.CopyTo(new int[3], 3));
|
||||
Assert.ThrowsExactly<ArgumentException>(() => o.Values.CopyTo(new int[3], 2));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -206,9 +206,9 @@ namespace Renci.SshNet.Tests.Classes
|
||||
{
|
||||
OrderedDictionary<string, string> o = new() { { "a", "1" } };
|
||||
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.GetAt(-2));
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.GetAt(-1));
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.GetAt(1));
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.GetAt(-2));
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.GetAt(-1));
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.GetAt(1));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -228,21 +228,21 @@ namespace Renci.SshNet.Tests.Classes
|
||||
{
|
||||
OrderedDictionary<string, double> o = new();
|
||||
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.SetAt(-2, 1.1));
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.SetAt(-1, 1.1));
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.SetAt(0, 1.1));
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.SetAt(1, 1.1));
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.SetAt(-2, 1.1));
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.SetAt(-1, 1.1));
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.SetAt(0, 1.1));
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.SetAt(1, 1.1));
|
||||
|
||||
o.Add("a", 4);
|
||||
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.SetAt(-2, 1.1));
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.SetAt(-1, 1.1));
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.SetAt(-2, 1.1));
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.SetAt(-1, 1.1));
|
||||
|
||||
o.SetAt(0, 1.1);
|
||||
|
||||
AssertEqual([new("a", 1.1)], o);
|
||||
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.SetAt(1, 5.5));
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.SetAt(1, 5.5));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -250,8 +250,8 @@ namespace Renci.SshNet.Tests.Classes
|
||||
{
|
||||
OrderedDictionary<string, int> o = new() { { "a", 4 }, { "b", 8 }, { "c", 12 } };
|
||||
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.SetAt(-1, "d", 16));
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.SetAt(3, "d", 16));
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.SetAt(-1, "d", 16));
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.SetAt(3, "d", 16));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -269,7 +269,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
{
|
||||
OrderedDictionary<string, int> o = new() { { "a", 4 }, { "b", 8 }, { "c", 12 } };
|
||||
|
||||
Assert.ThrowsException<ArgumentException>(() => o.SetAt(1, "c", 16));
|
||||
Assert.ThrowsExactly<ArgumentException>(() => o.SetAt(1, "c", 16));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -287,7 +287,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
{
|
||||
OrderedDictionary<string, float> o = new() { { "a", 4 } };
|
||||
|
||||
Assert.ThrowsException<KeyNotFoundException>(() => o["doesn't exist"]);
|
||||
Assert.ThrowsExactly<KeyNotFoundException>(() => o["doesn't exist"]);
|
||||
Assert.IsFalse(((ICollection<KeyValuePair<string, float>>)o).Contains(new KeyValuePair<string, float>("doesn't exist", 1)));
|
||||
Assert.IsFalse(o.ContainsKey("doesn't exist"));
|
||||
Assert.IsFalse(o.ContainsValue(999));
|
||||
@@ -315,7 +315,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
{
|
||||
OrderedDictionary<string, float> o = new() { { "a", 4 }, { "b", 8 } };
|
||||
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.Insert(-1, "c", 12));
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.Insert(-1, "c", 12));
|
||||
|
||||
o.Insert(0, "c", 12); // Start
|
||||
AssertEqual([new("c", 12), new("a", 4), new("b", 8)], o);
|
||||
@@ -326,10 +326,10 @@ namespace Renci.SshNet.Tests.Classes
|
||||
o.Insert(o.Count, "e", 16); // End
|
||||
AssertEqual([new("c", 12), new("a", 4), new("d", 12), new("b", 8), new("e", 16)], o);
|
||||
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.Insert(o.Count + 1, "f", 16));
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.Insert(o.Count + 1, "f", 16));
|
||||
|
||||
// Existing key
|
||||
Assert.ThrowsException<ArgumentException>(() => o.Insert(0, "a", 12));
|
||||
Assert.ThrowsExactly<ArgumentException>(() => o.Insert(0, "a", 12));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -357,8 +357,8 @@ namespace Renci.SshNet.Tests.Classes
|
||||
{
|
||||
OrderedDictionary<string, float> o = new() { { "a", 4 }, { "b", 8 }, { "c", 12 }, { "d", 16 } };
|
||||
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.RemoveAt(-2));
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.RemoveAt(-1));
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.RemoveAt(-2));
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.RemoveAt(-1));
|
||||
|
||||
o.RemoveAt(0); // Start
|
||||
AssertEqual([new("b", 8), new("c", 12), new("d", 16)], o);
|
||||
@@ -369,7 +369,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
o.RemoveAt(1); // End
|
||||
AssertEqual([new("b", 8)], o);
|
||||
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.RemoveAt(1));
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.RemoveAt(1));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -379,16 +379,16 @@ namespace Renci.SshNet.Tests.Classes
|
||||
|
||||
ArgumentOutOfRangeException ex;
|
||||
|
||||
ex = Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.SetPosition(-1, 0));
|
||||
ex = Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.SetPosition(-1, 0));
|
||||
Assert.AreEqual("index", ex.ParamName);
|
||||
|
||||
ex = Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.SetPosition(0, -1));
|
||||
ex = Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.SetPosition(0, -1));
|
||||
Assert.AreEqual("newIndex", ex.ParamName);
|
||||
|
||||
ex = Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.SetPosition(0, 4));
|
||||
ex = Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.SetPosition(0, 4));
|
||||
Assert.AreEqual("newIndex", ex.ParamName);
|
||||
|
||||
ex = Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.SetPosition(4, 0));
|
||||
ex = Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.SetPosition(4, 0));
|
||||
Assert.AreEqual("index", ex.ParamName);
|
||||
|
||||
o.SetPosition(1, 0);
|
||||
@@ -418,9 +418,9 @@ namespace Renci.SshNet.Tests.Classes
|
||||
{
|
||||
OrderedDictionary<string, float> o = new() { { "a", 4 }, { "b", 8 }, { "c", 12 }, { "d", 16 } };
|
||||
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.SetPosition("a", -1));
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(() => o.SetPosition("a", 4));
|
||||
Assert.ThrowsException<KeyNotFoundException>(() => o.SetPosition("e", 0));
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.SetPosition("a", -1));
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(() => o.SetPosition("a", 4));
|
||||
Assert.ThrowsExactly<KeyNotFoundException>(() => o.SetPosition("e", 0));
|
||||
|
||||
o.SetPosition("b", 0);
|
||||
AssertEqual([new("b", 8), new("a", 4), new("c", 12), new("d", 16)], o);
|
||||
@@ -456,14 +456,14 @@ namespace Renci.SshNet.Tests.Classes
|
||||
OrderedDictionary<string, int> o = new() { { "a", 4 }, { "b", 8 } };
|
||||
|
||||
Assert.IsTrue(o.Keys.IsReadOnly);
|
||||
Assert.ThrowsException<NotSupportedException>(() => o.Keys.Add("c"));
|
||||
Assert.ThrowsException<NotSupportedException>(o.Keys.Clear);
|
||||
Assert.ThrowsException<NotSupportedException>(() => o.Keys.Remove("a"));
|
||||
Assert.ThrowsExactly<NotSupportedException>(() => o.Keys.Add("c"));
|
||||
Assert.ThrowsExactly<NotSupportedException>(o.Keys.Clear);
|
||||
Assert.ThrowsExactly<NotSupportedException>(() => o.Keys.Remove("a"));
|
||||
|
||||
Assert.IsTrue(o.Values.IsReadOnly);
|
||||
Assert.ThrowsException<NotSupportedException>(() => o.Values.Add(12));
|
||||
Assert.ThrowsException<NotSupportedException>(o.Values.Clear);
|
||||
Assert.ThrowsException<NotSupportedException>(() => o.Values.Remove(4));
|
||||
Assert.ThrowsExactly<NotSupportedException>(() => o.Values.Add(12));
|
||||
Assert.ThrowsExactly<NotSupportedException>(o.Values.Clear);
|
||||
Assert.ThrowsExactly<NotSupportedException>(() => o.Values.Remove(4));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,13 +15,13 @@ namespace Renci.SshNet.Tests.Classes
|
||||
[TestMethod]
|
||||
public void Password_Test_Pass_Null_Username()
|
||||
{
|
||||
Assert.ThrowsException<ArgumentNullException>(() => new PasswordAuthenticationMethod(null, "valid"));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => new PasswordAuthenticationMethod(null, "valid"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Password_Test_Pass_Null_Password()
|
||||
{
|
||||
Assert.ThrowsException<ArgumentNullException>(() => new PasswordAuthenticationMethod("valid", (string)null));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => new PasswordAuthenticationMethod("valid", (string)null));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -33,7 +33,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
[TestMethod]
|
||||
public void Password_Test_Pass_Whitespace()
|
||||
{
|
||||
Assert.ThrowsException<ArgumentException>(() => new PasswordAuthenticationMethod(string.Empty, "valid"));
|
||||
Assert.ThrowsExactly<ArgumentException>(() => new PasswordAuthenticationMethod(string.Empty, "valid"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
||||
@@ -33,33 +33,33 @@ namespace Renci.SshNet.Tests.Classes
|
||||
[TestMethod]
|
||||
public void Test_ConnectionInfo_Username_Is_Null()
|
||||
{
|
||||
Assert.ThrowsException<ArgumentNullException>(() => new PasswordConnectionInfo(Resources.HOST, null, Resources.PASSWORD));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => new PasswordConnectionInfo(Resources.HOST, null, Resources.PASSWORD));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Test_ConnectionInfo_Password_Is_Null()
|
||||
{
|
||||
Assert.ThrowsException<ArgumentNullException>(
|
||||
Assert.ThrowsExactly<ArgumentNullException>(
|
||||
() => new PasswordConnectionInfo(Resources.HOST, Resources.USERNAME, (string)null));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Test_ConnectionInfo_Username_Is_Whitespace()
|
||||
{
|
||||
Assert.ThrowsException<ArgumentException>(() => new PasswordConnectionInfo(Resources.HOST, " ", Resources.PASSWORD));
|
||||
Assert.ThrowsExactly<ArgumentException>(() => new PasswordConnectionInfo(Resources.HOST, " ", Resources.PASSWORD));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Test_ConnectionInfo_SmallPortNumber()
|
||||
{
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(
|
||||
() => new PasswordConnectionInfo(Resources.HOST, IPEndPoint.MinPort - 1, Resources.USERNAME, Resources.PASSWORD));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void Test_ConnectionInfo_BigPortNumber()
|
||||
{
|
||||
Assert.ThrowsException<ArgumentOutOfRangeException>(
|
||||
Assert.ThrowsExactly<ArgumentOutOfRangeException>(
|
||||
() => new PasswordConnectionInfo(Resources.HOST, IPEndPoint.MaxPort + 1, Resources.USERNAME, Resources.PASSWORD));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,19 +15,19 @@ namespace Renci.SshNet.Tests.Classes
|
||||
[TestMethod]
|
||||
public void PrivateKey_Test_Pass_Null()
|
||||
{
|
||||
Assert.ThrowsException<ArgumentNullException>(() => new PrivateKeyAuthenticationMethod(null, null));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => new PrivateKeyAuthenticationMethod(null, null));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PrivateKey_Test_Pass_PrivateKey_Null()
|
||||
{
|
||||
Assert.ThrowsException<ArgumentNullException>(() => new PrivateKeyAuthenticationMethod("username", null));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => new PrivateKeyAuthenticationMethod("username", null));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void PrivateKey_Test_Pass_Whitespace()
|
||||
{
|
||||
Assert.ThrowsException<ArgumentException>(() => new PrivateKeyAuthenticationMethod(string.Empty, null));
|
||||
Assert.ThrowsExactly<ArgumentException>(() => new PrivateKeyAuthenticationMethod(string.Empty, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -433,7 +433,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
using (var privateKey = GetData("Key.OPENSSH.RSA.txt"))
|
||||
using (var certificate = GetData("Key.OPENSSH.ECDSA521-cert.pub"))
|
||||
{
|
||||
Assert.ThrowsException<ArgumentException>(() => new PrivateKeyFile(privateKey, passPhrase: null, certificate));
|
||||
Assert.ThrowsExactly<ArgumentException>(() => new PrivateKeyFile(privateKey, passPhrase: null, certificate));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -563,7 +563,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
|
||||
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(pk)))
|
||||
{
|
||||
var ex = Assert.ThrowsException<SshException>(() => new PrivateKeyFile(stream));
|
||||
var ex = Assert.ThrowsExactly<SshException>(() => new PrivateKeyFile(stream));
|
||||
|
||||
Assert.AreEqual("MAC verification failed for PuTTY key file", ex.Message);
|
||||
}
|
||||
@@ -603,7 +603,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
|
||||
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(pk)))
|
||||
{
|
||||
var ex = Assert.ThrowsException<SshException>(() => new PrivateKeyFile(stream));
|
||||
var ex = Assert.ThrowsExactly<SshException>(() => new PrivateKeyFile(stream));
|
||||
|
||||
Assert.AreEqual("MAC verification failed for PuTTY key file", ex.Message);
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ namespace Renci.SshNet.Tests.Classes.Security
|
||||
|
||||
byte[] signature = algorithm.Sign(data);
|
||||
|
||||
var ex = Assert.ThrowsException<InvalidOperationException>(() => algorithm.VerifySignature(data, signature));
|
||||
var ex = Assert.ThrowsExactly<InvalidOperationException>(() => algorithm.VerifySignature(data, signature));
|
||||
Assert.IsTrue(ex.Message.StartsWith("Invalid usage", StringComparison.Ordinal));
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
[TestMethod]
|
||||
public void ShouldThrowSshConnectionException()
|
||||
{
|
||||
var reason = Assert.ThrowsException<SshConnectionException>(Session.Connect).DisconnectReason;
|
||||
var reason = Assert.ThrowsExactly<SshConnectionException>(Session.Connect).DisconnectReason;
|
||||
Assert.AreEqual(DisconnectReason.MacError, reason);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
[TestMethod]
|
||||
public void ShouldThrowSshException()
|
||||
{
|
||||
var message = Assert.ThrowsException<SshException>(Session.Connect).Message;
|
||||
var message = Assert.ThrowsExactly<SshException>(Session.Connect).Message;
|
||||
Assert.AreEqual("Message type 4 is not valid in the current context.", message);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
[TestMethod]
|
||||
public void DisconnectIsAllowedDuringStrictKex()
|
||||
{
|
||||
var exception = Assert.ThrowsException<SshConnectionException>(Session.Connect);
|
||||
var exception = Assert.ThrowsExactly<SshConnectionException>(Session.Connect);
|
||||
Assert.AreEqual(DisconnectReason.TooManyConnections, exception.DisconnectReason);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
[TestMethod]
|
||||
public void ShouldThrowSshException()
|
||||
{
|
||||
var message = Assert.ThrowsException<SshException>(Session.Connect).Message;
|
||||
var message = Assert.ThrowsExactly<SshException>(Session.Connect).Message;
|
||||
Assert.AreEqual("Message type 2 is not valid in the current context.", message);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
[TestMethod]
|
||||
public void ShouldThrowSshConnectionException()
|
||||
{
|
||||
var exception = Assert.ThrowsException<SshConnectionException>(Session.Connect);
|
||||
var exception = Assert.ThrowsExactly<SshConnectionException>(Session.Connect);
|
||||
Assert.AreEqual(DisconnectReason.KeyExchangeFailed, exception.DisconnectReason);
|
||||
Assert.AreEqual("KEXINIT was not the first packet during strict key exchange.", exception.Message);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
|
||||
[TestClass]
|
||||
public class SftpFileStreamTest
|
||||
{
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DataRow(false)]
|
||||
[DataRow(true)]
|
||||
public async Task BadFileMode_ThrowsArgumentOutOfRangeException(bool isAsync)
|
||||
@@ -38,7 +38,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp
|
||||
Assert.AreEqual("mode", ex.ParamName);
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DataRow(false)]
|
||||
[DataRow(true)]
|
||||
public async Task BadFileAccess_ThrowsArgumentOutOfRangeException(bool isAsync)
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
{
|
||||
using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
|
||||
{
|
||||
Assert.ThrowsException<SshConnectionException>(() => sftp.DeleteDirectory("test"));
|
||||
Assert.ThrowsExactly<SshConnectionException>(() => sftp.DeleteDirectory("test"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
{
|
||||
using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
|
||||
{
|
||||
Assert.ThrowsException<ArgumentNullException>(() => sftp.DeleteFile(null));
|
||||
Assert.ThrowsExactly<ArgumentNullException>(() => sftp.DeleteFile(null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
{
|
||||
using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
|
||||
{
|
||||
await Assert.ThrowsExceptionAsync<ArgumentNullException>(() => sftp.DeleteFileAsync(null, default));
|
||||
await Assert.ThrowsExactlyAsync<ArgumentNullException>(() => sftp.DeleteFileAsync(null, default));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
{
|
||||
using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
|
||||
{
|
||||
Assert.ThrowsException<SshConnectionException>(() => sftp.GetAttributes("."));
|
||||
Assert.ThrowsExactly<SshConnectionException>(() => sftp.GetAttributes("."));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD);
|
||||
sftp.Dispose();
|
||||
|
||||
Assert.ThrowsException<ObjectDisposedException>(() => sftp.GetAttributes("."));
|
||||
Assert.ThrowsExactly<ObjectDisposedException>(() => sftp.GetAttributes("."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
{
|
||||
using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
|
||||
{
|
||||
await Assert.ThrowsExceptionAsync<SshConnectionException>(() => sftp.GetAttributesAsync(".", CancellationToken.None));
|
||||
await Assert.ThrowsExactlyAsync<SshConnectionException>(() => sftp.GetAttributesAsync(".", CancellationToken.None));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD);
|
||||
sftp.Dispose();
|
||||
|
||||
await Assert.ThrowsExceptionAsync<ObjectDisposedException>(() => sftp.GetAttributesAsync(".", CancellationToken.None));
|
||||
await Assert.ThrowsExactlyAsync<ObjectDisposedException>(() => sftp.GetAttributesAsync(".", CancellationToken.None));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
{
|
||||
using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
|
||||
{
|
||||
Assert.ThrowsException<SshConnectionException>(() => sftp.ListDirectory("."));
|
||||
Assert.ThrowsExactly<SshConnectionException>(() => sftp.ListDirectory("."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
{
|
||||
using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
|
||||
{
|
||||
await Assert.ThrowsExceptionAsync<SshConnectionException>(async () =>
|
||||
await Assert.ThrowsExactlyAsync<SshConnectionException>(async () =>
|
||||
{
|
||||
await foreach (var x in sftp.ListDirectoryAsync(".", CancellationToken.None))
|
||||
{
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
|
||||
_session.InvokeDisconnected();
|
||||
|
||||
var ex = await Assert.ThrowsExceptionAsync<SshException>(() => openTask);
|
||||
var ex = await Assert.ThrowsExactlyAsync<SshException>(() => openTask);
|
||||
Assert.AreEqual("Connection was closed by the server.", ex.Message);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
|
||||
_session.InvokeChannelCloseReceived();
|
||||
|
||||
var ex = await Assert.ThrowsExceptionAsync<SshException>(() => openTask);
|
||||
var ex = await Assert.ThrowsExactlyAsync<SshException>(() => openTask);
|
||||
Assert.AreEqual("Channel was closed.", ex.Message);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
|
||||
await cts.CancelAsync();
|
||||
|
||||
var ex = await Assert.ThrowsExceptionAsync<TaskCanceledException>(() => openTask);
|
||||
var ex = await Assert.ThrowsExactlyAsync<TaskCanceledException>(() => openTask);
|
||||
Assert.AreEqual(cts.Token, ex.CancellationToken);
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
|
||||
Task<SftpFileStream> openTask = _client.OpenAsync("path", FileMode.Create, FileAccess.Write, CancellationToken.None);
|
||||
|
||||
var ex = await Assert.ThrowsExceptionAsync<SshOperationTimeoutException>(() => openTask);
|
||||
var ex = await Assert.ThrowsExactlyAsync<SshOperationTimeoutException>(() => openTask);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -124,7 +124,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
|
||||
_session.InvokeErrorOccurred(ex);
|
||||
|
||||
var ex2 = await Assert.ThrowsExceptionAsync<MyException>(() => openTask);
|
||||
var ex2 = await Assert.ThrowsExactlyAsync<MyException>(() => openTask);
|
||||
Assert.AreEqual(ex.Message, ex2.Message);
|
||||
}
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
|
||||
var bytes = _encoding.GetBytes("Hello World!");
|
||||
|
||||
Assert.ThrowsException<ObjectDisposedException>(() => shellStream.Write(bytes, 0, bytes.Length));
|
||||
Assert.ThrowsExactly<ObjectDisposedException>(() => shellStream.Write(bytes, 0, bytes.Length));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@@ -134,7 +134,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
|
||||
shellStream.Dispose();
|
||||
|
||||
Assert.ThrowsException<ObjectDisposedException>(() => shellStream.ChangeWindowSize(80, 25, 0, 0));
|
||||
Assert.ThrowsExactly<ObjectDisposedException>(() => shellStream.ChangeWindowSize(80, 25, 0, 0));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
CollectionAssert.AreEqual(expectedData, actualData.Take(expectedData.Length));
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DataRow("\r\n")]
|
||||
[DataRow("\r")]
|
||||
[DataRow("\n")]
|
||||
@@ -149,7 +149,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
Assert.IsNull(_shellStream.ReadLine(TimeSpan.Zero));
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[TestMethod]
|
||||
[DataRow("\r\n")]
|
||||
[DataRow("\r")]
|
||||
[DataRow("\n")]
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Renci.SshNet.Tests.Classes
|
||||
{
|
||||
using (var client = new SshClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
|
||||
{
|
||||
Assert.ThrowsException<SshConnectionException>(() => client.CreateCommand("echo Hello"));
|
||||
Assert.ThrowsExactly<SshConnectionException>(() => client.CreateCommand("echo Hello"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user