Merge remote-tracking branch 'upstream/develop' into net10

This commit is contained in:
Marius Thesing
2025-11-15 09:18:34 +01:00
225 changed files with 642 additions and 549 deletions
+6 -6
View File
@@ -48,7 +48,7 @@ jobs:
test/Renci.SshNet.IntegrationTests/
- name: Archive Coverlet Results
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: Coverlet Results Linux
path: coverlet
@@ -74,7 +74,7 @@ jobs:
run: dotnet pack
- name: Archive NuGet Package
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: NuGet Package
path: src/Renci.SshNet/bin/Release/*.*nupkg
@@ -140,7 +140,7 @@ jobs:
test\Renci.SshNet.IntegrationTests\
- name: Archive Coverlet Results
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: Coverlet Results Windows .NET Framework
path: coverlet
@@ -182,7 +182,7 @@ jobs:
test\Renci.SshNet.IntegrationTests\
- name: Archive Coverlet Results
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: Coverlet Results Windows .NET
path: coverlet
@@ -200,7 +200,7 @@ jobs:
- Windows-Integration-Tests-Net
steps:
- name: Download NuGet Package
uses: actions/download-artifact@v5
uses: actions/download-artifact@v6
with:
name: NuGet Package
@@ -229,7 +229,7 @@ jobs:
- Windows-Integration-Tests-Net
steps:
- name: Download NuGet Package
uses: actions/download-artifact@v5
uses: actions/download-artifact@v6
with:
name: NuGet Package
+2 -1
View File
@@ -11,9 +11,10 @@
<PackageVersion Include="GitHubActionsTestLogger" Version="2.4.1" />
<PackageVersion Include="Meziantou.Analyzer" Version="2.0.220" />
<!-- Should stay on LTS .NET releases. -->
<PackageVersion Include="Microsoft.Bcl.Cryptography" Version="10.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.3" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="10.0.0" />
<PackageVersion Include="MSTest" Version="3.9.3" />
<PackageVersion Include="MSTest" Version="4.0.2" />
<PackageVersion Include="Moq" Version="4.20.72" />
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.7.115" />
<PackageVersion Include="PolySharp" Version="1.15.0" />
+5 -1
View File
@@ -49,7 +49,11 @@
</PackageReference>
</ItemGroup>
<ItemGroup Condition=" !$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0')) ">
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
<PackageReference Include="Microsoft.Bcl.Cryptography" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="System.Formats.Asn1" />
</ItemGroup>
@@ -1,4 +1,4 @@
#if NET
#if !NETSTANDARD
using System;
using System.Security.Cryptography;
@@ -15,7 +15,7 @@ namespace Renci.SshNet.Security.Cryptography.Ciphers
private const int TagSizeInBytes = 16;
private readonly byte[] _iv;
private readonly int _aadLength;
#if NET
#if !NETSTANDARD
private readonly Impl _impl;
#else
private readonly BouncyCastleImpl _impl;
@@ -62,7 +62,7 @@ namespace Renci.SshNet.Security.Cryptography.Ciphers
// SSH AES-GCM requires a 12-octet Initial IV
_iv = iv.Take(12);
_aadLength = aadLength;
#if NET
#if !NETSTANDARD
if (System.Security.Cryptography.AesGcm.IsSupported)
{
_impl = new BclImpl(key, _iv);
+6
View File
@@ -102,6 +102,12 @@ dotnet_diagnostic.SA1623.severity = none
# For unit test projects, we do not care about documentation.
dotnet_diagnostic.SA1629.severity = none
# Workaround https://github.com/SonarSource/sonar-dotnet/issues/9767
dotnet_diagnostic.S1450.severity = none
dotnet_diagnostic.S1764.severity = none
dotnet_diagnostic.S3260.severity = none
dotnet_diagnostic.S5445.severity = none
#### .NET Compiler Platform analysers rules ####
# CA1001: Types that own disposable fields should be disposable
@@ -0,0 +1 @@
[assembly: DoNotParallelize]
@@ -436,7 +436,7 @@ namespace Renci.SshNet.IntegrationTests
catch (SshAuthenticationException ex)
{
Assert.IsNull(ex.InnerException);
Assert.IsTrue(ex.Message.StartsWith("AuthenticationPrompt.Response is null for prompt \"Password: \""), $"Message was \"{ex.Message}\"");
Assert.StartsWith("AuthenticationPrompt.Response is null for prompt \"Password: \"", ex.Message);
}
}
}
@@ -432,7 +432,7 @@ namespace Renci.SshNet.IntegrationTests
var ex = Assert.Throws<SshConnectionException>(client.Connect);
Assert.AreEqual(DisconnectReason.KeyExchangeFailed, ex.DisconnectReason);
Assert.IsTrue(ex.Message.StartsWith("No matching host key algorithm"), ex.Message);
Assert.StartsWith("No matching host key algorithm", ex.Message);
}
}
@@ -0,0 +1,40 @@
#nullable enable
using Microsoft.Extensions.Logging;
namespace Renci.SshNet.IntegrationTests.Logging
{
internal class TestConsoleLogger(string categoryName) : ILogger
{
public IDisposable? BeginScope<TState>(TState state)
where TState : notnull
{
return null;
}
public bool IsEnabled(LogLevel logLevel)
{
return true;
}
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
{
StringBuilder sb = new StringBuilder();
sb.Append(logLevel);
sb.Append(": ");
sb.Append(categoryName);
sb.Append(": ");
string message = formatter(state, exception);
sb.Append(message);
if (exception != null)
{
sb.Append(": ");
sb.Append(exception);
}
string line = sb.ToString();
Console.WriteLine(line);
}
}
}
@@ -0,0 +1,18 @@
#nullable enable
using Microsoft.Extensions.Logging;
namespace Renci.SshNet.IntegrationTests.Logging
{
internal class TestConsoleLoggerProvider : ILoggerProvider
{
public ILogger CreateLogger(string categoryName)
{
return new TestConsoleLogger(categoryName);
}
public void Dispose()
{
}
}
}
@@ -0,0 +1,16 @@
#nullable enable
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Logging;
namespace Renci.SshNet.IntegrationTests.Logging
{
internal static class TestConsoleLoggerProviderExtensions
{
internal static void AddTestConsoleLogger(this ILoggingBuilder builder)
{
builder.Services.TryAddEnumerable(ServiceDescriptor.Singleton<ILoggerProvider, TestConsoleLoggerProvider>());
}
}
}
@@ -43,7 +43,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
var files = sftp.ListDirectory(".");
Assert.IsTrue(files.Count() > 0);
Assert.IsGreaterThan(0, files.Count());
foreach (var file in files)
{
@@ -71,7 +71,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
Debug.WriteLine(file.FullName);
}
Assert.IsTrue(count > 0);
Assert.IsGreaterThan(0, count);
sftp.Disconnect();
}
@@ -87,7 +87,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
var files = sftp.ListDirectory(string.Empty);
Assert.IsTrue(files.Count() > 0);
Assert.IsGreaterThan(0, files.Count());
foreach (var file in files)
{
@@ -128,7 +128,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
var files = sftp.ListDirectory(".");
// Ensure that directory has at least 10000 items
Assert.IsTrue(files.Count() > 10000);
Assert.IsGreaterThan(10000, files.Count());
sftp.Disconnect();
}
@@ -158,7 +158,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
var files = sftp.ListDirectory(".");
Assert.IsTrue(files.First().FullName.StartsWith(string.Format("{0}", sftp.WorkingDirectory)));
Assert.StartsWith(string.Format("{0}", sftp.WorkingDirectory), files.First().FullName);
sftp.ChangeDirectory("test1_1");
@@ -178,7 +178,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
files = sftp.ListDirectory("test1/test1_1");
Assert.IsTrue(files.First().FullName.StartsWith(string.Format("{0}/test1/test1_1", sftp.WorkingDirectory)));
Assert.StartsWith(string.Format("{0}/test1/test1_1", sftp.WorkingDirectory), files.First().FullName);
sftp.ChangeDirectory("test1/test1_1");
@@ -227,7 +227,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
var files = sftp.ListDirectory(".");
Assert.IsTrue(files.First().FullName.StartsWith(string.Format("{0}", sftp.WorkingDirectory)));
Assert.StartsWith(string.Format("{0}", sftp.WorkingDirectory), files.First().FullName);
await sftp.ChangeDirectoryAsync("test1_1", CancellationToken.None).ConfigureAwait(false);
@@ -247,7 +247,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
files = sftp.ListDirectory("test1/test1_1");
Assert.IsTrue(files.First().FullName.StartsWith(string.Format("{0}/test1/test1_1", sftp.WorkingDirectory)));
Assert.StartsWith(string.Format("{0}/test1/test1_1", sftp.WorkingDirectory), files.First().FullName);
await sftp.ChangeDirectoryAsync("test1/test1_1", CancellationToken.None).ConfigureAwait(false);
@@ -24,7 +24,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
string searchPattern = Path.GetFileName(uploadedFileName);
var upLoadedFiles = sftp.SynchronizeDirectories(sourceDir, destDir, searchPattern);
Assert.IsTrue(upLoadedFiles.Count() > 0);
Assert.IsGreaterThan(0, upLoadedFiles.Count());
foreach (var file in upLoadedFiles)
{
@@ -63,7 +63,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
var upLoadedFiles = sftp.EndSynchronizeDirectories(asyncResult);
Assert.IsTrue(upLoadedFiles.Count() > 0);
Assert.IsGreaterThan(0, upLoadedFiles.Count());
foreach (var file in upLoadedFiles)
{
@@ -54,7 +54,6 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
}
[TestMethod]
[Timeout(5000)]
public void Test_CancelAsync_Unfinished_Command()
{
using var client = new SshClient(SshServerHostName, SshServerPort, User.UserName, User.Password);
@@ -76,7 +75,6 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
}
[TestMethod]
[Timeout(5000)]
public async Task Test_CancelAsync_Kill_Unfinished_Command()
{
using var client = new SshClient(SshServerHostName, SshServerPort, User.UserName, User.Password);
@@ -122,7 +120,6 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
}
[TestMethod]
[Timeout(5000)]
public async Task Test_ExecuteAsync_CancellationToken()
{
using var client = new SshClient(SshServerHostName, SshServerPort, User.UserName, User.Password);
@@ -195,7 +192,6 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
}
[TestMethod]
[Timeout(15000)]
public async Task Test_ExecuteAsync_Disconnect()
{
using (var client = new SshClient(SshServerHostName, SshServerPort, User.UserName, User.Password))
@@ -226,7 +222,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
{
Assert.Fail("Operation should fail");
}
Assert.IsTrue(cmd.ExitStatus > 0);
Assert.IsGreaterThan(0, cmd.ExitStatus.Value);
client.Disconnect();
}
@@ -244,7 +240,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests
{
Assert.Fail("Operation should fail");
}
Assert.IsTrue(cmd.ExitStatus > 0);
Assert.IsGreaterThan(0, cmd.ExitStatus.Value);
var result = ExecuteTestCommand(client);
@@ -3,3 +3,5 @@ using System.Diagnostics.CodeAnalysis;
[assembly: ExcludeFromCodeCoverage]
#endif // NET
[assembly: DoNotParallelize]
+26 -26
View File
@@ -20,7 +20,7 @@ namespace Renci.SshNet.IntegrationTests
}
[TestMethod]
[DynamicData(nameof(GetScpDownloadStreamDirectoryDoesNotExistData), DynamicDataSourceType.Method)]
[DynamicData(nameof(GetScpDownloadStreamDirectoryDoesNotExistData))]
public void Scp_Download_Stream_DirectoryDoesNotExist(IRemotePathTransformation remotePathTransformation,
string remotePath,
string remoteFile)
@@ -94,7 +94,7 @@ namespace Renci.SshNet.IntegrationTests
}
[TestMethod]
[DynamicData(nameof(GetScpDownloadStreamFileDoesNotExistData), DynamicDataSourceType.Method)]
[DynamicData(nameof(GetScpDownloadStreamFileDoesNotExistData))]
public void Scp_Download_Stream_FileDoesNotExist(IRemotePathTransformation remotePathTransformation,
string remotePath,
string remoteFile)
@@ -170,7 +170,7 @@ namespace Renci.SshNet.IntegrationTests
}
[TestMethod]
[DynamicData(nameof(GetScpDownloadDirectoryInfoDirectoryDoesNotExistData), DynamicDataSourceType.Method)]
[DynamicData(nameof(GetScpDownloadDirectoryInfoDirectoryDoesNotExistData))]
public void Scp_Download_DirectoryInfo_DirectoryDoesNotExist(IRemotePathTransformation remotePathTransformation,
string remotePath)
{
@@ -228,7 +228,7 @@ namespace Renci.SshNet.IntegrationTests
}
[TestMethod]
[DynamicData(nameof(GetScpDownloadDirectoryInfoExistingFileData), DynamicDataSourceType.Method)]
[DynamicData(nameof(GetScpDownloadDirectoryInfoExistingFileData))]
public void Scp_Download_DirectoryInfo_ExistingFile(IRemotePathTransformation remotePathTransformation,
string remotePath)
{
@@ -291,7 +291,7 @@ namespace Renci.SshNet.IntegrationTests
}
[TestMethod]
[DynamicData(nameof(GetScpDownloadDirectoryInfoExistingDirectoryData), DynamicDataSourceType.Method)]
[DynamicData(nameof(GetScpDownloadDirectoryInfoExistingDirectoryData))]
public void Scp_Download_DirectoryInfo_ExistingDirectory(IRemotePathTransformation remotePathTransformation,
string remotePath)
{
@@ -380,19 +380,19 @@ namespace Renci.SshNet.IntegrationTests
}
var localFiles = Directory.GetFiles(localDirectory);
Assert.AreEqual(2, localFiles.Length);
Assert.HasCount(2, localFiles);
Assert.IsTrue(localFiles.Contains(localPathFile1));
Assert.IsTrue(localFiles.Contains(localPathFile2));
var localSubDirecties = Directory.GetDirectories(localDirectory);
Assert.AreEqual(1, localSubDirecties.Length);
Assert.HasCount(1, localSubDirecties);
Assert.AreEqual(localPathSubDirectory, localSubDirecties[0]);
var localFilesSubDirectory = Directory.GetFiles(localPathSubDirectory);
Assert.AreEqual(1, localFilesSubDirectory.Length);
Assert.HasCount(1, localFilesSubDirectory);
Assert.AreEqual(localPathFile3, localFilesSubDirectory[0]);
Assert.AreEqual(0, Directory.GetDirectories(localPathSubDirectory).Length);
Assert.IsEmpty(Directory.GetDirectories(localPathSubDirectory));
}
finally
{
@@ -434,7 +434,7 @@ namespace Renci.SshNet.IntegrationTests
}
[TestMethod]
[DynamicData(nameof(GetScpDownloadFileInfoDirectoryDoesNotExistData), DynamicDataSourceType.Method)]
[DynamicData(nameof(GetScpDownloadFileInfoDirectoryDoesNotExistData))]
public void Scp_Download_FileInfo_DirectoryDoesNotExist(IRemotePathTransformation remotePathTransformation,
string remotePath,
string remoteFile)
@@ -506,7 +506,7 @@ namespace Renci.SshNet.IntegrationTests
}
[TestMethod]
[DynamicData(nameof(GetScpDownloadFileInfoFileDoesNotExistData), DynamicDataSourceType.Method)]
[DynamicData(nameof(GetScpDownloadFileInfoFileDoesNotExistData))]
public void Scp_Download_FileInfo_FileDoesNotExist(IRemotePathTransformation remotePathTransformation,
string remotePath,
string remoteFile)
@@ -580,7 +580,7 @@ namespace Renci.SshNet.IntegrationTests
}
[TestMethod]
[DynamicData(nameof(GetScpDownloadFileInfoExistingDirectoryData), DynamicDataSourceType.Method)]
[DynamicData(nameof(GetScpDownloadFileInfoExistingDirectoryData))]
public void Scp_Download_FileInfo_ExistingDirectory(IRemotePathTransformation remotePathTransformation,
string remotePath)
{
@@ -649,7 +649,7 @@ namespace Renci.SshNet.IntegrationTests
}
[TestMethod]
[DynamicData(nameof(GetScpDownloadFileInfoExistingFileData), DynamicDataSourceType.Method)]
[DynamicData(nameof(GetScpDownloadFileInfoExistingFileData))]
public void Scp_Download_FileInfo_ExistingFile(IRemotePathTransformation remotePathTransformation,
string remotePath,
string remoteFile,
@@ -741,7 +741,7 @@ namespace Renci.SshNet.IntegrationTests
}
[TestMethod]
[DynamicData(nameof(GetScpDownloadStreamExistingDirectoryData), DynamicDataSourceType.Method)]
[DynamicData(nameof(GetScpDownloadStreamExistingDirectoryData))]
public void Scp_Download_Stream_ExistingDirectory(IRemotePathTransformation remotePathTransformation,
string remotePath)
{
@@ -809,7 +809,7 @@ namespace Renci.SshNet.IntegrationTests
}
[TestMethod]
[DynamicData(nameof(GetScpDownloadStreamExistingFileData), DynamicDataSourceType.Method)]
[DynamicData(nameof(GetScpDownloadStreamExistingFileData))]
public void Scp_Download_Stream_ExistingFile(IRemotePathTransformation remotePathTransformation,
string remotePath,
string remoteFile,
@@ -896,7 +896,7 @@ namespace Renci.SshNet.IntegrationTests
}
[TestMethod]
[DynamicData(nameof(GetScpUploadFileStreamDirectoryDoesNotExistData), DynamicDataSourceType.Method)]
[DynamicData(nameof(GetScpUploadFileStreamDirectoryDoesNotExistData))]
public void Scp_Upload_FileStream_DirectoryDoesNotExist(IRemotePathTransformation remotePathTransformation,
string remotePath,
string remoteFile)
@@ -966,7 +966,7 @@ namespace Renci.SshNet.IntegrationTests
}
[TestMethod]
[DynamicData(nameof(GetScpUploadFileStreamExistingDirectoryData), DynamicDataSourceType.Method)]
[DynamicData(nameof(GetScpUploadFileStreamExistingDirectoryData))]
public void Scp_Upload_FileStream_ExistingDirectory(IRemotePathTransformation remotePathTransformation,
string remoteFile)
{
@@ -1029,7 +1029,7 @@ namespace Renci.SshNet.IntegrationTests
}
[TestMethod]
[DynamicData(nameof(ScpUploadFileStreamExistingFileData), DynamicDataSourceType.Method)]
[DynamicData(nameof(ScpUploadFileStreamExistingFileData))]
public void Scp_Upload_FileStream_ExistingFile(IRemotePathTransformation remotePathTransformation,
string remoteFile)
{
@@ -1098,7 +1098,7 @@ namespace Renci.SshNet.IntegrationTests
}
[TestMethod]
[DynamicData(nameof(GetScpUploadFileStreamFileDoesNotExistData), DynamicDataSourceType.Method)]
[DynamicData(nameof(GetScpUploadFileStreamFileDoesNotExistData))]
public void Scp_Upload_FileStream_FileDoesNotExist(IRemotePathTransformation remotePathTransformation,
string remotePath,
string remoteFile,
@@ -1197,7 +1197,7 @@ namespace Renci.SshNet.IntegrationTests
/// https://github.com/sshnet/SSH.NET/issues/289
/// </summary>
[TestMethod]
[DynamicData(nameof(GetScpUploadFileInfoDirectoryDoesNotExistData), DynamicDataSourceType.Method)]
[DynamicData(nameof(GetScpUploadFileInfoDirectoryDoesNotExistData))]
public void Scp_Upload_FileInfo_DirectoryDoesNotExist(IRemotePathTransformation remotePathTransformation,
string remotePath,
string remoteFile)
@@ -1277,7 +1277,7 @@ namespace Renci.SshNet.IntegrationTests
/// https://github.com/sshnet/SSH.NET/issues/286
/// </summary>
[TestMethod]
[DynamicData(nameof(GetScpUploadFileInfoExistingDirectoryData), DynamicDataSourceType.Method)]
[DynamicData(nameof(GetScpUploadFileInfoExistingDirectoryData))]
public void Scp_Upload_FileInfo_ExistingDirectory(IRemotePathTransformation remotePathTransformation,
string remoteFile)
{
@@ -1339,7 +1339,7 @@ namespace Renci.SshNet.IntegrationTests
}
[TestMethod]
[DynamicData(nameof(GetScpUploadFileInfoExistingFileData), DynamicDataSourceType.Method)]
[DynamicData(nameof(GetScpUploadFileInfoExistingFileData))]
public void Scp_Upload_FileInfo_ExistingFile(IRemotePathTransformation remotePathTransformation,
string remoteFile)
{
@@ -1417,7 +1417,7 @@ namespace Renci.SshNet.IntegrationTests
}
[TestMethod]
[DynamicData(nameof(GetScpUploadFileInfoFileDoesNotExistData), DynamicDataSourceType.Method)]
[DynamicData(nameof(GetScpUploadFileInfoFileDoesNotExistData))]
public void Scp_Upload_FileInfo_FileDoesNotExist(IRemotePathTransformation remotePathTransformation,
string remotePath,
string remoteFile,
@@ -1522,7 +1522,7 @@ namespace Renci.SshNet.IntegrationTests
}
[TestMethod]
[DynamicData(nameof(GetScpUploadDirectoryInfoDirectoryDoesNotExistData), DynamicDataSourceType.Method)]
[DynamicData(nameof(GetScpUploadDirectoryInfoDirectoryDoesNotExistData))]
public void Scp_Upload_DirectoryInfo_DirectoryDoesNotExist(IRemotePathTransformation remotePathTransformation,
string remoteDirectory)
{
@@ -1587,7 +1587,7 @@ namespace Renci.SshNet.IntegrationTests
}
[TestMethod]
[DynamicData(nameof(GetScpUploadDirectoryInfoExistingDirectoryData), DynamicDataSourceType.Method)]
[DynamicData(nameof(GetScpUploadDirectoryInfoExistingDirectoryData))]
public void Scp_Upload_DirectoryInfo_ExistingDirectory(IRemotePathTransformation remotePathTransformation,
string remoteDirectory)
{
@@ -1791,7 +1791,7 @@ namespace Renci.SshNet.IntegrationTests
}
[TestMethod]
[DynamicData(nameof(GetScpUploadDirectoryInfoExistingFileData), DynamicDataSourceType.Method)]
[DynamicData(nameof(GetScpUploadDirectoryInfoExistingFileData))]
public void Scp_Upload_DirectoryInfo_ExistingFile(IRemotePathTransformation remotePathTransformation,
string remoteDirectory)
{
@@ -26,7 +26,7 @@ namespace Renci.SshNet.IntegrationTests
}
[TestMethod]
[DynamicData(nameof(GetSftpUploadFileFileStreamData), DynamicDataSourceType.Method)]
[DynamicData(nameof(GetSftpUploadFileFileStreamData))]
public void Sftp_UploadFile_FileStream(int size)
{
var file = CreateTempFile(size);
@@ -3669,7 +3669,7 @@ namespace Renci.SshNet.IntegrationTests
client.ChangeDirectory(remoteDirectory);
var directoryContent = client.ListDirectory(".").OrderBy(p => p.Name).ToList();
Assert.AreEqual(5, directoryContent.Count);
Assert.HasCount(5, directoryContent);
Assert.AreEqual(".", directoryContent[0].Name);
Assert.AreEqual($"{remoteDirectory}/.", directoryContent[0].FullName);
@@ -74,7 +74,7 @@ namespace Renci.SshNet.IntegrationTests
var line = shellStream.ReadLine();
Assert.IsNotNull(line);
Assert.IsTrue(line.EndsWith("Hello!"), line);
Assert.EndsWith("Hello!", line);
Assert.IsTrue(shellStream.ReadLine() is null || shellStream.ReadLine() is null); // we might first get e.g. "renci-ssh-tests-server:~$"
}
@@ -94,7 +94,7 @@ namespace Renci.SshNet.IntegrationTests
shellStream.WriteLine($"echo {foo}");
var line = shellStream.ReadLine(TimeSpan.FromSeconds(1));
Assert.IsNotNull(line);
Assert.IsTrue(line.EndsWith(foo), line);
Assert.EndsWith(foo, line);
}
}
}
@@ -221,7 +221,7 @@ namespace Renci.SshNet.IntegrationTests
var outputString = outputReader.ReadLine();
Assert.IsNotNull(outputString);
Assert.IsTrue(outputString.EndsWith(foo), outputString);
Assert.EndsWith(foo, outputString);
shell.Stop();
}
@@ -341,7 +341,7 @@ namespace Renci.SshNet.IntegrationTests
lines.Add(line);
}
Assert.AreEqual(6, lines.Count, string.Join("\n", lines));
Assert.HasCount(6, lines, string.Join("\n", lines));
Assert.AreEqual(expectedResult, string.Join("\n", lines));
}
@@ -383,7 +383,7 @@ namespace Renci.SshNet.IntegrationTests
socksSocket.Send(httpGetRequest);
var httpResponse = GetHttpResponse(socksSocket, Encoding.ASCII);
Assert.IsTrue(httpResponse.Contains(searchText), httpResponse);
Assert.Contains(searchText, httpResponse);
}
Assert.IsTrue(socksSocket.Connected);
@@ -427,7 +427,7 @@ namespace Renci.SshNet.IntegrationTests
socksSocket.Send(httpGetRequest);
var httpResponse = GetHttpResponse(socksSocket, Encoding.ASCII);
Assert.IsTrue(httpResponse.Contains(searchText), httpResponse);
Assert.Contains(searchText, httpResponse);
// Verify if port is still open
socksSocket.Send(httpGetRequest);
@@ -447,7 +447,7 @@ namespace Renci.SshNet.IntegrationTests
socksSocket.Send(httpGetRequest);
httpResponse = GetHttpResponse(socksSocket, Encoding.ASCII);
Assert.IsTrue(httpResponse.Contains(searchText), httpResponse);
Assert.Contains(searchText, httpResponse);
forwardedPort.Dispose();
@@ -496,7 +496,7 @@ namespace Renci.SshNet.IntegrationTests
socksSocket.Send(httpGetRequest);
var httpResponse = GetHttpResponse(socksSocket, Encoding.ASCII);
Assert.IsTrue(httpResponse.Contains(searchText), httpResponse);
Assert.Contains(searchText, httpResponse);
forwardedPort.Dispose();
@@ -62,7 +62,7 @@ namespace Renci.SshNet.IntegrationTests
shellStream.WriteLine($"echo {foo}");
var line = shellStream.ReadLine(TimeSpan.FromSeconds(1));
Assert.IsNotNull(line);
Assert.IsTrue(line.EndsWith(foo), line);
Assert.EndsWith(foo, line);
}
}
}
@@ -122,7 +122,7 @@ namespace Renci.SshNet.IntegrationTests
var outputString = outputReader.ReadLine();
Assert.IsNotNull(outputString);
Assert.IsTrue(outputString.EndsWith(foo), outputString);
Assert.EndsWith(foo, outputString);
shell.Stop();
}
@@ -6,6 +6,8 @@ using DotNet.Testcontainers.Images;
using Microsoft.Extensions.Logging;
using Renci.SshNet.IntegrationTests.Logging;
namespace Renci.SshNet.IntegrationTests.TestsFixtures
{
public sealed class InfrastructureFixture : IDisposable
@@ -16,7 +18,7 @@ namespace Renci.SshNet.IntegrationTests.TestsFixtures
{
builder.SetMinimumLevel(LogLevel.Debug);
builder.AddFilter("testcontainers", LogLevel.Information);
builder.AddConsole();
builder.AddTestConsoleLogger();
});
SshNetLoggingConfiguration.InitializeLogging(_loggerFactory);
@@ -12,7 +12,7 @@ namespace Renci.SshNet.Tests.Classes
[TestMethod]
public void CryptoAbstraction_GenerateRandom_ShouldPerformNoOpWhenDataIsZeroLength()
{
Assert.AreEqual(0, RandomNumberGenerator.GetBytes(0).Length);
Assert.IsEmpty(RandomNumberGenerator.GetBytes(0));
}
[TestMethod]
@@ -23,8 +23,8 @@ namespace Renci.SshNet.Tests.Classes
var dataA = RandomNumberGenerator.GetBytes(dataLength);
var dataB = RandomNumberGenerator.GetBytes(dataLength);
Assert.AreEqual(dataLength, dataA.Length);
Assert.AreEqual(dataLength, dataB.Length);
Assert.HasCount(dataLength, dataA);
Assert.HasCount(dataLength, dataB);
CollectionAssert.AreNotEqual(dataA, dataB);
}
@@ -165,8 +165,8 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ChannelShouldShutdownSocketToRemoteListener()
{
Assert.AreEqual(1, _connectedRegister.Count);
Assert.AreEqual(1, _disconnectedRegister.Count);
Assert.HasCount(1, _connectedRegister);
Assert.HasCount(1, _disconnectedRegister);
Assert.AreSame(_connectedRegister[0], _disconnectedRegister[0]);
}
@@ -131,13 +131,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
[TestMethod]
public void ClosedEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelClosedRegister.Count);
Assert.HasCount(1, _channelClosedRegister);
Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber);
}
@@ -123,13 +123,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count, _channelExceptionRegister.AsString());
Assert.IsEmpty(_channelExceptionRegister, _channelExceptionRegister.AsString());
}
[TestMethod]
public void ClosedEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelClosedRegister.Count);
Assert.HasCount(1, _channelClosedRegister);
Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber);
}
@@ -113,13 +113,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
[TestMethod]
public void ClosedEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelClosedRegister.Count);
Assert.HasCount(1, _channelClosedRegister);
Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber);
}
@@ -121,13 +121,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count, _channelExceptionRegister.AsString());
Assert.IsEmpty(_channelExceptionRegister, _channelExceptionRegister.AsString());
}
[TestMethod]
public void ClosedEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelClosedRegister.Count);
Assert.HasCount(1, _channelClosedRegister);
Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber);
}
@@ -110,13 +110,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
[TestMethod]
public void ClosedEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelClosedRegister.Count);
Assert.HasCount(1, _channelClosedRegister);
Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber);
}
@@ -118,13 +118,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count, _channelExceptionRegister.AsString());
Assert.IsEmpty(_channelExceptionRegister, _channelExceptionRegister.AsString());
}
[TestMethod]
public void ClosedEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelClosedRegister.Count);
Assert.HasCount(1, _channelClosedRegister);
Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber);
}
@@ -109,13 +109,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
[TestMethod]
public void ClosedEventShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelClosedRegister.Count);
Assert.IsEmpty(_channelClosedRegister);
}
[TestMethod]
@@ -124,13 +124,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
[TestMethod]
public void ClosedEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelClosedRegister.Count);
Assert.HasCount(1, _channelClosedRegister);
Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber);
}
@@ -129,13 +129,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
[TestMethod]
public void ClosedEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelClosedRegister.Count);
Assert.HasCount(1, _channelClosedRegister);
Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber);
}
@@ -128,13 +128,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
[TestMethod]
public void ClosedEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelClosedRegister.Count);
Assert.HasCount(1, _channelClosedRegister);
Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber);
}
@@ -109,13 +109,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
[TestMethod]
public void ClosedEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelClosedRegister.Count);
Assert.HasCount(1, _channelClosedRegister);
Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber);
}
@@ -106,13 +106,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
[TestMethod]
public void ClosedEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelClosedRegister.Count);
Assert.HasCount(1, _channelClosedRegister);
Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber);
}
@@ -101,13 +101,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
[TestMethod]
public void ClosedEventShouldNotHaveFired()
{
Assert.AreEqual(0, _channelClosedRegister.Count);
Assert.IsEmpty(_channelClosedRegister);
}
[TestMethod]
@@ -117,13 +117,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count, _channelExceptionRegister.AsString());
Assert.IsEmpty(_channelExceptionRegister, _channelExceptionRegister.AsString());
}
[TestMethod]
public void ClosedEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelClosedRegister.Count);
Assert.HasCount(1, _channelClosedRegister);
Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber);
}
@@ -98,13 +98,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
[TestMethod]
public void ClosedEventShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelClosedRegister.Count);
Assert.IsEmpty(_channelClosedRegister);
}
[TestMethod]
@@ -122,13 +122,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
[TestMethod]
public void ClosedEventShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelClosedRegister.Count);
Assert.IsEmpty(_channelClosedRegister);
}
[TestMethod]
@@ -135,13 +135,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
[TestMethod]
public void ClosedEventShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelClosedRegister.Count);
Assert.IsEmpty(_channelClosedRegister);
}
[TestMethod]
@@ -66,13 +66,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ClosedEventShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelClosedRegister.Count);
Assert.IsEmpty(_channelClosedRegister);
}
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
}
}
@@ -133,13 +133,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void WaitOnHandleOnSessionShouldWaitForChannelCloseMessageToBeReceived()
{
Assert.IsTrue(_closeTimer.ElapsedMilliseconds >= 100, "Elapsed milliseconds=" + _closeTimer.ElapsedMilliseconds);
Assert.IsGreaterThanOrEqualTo(100, _closeTimer.ElapsedMilliseconds, "Elapsed milliseconds=" + _closeTimer.ElapsedMilliseconds);
}
[TestMethod]
public void ClosedEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelClosedRegister.Count);
Assert.HasCount(1, _channelClosedRegister);
Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber);
}
@@ -152,7 +152,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
}
}
@@ -136,13 +136,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void WaitOnHandleOnSessionShouldWaitForChannelCloseMessageToBeReceived()
{
Assert.IsTrue(_closeTimer.ElapsedMilliseconds >= 100, "Elapsed milliseconds=" + _closeTimer.ElapsedMilliseconds);
Assert.IsGreaterThanOrEqualTo(100, _closeTimer.ElapsedMilliseconds, "Elapsed milliseconds=" + _closeTimer.ElapsedMilliseconds);
}
[TestMethod]
public void ClosedEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelClosedRegister.Count);
Assert.HasCount(1, _channelClosedRegister);
Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber);
}
@@ -155,7 +155,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
}
}
@@ -164,21 +164,21 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ClosedEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelClosedRegister.Count);
Assert.HasCount(1, _channelClosedRegister);
Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber);
}
[TestMethod]
public void EndOfDataEventShouldNotHaveFired()
{
Assert.AreEqual(1, _channelEndOfDataRegister.Count);
Assert.HasCount(1, _channelEndOfDataRegister);
Assert.AreEqual(_localChannelNumber, _channelEndOfDataRegister[0].ChannelNumber);
}
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
[TestMethod]
@@ -105,20 +105,20 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ClosedEventShouldNotHaveFired()
{
Assert.AreEqual(0, _channelClosedRegister.Count);
Assert.IsEmpty(_channelClosedRegister);
}
[TestMethod]
public void EndOfDataEventShouldNotHaveFired()
{
Assert.AreEqual(1, _channelEndOfDataRegister.Count);
Assert.HasCount(1, _channelEndOfDataRegister);
Assert.AreEqual(_localChannelNumber, _channelEndOfDataRegister[0].ChannelNumber);
}
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
}
}
@@ -105,20 +105,20 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ClosedEventShouldNotHaveFired()
{
Assert.AreEqual(0, _channelClosedRegister.Count);
Assert.IsEmpty(_channelClosedRegister);
}
[TestMethod]
public void EndOfDataEventShouldNotHaveFired()
{
Assert.AreEqual(1, _channelEndOfDataRegister.Count);
Assert.HasCount(1, _channelEndOfDataRegister);
Assert.AreEqual(_localChannelNumber, _channelEndOfDataRegister[0].ChannelNumber);
}
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
}
}
@@ -66,13 +66,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ClosedEventShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelClosedRegister.Count);
Assert.IsEmpty(_channelClosedRegister);
}
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
}
}
@@ -66,13 +66,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ClosedEventShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelClosedRegister.Count);
Assert.IsEmpty(_channelClosedRegister);
}
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
}
}
@@ -51,14 +51,14 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelExceptionRegister.Count);
Assert.HasCount(1, _channelExceptionRegister);
Assert.AreSame(_onCloseException, _channelExceptionRegister[0].Exception);
}
[TestMethod]
public void OnErrorOccurredShouldBeInvokedOnce()
{
Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count);
Assert.HasCount(1, _channel.OnErrorOccurredInvocations);
Assert.AreSame(_onCloseException, _channel.OnErrorOccurredInvocations[0]);
}
}
@@ -121,20 +121,20 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ClosedEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelClosedRegister.Count);
Assert.HasCount(1, _channelClosedRegister);
Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber);
}
[TestMethod]
public void EndOfDataEventShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelEndOfDataRegister.Count);
Assert.IsEmpty(_channelEndOfDataRegister);
}
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
[TestMethod]
@@ -110,14 +110,14 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ClosedEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelClosedRegister.Count);
Assert.HasCount(1, _channelClosedRegister);
Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber);
}
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count, _channelExceptionRegister.AsString());
Assert.IsEmpty(_channelExceptionRegister, _channelExceptionRegister.AsString());
}
[TestMethod]
@@ -113,14 +113,14 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ClosedEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelClosedRegister.Count);
Assert.HasCount(1, _channelClosedRegister);
Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber);
}
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count, _channelExceptionRegister.AsString());
Assert.IsEmpty(_channelExceptionRegister, _channelExceptionRegister.AsString());
}
[TestMethod]
@@ -51,14 +51,14 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelExceptionRegister.Count);
Assert.HasCount(1, _channelExceptionRegister);
Assert.AreSame(_onDataException, _channelExceptionRegister[0].Exception);
}
[TestMethod]
public void OnErrorOccurredShouldBeInvokedOnce()
{
Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count);
Assert.HasCount(1, _channel.OnErrorOccurredInvocations);
Assert.AreSame(_onDataException, _channel.OnErrorOccurredInvocations[0]);
}
}
@@ -59,14 +59,14 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelExceptionRegister.Count);
Assert.HasCount(1, _channelExceptionRegister);
Assert.AreSame(_onEofException, _channelExceptionRegister[0].Exception);
}
[TestMethod]
public void OnErrorOccurredShouldBeInvokedOnce()
{
Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count);
Assert.HasCount(1, _channel.OnErrorOccurredInvocations);
Assert.AreSame(_onEofException, _channel.OnErrorOccurredInvocations[0]);
}
}
@@ -51,14 +51,14 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelExceptionRegister.Count);
Assert.HasCount(1, _channelExceptionRegister);
Assert.AreSame(_onExtendedDataException, _channelExceptionRegister[0].Exception);
}
[TestMethod]
public void OnErrorOccurredShouldBeInvokedOnce()
{
Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count);
Assert.HasCount(1, _channel.OnErrorOccurredInvocations);
Assert.AreSame(_onExtendedDataException, _channel.OnErrorOccurredInvocations[0]);
}
}
@@ -51,14 +51,14 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelExceptionRegister.Count);
Assert.HasCount(1, _channelExceptionRegister);
Assert.AreSame(_onFailureException, _channelExceptionRegister[0].Exception);
}
[TestMethod]
public void OnErrorOccurredShouldBeInvokedOnce()
{
Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count);
Assert.HasCount(1, _channel.OnErrorOccurredInvocations);
Assert.AreSame(_onFailureException, _channel.OnErrorOccurredInvocations[0]);
}
}
@@ -70,7 +70,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void NoExceptionShouldHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
}
@@ -55,14 +55,14 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelExceptionRegister.Count);
Assert.HasCount(1, _channelExceptionRegister);
Assert.AreSame(_onRequestException, _channelExceptionRegister[0].Exception);
}
[TestMethod]
public void OnErrorOccurredShouldBeInvokedOnce()
{
Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count);
Assert.HasCount(1, _channel.OnErrorOccurredInvocations);
Assert.AreSame(_onRequestException, _channel.OnErrorOccurredInvocations[0]);
}
}
@@ -51,14 +51,14 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelExceptionRegister.Count);
Assert.HasCount(1, _channelExceptionRegister);
Assert.AreSame(_onSuccessException, _channelExceptionRegister[0].Exception);
}
[TestMethod]
public void OnErrorOccurredShouldBeInvokedOnce()
{
Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count);
Assert.HasCount(1, _channel.OnErrorOccurredInvocations);
Assert.AreSame(_onSuccessException, _channel.OnErrorOccurredInvocations[0]);
}
}
@@ -60,14 +60,14 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelExceptionRegister.Count);
Assert.HasCount(1, _channelExceptionRegister);
Assert.AreSame(_onWindowAdjustException, _channelExceptionRegister[0].Exception);
}
[TestMethod]
public void OnErrorOccurredShouldBeInvokedOnce()
{
Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count);
Assert.HasCount(1, _channel.OnErrorOccurredInvocations);
Assert.AreSame(_onWindowAdjustException, _channel.OnErrorOccurredInvocations[0]);
}
}
@@ -49,14 +49,14 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelExceptionRegister.Count);
Assert.HasCount(1, _channelExceptionRegister);
Assert.AreSame(_onDisconnectedException, _channelExceptionRegister[0].Exception);
}
[TestMethod]
public void OnErrorOccurredShouldBeInvokedOnce()
{
Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count);
Assert.HasCount(1, _channel.OnErrorOccurredInvocations);
Assert.AreSame(_onDisconnectedException, _channel.OnErrorOccurredInvocations[0]);
}
}
@@ -65,13 +65,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ClosedEventShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelClosedRegister.Count);
Assert.IsEmpty(_channelClosedRegister);
}
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
}
}
@@ -51,14 +51,14 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelExceptionRegister.Count);
Assert.HasCount(1, _channelExceptionRegister);
Assert.AreSame(_onErrorOccurredException, _channelExceptionRegister[0].Exception);
}
[TestMethod]
public void OnErrorOccurredShouldBeInvokedOnce()
{
Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count);
Assert.HasCount(1, _channel.OnErrorOccurredInvocations);
Assert.AreSame(_errorOccurredException, _channel.OnErrorOccurredInvocations[0]);
}
}
@@ -82,13 +82,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ClosedEventShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelClosedRegister.Count);
Assert.IsEmpty(_channelClosedRegister);
}
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
}
}
@@ -75,13 +75,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ClosedEventShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelClosedRegister.Count);
Assert.IsEmpty(_channelClosedRegister);
}
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
Assert.IsEmpty(_channelExceptionRegister);
}
}
}
@@ -59,14 +59,14 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelExceptionRegister.Count);
Assert.HasCount(1, _channelExceptionRegister);
Assert.AreSame(_onOpenConfirmationException, _channelExceptionRegister[0].Exception);
}
[TestMethod]
public void OnErrorOccurredShouldBeInvokedOnce()
{
Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count);
Assert.HasCount(1, _channel.OnErrorOccurredInvocations);
Assert.AreSame(_onOpenConfirmationException, _channel.OnErrorOccurredInvocations[0]);
}
}
@@ -56,14 +56,14 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ExceptionEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelExceptionRegister.Count);
Assert.HasCount(1, _channelExceptionRegister);
Assert.AreSame(_onOpenFailureException, _channelExceptionRegister[0].Exception);
}
[TestMethod]
public void OnErrorOccurredShouldBeInvokedOnce()
{
Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count);
Assert.HasCount(1, _channel.OnErrorOccurredInvocations);
Assert.AreSame(_onOpenFailureException, _channel.OnErrorOccurredInvocations[0]);
}
}
@@ -85,7 +85,7 @@ namespace Renci.SshNet.Tests.Classes.Common
var actual = Extensions.Concat(first, second);
Assert.IsNotNull(actual);
Assert.AreEqual(first.Length + second.Length, actual.Length);
Assert.HasCount(first.Length + second.Length, actual);
Assert.AreEqual(first[0], actual[0]);
Assert.AreEqual(first[1], actual[1]);
Assert.AreEqual(first[2], actual[2]);
@@ -13,7 +13,7 @@ namespace Renci.SshNet.Tests.Classes.Common
byte[] value = { 0x0a, 0x0d };
var padded = value.Pad(2);
Assert.AreEqual(value, padded);
Assert.AreEqual(value.Length, padded.Length);
Assert.HasCount(value.Length, padded);
}
[TestMethod]
@@ -21,7 +21,7 @@ namespace Renci.SshNet.Tests.Classes.Common
{
byte[] value = { 0x0a, 0x0d };
var padded = value.Pad(3);
Assert.AreEqual(value.Length + 1, padded.Length);
Assert.HasCount(value.Length + 1, padded);
Assert.AreEqual(0x00, padded[0]);
Assert.AreEqual(0x0a, padded[1]);
Assert.AreEqual(0x0d, padded[2]);
@@ -44,7 +44,7 @@ namespace Renci.SshNet.Tests.Classes.Common
var actual = Extensions.Take(value, count);
Assert.IsNotNull(actual);
Assert.AreEqual(0, actual.Length);
Assert.IsEmpty(actual);
}
[TestMethod]
@@ -68,7 +68,7 @@ namespace Renci.SshNet.Tests.Classes.Common
var actual = Extensions.Take(value, count);
Assert.IsNotNull(actual);
Assert.AreEqual(count, actual.Length);
Assert.HasCount(count, actual);
Assert.AreEqual(value[0], actual[0]);
Assert.AreEqual(value[1], actual[1]);
Assert.AreEqual(value[2], actual[2]);
@@ -47,7 +47,7 @@ namespace Renci.SshNet.Tests.Classes.Common
var actual = Extensions.Take(value, offset, count);
Assert.IsNotNull(actual);
Assert.AreEqual(0, actual.Length);
Assert.IsEmpty(actual);
}
[TestMethod]
@@ -60,7 +60,7 @@ namespace Renci.SshNet.Tests.Classes.Common
var actual = Extensions.Take(value, offset, count);
Assert.IsNotNull(actual);
Assert.AreEqual(value.Length, actual.Length);
Assert.HasCount(value.Length, actual);
Assert.AreEqual(value, actual);
}
@@ -74,7 +74,7 @@ namespace Renci.SshNet.Tests.Classes.Common
var actual = Extensions.Take(value, offset, count);
Assert.IsNotNull(actual);
Assert.AreEqual(count, actual.Length);
Assert.HasCount(count, actual);
Assert.AreEqual(value[0], actual[0]);
Assert.AreEqual(value[1], actual[1]);
Assert.AreEqual(value[2], actual[2]);
@@ -92,7 +92,7 @@ namespace Renci.SshNet.Tests.Classes.Common
var actual = Extensions.Take(value, offset, count);
Assert.IsNotNull(actual);
Assert.AreEqual(count, actual.Length);
Assert.HasCount(count, actual);
Assert.AreEqual(value[3], actual[0]);
Assert.AreEqual(value[4], actual[1]);
Assert.AreEqual(value[5], actual[2]);
@@ -15,7 +15,7 @@ namespace Renci.SshNet.Tests.Classes.Common
var actual = value.ToBigInteger2().ToByteArray(isBigEndian: true);
Assert.IsNotNull(actual);
Assert.AreEqual(2, actual.Length);
Assert.HasCount(2, actual);
Assert.AreEqual(0x0a, actual[0]);
Assert.AreEqual(0x0d, actual[1]);
}
@@ -28,7 +28,7 @@ namespace Renci.SshNet.Tests.Classes.Common
var actual = value.ToBigInteger2().ToByteArray(isBigEndian: true);
Assert.IsNotNull(actual);
Assert.AreEqual(4, actual.Length);
Assert.HasCount(4, actual);
Assert.AreEqual(0x00, actual[0]);
Assert.AreEqual(0xff, actual[1]);
Assert.AreEqual(0x0a, actual[2]);
@@ -34,7 +34,7 @@ namespace Renci.SshNet.Tests.Classes.Common
var actual = Extensions.TrimLeadingZeros(value);
Assert.IsNotNull(actual);
Assert.AreEqual(2, actual.Length);
Assert.HasCount(2, actual);
Assert.AreEqual(0x0a, actual[0]);
Assert.AreEqual(0x0d, actual[1]);
}
@@ -47,7 +47,7 @@ namespace Renci.SshNet.Tests.Classes.Common
var actual = Extensions.TrimLeadingZeros(value);
Assert.IsNotNull(actual);
Assert.AreEqual(4, actual.Length);
Assert.HasCount(4, actual);
Assert.AreEqual(0x0a, actual[0]);
Assert.AreEqual(0x00, actual[1]);
Assert.AreEqual(0x0d, actual[2]);
@@ -62,7 +62,7 @@ namespace Renci.SshNet.Tests.Classes.Common
var actual = Extensions.TrimLeadingZeros(value);
Assert.IsNotNull(actual);
Assert.AreEqual(3, actual.Length);
Assert.HasCount(3, actual);
Assert.AreEqual(0x0a, actual[0]);
Assert.AreEqual(0x00, actual[1]);
Assert.AreEqual(0x0d, actual[2]);
@@ -76,7 +76,7 @@ namespace Renci.SshNet.Tests.Classes.Common
var actual = Extensions.TrimLeadingZeros(value);
Assert.IsNotNull(actual);
Assert.AreEqual(0, actual.Length);
Assert.IsEmpty(actual);
}
}
}
@@ -76,7 +76,7 @@ namespace Renci.SshNet.Tests.Classes.Connection
_connectionInfo.Timeout.TotalMilliseconds);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText);
}
[TestMethod]
@@ -83,7 +83,7 @@ namespace Renci.SshNet.Tests.Classes.Connection
_connectionInfo.Timeout.TotalMilliseconds);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText);
}
[TestMethod]
@@ -96,8 +96,8 @@ namespace Renci.SshNet.Tests.Classes.Connection
_connectionInfo.Timeout.TotalMilliseconds);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
Assert.IsGreaterThanOrEqualTo(_connectionInfo.Timeout.TotalMilliseconds - 10, _stopWatch.ElapsedMilliseconds, errorText);
Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText);
}
[TestMethod]
@@ -86,7 +86,7 @@ namespace Renci.SshNet.Tests.Classes.Connection
_connectionInfo.Timeout.TotalMilliseconds);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText);
}
[TestMethod]
@@ -106,8 +106,8 @@ namespace Renci.SshNet.Tests.Classes.Connection
_connectionInfo.Timeout.TotalMilliseconds);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
Assert.IsGreaterThanOrEqualTo(_connectionInfo.Timeout.TotalMilliseconds - 10, _stopWatch.ElapsedMilliseconds, errorText);
Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText);
}
[TestMethod]
@@ -137,8 +137,8 @@ namespace Renci.SshNet.Tests.Classes.Connection
_connectionInfo.Timeout.TotalMilliseconds);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
Assert.IsGreaterThanOrEqualTo(_connectionInfo.Timeout.TotalMilliseconds - 10, _stopWatch.ElapsedMilliseconds, errorText);
Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText);
}
[TestMethod]
@@ -107,8 +107,8 @@ namespace Renci.SshNet.Tests.Classes.Connection
_connectionInfo.Timeout.TotalMilliseconds);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
Assert.IsGreaterThanOrEqualTo(_connectionInfo.Timeout.TotalMilliseconds - 10, _stopWatch.ElapsedMilliseconds, errorText);
Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText);
}
[TestMethod]
@@ -100,7 +100,7 @@ namespace Renci.SshNet.Tests.Classes.Connection
[TestMethod]
public void ClientIdentificationWasSentToServer()
{
Assert.AreEqual(5, _dataReceivedByServer.Count);
Assert.HasCount(5, _dataReceivedByServer);
Assert.AreEqual(0xed, _dataReceivedByServer[0]);
Assert.AreEqual(0x95, _dataReceivedByServer[1]);
@@ -108,7 +108,7 @@ namespace Renci.SshNet.Tests.Classes.Connection
{
var expected = Encoding.UTF8.GetBytes(_clientVersion);
Assert.AreEqual(expected.Length + 2, _dataReceivedByServer.Count);
Assert.HasCount(expected.Length + 2, _dataReceivedByServer);
Assert.IsTrue(expected.SequenceEqual(_dataReceivedByServer.Take(expected.Length)));
Assert.AreEqual(Session.CarriageReturn, _dataReceivedByServer[_dataReceivedByServer.Count - 2]);
@@ -110,7 +110,7 @@ namespace Renci.SshNet.Tests.Classes.Connection
{
var expected = Encoding.UTF8.GetBytes(_clientVersion);
Assert.AreEqual(expected.Length + 2, _dataReceivedByServer.Count);
Assert.HasCount(expected.Length + 2, _dataReceivedByServer);
Assert.IsTrue(expected.SequenceEqual(_dataReceivedByServer.Take(expected.Length)));
Assert.AreEqual(Session.CarriageReturn, _dataReceivedByServer[_dataReceivedByServer.Count - 2]);
@@ -94,7 +94,7 @@ namespace Renci.SshNet.Tests.Classes.Connection
{
var expected = Encoding.UTF8.GetBytes(_clientVersion);
Assert.AreEqual(expected.Length + 2, _dataReceivedByServer.Count);
Assert.HasCount(expected.Length + 2, _dataReceivedByServer);
Assert.IsTrue(expected.SequenceEqual(_dataReceivedByServer.Take(expected.Length)));
Assert.AreEqual(Session.CarriageReturn, _dataReceivedByServer[_dataReceivedByServer.Count - 2]);
@@ -97,7 +97,7 @@ namespace Renci.SshNet.Tests.Classes.Connection
{
var expected = Encoding.UTF8.GetBytes(_clientVersion);
Assert.AreEqual(expected.Length + 2, _dataReceivedByServer.Count);
Assert.HasCount(expected.Length + 2, _dataReceivedByServer);
Assert.IsTrue(expected.SequenceEqual(_dataReceivedByServer.Take(expected.Length)));
Assert.AreEqual(Session.CarriageReturn, _dataReceivedByServer[_dataReceivedByServer.Count - 2]);
@@ -94,7 +94,7 @@ namespace Renci.SshNet.Tests.Classes.Connection
{
var expected = Encoding.UTF8.GetBytes(_clientVersion);
Assert.AreEqual(expected.Length + 2, _dataReceivedByServer.Count);
Assert.HasCount(expected.Length + 2, _dataReceivedByServer);
Assert.IsTrue(expected.SequenceEqual(_dataReceivedByServer.Take(expected.Length)));
Assert.AreEqual(Session.CarriageReturn, _dataReceivedByServer[_dataReceivedByServer.Count - 2]);
@@ -96,7 +96,7 @@ namespace Renci.SshNet.Tests.Classes.Connection
{
var expected = Encoding.UTF8.GetBytes(_clientVersion);
Assert.AreEqual(expected.Length + 2, _dataReceivedByServer.Count);
Assert.HasCount(expected.Length + 2, _dataReceivedByServer);
Assert.IsTrue(expected.SequenceEqual(_dataReceivedByServer.Take(expected.Length)));
Assert.AreEqual(Session.CarriageReturn, _dataReceivedByServer[_dataReceivedByServer.Count - 2]);
@@ -97,7 +97,7 @@ namespace Renci.SshNet.Tests.Classes.Connection
{
var expected = Encoding.UTF8.GetBytes(_clientVersion);
Assert.AreEqual(expected.Length + 2, _dataReceivedByServer.Count);
Assert.HasCount(expected.Length + 2, _dataReceivedByServer);
Assert.IsTrue(expected.SequenceEqual(_dataReceivedByServer.Take(expected.Length)));
Assert.AreEqual(Session.CarriageReturn, _dataReceivedByServer[_dataReceivedByServer.Count - 2]);
@@ -75,7 +75,7 @@ namespace Renci.SshNet.Tests.Classes.Connection
_connectionInfo.Timeout.TotalMilliseconds);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText);
}
[TestMethod]
@@ -94,8 +94,8 @@ namespace Renci.SshNet.Tests.Classes.Connection
_connectionInfo.Timeout.TotalMilliseconds);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
Assert.IsGreaterThanOrEqualTo(_connectionInfo.Timeout.TotalMilliseconds - 10, _stopWatch.ElapsedMilliseconds, errorText);
Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText);
}
[TestMethod]
@@ -109,8 +109,8 @@ namespace Renci.SshNet.Tests.Classes.Connection
_connectionInfo.Timeout.TotalMilliseconds);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
Assert.IsGreaterThanOrEqualTo(_connectionInfo.Timeout.TotalMilliseconds - 10, _stopWatch.ElapsedMilliseconds, errorText);
Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText);
}
[TestMethod]
@@ -105,8 +105,8 @@ namespace Renci.SshNet.Tests.Classes.Connection
_connectionInfo.Timeout.TotalMilliseconds);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
Assert.IsGreaterThanOrEqualTo(_connectionInfo.Timeout.TotalMilliseconds - 10, _stopWatch.ElapsedMilliseconds, errorText);
Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText);
}
[TestMethod]
@@ -97,8 +97,8 @@ namespace Renci.SshNet.Tests.Classes.Connection
_connectionInfo.Timeout.TotalMilliseconds);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
Assert.IsGreaterThanOrEqualTo(_connectionInfo.Timeout.TotalMilliseconds - 10, _stopWatch.ElapsedMilliseconds, errorText);
Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText);
}
[TestMethod]
@@ -75,7 +75,7 @@ namespace Renci.SshNet.Tests.Classes.Connection
_connectionInfo.Timeout.TotalMilliseconds);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText);
}
[TestMethod]
@@ -95,8 +95,8 @@ namespace Renci.SshNet.Tests.Classes.Connection
_connectionInfo.Timeout.TotalMilliseconds);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
Assert.IsGreaterThanOrEqualTo(_connectionInfo.Timeout.TotalMilliseconds - 10, _stopWatch.ElapsedMilliseconds, errorText);
Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText);
}
[TestMethod]
@@ -107,8 +107,8 @@ namespace Renci.SshNet.Tests.Classes.Connection
_connectionInfo.Timeout.TotalMilliseconds);
// Compare elapsed time with configured timeout, allowing for a margin of error
Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText);
Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText);
Assert.IsGreaterThanOrEqualTo(_connectionInfo.Timeout.TotalMilliseconds - 10, _stopWatch.ElapsedMilliseconds, errorText);
Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText);
}
[TestMethod]
@@ -47,13 +47,13 @@ namespace Renci.SshNet.Tests.Classes
[TestMethod]
public void ClosingShouldNotHaveFired()
{
Assert.AreEqual(0, _closingRegister.Count);
Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
Assert.AreEqual(0, _exceptionRegister.Count);
Assert.IsEmpty(_exceptionRegister);
}
}
}
@@ -86,13 +86,13 @@ namespace Renci.SshNet.Tests.Classes
[TestMethod]
public void ClosingShouldNotHaveFired()
{
Assert.AreEqual(0, _closingRegister.Count);
Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
Assert.AreEqual(0, _exceptionRegister.Count);
Assert.IsEmpty(_exceptionRegister);
}
}
}
@@ -177,13 +177,13 @@ namespace Renci.SshNet.Tests.Classes
[TestMethod]
public void ClosingShouldHaveFiredOnce()
{
Assert.AreEqual(1, _closingRegister.Count);
Assert.HasCount(1, _closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
Assert.AreEqual(0, _exceptionRegister.Count, _exceptionRegister.AsString());
Assert.IsEmpty(_exceptionRegister, _exceptionRegister.AsString());
}
[TestMethod]
@@ -125,13 +125,13 @@ namespace Renci.SshNet.Tests.Classes
[TestMethod]
public void ClosingShouldHaveFiredOnce()
{
Assert.AreEqual(1, _closingRegister.Count);
Assert.HasCount(1, _closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
Assert.AreEqual(0, _exceptionRegister.Count);
Assert.IsEmpty(_exceptionRegister);
}
[TestMethod]

Some files were not shown because too many files have changed in this diff Show More