This commit is contained in:
Zeeshaun
2026-03-24 15:28:37 -05:00
parent 9cc87337b8
commit 73d62efb39
58 changed files with 2952 additions and 0 deletions
@@ -0,0 +1,46 @@
using System.IO;
using NUnit.Framework;
using Newtonsoft.Json;
using LCU.Api.Internal.FTPLib.Models.Enums;
using LCU.Api.Internal.FTPLib.Models;
using LCU.Api.Internal.FTP.Services.FtpOpertionServices;
namespace LCU.Api.Internal.FTP.IntegrationTests;
public class SshFtpServiceTest
{
[SetUp]
public void Setup()
{
// Local docker SFTP Server setup:
// docker run -p 22:22 -d emberstack/sftp --name sftp -v /host/demo:/c/dev/sftp
}
/// <summary>
/// This test shows that we can use the SSH.NET sftp to easily transfer via byte array with no filesystem dependency
/// </summary>
[Test]
[Ignore("Can only be run locally for now.")]
public void TestSshFileRequest()
{
var request = new SshFtpRequest()
{
HostName = "127.0.0.1",
PortNumber = 22,
Password = "demo",
UserName = "demo",
Protocol = ProtocolType.Sftp,
RemoteFilePath = "test_uploaded1.csv",
LocalFileData = File.ReadAllBytes("example.csv")
};
var queueRequest = new QueueRequest()
{
Request = JsonConvert.SerializeObject(request),
FtpType = FtpType.SshFtp
};
var service = new SshFtpService();
var result = service.ExecuteAction(queueRequest);
Assert.True(result.IsSuccessful);
}
}