mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-11 13:39:09 +00:00
c0a353a4de
* Preparation to enforce formatting and style in CI - enabled IDE0055 to enforce formatting on build - disabled SA1137 and SA1025 because they are already covered by IDE0055 - disabled SA1021 because it conflicts with csharp_space_after_cast * Cleanup formatting and style on codebase This commit has no manual changes, it is the result of running "dotnet format whitespace" and "dotnet format style" * new formatting fixes after merge * appveyor: set git autocrlf as suggested by sharwell to hopefully fix Windows CI. * use autocrlf input to hopefully fix Linux tests * fix formatting * use autocrlf input for Linux only * set csharp_space_after_cast to false * Revert SA1021 suppression --------- Co-authored-by: Robert Hague <rh@johnstreetcapital.com>
42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
namespace Renci.SshNet.IntegrationTests
|
|
{
|
|
/// <summary>
|
|
/// The SCP client integration tests
|
|
/// </summary>
|
|
[TestClass]
|
|
public class ScpClientTests : IntegrationTestBase, IDisposable
|
|
{
|
|
private readonly ScpClient _scpClient;
|
|
|
|
public ScpClientTests()
|
|
{
|
|
_scpClient = new ScpClient(SshServerHostName, SshServerPort, User.UserName, User.Password);
|
|
_scpClient.Connect();
|
|
}
|
|
|
|
[TestMethod]
|
|
|
|
public void Upload_And_Download_FileStream()
|
|
{
|
|
var file = $"/tmp/{Guid.NewGuid()}.txt";
|
|
var fileContent = "File content !@#$%^&*()_+{}:,./<>[];'\\|";
|
|
|
|
using var uploadStream = new MemoryStream(Encoding.UTF8.GetBytes(fileContent));
|
|
_scpClient.Upload(uploadStream, file);
|
|
|
|
using var downloadStream = new MemoryStream();
|
|
_scpClient.Download(file, downloadStream);
|
|
|
|
var result = Encoding.UTF8.GetString(downloadStream.ToArray());
|
|
|
|
Assert.AreEqual(fileContent, result);
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
_scpClient.Disconnect();
|
|
_scpClient.Dispose();
|
|
}
|
|
}
|
|
}
|