Skip to content

Commit 76a6476

Browse files
WojciechNagorskiPatrick-3000Rob-Hague
authored
Move test projects (#1211)
* Enable list directory async for net framework (#1206) * Enable ListDirectoryAsync for .NET Framework * Removed (now) unused constant. * Remove placeholder tests (#1183) * Remove placeholder tests * Move Reverse perf test to benchmarks project --------- Co-authored-by: Wojciech Nagórski <[email protected]> * Fix integration test after moving test projects --------- Co-authored-by: Patrick-3000 <[email protected]> Co-authored-by: Rob Hague <[email protected]>
1 parent 20f4bc1 commit 76a6476

File tree

127 files changed

+71
-7863
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+71
-7863
lines changed

src/Renci.SshNet/ISftpClient.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,6 @@ public interface ISftpClient : IBaseClient, IDisposable
700700
/// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
701701
IEnumerable<ISftpFile> ListDirectory(string path, Action<int> listCallback = null);
702702

703-
#if FEATURE_ASYNC_ENUMERABLE
704703
/// <summary>
705704
/// Asynchronously enumerates the files in remote directory.
706705
/// </summary>
@@ -716,7 +715,6 @@ public interface ISftpClient : IBaseClient, IDisposable
716715
/// <exception cref="SshException">A SSH error where <see cref="Exception.Message" /> is the message from the remote host.</exception>
717716
/// <exception cref="ObjectDisposedException">The method was called after the client was disposed.</exception>
718717
IAsyncEnumerable<ISftpFile> ListDirectoryAsync(string path, CancellationToken cancellationToken);
719-
#endif //FEATURE_ASYNC_ENUMERABLE
720718

721719
/// <summary>
722720
/// Opens a <see cref="SftpFileStream"/> on the specified path with read/write access.

src/Renci.SshNet/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
[assembly: Guid("ad816c5e-6f13-4589-9f3e-59523f8b77a4")]
77
[assembly: InternalsVisibleTo("Renci.SshNet.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f9194e1eb66b7e2575aaee115ee1d27bc100920e7150e43992d6f668f9737de8b9c7ae892b62b8a36dd1d57929ff1541665d101dc476d6e02390846efae7e5186eec409710fdb596e3f83740afef0d4443055937649bc5a773175b61c57615dac0f0fd10f52b52fedf76c17474cc567b3f7a79de95dde842509fb39aaf69c6c2")]
88
[assembly: InternalsVisibleTo("Renci.SshNet.IntegrationTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f9194e1eb66b7e2575aaee115ee1d27bc100920e7150e43992d6f668f9737de8b9c7ae892b62b8a36dd1d57929ff1541665d101dc476d6e02390846efae7e5186eec409710fdb596e3f83740afef0d4443055937649bc5a773175b61c57615dac0f0fd10f52b52fedf76c17474cc567b3f7a79de95dde842509fb39aaf69c6c2")]
9+
[assembly: InternalsVisibleTo("Renci.SshNet.Benchmarks, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f9194e1eb66b7e2575aaee115ee1d27bc100920e7150e43992d6f668f9737de8b9c7ae892b62b8a36dd1d57929ff1541665d101dc476d6e02390846efae7e5186eec409710fdb596e3f83740afef0d4443055937649bc5a773175b61c57615dac0f0fd10f52b52fedf76c17474cc567b3f7a79de95dde842509fb39aaf69c6c2")]
910
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]

src/Renci.SshNet/Renci.SshNet.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
<PackageReference Include="SshNet.Security.Cryptography" Version="[1.3.0]" />
1414
</ItemGroup>
1515

16+
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' or '$(TargetFramework)' == 'netstandard2.0' ">
17+
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" />
18+
</ItemGroup>
19+
1620
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' ">
1721
<DefineConstants>FEATURE_SOCKET_TAP;FEATURE_SOCKET_APM;FEATURE_SOCKET_EAP;FEATURE_DNS_SYNC;FEATURE_DNS_APM;FEATURE_DNS_TAP</DefineConstants>
1822
</PropertyGroup>
19-
20-
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' ">
21-
<DefineConstants>$(DefineConstants);FEATURE_ASYNC_ENUMERABLE</DefineConstants>
22-
</PropertyGroup>
2323
</Project>

src/Renci.SshNet/SftpClient.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
using Renci.SshNet.Common;
1111
using Renci.SshNet.Sftp;
1212
using System.Threading.Tasks;
13-
#if FEATURE_ASYNC_ENUMERABLE
1413
using System.Runtime.CompilerServices;
15-
#endif
1614

1715
namespace Renci.SshNet
1816
{
@@ -587,7 +585,6 @@ public IEnumerable<ISftpFile> ListDirectory(string path, Action<int> listCallbac
587585
return InternalListDirectory(path, listCallback);
588586
}
589587

590-
#if FEATURE_ASYNC_ENUMERABLE
591588
/// <summary>
592589
/// Asynchronously enumerates the files in remote directory.
593590
/// </summary>
@@ -646,7 +643,6 @@ public async IAsyncEnumerable<ISftpFile> ListDirectoryAsync(string path, [Enumer
646643
await _sftpSession.RequestCloseAsync(handle, cancellationToken).ConfigureAwait(false);
647644
}
648645
}
649-
#endif //FEATURE_ASYNC_ENUMERABLE
650646

651647
/// <summary>
652648
/// Begins an asynchronous operation of retrieving list of files in remote directory.
@@ -1613,7 +1609,7 @@ public Task<SftpFileStream> OpenAsync(string path, FileMode mode, FileAccess acc
16131609

16141610
cancellationToken.ThrowIfCancellationRequested();
16151611

1616-
return SftpFileStream.OpenAsync(_sftpSession, path, mode, access, (int)_bufferSize, cancellationToken);
1612+
return SftpFileStream.OpenAsync(_sftpSession, path, mode, access, (int) _bufferSize, cancellationToken);
16171613
}
16181614

16191615
/// <summary>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using BenchmarkDotNet.Attributes;
2+
3+
using Renci.SshNet.Common;
4+
5+
namespace Renci.SshNet.Benchmarks.Common
6+
{
7+
public class ExtensionsBenchmarks
8+
{
9+
private byte[]? _data;
10+
11+
[Params(1000, 10000)]
12+
public int N;
13+
14+
[GlobalSetup]
15+
public void Setup()
16+
{
17+
_data = new byte[N];
18+
new Random(42).NextBytes(_data);
19+
}
20+
21+
[Benchmark]
22+
public byte[] Reverse()
23+
{
24+
return _data.Reverse();
25+
}
26+
}
27+
}

test/Renci.SshNet.IntegrationTests/TestsFixtures/InfrastructureFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public async Task InitializeAsync()
3636
{
3737
_sshServerImage = new ImageFromDockerfileBuilder()
3838
.WithName("renci-ssh-tests-server-image")
39-
.WithDockerfileDirectory(CommonDirectoryPath.GetSolutionDirectory(), "Renci.SshNet.IntegrationTests")
39+
.WithDockerfileDirectory(CommonDirectoryPath.GetSolutionDirectory(), Path.Combine("test", "Renci.SshNet.IntegrationTests"))
4040
.WithDockerfile("Dockerfile")
4141
.WithDeleteIfExists(true)
4242

test/Renci.SshNet.Tests/Classes/CipherInfoTest.cs

Lines changed: 0 additions & 29 deletions
This file was deleted.

test/Renci.SshNet.Tests/Classes/Common/AsyncResultTest.cs

Lines changed: 0 additions & 136 deletions
This file was deleted.

0 commit comments

Comments
 (0)