Quantcast
Channel: sshnet Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1026

Created Unassigned: sftpClient and Exists method [2783]

$
0
0
I have wrote this simple test in MsTest:

[TestMethod]
public void TestExist()
{
// arrange
var filename = "filename.txt";
var file = new MemoryStream(this.GetBytes("This is a test"));

var cl = new SftpClient(configurator.Object.AppSettings["ftpServerURL"],
configurator.Object.GetIntValueFromAppSettings("ftpPortNumber"),
configurator.Object.AppSettings["ftpUsername"],
configurator.Object.AppSettings["ftpPassword"]);
cl.Connect();
cl.UploadFile(file, filename);

// act
var result = cl.Exists(filename);

// assert
Assert.AreEqual(true, result);
}

private byte[] GetBytes(string str)
{
byte[] bytes = new byte[str.Length * sizeof(char)];
System.Buffer.BlockCopy(str.ToCharArray(), 0, bytes, 0, bytes.Length);
return bytes;
}

Though the file is correctly uploaded to the FTP the assertion is not verified. Why?

Viewing all articles
Browse latest Browse all 1026

Trending Articles