Skip to content

Commit 9ff0cea

Browse files
Address warnings in test classes.
1 parent 459ebc7 commit 9ff0cea

2 files changed

Lines changed: 34 additions & 28 deletions

File tree

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,30 @@
11
using System;
2+
23
using Microsoft.VisualStudio.TestTools.UnitTesting;
4+
35
using Renci.SshNet.Common;
46
using Renci.SshNet.Tests.Properties;
57

6-
namespace Renci.SshNet.Tests.Classes;
7-
8-
public partial class SftpClientTest
8+
namespace Renci.SshNet.Tests.Classes
99
{
10-
[TestMethod]
11-
public void GetAttributes_Throws_WhenNotConnected()
10+
public partial class SftpClientTest
1211
{
13-
using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
12+
[TestMethod]
13+
public void GetAttributes_Throws_WhenNotConnected()
1414
{
15-
Assert.ThrowsException<SshConnectionException>(() => sftp.GetAttributes("."));
15+
using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
16+
{
17+
Assert.ThrowsException<SshConnectionException>(() => sftp.GetAttributes("."));
18+
}
1619
}
17-
}
1820

19-
[TestMethod]
20-
public void GetAttributes_Throws_WhenDisposed()
21-
{
22-
var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD);
23-
sftp.Dispose();
21+
[TestMethod]
22+
public void GetAttributes_Throws_WhenDisposed()
23+
{
24+
var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD);
25+
sftp.Dispose();
2426

25-
Assert.ThrowsException<ObjectDisposedException>(() => sftp.GetAttributes("."));
27+
Assert.ThrowsException<ObjectDisposedException>(() => sftp.GetAttributes("."));
28+
}
2629
}
2730
}
Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,32 @@
11
using System;
22
using System.Threading;
33
using System.Threading.Tasks;
4+
45
using Microsoft.VisualStudio.TestTools.UnitTesting;
6+
57
using Renci.SshNet.Common;
68
using Renci.SshNet.Tests.Properties;
79

8-
namespace Renci.SshNet.Tests.Classes;
9-
10-
public partial class SftpClientTest
10+
namespace Renci.SshNet.Tests.Classes
1111
{
12-
[TestMethod]
13-
public async Task GetAttributesAsync_Throws_WhenNotConnected()
12+
public partial class SftpClientTest
1413
{
15-
using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
14+
[TestMethod]
15+
public async Task GetAttributesAsync_Throws_WhenNotConnected()
1616
{
17-
await Assert.ThrowsExceptionAsync<SshConnectionException>(() => sftp.GetAttributesAsync(".", CancellationToken.None));
17+
using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
18+
{
19+
await Assert.ThrowsExceptionAsync<SshConnectionException>(() => sftp.GetAttributesAsync(".", CancellationToken.None));
20+
}
1821
}
19-
}
2022

21-
[TestMethod]
22-
public async Task GetAttributesAsync_Throws_WhenDisposed()
23-
{
24-
var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD);
25-
sftp.Dispose();
23+
[TestMethod]
24+
public async Task GetAttributesAsync_Throws_WhenDisposed()
25+
{
26+
var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD);
27+
sftp.Dispose();
2628

27-
await Assert.ThrowsExceptionAsync<ObjectDisposedException>(() => sftp.GetAttributesAsync(".", CancellationToken.None));
29+
await Assert.ThrowsExceptionAsync<ObjectDisposedException>(() => sftp.GetAttributesAsync(".", CancellationToken.None));
30+
}
2831
}
2932
}

0 commit comments

Comments
 (0)