Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion test/Renci.SshNet.IntegrationTests/SftpTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,13 @@ public void Sftp_BeginUploadFile()
using (var memoryStream = new MemoryStream(Encoding.ASCII.GetBytes(content)))
{
IAsyncResult asyncResultCallback = null;
var callbackCalled = new ManualResetEvent(false);

var asyncResult = client.BeginUploadFile(memoryStream, remoteFile, ar => asyncResultCallback = ar);
var asyncResult = client.BeginUploadFile(memoryStream, remoteFile, ar =>
{
asyncResultCallback = ar;
callbackCalled.Set();
});

Assert.IsTrue(asyncResult.AsyncWaitHandle.WaitOne(10000));

Expand All @@ -145,6 +150,8 @@ public void Sftp_BeginUploadFile()
Assert.IsFalse(sftpUploadAsyncResult.CompletedSynchronously);
Assert.AreEqual(expectedByteCount, sftpUploadAsyncResult.UploadedBytes);

Assert.IsTrue(callbackCalled.WaitOne(10000));

// check async result callback
var sftpUploadAsyncResultCallback = asyncResultCallback as SftpUploadAsyncResult;
Assert.IsNotNull(sftpUploadAsyncResultCallback);
Expand Down