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,26 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LCU.Api.Internal.FTPLib\LCU.Api.Internal.FTPLib.csproj" />
<ProjectReference Include="..\LCU.Api.Internal.FTP\LCU.Api.Internal.FTP.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="example.csv">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
@@ -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);
}
}
@@ -0,0 +1,4 @@
Name,Job Title,Address,State,City
John Doe,Designer,325 Pine Street,,Seattle
,,,,
Edward Green,Developer,110 Pike Street,WA,Seattle
1 Name Job Title Address State City
2 John Doe Designer 325 Pine Street Seattle
3
4 Edward Green Developer 110 Pike Street WA Seattle