-
-
Notifications
You must be signed in to change notification settings - Fork 952
ListDirectoryAsync return IAsyncEnumerable #1126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
14f4838
1b0732d
ef915c7
eafa871
582d6a3
aaf8790
a1b3dd6
5fbaba6
17e7abe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,10 @@ | |
using System; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
#if NET6_0_OR_GREATER | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
#endif | ||
|
||
namespace Renci.SshNet.Tests.Classes | ||
{ | ||
|
@@ -89,6 +93,30 @@ public void Test_Sftp_ListDirectory_Current() | |
} | ||
} | ||
|
||
#if NET6_0_OR_GREATER | ||
[TestMethod] | ||
[TestCategory("Sftp")] | ||
[TestCategory("integration")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this test unnecessary now that there is an integration tests project? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I plan to rewrite all integration tests in the new approach, so this will be removed. |
||
public async Task Test_Sftp_ListDirectoryAsync_Current() | ||
{ | ||
using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD)) | ||
{ | ||
sftp.Connect(); | ||
var cts = new CancellationTokenSource(); | ||
cts.CancelAfter(TimeSpan.FromMinutes(1)); | ||
var count = 0; | ||
await foreach(var file in sftp.ListDirectoryAsync(".", cts.Token)) | ||
{ | ||
count++; | ||
Debug.WriteLine(file.FullName); | ||
} | ||
|
||
Assert.IsTrue(count > 0); | ||
|
||
sftp.Disconnect(); | ||
} | ||
} | ||
#endif | ||
[TestMethod] | ||
[TestCategory("Sftp")] | ||
[TestCategory("integration")] | ||
|
@@ -265,4 +293,4 @@ public void Test_Sftp_Call_EndListDirectory_Twice() | |
} | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,18 +2,22 @@ | |
<PropertyGroup> | ||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> | ||
<AssemblyName>Renci.SshNet</AssemblyName> | ||
<TargetFrameworks>net462;netstandard2.0;net6.0;net7.0</TargetFrameworks> | ||
<TargetFrameworks>net462;netstandard2.0;netstandard2.1;net6.0;net7.0</TargetFrameworks> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What was the motivation to add a netstandard2.1 target, given that net6.0 is the lowest supported platform that can use it? Should the test projects have a net5.0 (or earlier) target in order to test the netstandard2.1 target? Is it worth it for a new feature? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-1#select-net-standard-version I am open to discussing this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did not think of that. But given any platform supporting netstandard2.1 would also support netstandard2.0, the only advantage is the extra APIs available e.g. And if we are adding new features using those APIs, at some point the implementation may differ from the .NET implementation, and we then probably ought to have test coverage by using an older target. That doesn't apply here, so while I would vote to drop netstandard2.1, I think it's fine for now. |
||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition=" '$(TargetFramework)' == 'net462' "> | ||
<DefineConstants>FEATURE_BINARY_SERIALIZATION;FEATURE_SOCKET_EAP;FEATURE_SOCKET_APM;FEATURE_DNS_SYNC;FEATURE_HASH_RIPEMD160_CREATE;FEATURE_HMAC_RIPEMD160</DefineConstants> | ||
</PropertyGroup> | ||
|
||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' "> | ||
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' "> | ||
<PackageReference Include="SshNet.Security.Cryptography" Version="[1.3.0]" /> | ||
</ItemGroup> | ||
|
||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' "> | ||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' "> | ||
<DefineConstants>FEATURE_SOCKET_TAP;FEATURE_SOCKET_APM;FEATURE_SOCKET_EAP;FEATURE_DNS_SYNC;FEATURE_DNS_APM;FEATURE_DNS_TAP</DefineConstants> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' "> | ||
<DefineConstants>$(DefineConstants);FEATURE_ASYNC_ENUMERABLE</DefineConstants> | ||
</PropertyGroup> | ||
</Project> |
Uh oh!
There was an error while loading. Please reload this page.