| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- using Renci.SshNet.Common;
- namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
- {
- /// <summary>
- /// Implementation of the SSH File Transfer Protocol (SFTP) over SSH.
- /// </summary>
- public partial class SftpClientTest
- {
- [TestMethod]
- [TestCategory("Sftp")]
- public async Task Test_Sftp_GetAttributesAsync_Not_Exists()
- {
- using (var sftp = new SftpClient(SshServerHostName, SshServerPort, User.UserName, User.Password))
- {
- var cts = new CancellationTokenSource();
- cts.CancelAfter(TimeSpan.FromMinutes(1));
- await sftp.ConnectAsync(cts.Token);
- await Assert.ThrowsExceptionAsync<SftpPathNotFoundException>(async () => await sftp.GetAttributesAsync("/asdfgh", cts.Token));
- }
- }
- [TestMethod]
- [TestCategory("Sftp")]
- public async Task Test_Sftp_GetAttributesAsync_Null()
- {
- using (var sftp = new SftpClient(SshServerHostName, SshServerPort, User.UserName, User.Password))
- {
- var cts = new CancellationTokenSource();
- cts.CancelAfter(TimeSpan.FromMinutes(1));
- await sftp.ConnectAsync(cts.Token);
- await Assert.ThrowsExceptionAsync<ArgumentNullException>(async () => await sftp.GetAttributesAsync(null, cts.Token));
- }
- }
- [TestMethod]
- [TestCategory("Sftp")]
- public async Task Test_Sftp_GetAttributesAsync_Current()
- {
- using (var sftp = new SftpClient(SshServerHostName, SshServerPort, User.UserName, User.Password))
- {
- var cts = new CancellationTokenSource();
- cts.CancelAfter(TimeSpan.FromMinutes(1));
- await sftp.ConnectAsync(cts.Token);
- var fileAttributes = await sftp.GetAttributesAsync(".", cts.Token);
- Assert.IsNotNull(fileAttributes);
- sftp.Disconnect();
- }
- }
- }
- }
|