-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from FrendsPlatform/ISSUE-56
Fixed issue-56: Server fingerprint, documentation and Bug with SourceOperation.Move
- Loading branch information
Showing
18 changed files
with
1,023 additions
and
344 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
204 changes: 204 additions & 0 deletions
204
Frends.SFTP.UploadFiles/Frends.SFTP.UploadFiles.Tests/EncodingTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
using NUnit.Framework; | ||
using System.IO; | ||
using System; | ||
using System.Threading; | ||
using Frends.SFTP.UploadFiles.Definitions; | ||
|
||
namespace Frends.SFTP.UploadFiles.Tests; | ||
|
||
[TestFixture] | ||
class EncodingTests : UploadFilesTestBase | ||
{ | ||
[Test] | ||
public void UploadFiles_TransferWithANSIFileNameEncoding() | ||
{ | ||
var destination = new Destination | ||
{ | ||
Directory = "/upload/Upload", | ||
FileNameEncoding = FileEncoding.ANSI | ||
}; | ||
|
||
var result = SFTP.UploadFiles(_source, destination, _connection, _options, _info, new CancellationToken()); | ||
Assert.IsTrue(result.Success); | ||
Assert.AreEqual(1, result.SuccessfulTransferCount); | ||
} | ||
|
||
[Test] | ||
public void UploadFiles_TransferWithASCIIFileNameEncoding() | ||
{ | ||
var destination = new Destination | ||
{ | ||
Directory = "/upload/Upload", | ||
FileNameEncoding = FileEncoding.ASCII | ||
}; | ||
|
||
var result = SFTP.UploadFiles(_source, destination, _connection, _options, _info, new CancellationToken()); | ||
Assert.IsTrue(result.Success); | ||
Assert.AreEqual(1, result.SuccessfulTransferCount); | ||
} | ||
|
||
[Test] | ||
public void UploadFiles_TransferWithUTF8WithoutBomFileNameEncoding() | ||
{ | ||
var destination = new Destination | ||
{ | ||
Directory = "/upload/Upload", | ||
FileNameEncoding = FileEncoding.UTF8, | ||
EnableBomForFileName = false | ||
}; | ||
|
||
var result = SFTP.UploadFiles(_source, destination, _connection, _options, _info, new CancellationToken()); | ||
Assert.IsTrue(result.Success); | ||
Assert.AreEqual(1, result.SuccessfulTransferCount); | ||
} | ||
|
||
[Test] | ||
public void UploadFiles_TransferWithUTF8WithBomFileNameEncoding() | ||
{ | ||
var destination = new Destination | ||
{ | ||
Directory = "/upload/Upload", | ||
FileNameEncoding = FileEncoding.UTF8, | ||
EnableBomForFileName = true | ||
}; | ||
|
||
var result = SFTP.UploadFiles(_source, destination, _connection, _options, _info, new CancellationToken()); | ||
Assert.IsTrue(result.Success); | ||
Assert.AreEqual(1, result.SuccessfulTransferCount); | ||
} | ||
|
||
[Test] | ||
public void UploadFiles_TransferWithWin1252FileNameEncoding() | ||
{ | ||
var destination = new Destination | ||
{ | ||
Directory = "/upload/Upload", | ||
FileNameEncoding = FileEncoding.WINDOWS1252 | ||
}; | ||
|
||
var result = SFTP.UploadFiles(_source, destination, _connection, _options, _info, new CancellationToken()); | ||
Assert.IsTrue(result.Success); | ||
Assert.AreEqual(1, result.SuccessfulTransferCount); | ||
} | ||
|
||
[Test] | ||
public void UploadFiles_TransferWithOtherFileNameEncoding() | ||
{ | ||
var destination = new Destination | ||
{ | ||
Directory = "/upload/Upload", | ||
FileNameEncoding = FileEncoding.Other, | ||
FileNameEncodingInString = "windows-1252" | ||
}; | ||
|
||
var result = SFTP.UploadFiles(_source, destination, _connection, _options, _info, new CancellationToken()); | ||
Assert.IsTrue(result.Success); | ||
Assert.AreEqual(1, result.SuccessfulTransferCount); | ||
} | ||
|
||
[Test] | ||
public void UploadFiles_TransferWithASCIIFileContentEncoding() | ||
{ | ||
var destination = new Destination | ||
{ | ||
Directory = "/upload/Upload", | ||
FileContentEncoding = FileEncoding.ASCII, | ||
Action = DestinationAction.Append | ||
}; | ||
|
||
Helpers.UploadSingleTestFile(destination.Directory, Path.Combine(_workDir, _source.FileName)); | ||
|
||
var result = SFTP.UploadFiles(_source, destination, _connection, _options, _info, new CancellationToken()); | ||
Assert.IsTrue(result.Success); | ||
Assert.AreEqual(1, result.SuccessfulTransferCount); | ||
} | ||
|
||
[Test] | ||
public void UploadFiles_TransferWithANSIFileContentEncoding() | ||
{ | ||
var destination = new Destination | ||
{ | ||
Directory = "/upload/Upload", | ||
FileContentEncoding = FileEncoding.ANSI, | ||
Action = DestinationAction.Append | ||
}; | ||
|
||
Helpers.UploadSingleTestFile(destination.Directory, Path.Combine(_workDir, _source.FileName)); | ||
|
||
var result = SFTP.UploadFiles(_source, destination, _connection, _options, _info, new CancellationToken()); | ||
Assert.IsTrue(result.Success); | ||
Assert.AreEqual(1, result.SuccessfulTransferCount); | ||
} | ||
|
||
[Test] | ||
public void UploadFiles_TransferWithUTF8WithBomFileContentEncoding() | ||
{ | ||
var destination = new Destination | ||
{ | ||
Directory = "/upload/Upload", | ||
FileContentEncoding = FileEncoding.UTF8, | ||
EnableBomForContent = true, | ||
Action = DestinationAction.Append | ||
}; | ||
|
||
Helpers.UploadSingleTestFile(destination.Directory, Path.Combine(_workDir, _source.FileName)); | ||
|
||
var result = SFTP.UploadFiles(_source, destination, _connection, _options, _info, new CancellationToken()); | ||
Assert.IsTrue(result.Success); | ||
Assert.AreEqual(1, result.SuccessfulTransferCount); | ||
} | ||
|
||
[Test] | ||
public void UploadFiles_TransferWithUTF8WithoutBomFileContentEncoding() | ||
{ | ||
var destination = new Destination | ||
{ | ||
Directory = "/upload/Upload", | ||
FileContentEncoding = FileEncoding.UTF8, | ||
EnableBomForContent = false, | ||
Action = DestinationAction.Append | ||
}; | ||
|
||
Helpers.UploadSingleTestFile(destination.Directory, Path.Combine(_workDir, _source.FileName)); | ||
|
||
var result = SFTP.UploadFiles(_source, destination, _connection, _options, _info, new CancellationToken()); | ||
Assert.IsTrue(result.Success); | ||
Assert.AreEqual(1, result.SuccessfulTransferCount); | ||
} | ||
|
||
[Test] | ||
public void UploadFiles_TransferWithWIN1252FileContentEncoding() | ||
{ | ||
var destination = new Destination | ||
{ | ||
Directory = "/upload/Upload", | ||
FileContentEncoding = FileEncoding.WINDOWS1252, | ||
Action = DestinationAction.Append | ||
}; | ||
|
||
Helpers.UploadSingleTestFile(destination.Directory, Path.Combine(_workDir, _source.FileName)); | ||
|
||
var result = SFTP.UploadFiles(_source, destination, _connection, _options, _info, new CancellationToken()); | ||
Assert.IsTrue(result.Success); | ||
Assert.AreEqual(1, result.SuccessfulTransferCount); | ||
} | ||
|
||
[Test] | ||
public void UploadFiles_TransferWithOtherFileContentEncoding() | ||
{ | ||
var destination = new Destination | ||
{ | ||
Directory = "/upload/Upload", | ||
FileContentEncoding = FileEncoding.Other, | ||
FileContentEncodingInString = "Windows-1252", | ||
Action = DestinationAction.Append | ||
}; | ||
|
||
Helpers.UploadSingleTestFile(destination.Directory, Path.Combine(_workDir, _source.FileName)); | ||
|
||
var result = SFTP.UploadFiles(_source, destination, _connection, _options, _info, new CancellationToken()); | ||
Assert.IsTrue(result.Success); | ||
Assert.AreEqual(1, result.SuccessfulTransferCount); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.