Skip to content
Merged
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
8 changes: 4 additions & 4 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void Test_PortForwarding_Local_Without_Connecting()
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));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void Test_Sftp_ChangeDirectory_Root_Dont_Exists()
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"));
}
}

Expand All @@ -26,7 +26,7 @@ public async Task Test_Sftp_ChangeDirectory_Root_Dont_ExistsAsync()
{
await sftp.ConnectAsync(CancellationToken.None).ConfigureAwait(false);

await Assert.ThrowsExceptionAsync<SftpPathNotFoundException>(
await Assert.ThrowsExactlyAsync<SftpPathNotFoundException>(
() => sftp.ChangeDirectoryAsync("/asdasd", CancellationToken.None));
}
}
Expand All @@ -38,7 +38,7 @@ public void Test_Sftp_ChangeDirectory_Root_With_Slash_Dont_Exists()
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/"));
}
}

Expand All @@ -50,7 +50,7 @@ public async Task Test_Sftp_ChangeDirectory_Root_With_Slash_Dont_ExistsAsync()
{
await sftp.ConnectAsync(CancellationToken.None).ConfigureAwait(false);

await Assert.ThrowsExceptionAsync<SftpPathNotFoundException>(
await Assert.ThrowsExactlyAsync<SftpPathNotFoundException>(
() => sftp.ChangeDirectoryAsync("/asdasd/", CancellationToken.None));
}
}
Expand All @@ -62,7 +62,7 @@ public void Test_Sftp_ChangeDirectory_Subfolder_Dont_Exists()
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"));
}
}

Expand All @@ -74,7 +74,7 @@ public async Task Test_Sftp_ChangeDirectory_Subfolder_Dont_ExistsAsync()
{
await sftp.ConnectAsync(CancellationToken.None).ConfigureAwait(false);

await Assert.ThrowsExceptionAsync<SftpPathNotFoundException>(
await Assert.ThrowsExactlyAsync<SftpPathNotFoundException>(
() => sftp.ChangeDirectoryAsync("/asdasd/sssddds", CancellationToken.None));
}
}
Expand All @@ -86,7 +86,7 @@ public void Test_Sftp_ChangeDirectory_Subfolder_With_Slash_Dont_Exists()
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/"));
}
}

Expand All @@ -98,7 +98,7 @@ public async Task Test_Sftp_ChangeDirectory_Subfolder_With_Slash_Dont_ExistsAsyn
{
await sftp.ConnectAsync(CancellationToken.None).ConfigureAwait(false);

await Assert.ThrowsExceptionAsync<SftpPathNotFoundException>(
await Assert.ThrowsExactlyAsync<SftpPathNotFoundException>(
() => sftp.ChangeDirectoryAsync("/asdasd/sssddds/", CancellationToken.None));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void Test_Sftp_CreateDirectory_In_Forbidden_Directory()
{
sftp.Connect();

Assert.ThrowsException<SftpPermissionDeniedException>(() => sftp.CreateDirectory("/sbin/test"));
Assert.ThrowsExactly<SftpPermissionDeniedException>(() => sftp.CreateDirectory("/sbin/test"));
}
}

Expand All @@ -42,7 +42,7 @@ public void Test_Sftp_CreateDirectory_Invalid_Path()
{
sftp.Connect();

Assert.ThrowsException<SftpPathNotFoundException>(() => sftp.CreateDirectory("/abcdefg/abcefg"));
Assert.ThrowsExactly<SftpPathNotFoundException>(() => sftp.CreateDirectory("/abcdefg/abcefg"));
}
}

Expand All @@ -56,7 +56,7 @@ public void Test_Sftp_CreateDirectory_Already_Exists()

sftp.CreateDirectory("test");

Assert.ThrowsException<SshException>(() => sftp.CreateDirectory("test"));
Assert.ThrowsExactly<SshException>(() => sftp.CreateDirectory("test"));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void Test_Sftp_DeleteDirectory_Which_Doesnt_Exists()
{
sftp.Connect();

Assert.ThrowsException<SftpPathNotFoundException>(() => sftp.DeleteDirectory("abcdef"));
Assert.ThrowsExactly<SftpPathNotFoundException>(() => sftp.DeleteDirectory("abcdef"));
}
}

Expand All @@ -27,7 +27,7 @@ public void Test_Sftp_DeleteDirectory_Which_No_Permissions()
{
sftp.Connect();

Assert.ThrowsException<SftpPermissionDeniedException>(() => sftp.DeleteDirectory("/usr"));
Assert.ThrowsExactly<SftpPermissionDeniedException>(() => sftp.DeleteDirectory("/usr"));
}
}

Expand Down Expand Up @@ -55,7 +55,7 @@ public void Test_Sftp_DeleteDirectory_Null()
{
sftp.Connect();

Assert.ThrowsException<ArgumentNullException>(() => sftp.DeleteDirectory(null));
Assert.ThrowsExactly<ArgumentNullException>(() => sftp.DeleteDirectory(null));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void Test_Sftp_Download_Forbidden()
{
sftp.Connect();

Assert.ThrowsException<SftpPermissionDeniedException>(() => sftp.DownloadFile("/root/.profile", Stream.Null));
Assert.ThrowsExactly<SftpPermissionDeniedException>(() => sftp.DownloadFile("/root/.profile", Stream.Null));
}
}

Expand All @@ -27,7 +27,7 @@ public void Test_Sftp_Download_File_Not_Exists()
{
sftp.Connect();

Assert.ThrowsException<SftpPathNotFoundException>(() => sftp.DownloadFile("/xxx/eee/yyy", Stream.Null));
Assert.ThrowsExactly<SftpPathNotFoundException>(() => sftp.DownloadFile("/xxx/eee/yyy", Stream.Null));
}
}

Expand All @@ -39,7 +39,7 @@ public async Task Test_Sftp_DownloadAsync_Forbidden()
{
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));
}
}

Expand All @@ -51,7 +51,7 @@ public async Task Test_Sftp_DownloadAsync_File_Not_Exists()
{
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));
}
}

Expand All @@ -65,7 +65,7 @@ public async Task Test_Sftp_DownloadAsync_Cancellation_Requested()

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));
}
}

Expand All @@ -78,7 +78,7 @@ public void Test_Sftp_BeginDownloadFile_StreamIsNull()
{
sftp.Connect();

Assert.ThrowsException<ArgumentNullException>(() => sftp.BeginDownloadFile("aaaa", null, null, null));
Assert.ThrowsExactly<ArgumentNullException>(() => sftp.BeginDownloadFile("aaaa", null, null, null));
}
}

Expand All @@ -91,7 +91,7 @@ public void Test_Sftp_BeginDownloadFile_FileNameIsWhiteSpace()
{
sftp.Connect();

Assert.ThrowsException<ArgumentException>(() => sftp.BeginDownloadFile(" ", Stream.Null, null, null));
Assert.ThrowsExactly<ArgumentException>(() => sftp.BeginDownloadFile(" ", Stream.Null, null, null));
}
}

Expand All @@ -104,7 +104,7 @@ public void Test_Sftp_BeginDownloadFile_FileNameIsNull()
{
sftp.Connect();

Assert.ThrowsException<ArgumentNullException>(() => sftp.BeginDownloadFile(null, Stream.Null, null, null));
Assert.ThrowsExactly<ArgumentNullException>(() => sftp.BeginDownloadFile(null, Stream.Null, null, null));
}
}

Expand All @@ -121,7 +121,7 @@ public void Test_Sftp_EndDownloadFile_Invalid_Async_Handle()
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));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public void Test_Sftp_GetAttributes_Not_Exists()
{
sftp.Connect();

Assert.ThrowsException<SftpPathNotFoundException>(() => sftp.GetAttributes("/asdfgh"));
Assert.ThrowsExactly<SftpPathNotFoundException>(() => sftp.GetAttributes("/asdfgh"));
}
}

Expand All @@ -24,7 +24,7 @@ public void Test_Sftp_GetAttributes_Null()
{
sftp.Connect();

Assert.ThrowsException<ArgumentNullException>(() => sftp.GetAttributes(null));
Assert.ThrowsExactly<ArgumentNullException>(() => sftp.GetAttributes(null));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public async Task Test_Sftp_GetAttributesAsync_Not_Exists()

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));
}
}

Expand All @@ -33,7 +33,7 @@ public async Task Test_Sftp_GetAttributesAsync_Null()

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));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void Test_Sftp_ListDirectory_Permission_Denied()
{
sftp.Connect();

Assert.ThrowsException<SftpPermissionDeniedException>(() => sftp.ListDirectory("/root"));
Assert.ThrowsExactly<SftpPermissionDeniedException>(() => sftp.ListDirectory("/root"));
}
}

Expand All @@ -29,7 +29,7 @@ public void Test_Sftp_ListDirectory_Not_Exists()
{
sftp.Connect();

Assert.ThrowsException<SftpPathNotFoundException>(() => sftp.ListDirectory("/asdfgh"));
Assert.ThrowsExactly<SftpPathNotFoundException>(() => sftp.ListDirectory("/asdfgh"));
}
}

Expand Down Expand Up @@ -107,7 +107,7 @@ public void Test_Sftp_ListDirectory_Null()
{
sftp.Connect();

Assert.ThrowsException<ArgumentNullException>(() => sftp.ListDirectory(null));
Assert.ThrowsExactly<ArgumentNullException>(() => sftp.ListDirectory(null));
}
}

Expand Down Expand Up @@ -283,7 +283,7 @@ public void Test_Sftp_ChangeDirectory_Null()
{
sftp.Connect();

Assert.ThrowsException<ArgumentNullException>(() => sftp.ChangeDirectory(null));
Assert.ThrowsExactly<ArgumentNullException>(() => sftp.ChangeDirectory(null));
}
}

Expand All @@ -296,7 +296,7 @@ public async Task Test_Sftp_ChangeDirectory_NullAsync()
{
await sftp.ConnectAsync(CancellationToken.None).ConfigureAwait(false);

await Assert.ThrowsExceptionAsync<ArgumentNullException>(() => sftp.ChangeDirectoryAsync(null));
await Assert.ThrowsExactlyAsync<ArgumentNullException>(() => sftp.ChangeDirectoryAsync(null));
}
}

Expand All @@ -312,7 +312,7 @@ public void Test_Sftp_Call_EndListDirectory_Twice()
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));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void Test_Sftp_RenameFile_Null()
{
sftp.Connect();

Assert.ThrowsException<ArgumentNullException>(() => sftp.RenameFile(null, null));
Assert.ThrowsExactly<ArgumentNullException>(() => sftp.RenameFile(null, null));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public async Task Test_Sftp_RenameFileAsync_Null()
{
await sftp.ConnectAsync(default);

await Assert.ThrowsExceptionAsync<ArgumentNullException>(() => sftp.RenameFileAsync(null, null, default));
await Assert.ThrowsExactlyAsync<ArgumentNullException>(() => sftp.RenameFileAsync(null, null, default));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public void Test_Sftp_Upload_Forbidden()

using (var file = File.OpenRead(uploadedFileName))
{
Assert.ThrowsException<SftpPermissionDeniedException>(() => sftp.UploadFile(file, remoteFileName));
Assert.ThrowsExactly<SftpPermissionDeniedException>(() => sftp.UploadFile(file, remoteFileName));
}

sftp.Disconnect();
Expand Down Expand Up @@ -395,7 +395,7 @@ public void Test_Sftp_BeginUploadFile_StreamIsNull()
{
sftp.Connect();

Assert.ThrowsException<ArgumentNullException>(() => sftp.BeginUploadFile(null, "aaaaa", null, null));
Assert.ThrowsExactly<ArgumentNullException>(() => sftp.BeginUploadFile(null, "aaaaa", null, null));
}
}

Expand All @@ -408,7 +408,7 @@ public void Test_Sftp_BeginUploadFile_FileNameIsWhiteSpace()
{
sftp.Connect();

Assert.ThrowsException<ArgumentException>(() => sftp.BeginUploadFile(new MemoryStream(), " ", null, null));
Assert.ThrowsExactly<ArgumentException>(() => sftp.BeginUploadFile(new MemoryStream(), " ", null, null));
}
}

Expand All @@ -421,7 +421,7 @@ public void Test_Sftp_BeginUploadFile_FileNameIsNull()
{
sftp.Connect();

Assert.ThrowsException<ArgumentNullException>(() => sftp.BeginUploadFile(new MemoryStream(), null, null, null));
Assert.ThrowsExactly<ArgumentNullException>(() => sftp.BeginUploadFile(new MemoryStream(), null, null, null));
}
}

Expand All @@ -438,7 +438,7 @@ public void Test_Sftp_EndUploadFile_Invalid_Async_Handle()
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));
}
}
}
Expand Down
Loading