diff --git a/Directory.Packages.props b/Directory.Packages.props
index 8138199d5..156ca6f12 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -13,7 +13,7 @@
-
+
diff --git a/test/.editorconfig b/test/.editorconfig
index 5cc9439fe..ff7e4853a 100644
--- a/test/.editorconfig
+++ b/test/.editorconfig
@@ -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
diff --git a/test/Renci.SshNet.IntegrationBenchmarks/Properties/AssemblyInfo.cs b/test/Renci.SshNet.IntegrationBenchmarks/Properties/AssemblyInfo.cs
new file mode 100644
index 000000000..a972a5d8c
--- /dev/null
+++ b/test/Renci.SshNet.IntegrationBenchmarks/Properties/AssemblyInfo.cs
@@ -0,0 +1 @@
+[assembly: DoNotParallelize]
diff --git a/test/Renci.SshNet.IntegrationTests/AuthenticationTests.cs b/test/Renci.SshNet.IntegrationTests/AuthenticationTests.cs
index 9f143eee0..28e9b7b36 100644
--- a/test/Renci.SshNet.IntegrationTests/AuthenticationTests.cs
+++ b/test/Renci.SshNet.IntegrationTests/AuthenticationTests.cs
@@ -436,7 +436,7 @@ public void KeyboardInteractive_NoResponseSet_ThrowsSshAuthenticationException()
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, $"Message was \"{ex.Message}\"");
}
}
}
diff --git a/test/Renci.SshNet.IntegrationTests/ConnectivityTests.cs b/test/Renci.SshNet.IntegrationTests/ConnectivityTests.cs
index bbe6f9064..5b8406a6f 100644
--- a/test/Renci.SshNet.IntegrationTests/ConnectivityTests.cs
+++ b/test/Renci.SshNet.IntegrationTests/ConnectivityTests.cs
@@ -432,7 +432,7 @@ public void Common_HostKeyAlgorithms_NoMatch()
var ex = Assert.Throws(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, ex.Message);
}
}
diff --git a/test/Renci.SshNet.IntegrationTests/Logging/TestConsoleLogger.cs b/test/Renci.SshNet.IntegrationTests/Logging/TestConsoleLogger.cs
new file mode 100644
index 000000000..10b58b2c6
--- /dev/null
+++ b/test/Renci.SshNet.IntegrationTests/Logging/TestConsoleLogger.cs
@@ -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 state)
+ where TState : notnull
+ {
+ return null;
+ }
+
+ public bool IsEnabled(LogLevel logLevel)
+ {
+ return true;
+ }
+
+ public void Log(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func 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);
+ }
+ }
+}
diff --git a/test/Renci.SshNet.IntegrationTests/Logging/TestConsoleLoggerProvider.cs b/test/Renci.SshNet.IntegrationTests/Logging/TestConsoleLoggerProvider.cs
new file mode 100644
index 000000000..4a9c2357b
--- /dev/null
+++ b/test/Renci.SshNet.IntegrationTests/Logging/TestConsoleLoggerProvider.cs
@@ -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()
+ {
+ }
+ }
+}
diff --git a/test/Renci.SshNet.IntegrationTests/Logging/TestConsoleLoggerProviderExtensions.cs b/test/Renci.SshNet.IntegrationTests/Logging/TestConsoleLoggerProviderExtensions.cs
new file mode 100644
index 000000000..7168e6ba6
--- /dev/null
+++ b/test/Renci.SshNet.IntegrationTests/Logging/TestConsoleLoggerProviderExtensions.cs
@@ -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());
+ }
+ }
+}
diff --git a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.ListDirectory.cs b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.ListDirectory.cs
index f85f951e1..9200b6504 100644
--- a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.ListDirectory.cs
+++ b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.ListDirectory.cs
@@ -43,7 +43,7 @@ public void Test_Sftp_ListDirectory_Current()
var files = sftp.ListDirectory(".");
- Assert.IsTrue(files.Count() > 0);
+ Assert.IsGreaterThan(0, files.Count());
foreach (var file in files)
{
@@ -71,7 +71,7 @@ public async Task Test_Sftp_ListDirectoryAsync_Current()
Debug.WriteLine(file.FullName);
}
- Assert.IsTrue(count > 0);
+ Assert.IsGreaterThan(0, count);
sftp.Disconnect();
}
@@ -87,7 +87,7 @@ public void Test_Sftp_ListDirectory_Empty()
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 @@ public void Test_Sftp_ListDirectory_HugeDirectory()
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 @@ public void Test_Sftp_Change_Directory()
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 @@ public void Test_Sftp_Change_Directory()
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 @@ public async Task Test_Sftp_Change_DirectoryAsync()
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 @@ public async Task Test_Sftp_Change_DirectoryAsync()
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);
diff --git a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.SynchronizeDirectories.cs b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.SynchronizeDirectories.cs
index 4964715ef..60e1f124e 100644
--- a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.SynchronizeDirectories.cs
+++ b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.SynchronizeDirectories.cs
@@ -24,7 +24,7 @@ public void Test_Sftp_SynchronizeDirectories()
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 @@ public void Test_Sftp_BeginSynchronizeDirectories()
var upLoadedFiles = sftp.EndSynchronizeDirectories(asyncResult);
- Assert.IsTrue(upLoadedFiles.Count() > 0);
+ Assert.IsGreaterThan(0, upLoadedFiles.Count());
foreach (var file in upLoadedFiles)
{
diff --git a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SshCommandTest.cs b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SshCommandTest.cs
index e68fd7cba..c5a26342e 100644
--- a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SshCommandTest.cs
+++ b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SshCommandTest.cs
@@ -54,7 +54,6 @@ public void Test_Execute_SingleCommand()
}
[TestMethod]
- [Timeout(5000)]
public void Test_CancelAsync_Unfinished_Command()
{
using var client = new SshClient(SshServerHostName, SshServerPort, User.UserName, User.Password);
@@ -76,7 +75,6 @@ public void Test_CancelAsync_Unfinished_Command()
}
[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 @@ public void Test_CancelAsync_Finished_Command()
}
[TestMethod]
- [Timeout(5000)]
public async Task Test_ExecuteAsync_CancellationToken()
{
using var client = new SshClient(SshServerHostName, SshServerPort, User.UserName, User.Password);
@@ -195,7 +192,6 @@ public async Task Test_ExecuteAsync_Timeout()
}
[TestMethod]
- [Timeout(15000)]
public async Task Test_ExecuteAsync_Disconnect()
{
using (var client = new SshClient(SshServerHostName, SshServerPort, User.UserName, User.Password))
@@ -226,7 +222,7 @@ public void Test_Execute_InvalidCommand()
{
Assert.Fail("Operation should fail");
}
- Assert.IsTrue(cmd.ExitStatus > 0);
+ Assert.IsGreaterThan(0, cmd.ExitStatus.Value);
client.Disconnect();
}
@@ -244,7 +240,7 @@ public void Test_Execute_InvalidCommand_Then_Execute_ValidCommand()
{
Assert.Fail("Operation should fail");
}
- Assert.IsTrue(cmd.ExitStatus > 0);
+ Assert.IsGreaterThan(0, cmd.ExitStatus.Value);
var result = ExecuteTestCommand(client);
diff --git a/test/Renci.SshNet.IntegrationTests/Properties/AssemblyInfo.cs b/test/Renci.SshNet.IntegrationTests/Properties/AssemblyInfo.cs
index 886e59996..9a9f8c45a 100644
--- a/test/Renci.SshNet.IntegrationTests/Properties/AssemblyInfo.cs
+++ b/test/Renci.SshNet.IntegrationTests/Properties/AssemblyInfo.cs
@@ -3,3 +3,5 @@
[assembly: ExcludeFromCodeCoverage]
#endif // NET
+
+[assembly: DoNotParallelize]
diff --git a/test/Renci.SshNet.IntegrationTests/ScpTests.cs b/test/Renci.SshNet.IntegrationTests/ScpTests.cs
index 8433bf704..2df8eef46 100644
--- a/test/Renci.SshNet.IntegrationTests/ScpTests.cs
+++ b/test/Renci.SshNet.IntegrationTests/ScpTests.cs
@@ -20,7 +20,7 @@ public void SetUp()
}
[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 @@ public void Scp_Download_Stream_DirectoryDoesNotExist(IRemotePathTransformation
}
[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 @@ public void Scp_Download_Stream_FileDoesNotExist(IRemotePathTransformation remot
}
[TestMethod]
- [DynamicData(nameof(GetScpDownloadDirectoryInfoDirectoryDoesNotExistData), DynamicDataSourceType.Method)]
+ [DynamicData(nameof(GetScpDownloadDirectoryInfoDirectoryDoesNotExistData))]
public void Scp_Download_DirectoryInfo_DirectoryDoesNotExist(IRemotePathTransformation remotePathTransformation,
string remotePath)
{
@@ -228,7 +228,7 @@ public void Scp_Download_DirectoryInfo_DirectoryDoesNotExist(IRemotePathTransfor
}
[TestMethod]
- [DynamicData(nameof(GetScpDownloadDirectoryInfoExistingFileData), DynamicDataSourceType.Method)]
+ [DynamicData(nameof(GetScpDownloadDirectoryInfoExistingFileData))]
public void Scp_Download_DirectoryInfo_ExistingFile(IRemotePathTransformation remotePathTransformation,
string remotePath)
{
@@ -291,7 +291,7 @@ public void Scp_Download_DirectoryInfo_ExistingFile(IRemotePathTransformation re
}
[TestMethod]
- [DynamicData(nameof(GetScpDownloadDirectoryInfoExistingDirectoryData), DynamicDataSourceType.Method)]
+ [DynamicData(nameof(GetScpDownloadDirectoryInfoExistingDirectoryData))]
public void Scp_Download_DirectoryInfo_ExistingDirectory(IRemotePathTransformation remotePathTransformation,
string remotePath)
{
@@ -380,19 +380,19 @@ public void Scp_Download_DirectoryInfo_ExistingDirectory(IRemotePathTransformati
}
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 @@ public void Scp_Download_DirectoryInfo_ExistingDirectory(IRemotePathTransformati
}
[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 @@ public void Scp_Download_FileInfo_DirectoryDoesNotExist(IRemotePathTransformatio
}
[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 @@ public void Scp_Download_FileInfo_FileDoesNotExist(IRemotePathTransformation rem
}
[TestMethod]
- [DynamicData(nameof(GetScpDownloadFileInfoExistingDirectoryData), DynamicDataSourceType.Method)]
+ [DynamicData(nameof(GetScpDownloadFileInfoExistingDirectoryData))]
public void Scp_Download_FileInfo_ExistingDirectory(IRemotePathTransformation remotePathTransformation,
string remotePath)
{
@@ -649,7 +649,7 @@ public void Scp_Download_FileInfo_ExistingDirectory(IRemotePathTransformation re
}
[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 @@ public void Scp_Download_FileInfo_ExistingFile(IRemotePathTransformation remoteP
}
[TestMethod]
- [DynamicData(nameof(GetScpDownloadStreamExistingDirectoryData), DynamicDataSourceType.Method)]
+ [DynamicData(nameof(GetScpDownloadStreamExistingDirectoryData))]
public void Scp_Download_Stream_ExistingDirectory(IRemotePathTransformation remotePathTransformation,
string remotePath)
{
@@ -809,7 +809,7 @@ public void Scp_Download_Stream_ExistingDirectory(IRemotePathTransformation remo
}
[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 @@ public void Scp_Download_Stream_ExistingFile(IRemotePathTransformation remotePat
}
[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 @@ public void Scp_Upload_FileStream_DirectoryDoesNotExist(IRemotePathTransformatio
}
[TestMethod]
- [DynamicData(nameof(GetScpUploadFileStreamExistingDirectoryData), DynamicDataSourceType.Method)]
+ [DynamicData(nameof(GetScpUploadFileStreamExistingDirectoryData))]
public void Scp_Upload_FileStream_ExistingDirectory(IRemotePathTransformation remotePathTransformation,
string remoteFile)
{
@@ -1029,7 +1029,7 @@ public void Scp_Upload_FileStream_ExistingDirectory(IRemotePathTransformation re
}
[TestMethod]
- [DynamicData(nameof(ScpUploadFileStreamExistingFileData), DynamicDataSourceType.Method)]
+ [DynamicData(nameof(ScpUploadFileStreamExistingFileData))]
public void Scp_Upload_FileStream_ExistingFile(IRemotePathTransformation remotePathTransformation,
string remoteFile)
{
@@ -1098,7 +1098,7 @@ public void Scp_Upload_FileStream_ExistingFile(IRemotePathTransformation remoteP
}
[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 @@ public void Scp_Upload_FileStream_FileDoesNotExist(IRemotePathTransformation rem
/// https://github.com/sshnet/SSH.NET/issues/289
///
[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 @@ public void Scp_Upload_FileInfo_DirectoryDoesNotExist(IRemotePathTransformation
/// https://github.com/sshnet/SSH.NET/issues/286
///
[TestMethod]
- [DynamicData(nameof(GetScpUploadFileInfoExistingDirectoryData), DynamicDataSourceType.Method)]
+ [DynamicData(nameof(GetScpUploadFileInfoExistingDirectoryData))]
public void Scp_Upload_FileInfo_ExistingDirectory(IRemotePathTransformation remotePathTransformation,
string remoteFile)
{
@@ -1339,7 +1339,7 @@ public void Scp_Upload_FileInfo_ExistingDirectory(IRemotePathTransformation remo
}
[TestMethod]
- [DynamicData(nameof(GetScpUploadFileInfoExistingFileData), DynamicDataSourceType.Method)]
+ [DynamicData(nameof(GetScpUploadFileInfoExistingFileData))]
public void Scp_Upload_FileInfo_ExistingFile(IRemotePathTransformation remotePathTransformation,
string remoteFile)
{
@@ -1417,7 +1417,7 @@ public void Scp_Upload_FileInfo_ExistingFile(IRemotePathTransformation remotePat
}
[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 @@ public void Scp_Upload_FileInfo_FileDoesNotExist(IRemotePathTransformation remot
}
[TestMethod]
- [DynamicData(nameof(GetScpUploadDirectoryInfoDirectoryDoesNotExistData), DynamicDataSourceType.Method)]
+ [DynamicData(nameof(GetScpUploadDirectoryInfoDirectoryDoesNotExistData))]
public void Scp_Upload_DirectoryInfo_DirectoryDoesNotExist(IRemotePathTransformation remotePathTransformation,
string remoteDirectory)
{
@@ -1587,7 +1587,7 @@ public void Scp_Upload_DirectoryInfo_DirectoryDoesNotExist(IRemotePathTransforma
}
[TestMethod]
- [DynamicData(nameof(GetScpUploadDirectoryInfoExistingDirectoryData), DynamicDataSourceType.Method)]
+ [DynamicData(nameof(GetScpUploadDirectoryInfoExistingDirectoryData))]
public void Scp_Upload_DirectoryInfo_ExistingDirectory(IRemotePathTransformation remotePathTransformation,
string remoteDirectory)
{
@@ -1791,7 +1791,7 @@ public void Scp_Upload_DirectoryInfo_ExistingDirectory(IRemotePathTransformation
}
[TestMethod]
- [DynamicData(nameof(GetScpUploadDirectoryInfoExistingFileData), DynamicDataSourceType.Method)]
+ [DynamicData(nameof(GetScpUploadDirectoryInfoExistingFileData))]
public void Scp_Upload_DirectoryInfo_ExistingFile(IRemotePathTransformation remotePathTransformation,
string remoteDirectory)
{
diff --git a/test/Renci.SshNet.IntegrationTests/SftpTests.cs b/test/Renci.SshNet.IntegrationTests/SftpTests.cs
index bc404d439..3e43890cf 100644
--- a/test/Renci.SshNet.IntegrationTests/SftpTests.cs
+++ b/test/Renci.SshNet.IntegrationTests/SftpTests.cs
@@ -26,7 +26,7 @@ public void SetUp()
}
[TestMethod]
- [DynamicData(nameof(GetSftpUploadFileFileStreamData), DynamicDataSourceType.Method)]
+ [DynamicData(nameof(GetSftpUploadFileFileStreamData))]
public void Sftp_UploadFile_FileStream(int size)
{
var file = CreateTempFile(size);
@@ -3669,7 +3669,7 @@ public void Sftp_ListDirectory()
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);
diff --git a/test/Renci.SshNet.IntegrationTests/SshTests.cs b/test/Renci.SshNet.IntegrationTests/SshTests.cs
index ee9f5d905..7ec3de419 100644
--- a/test/Renci.SshNet.IntegrationTests/SshTests.cs
+++ b/test/Renci.SshNet.IntegrationTests/SshTests.cs
@@ -74,7 +74,7 @@ public void Ssh_ShellStream_Exit()
var line = shellStream.ReadLine();
Assert.IsNotNull(line);
- Assert.IsTrue(line.EndsWith("Hello!"), line);
+ Assert.EndsWith("Hello!", line, 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 @@ public void Ssh_CreateShellStreamNoTerminal()
shellStream.WriteLine($"echo {foo}");
var line = shellStream.ReadLine(TimeSpan.FromSeconds(1));
Assert.IsNotNull(line);
- Assert.IsTrue(line.EndsWith(foo), line);
+ Assert.EndsWith(foo, line, line);
}
}
}
@@ -221,7 +221,7 @@ public void Ssh_CreateShellNoTerminal()
var outputString = outputReader.ReadLine();
Assert.IsNotNull(outputString);
- Assert.IsTrue(outputString.EndsWith(foo), outputString);
+ Assert.EndsWith(foo, outputString, outputString);
shell.Stop();
}
@@ -341,7 +341,7 @@ public async Task Ssh_Command_IntermittentOutput_OutputStream()
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 @@ public void Ssh_DynamicPortForwarding_DisposeSshClientWithoutStoppingPort()
socksSocket.Send(httpGetRequest);
var httpResponse = GetHttpResponse(socksSocket, Encoding.ASCII);
- Assert.IsTrue(httpResponse.Contains(searchText), httpResponse);
+ Assert.Contains(searchText, httpResponse, httpResponse);
}
Assert.IsTrue(socksSocket.Connected);
@@ -427,7 +427,7 @@ public void Ssh_DynamicPortForwarding_DomainName()
socksSocket.Send(httpGetRequest);
var httpResponse = GetHttpResponse(socksSocket, Encoding.ASCII);
- Assert.IsTrue(httpResponse.Contains(searchText), httpResponse);
+ Assert.Contains(searchText, httpResponse, httpResponse);
// Verify if port is still open
socksSocket.Send(httpGetRequest);
@@ -447,7 +447,7 @@ public void Ssh_DynamicPortForwarding_DomainName()
socksSocket.Send(httpGetRequest);
httpResponse = GetHttpResponse(socksSocket, Encoding.ASCII);
- Assert.IsTrue(httpResponse.Contains(searchText), httpResponse);
+ Assert.Contains(searchText, httpResponse, httpResponse);
forwardedPort.Dispose();
@@ -496,7 +496,7 @@ public void Ssh_DynamicPortForwarding_IPv4()
socksSocket.Send(httpGetRequest);
var httpResponse = GetHttpResponse(socksSocket, Encoding.ASCII);
- Assert.IsTrue(httpResponse.Contains(searchText), httpResponse);
+ Assert.Contains(searchText, httpResponse, httpResponse);
forwardedPort.Dispose();
diff --git a/test/Renci.SshNet.IntegrationTests/SshTests_TTYDisabled.cs b/test/Renci.SshNet.IntegrationTests/SshTests_TTYDisabled.cs
index 6150e128d..01f014350 100644
--- a/test/Renci.SshNet.IntegrationTests/SshTests_TTYDisabled.cs
+++ b/test/Renci.SshNet.IntegrationTests/SshTests_TTYDisabled.cs
@@ -62,7 +62,7 @@ public void Ssh_CreateShellStreamNoTerminal()
shellStream.WriteLine($"echo {foo}");
var line = shellStream.ReadLine(TimeSpan.FromSeconds(1));
Assert.IsNotNull(line);
- Assert.IsTrue(line.EndsWith(foo), line);
+ Assert.EndsWith(foo, line, line);
}
}
}
@@ -122,7 +122,7 @@ public void Ssh_CreateShellNoTerminal()
var outputString = outputReader.ReadLine();
Assert.IsNotNull(outputString);
- Assert.IsTrue(outputString.EndsWith(foo), outputString);
+ Assert.EndsWith(foo, outputString, outputString);
shell.Stop();
}
diff --git a/test/Renci.SshNet.IntegrationTests/TestsFixtures/InfrastructureFixture.cs b/test/Renci.SshNet.IntegrationTests/TestsFixtures/InfrastructureFixture.cs
index 304f294a4..b16938ebb 100644
--- a/test/Renci.SshNet.IntegrationTests/TestsFixtures/InfrastructureFixture.cs
+++ b/test/Renci.SshNet.IntegrationTests/TestsFixtures/InfrastructureFixture.cs
@@ -6,6 +6,8 @@
using Microsoft.Extensions.Logging;
+using Renci.SshNet.IntegrationTests.Logging;
+
namespace Renci.SshNet.IntegrationTests.TestsFixtures
{
public sealed class InfrastructureFixture : IDisposable
@@ -16,7 +18,7 @@ private InfrastructureFixture()
{
builder.SetMinimumLevel(LogLevel.Debug);
builder.AddFilter("testcontainers", LogLevel.Information);
- builder.AddConsole();
+ builder.AddTestConsoleLogger();
});
SshNetLoggingConfiguration.InitializeLogging(_loggerFactory);
diff --git a/test/Renci.SshNet.Tests/Classes/AbstractionsTest.cs b/test/Renci.SshNet.Tests/Classes/AbstractionsTest.cs
index c37b3dcf9..2fd7d9429 100644
--- a/test/Renci.SshNet.Tests/Classes/AbstractionsTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/AbstractionsTest.cs
@@ -11,7 +11,7 @@ public class AbstractionsTest
[TestMethod]
public void CryptoAbstraction_GenerateRandom_ShouldPerformNoOpWhenDataIsZeroLength()
{
- Assert.AreEqual(0, CryptoAbstraction.GenerateRandom(0).Length);
+ Assert.IsEmpty(CryptoAbstraction.GenerateRandom(0));
}
[TestMethod]
@@ -22,8 +22,8 @@ public void CryptoAbstraction_GenerateRandom_ShouldGenerateRandomSequenceOfValue
var dataA = CryptoAbstraction.GenerateRandom(dataLength);
var dataB = CryptoAbstraction.GenerateRandom(dataLength);
- Assert.AreEqual(dataLength, dataA.Length);
- Assert.AreEqual(dataLength, dataB.Length);
+ Assert.HasCount(dataLength, dataA);
+ Assert.HasCount(dataLength, dataB);
CollectionAssert.AreNotEqual(dataA, dataB);
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelForwardedTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelForwardedTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs
index 8617aba37..c00654dc0 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelForwardedTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelForwardedTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs
@@ -174,8 +174,8 @@ private void Act()
[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]);
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_Disposed.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_Disposed.cs
index 42ef98747..d2d14eee4 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_Disposed.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_Disposed.cs
@@ -131,13 +131,13 @@ public void ChannelCloseMessageShouldBeSentOnce()
[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);
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived_DisposeInEventHandler.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived_DisposeInEventHandler.cs
index da7438b97..135c2f81f 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived_DisposeInEventHandler.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived_DisposeInEventHandler.cs
@@ -123,13 +123,13 @@ public void CurrentCountOfSessionSemaphoreShouldBeEqualToInitialCount()
[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);
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived_SendChannelCloseMessageFailure.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived_SendChannelCloseMessageFailure.cs
index 80fc2e038..a13ce4738 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived_SendChannelCloseMessageFailure.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived_SendChannelCloseMessageFailure.cs
@@ -113,13 +113,13 @@ public void CurrentCountOfSessionSemaphoreShouldBeEqualToInitialCount()
[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);
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived_SendChannelCloseMessageSuccess.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived_SendChannelCloseMessageSuccess.cs
index 1684b364d..f58bc4dbb 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived_SendChannelCloseMessageSuccess.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived_SendChannelCloseMessageSuccess.cs
@@ -121,13 +121,13 @@ public void CurrentCountOfSessionSemaphoreShouldBeEqualToInitialCount()
[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);
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseReceived_SendChannelCloseMessageFailure.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseReceived_SendChannelCloseMessageFailure.cs
index 3fbba4e9e..75882814b 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseReceived_SendChannelCloseMessageFailure.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseReceived_SendChannelCloseMessageFailure.cs
@@ -110,13 +110,13 @@ public void CurrentCountOfSessionSemaphoreShouldBeEqualToInitialCount()
[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);
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseReceived_SendChannelCloseMessageSuccess.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseReceived_SendChannelCloseMessageSuccess.cs
index 075b02a55..24a8798ee 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseReceived_SendChannelCloseMessageSuccess.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseReceived_SendChannelCloseMessageSuccess.cs
@@ -118,13 +118,13 @@ public void CurrentCountOfSessionSemaphoreShouldBeEqualToInitialCount()
[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);
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelEofReceived_SendChannelCloseMessageFailure.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelEofReceived_SendChannelCloseMessageFailure.cs
index 44e661708..4ac844652 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelEofReceived_SendChannelCloseMessageFailure.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelEofReceived_SendChannelCloseMessageFailure.cs
@@ -109,13 +109,13 @@ public void CurrentCountOfSessionSemaphoreShouldBeEqualToInitialCount()
[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]
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelEofReceived_SendChannelCloseMessageSuccess.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelEofReceived_SendChannelCloseMessageSuccess.cs
index 3d6a4407b..7c35fe496 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelEofReceived_SendChannelCloseMessageSuccess.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelEofReceived_SendChannelCloseMessageSuccess.cs
@@ -124,13 +124,13 @@ public void CurrentCountOfSessionSemaphoreShouldBeEqualToInitialCount()
[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);
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_NoChannelCloseOrChannelEofReceived.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_NoChannelCloseOrChannelEofReceived.cs
index 0824ace27..4c5f5f327 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_NoChannelCloseOrChannelEofReceived.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_NoChannelCloseOrChannelEofReceived.cs
@@ -129,13 +129,13 @@ public void ChannelCloseMessageShouldBeSentOnce()
[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);
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_NoChannelCloseOrChannelEofReceived_SendChannelEofMessageFailure.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_NoChannelCloseOrChannelEofReceived_SendChannelEofMessageFailure.cs
index d7a14aa24..0f1ba3181 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_NoChannelCloseOrChannelEofReceived_SendChannelEofMessageFailure.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_NoChannelCloseOrChannelEofReceived_SendChannelEofMessageFailure.cs
@@ -128,13 +128,13 @@ public void ChannelCloseMessageShouldBeSentOnce()
[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);
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsNotConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsNotConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived.cs
index 3c3b30bb8..984cde463 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsNotConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsNotConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived.cs
@@ -109,13 +109,13 @@ public void CurrentCountOfSessionSemaphoreShouldBeEqualToInitialCount()
[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);
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsNotConnectedAndChannelIsOpen_ChannelCloseReceived.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsNotConnectedAndChannelIsOpen_ChannelCloseReceived.cs
index b584fa2d0..f76a4e88d 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsNotConnectedAndChannelIsOpen_ChannelCloseReceived.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsNotConnectedAndChannelIsOpen_ChannelCloseReceived.cs
@@ -106,13 +106,13 @@ public void CurrentCountOfSessionSemaphoreShouldBeEqualToInitialCount()
[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);
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsNotConnectedAndChannelIsOpen_NoChannelCloseOrChannelEofReceived.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsNotConnectedAndChannelIsOpen_NoChannelCloseOrChannelEofReceived.cs
index 23a619c5c..f9a565ca4 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsNotConnectedAndChannelIsOpen_NoChannelCloseOrChannelEofReceived.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_SessionIsNotConnectedAndChannelIsOpen_NoChannelCloseOrChannelEofReceived.cs
@@ -101,13 +101,13 @@ public void CurrentCountOfSessionSemaphoreShouldBeEqualToInitialCount()
[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]
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen.cs
index 22bb7dda3..7cdf6c9f7 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen.cs
@@ -117,13 +117,13 @@ public void CurrentCountOfSessionSemaphoreShouldBeEqualToInitialCount()
[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);
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_ExceptionWaitingOnOpenConfirmation.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_ExceptionWaitingOnOpenConfirmation.cs
index 43a19936d..ab387ab53 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_ExceptionWaitingOnOpenConfirmation.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_ExceptionWaitingOnOpenConfirmation.cs
@@ -98,13 +98,13 @@ public void CurrentCountOfSessionSemaphoreShouldBeEqualToInitialCount()
[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]
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_OnOpenFailureReceived_NoRetriesAvailable.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_OnOpenFailureReceived_NoRetriesAvailable.cs
index 5ff15cec2..e9e2f7195 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_OnOpenFailureReceived_NoRetriesAvailable.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_OnOpenFailureReceived_NoRetriesAvailable.cs
@@ -122,13 +122,13 @@ public void CurrentCountOfSessionSemaphoreShouldBeEqualToInitialCount()
[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]
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_OnOpenFailureReceived_RetriesAvailable.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_OnOpenFailureReceived_RetriesAvailable.cs
index 78ffa1ec1..0a80ce42c 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_OnOpenFailureReceived_RetriesAvailable.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_OnOpenFailureReceived_RetriesAvailable.cs
@@ -135,13 +135,13 @@ public void CurrentCountOfSessionSemaphoreShouldBeOneLessThanToInitialCount()
[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]
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsNotOpen.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsNotOpen.cs
index a6fa84184..ac6b23573 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsNotOpen.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsNotOpen.cs
@@ -66,13 +66,13 @@ public void SendMessageOnSessionShouldNeverBeInvoked()
[TestMethod]
public void ClosedEventShouldNeverHaveFired()
{
- Assert.AreEqual(0, _channelClosedRegister.Count);
+ Assert.IsEmpty(_channelClosedRegister);
}
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
- Assert.AreEqual(0, _channelExceptionRegister.Count);
+ Assert.IsEmpty(_channelExceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofNotReceived.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofNotReceived.cs
index db8440036..e3aabec90 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofNotReceived.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofNotReceived.cs
@@ -133,13 +133,13 @@ public void TryWaitOnSessionShouldBeInvokedOnce()
[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 @@ public void DisposeShouldBlockUntilClosedEventHandlerHasCompleted()
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
- Assert.AreEqual(0, _channelExceptionRegister.Count);
+ Assert.IsEmpty(_channelExceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofNotReceived_SendEofInvoked.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofNotReceived_SendEofInvoked.cs
index f6eb2933b..f21f593a6 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofNotReceived_SendEofInvoked.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofNotReceived_SendEofInvoked.cs
@@ -139,13 +139,13 @@ public void WaitOnHandleOnSessionShouldBeInvokedOnce()
[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);
}
@@ -158,7 +158,7 @@ public void DisposeShouldBlockUntilClosedEventHandlerHasCompleted()
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
- Assert.AreEqual(0, _channelExceptionRegister.Count);
+ Assert.IsEmpty(_channelExceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofReceived.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofReceived.cs
index 4f11009bb..151c98ec8 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofReceived.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofReceived.cs
@@ -173,21 +173,21 @@ public void WaitOnHandleOnSessionShouldWaitForChannelCloseMessageToBeReceived()
[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]
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofReceived_DisconnectWaitingForChannelCloseMessage.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofReceived_DisconnectWaitingForChannelCloseMessage.cs
index a9ea77825..1d4cb09c9 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofReceived_DisconnectWaitingForChannelCloseMessage.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofReceived_DisconnectWaitingForChannelCloseMessage.cs
@@ -105,20 +105,20 @@ public void TryWaitOnSessionShouldBeInvokedOnce()
[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);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofReceived_TimeoutWaitingForChannelCloseMessage.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofReceived_TimeoutWaitingForChannelCloseMessage.cs
index cc3f8547a..6b1777c6a 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofReceived_TimeoutWaitingForChannelCloseMessage.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofReceived_TimeoutWaitingForChannelCloseMessage.cs
@@ -105,20 +105,20 @@ public void TryWaitOnSessionShouldBeInvokedOnce()
[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);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsNotConnectedAndChannelIsNotOpen.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsNotConnectedAndChannelIsNotOpen.cs
index 2cd622443..0fe89eb14 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsNotConnectedAndChannelIsNotOpen.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsNotConnectedAndChannelIsNotOpen.cs
@@ -66,13 +66,13 @@ public void SendMessageOnSessionShouldNeverBeInvoked()
[TestMethod]
public void ClosedEventShouldNeverHaveFired()
{
- Assert.AreEqual(0, _channelClosedRegister.Count);
+ Assert.IsEmpty(_channelClosedRegister);
}
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
- Assert.AreEqual(0, _channelExceptionRegister.Count);
+ Assert.IsEmpty(_channelExceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsNotConnectedAndChannelIsOpen.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsNotConnectedAndChannelIsOpen.cs
index f0553cceb..394197637 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsNotConnectedAndChannelIsOpen.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsNotConnectedAndChannelIsOpen.cs
@@ -66,13 +66,13 @@ public void SendMessageOnSessionShouldNeverBeInvoked()
[TestMethod]
public void ClosedEventShouldNeverHaveFired()
{
- Assert.AreEqual(0, _channelClosedRegister.Count);
+ Assert.IsEmpty(_channelClosedRegister);
}
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
- Assert.AreEqual(0, _channelExceptionRegister.Count);
+ Assert.IsEmpty(_channelExceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelCloseReceived_OnClose_Exception.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelCloseReceived_OnClose_Exception.cs
index 964ae98b9..541ff3fe9 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelCloseReceived_OnClose_Exception.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelCloseReceived_OnClose_Exception.cs
@@ -51,14 +51,14 @@ protected override void Act()
[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]);
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen_DisposeChannelInClosedEventHandler.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen_DisposeChannelInClosedEventHandler.cs
index 27a1929e5..4deda5ade 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen_DisposeChannelInClosedEventHandler.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen_DisposeChannelInClosedEventHandler.cs
@@ -121,20 +121,20 @@ public void ChannelCloseWaitHandleShouldHaveBeenSignaledImmediately()
[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]
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen_EofNotReceived.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen_EofNotReceived.cs
index c9227791f..9e318f10e 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen_EofNotReceived.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen_EofNotReceived.cs
@@ -110,14 +110,14 @@ public void TryWaitOnSessionShouldBeInvokedOnce()
[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]
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen_EofReceived.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen_EofReceived.cs
index 101c169d3..81acb43ee 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen_EofReceived.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen_EofReceived.cs
@@ -113,14 +113,14 @@ public void TryWaitOnSessionShouldBeInvokedOnce()
[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]
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelDataReceived_OnData_Exception.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelDataReceived_OnData_Exception.cs
index 6ad785d85..7d37e79dc 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelDataReceived_OnData_Exception.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelDataReceived_OnData_Exception.cs
@@ -51,14 +51,14 @@ protected override void Act()
[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]);
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelEofReceived_OnEof_Exception.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelEofReceived_OnEof_Exception.cs
index c4f7f433d..ee72ec776 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelEofReceived_OnEof_Exception.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelEofReceived_OnEof_Exception.cs
@@ -59,14 +59,14 @@ protected override void Act()
[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]);
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelExtendedDataReceived_OnExtendedData_Exception.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelExtendedDataReceived_OnExtendedData_Exception.cs
index 84892795a..07a670a44 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelExtendedDataReceived_OnExtendedData_Exception.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelExtendedDataReceived_OnExtendedData_Exception.cs
@@ -51,14 +51,14 @@ protected override void Act()
[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]);
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelFailureReceived_OnFailure_Exception.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelFailureReceived_OnFailure_Exception.cs
index b0b3d8139..f1b856ac4 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelFailureReceived_OnFailure_Exception.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelFailureReceived_OnFailure_Exception.cs
@@ -51,14 +51,14 @@ protected override void Act()
[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]);
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelRequestReceived_HandleUnknownMessage.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelRequestReceived_HandleUnknownMessage.cs
index fa02dc49b..a861e33cb 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelRequestReceived_HandleUnknownMessage.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelRequestReceived_HandleUnknownMessage.cs
@@ -70,7 +70,7 @@ public void FailureMessageWasSent()
[TestMethod]
public void NoExceptionShouldHaveFired()
{
- Assert.AreEqual(0, _channelExceptionRegister.Count);
+ Assert.IsEmpty(_channelExceptionRegister);
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelRequestReceived_OnRequest_Exception.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelRequestReceived_OnRequest_Exception.cs
index 860fc684b..f5a505f4d 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelRequestReceived_OnRequest_Exception.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelRequestReceived_OnRequest_Exception.cs
@@ -55,14 +55,14 @@ protected override void Act()
[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]);
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelSuccessReceived_OnSuccess_Exception.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelSuccessReceived_OnSuccess_Exception.cs
index a12753067..1162d394a 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelSuccessReceived_OnSuccess_Exception.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelSuccessReceived_OnSuccess_Exception.cs
@@ -51,14 +51,14 @@ protected override void Act()
[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]);
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelWindowAdjustReceived_OnWindowAdjust_Exception.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelWindowAdjustReceived_OnWindowAdjust_Exception.cs
index 5f0686ef0..486be1390 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelWindowAdjustReceived_OnWindowAdjust_Exception.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelWindowAdjustReceived_OnWindowAdjust_Exception.cs
@@ -60,14 +60,14 @@ protected override void Act()
[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]);
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionDisconnected_OnDisconnected_Exception.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionDisconnected_OnDisconnected_Exception.cs
index 6900ac720..08b6c1279 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionDisconnected_OnDisconnected_Exception.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionDisconnected_OnDisconnected_Exception.cs
@@ -49,14 +49,14 @@ protected override void Act()
[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]);
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionDisconnected_SessionIsConnectedAndChannelIsOpen.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionDisconnected_SessionIsConnectedAndChannelIsOpen.cs
index d7f04dabe..c9174f532 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionDisconnected_SessionIsConnectedAndChannelIsOpen.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionDisconnected_SessionIsConnectedAndChannelIsOpen.cs
@@ -65,13 +65,13 @@ public void IsOpenShouldReturnFalse()
[TestMethod]
public void ClosedEventShouldNeverHaveFired()
{
- Assert.AreEqual(0, _channelClosedRegister.Count);
+ Assert.IsEmpty(_channelClosedRegister);
}
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
- Assert.AreEqual(0, _channelExceptionRegister.Count);
+ Assert.IsEmpty(_channelExceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionErrorOccurred_OnErrorOccurred_Exception.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionErrorOccurred_OnErrorOccurred_Exception.cs
index eabb0eab9..40202e807 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionErrorOccurred_OnErrorOccurred_Exception.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionErrorOccurred_OnErrorOccurred_Exception.cs
@@ -51,14 +51,14 @@ protected override void Act()
[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]);
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_SendEof_ChannelIsNotOpen.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_SendEof_ChannelIsNotOpen.cs
index 4a922ad3c..31303cf94 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_SendEof_ChannelIsNotOpen.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_SendEof_ChannelIsNotOpen.cs
@@ -82,13 +82,13 @@ public void SendMessageOnSessionShouldNeverBeInvoked()
[TestMethod]
public void ClosedEventShouldNeverHaveFired()
{
- Assert.AreEqual(0, _channelClosedRegister.Count);
+ Assert.IsEmpty(_channelClosedRegister);
}
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
- Assert.AreEqual(0, _channelExceptionRegister.Count);
+ Assert.IsEmpty(_channelExceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_SendEof_ChannelIsOpen.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_SendEof_ChannelIsOpen.cs
index fe8092250..317ea04b6 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_SendEof_ChannelIsOpen.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_SendEof_ChannelIsOpen.cs
@@ -75,13 +75,13 @@ public void SendMessageOnSessionShouldBeInvokedOnceWithChannelEofMessage()
[TestMethod]
public void ClosedEventShouldNeverHaveFired()
{
- Assert.AreEqual(0, _channelClosedRegister.Count);
+ Assert.IsEmpty(_channelClosedRegister);
}
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
- Assert.AreEqual(0, _channelExceptionRegister.Count);
+ Assert.IsEmpty(_channelExceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ClientChannelTest_OnSessionChannelOpenConfirmationReceived_OnOpenConfirmation_Exception.cs b/test/Renci.SshNet.Tests/Classes/Channels/ClientChannelTest_OnSessionChannelOpenConfirmationReceived_OnOpenConfirmation_Exception.cs
index 123cf9a90..e9ad92ab0 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ClientChannelTest_OnSessionChannelOpenConfirmationReceived_OnOpenConfirmation_Exception.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ClientChannelTest_OnSessionChannelOpenConfirmationReceived_OnOpenConfirmation_Exception.cs
@@ -59,14 +59,14 @@ private void Act()
[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]);
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ClientChannelTest_OnSessionChannelOpenFailureReceived_OnOpenFailure_Exception.cs b/test/Renci.SshNet.Tests/Classes/Channels/ClientChannelTest_OnSessionChannelOpenFailureReceived_OnOpenFailure_Exception.cs
index 20082a6a9..a2319987d 100644
--- a/test/Renci.SshNet.Tests/Classes/Channels/ClientChannelTest_OnSessionChannelOpenFailureReceived_OnOpenFailure_Exception.cs
+++ b/test/Renci.SshNet.Tests/Classes/Channels/ClientChannelTest_OnSessionChannelOpenFailureReceived_OnOpenFailure_Exception.cs
@@ -56,14 +56,14 @@ private void Act()
[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]);
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Concat.cs b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Concat.cs
index bbae3afac..2581826bb 100644
--- a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Concat.cs
+++ b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Concat.cs
@@ -85,7 +85,7 @@ public void ShouldConcatSecondToFirstWhenBothAreNotEmpty()
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]);
diff --git a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Pad.cs b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Pad.cs
index 3a7bb32f8..d14a4e172 100644
--- a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Pad.cs
+++ b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Pad.cs
@@ -13,7 +13,7 @@ public void ShouldReturnNotPadded()
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 @@ public void ShouldReturnPadded()
{
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]);
diff --git a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Take_Count.cs b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Take_Count.cs
index 0f30c0aea..5a20af685 100644
--- a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Take_Count.cs
+++ b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Take_Count.cs
@@ -44,7 +44,7 @@ public void ShouldReturnEmptyByteArrayWhenCountIsZero()
var actual = Extensions.Take(value, count);
Assert.IsNotNull(actual);
- Assert.AreEqual(0, actual.Length);
+ Assert.IsEmpty(actual);
}
[TestMethod]
@@ -68,7 +68,7 @@ public void ShouldReturnLeadingBytesWhenCountIsLessThanLengthOfValue()
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]);
diff --git a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Take_OffsetAndCount.cs b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Take_OffsetAndCount.cs
index f455915d2..85978bd2d 100644
--- a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Take_OffsetAndCount.cs
+++ b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Take_OffsetAndCount.cs
@@ -47,7 +47,7 @@ public void ShouldReturnEmptyByteArrayWhenCountIsZero()
var actual = Extensions.Take(value, offset, count);
Assert.IsNotNull(actual);
- Assert.AreEqual(0, actual.Length);
+ Assert.IsEmpty(actual);
}
[TestMethod]
@@ -60,7 +60,7 @@ public void ShouldReturnValueWhenCountIsEqualToLengthOfValueAndOffsetIsZero()
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 @@ public void ShouldReturnLeadingBytesWhenOffsetIsZeroAndCountIsLessThanLengthOfVa
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 @@ public void ShouldReturnCorrectPartOfValueWhenOffsetIsGreaterThanZeroAndOffsetPl
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]);
diff --git a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_ToBigInteger2.cs b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_ToBigInteger2.cs
index d655f3d73..20d40ac51 100644
--- a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_ToBigInteger2.cs
+++ b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_ToBigInteger2.cs
@@ -15,7 +15,7 @@ public void ShouldNotAppendZero()
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 @@ public void ShouldAppendZero()
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]);
diff --git a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_TrimLeadingZeros.cs b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_TrimLeadingZeros.cs
index dee706b0f..d3b537ea9 100644
--- a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_TrimLeadingZeros.cs
+++ b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_TrimLeadingZeros.cs
@@ -34,7 +34,7 @@ public void ShouldRemoveAllLeadingZeros()
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 @@ public void ShouldOnlyRemoveLeadingZeros()
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 @@ public void ShouldReturnOriginalEmptyByteArrayWhenValueHasNoLeadingZeros()
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 @@ public void ShouldReturnEmptyByteArrayWhenValueIsEmpty()
var actual = Extensions.TrimLeadingZeros(value);
Assert.IsNotNull(actual);
- Assert.AreEqual(0, actual.Length);
+ Assert.IsEmpty(actual);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_ConnectionRefusedByServer.cs b/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_ConnectionRefusedByServer.cs
index 3037134c3..81a9ff382 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_ConnectionRefusedByServer.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_ConnectionRefusedByServer.cs
@@ -76,7 +76,7 @@ public void ConnectShouldHaveRespectedTimeout()
_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]
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_ConnectionSucceeded.cs b/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_ConnectionSucceeded.cs
index 17d984262..55a8b1261 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_ConnectionSucceeded.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_ConnectionSucceeded.cs
@@ -83,7 +83,7 @@ public void ConnectShouldHaveRespectedTimeout()
_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]
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_TimeoutConnectingToServer.cs b/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_TimeoutConnectingToServer.cs
index 82623bc3e..46a45a355 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_TimeoutConnectingToServer.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/DirectConnectorTest_Connect_TimeoutConnectingToServer.cs
@@ -96,8 +96,8 @@ public void ConnectShouldHaveRespectedTimeoutOnWindows()
_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]
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ConnectionToProxyRefused.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ConnectionToProxyRefused.cs
index fd7d9c72a..01270c6dd 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ConnectionToProxyRefused.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ConnectionToProxyRefused.cs
@@ -86,7 +86,7 @@ public void ConnectShouldHaveRespectedTimeout()
_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]
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutConnectingToProxy.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutConnectingToProxy.cs
index 0e8b0935e..eb466816d 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutConnectingToProxy.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutConnectingToProxy.cs
@@ -106,8 +106,8 @@ public void ConnectShouldHaveRespectedTimeoutOnWindows()
_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]
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingHttpContent.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingHttpContent.cs
index 45d9a59e6..817cc27a3 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingHttpContent.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingHttpContent.cs
@@ -137,8 +137,8 @@ public void ConnectShouldHaveRespectedTimeout()
_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]
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingStatusLine.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingStatusLine.cs
index 4610c521c..e325c88f8 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingStatusLine.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingStatusLine.cs
@@ -107,8 +107,8 @@ public void ConnectShouldHaveRespectedTimeout()
_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]
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ConnectionClosedByServer_NoDataSentByServer.cs b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ConnectionClosedByServer_NoDataSentByServer.cs
index 43aa9a3b1..e9460cd8e 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ConnectionClosedByServer_NoDataSentByServer.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ConnectionClosedByServer_NoDataSentByServer.cs
@@ -103,7 +103,7 @@ public void StartShouldHaveThrownSshConnectionException()
[TestMethod]
public void ClientIdentificationWasSentToServer()
{
- Assert.AreEqual(5, _dataReceivedByServer.Count);
+ Assert.HasCount(5, _dataReceivedByServer);
Assert.AreEqual(0xed, _dataReceivedByServer[0]);
Assert.AreEqual(0x95, _dataReceivedByServer[1]);
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseContainsNullCharacter.cs b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseContainsNullCharacter.cs
index 164cb6a70..804fd20dd 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseContainsNullCharacter.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseContainsNullCharacter.cs
@@ -111,7 +111,7 @@ public void ClientIdentificationWasSentToServer()
{
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]);
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseInvalid_SshIdentificationOnlyContainsProtocolVersion.cs b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseInvalid_SshIdentificationOnlyContainsProtocolVersion.cs
index 3b0649517..25be7f945 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseInvalid_SshIdentificationOnlyContainsProtocolVersion.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseInvalid_SshIdentificationOnlyContainsProtocolVersion.cs
@@ -113,7 +113,7 @@ public void ClientIdentificationWasSentToServer()
{
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]);
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseValid_Comments.cs b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseValid_Comments.cs
index 2af8062b6..c00b69d06 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseValid_Comments.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseValid_Comments.cs
@@ -97,7 +97,7 @@ public void ClientIdentificationWasSentToServer()
{
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]);
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseValid_EmptySoftwareVersion.cs b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseValid_EmptySoftwareVersion.cs
index c7daaf14d..1770ecd97 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseValid_EmptySoftwareVersion.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseValid_EmptySoftwareVersion.cs
@@ -100,7 +100,7 @@ public void ClientIdentificationWasSentToServer()
{
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]);
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseValid_NoComments.cs b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseValid_NoComments.cs
index 365967209..9719a2a00 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseValid_NoComments.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseValid_NoComments.cs
@@ -97,7 +97,7 @@ public void ClientIdentificationWasSentToServer()
{
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]);
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseValid_TerminatedByLineFeedWithoutCarriageReturn.cs b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseValid_TerminatedByLineFeedWithoutCarriageReturn.cs
index 2c35bce53..29873c860 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseValid_TerminatedByLineFeedWithoutCarriageReturn.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseValid_TerminatedByLineFeedWithoutCarriageReturn.cs
@@ -99,7 +99,7 @@ public void ClientIdentificationWasSentToServer()
{
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]);
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_TimeoutReadingIdentificationString.cs b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_TimeoutReadingIdentificationString.cs
index 3710e2064..917516271 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_TimeoutReadingIdentificationString.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_TimeoutReadingIdentificationString.cs
@@ -103,7 +103,7 @@ public void ClientIdentificationWasSentToServer()
{
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]);
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_ConnectionToProxyRefused.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_ConnectionToProxyRefused.cs
index 96e094a1b..541eae147 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_ConnectionToProxyRefused.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_ConnectionToProxyRefused.cs
@@ -75,7 +75,7 @@ public void ConnectShouldHaveRespectedTimeout()
_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]
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutConnectingToProxy.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutConnectingToProxy.cs
index 639a603c1..b0ae1d88f 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutConnectingToProxy.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutConnectingToProxy.cs
@@ -94,8 +94,8 @@ public void ConnectShouldHaveRespectedTimeoutOnWindows()
_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]
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingDestinationAddress.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingDestinationAddress.cs
index efcd02520..35fe071ae 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingDestinationAddress.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingDestinationAddress.cs
@@ -109,8 +109,8 @@ public void ConnectShouldHaveRespectedTimeout()
_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]
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyCode.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyCode.cs
index 92b8843e4..e101b9035 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyCode.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyCode.cs
@@ -105,8 +105,8 @@ public void ConnectShouldHaveRespectedTimeout()
_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]
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyVersion.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyVersion.cs
index fcb5ffb0c..d01b1c562 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyVersion.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyVersion.cs
@@ -97,8 +97,8 @@ public void ConnectShouldHaveRespectedTimeout()
_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]
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_ConnectionToProxyRefused.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_ConnectionToProxyRefused.cs
index 51d6edda2..65cf4e3f5 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_ConnectionToProxyRefused.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_ConnectionToProxyRefused.cs
@@ -75,7 +75,7 @@ public void ConnectShouldHaveRespectedTimeout()
_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]
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_TimeoutConnectingToProxy.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_TimeoutConnectingToProxy.cs
index 1bf0f80d6..59e5e0bce 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_TimeoutConnectingToProxy.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_TimeoutConnectingToProxy.cs
@@ -95,8 +95,8 @@ public void ConnectShouldHaveRespectedTimeoutOnWindows()
_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]
diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_TimeoutConnectionReply.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_TimeoutConnectionReply.cs
index 40d078546..a1dfb236b 100644
--- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_TimeoutConnectionReply.cs
+++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_TimeoutConnectionReply.cs
@@ -107,8 +107,8 @@ public void ConnectShouldHaveRespectedTimeout()
_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]
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortDisposed.cs
index d39a91fab..5eed17484 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortDisposed.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortDisposed.cs
@@ -50,13 +50,13 @@ protected void Act()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortNeverStarted.cs
index a9ce2b49e..7f0c08a1c 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortNeverStarted.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortNeverStarted.cs
@@ -89,13 +89,13 @@ public void ForwardedPortShouldRejectNewConnections()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelBound.cs
index 692afe88d..d08c81324 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelBound.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelBound.cs
@@ -189,13 +189,13 @@ public void BoundClientShouldNotBeClosed()
[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]
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelNotBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelNotBound.cs
index 5804f6db1..c59117a0b 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelNotBound.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelNotBound.cs
@@ -131,13 +131,13 @@ public void ExistingConnectionShouldBeClosed()
[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]
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStopped.cs
index 85ef70f8b..9445c0ea0 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStopped.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStopped.cs
@@ -93,13 +93,13 @@ public void ForwardedPortShouldRejectNewConnections()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_SessionErrorOccurred_ChannelBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_SessionErrorOccurred_ChannelBound.cs
index c98784edd..fa2aab65c 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_SessionErrorOccurred_ChannelBound.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_SessionErrorOccurred_ChannelBound.cs
@@ -194,13 +194,13 @@ public void BoundClientShouldNotBeClosed()
[TestMethod]
public void ClosingShouldHaveFiredOnce()
{
- Assert.AreEqual(1, _closingRegister.Count);
+ Assert.HasCount(1, _closingRegister);
}
[TestMethod]
public void ExceptionShouldHaveFiredOne()
{
- Assert.AreEqual(1, _exceptionRegister.Count, _exceptionRegister.AsString());
+ Assert.HasCount(1, _exceptionRegister, _exceptionRegister.AsString());
Assert.IsNotNull(_exceptionRegister[0], _exceptionRegister.AsString());
Assert.AreSame(_sessionException, _exceptionRegister[0].Exception, _exceptionRegister.AsString());
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortDisposed.cs
index 2ceac31e4..a51cba116 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortDisposed.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortDisposed.cs
@@ -66,13 +66,13 @@ public void StartShouldThrowObjectDisposedException()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortNeverStarted.cs
index adc55951d..f52bf968d 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortNeverStarted.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortNeverStarted.cs
@@ -86,13 +86,13 @@ public void ForwardedPortShouldAcceptNewConnections()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStarted.cs
index d39263b5b..69b2cd7ef 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStarted.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStarted.cs
@@ -103,13 +103,13 @@ public void ForwardedPortShouldAcceptNewConnections()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStopped.cs
index ad71d804c..35d293abf 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStopped.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStopped.cs
@@ -90,13 +90,13 @@ public void ForwardedPortShouldAcceptNewConnections()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNotConnected.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNotConnected.cs
index ac2211cdc..d5d0faf6c 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNotConnected.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNotConnected.cs
@@ -105,13 +105,13 @@ public void ForwardedPortShouldRejectNewConnections()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNull.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNull.cs
index c326c00d1..99556cd6c 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNull.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNull.cs
@@ -91,13 +91,13 @@ public void ForwardedPortShouldRejectNewConnections()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketSendShutdownImmediately.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketSendShutdownImmediately.cs
index e58bf3d9c..0c2e02a8a 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketSendShutdownImmediately.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketSendShutdownImmediately.cs
@@ -149,13 +149,13 @@ public void ForwardedPortShouldShutdownSendOnSocket()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNeverBeFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count, _exceptionRegister.AsString());
+ Assert.IsEmpty(_exceptionRegister, _exceptionRegister.AsString());
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketVersionNotSupported.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketVersionNotSupported.cs
index d28c311b2..3ad553474 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketVersionNotSupported.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketVersionNotSupported.cs
@@ -136,13 +136,13 @@ public void ForwardedPortShouldShutdownSendOnSocket()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldHaveFiredOnce()
{
- Assert.AreEqual(1, _exceptionRegister.Count, _exceptionRegister.AsString());
+ Assert.HasCount(1, _exceptionRegister, _exceptionRegister.AsString());
var exception = _exceptionRegister[0].Exception;
Assert.IsNotNull(exception);
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortDisposed.cs
index 58b020323..d0fbbb54d 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortDisposed.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortDisposed.cs
@@ -76,13 +76,13 @@ public void ForwardedPortShouldRejectNewConnections()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortNeverStarted.cs
index 118b075e4..8a4948517 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortNeverStarted.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortNeverStarted.cs
@@ -75,13 +75,13 @@ public void ForwardedPortShouldRejectNewConnections()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelBound.cs
index fcfc88a0f..aa09011aa 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelBound.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelBound.cs
@@ -191,13 +191,13 @@ public void BoundClientShouldNotBeClosed()
[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]
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelNotBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelNotBound.cs
index fa716b6b3..3e7ad6ac0 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelNotBound.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelNotBound.cs
@@ -135,13 +135,13 @@ public void ExistingConnectionShouldBeClosed()
[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]
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStopped.cs
index dbc738801..42727dcc7 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStopped.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStopped.cs
@@ -93,13 +93,13 @@ public void ForwardedPortShouldRejectNewConnections()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortDisposed.cs
index 66cc6d57f..c4cbdadfb 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortDisposed.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortDisposed.cs
@@ -67,13 +67,13 @@ protected void Act()
[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]
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortDisposed_NeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortDisposed_NeverStarted.cs
index fb74e217d..4631ca5d9 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortDisposed_NeverStarted.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortDisposed_NeverStarted.cs
@@ -50,13 +50,13 @@ protected void Act()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortNeverStarted.cs
index 22a1ae9fe..456cddc8a 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortNeverStarted.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortNeverStarted.cs
@@ -95,13 +95,13 @@ public void ForwardedPortShouldRejectNewConnections()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelBound.cs
index 6980d3661..814f645b4 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelBound.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelBound.cs
@@ -169,13 +169,13 @@ public void BoundClientShouldNotBeClosed()
[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]
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelNotBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelNotBound.cs
index 0f3b0a57c..a541d9758 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelNotBound.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelNotBound.cs
@@ -100,13 +100,13 @@ public void ForwardedPortShouldRefuseNewConnections()
[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);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStopped.cs
index a9dacf9a6..7c6f2acca 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStopped.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStopped.cs
@@ -98,13 +98,13 @@ public void ForwardedPortShouldRejectNewConnections()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortDisposed.cs
index 6d841b9c9..5469293c4 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortDisposed.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortDisposed.cs
@@ -74,13 +74,13 @@ public void StartShouldThrowObjectDisposedException()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortNeverStarted.cs
index 9d003ff12..e49d648d4 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortNeverStarted.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortNeverStarted.cs
@@ -109,13 +109,13 @@ public void ForwardedPortShouldAcceptNewConnections()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStarted.cs
index 60718f7b3..725a9cac6 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStarted.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStarted.cs
@@ -125,13 +125,13 @@ public void ForwardedPortShouldAcceptNewConnections()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStopped.cs
index c7d13ec38..288b014d8 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStopped.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStopped.cs
@@ -114,13 +114,13 @@ public void ForwardedPortShouldAcceptNewConnections()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNotConnected.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNotConnected.cs
index 9887f7d50..cd41d71cc 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNotConnected.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNotConnected.cs
@@ -110,13 +110,13 @@ public void ForwardedPortShouldRejectNewConnections()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNull.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNull.cs
index 06c288458..758467ec9 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNull.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNull.cs
@@ -109,13 +109,13 @@ public void ForwardedPortShouldRejectNewConnections()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortDisposed.cs
index 2806ec540..de5663954 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortDisposed.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortDisposed.cs
@@ -56,13 +56,13 @@ public void IsStartedShouldReturnFalse()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortNeverStarted.cs
index 3b2c4a1d4..e344f8e17 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortNeverStarted.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortNeverStarted.cs
@@ -92,13 +92,13 @@ public void ForwardedPortShouldRejectNewConnections()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelBound.cs
index a6432f38a..1deb46674 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelBound.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelBound.cs
@@ -184,13 +184,13 @@ public void BoundClientShouldNotBeClosed()
[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]
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelNotBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelNotBound.cs
index b8e893db0..0c5d9cea8 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelNotBound.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelNotBound.cs
@@ -100,13 +100,13 @@ public void ForwardedPortShouldRefuseNewConnections()
[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);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStopped.cs
index 7ec8bde32..c5a66ef47 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStopped.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStopped.cs
@@ -99,13 +99,13 @@ public void ForwardedPortShouldRefuseNewConnections()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortDisposed.cs
index 2cedfbe5a..a0e15b2fa 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortDisposed.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortDisposed.cs
@@ -62,13 +62,13 @@ public void IsStartedShouldReturnFalse()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortNeverStarted.cs
index 37f526e40..c2fa6657b 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortNeverStarted.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortNeverStarted.cs
@@ -103,13 +103,13 @@ public void ForwardedPortShouldIgnoreChannelOpenMessagesWhenDisposed()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStarted_ChannelBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStarted_ChannelBound.cs
index eea751b13..e60398cec 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStarted_ChannelBound.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStarted_ChannelBound.cs
@@ -223,13 +223,13 @@ public void ForwardedPortShouldIgnoreChannelOpenMessagesWhenDisposed()
[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]
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStopped.cs
index ecb1a2ac2..5e58d8a2d 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStopped.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStopped.cs
@@ -133,13 +133,13 @@ public void ForwardedPortShouldIgnoreChannelOpenMessagesWhenDisposed()
[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);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortDisposed.cs
index 8b0b05112..99a5ab8fb 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortDisposed.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortDisposed.cs
@@ -72,13 +72,13 @@ public void StartShouldThrowObjectDisposedException()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs
index ede0df79d..a090242a7 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs
@@ -137,13 +137,13 @@ public void ForwardedPortShouldAcceptNewConnections()
[TestMethod]
public void ClosingShouldNeverHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStarted.cs
index 386da0130..e840aba88 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStarted.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStarted.cs
@@ -156,13 +156,13 @@ public void ForwardedPortShouldAcceptNewConnections()
[TestMethod]
public void ClosingShouldNeverHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStopped.cs
index b952bad9e..399f1c32b 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStopped.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStopped.cs
@@ -155,13 +155,13 @@ public void ForwardedPortShouldAcceptNewConnections()
[TestMethod]
public void ClosingShouldNeverHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNotConnected.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNotConnected.cs
index 681bffb0b..7792664aa 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNotConnected.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNotConnected.cs
@@ -120,13 +120,13 @@ public void ForwardedPortShouldIgnoreReceivedSignalForNewConnection()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNull.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNull.cs
index 9cd3a3046..0dea954d0 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNull.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNull.cs
@@ -77,13 +77,13 @@ public void IsStartedShouldReturnFalse()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Started.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Started.cs
index 5fe0ee302..416db2707 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Started.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Started.cs
@@ -127,8 +127,8 @@ public void ForwardedPortShouldAcceptChannelOpenMessageForBoundAddressAndBoundPo
channelMock.Verify(p => p.Bind(It.Is(ep => ep.Address.Equals(_remoteEndpoint.Address) && ep.Port == _remoteEndpoint.Port), _forwardedPort), Times.Once);
channelMock.Verify(p => p.Dispose(), Times.Once);
- Assert.AreEqual(0, _closingRegister.Count);
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_closingRegister);
+ Assert.IsEmpty(_exceptionRegister);
}
[TestMethod]
@@ -153,8 +153,8 @@ public void ForwardedPortShouldIgnoreChannelOpenMessageForBoundHostAndOtherPort(
_sessionMock.Verify(p => p.CreateChannelForwardedTcpip(channelNumber, initialWindowSize, maximumPacketSize), Times.Never);
- Assert.AreEqual(0, _closingRegister.Count);
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_closingRegister);
+ Assert.IsEmpty(_exceptionRegister);
}
[TestMethod]
@@ -179,8 +179,8 @@ public void ForwardedPortShouldIgnoreChannelOpenMessageForOtherHostAndBoundPort(
_sessionMock.Verify(p => p.CreateChannelForwardedTcpip(channelNumber, initialWindowSize, maximumPacketSize), Times.Never);
- Assert.AreEqual(0, _closingRegister.Count);
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_closingRegister);
+ Assert.IsEmpty(_exceptionRegister);
}
[TestMethod]
@@ -201,8 +201,8 @@ public void ForwardedPortShouldIgnoreChannelOpenMessageWhenChannelOpenInfoIsNotF
_sessionMock.Verify(p => p.CreateChannelForwardedTcpip(channelNumber, initialWindowSize, maximumPacketSize), Times.Never);
- Assert.AreEqual(0, _closingRegister.Count);
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_closingRegister);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortDisposed.cs
index 796bdda4d..09fe0247e 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortDisposed.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortDisposed.cs
@@ -62,13 +62,13 @@ public void IsStartedShouldReturnFalse()
[TestMethod]
public void ClosingShouldNotHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortNeverStarted.cs
index a95c54ca1..fdb83d228 100644
--- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortNeverStarted.cs
+++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortNeverStarted.cs
@@ -127,13 +127,13 @@ public void ForwardedPortShouldIgnoreNewConnections()
[TestMethod]
public void ClosingShouldNeverHaveFired()
{
- Assert.AreEqual(0, _closingRegister.Count);
+ Assert.IsEmpty(_closingRegister);
}
[TestMethod]
public void ExceptionShouldNotHaveFired()
{
- Assert.AreEqual(0, _exceptionRegister.Count);
+ Assert.IsEmpty(_exceptionRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelDataMessageTest.cs b/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelDataMessageTest.cs
index 2f96b11d8..05229be1e 100644
--- a/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelDataMessageTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelDataMessageTest.cs
@@ -114,7 +114,7 @@ public void GetBytes()
expectedBytesLength += 4; // Data length
expectedBytesLength += size; // Data
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelOpen/ChannelOpenMessageTest.cs b/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelOpen/ChannelOpenMessageTest.cs
index cc6fb086f..51f7774b7 100644
--- a/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelOpen/ChannelOpenMessageTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelOpen/ChannelOpenMessageTest.cs
@@ -92,7 +92,7 @@ public void GetBytes()
expectedBytesLength += 4; // MaximumPacketSize
expectedBytesLength += infoBytes.Length; // Info
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelRequest/PseudoTerminalInfoTest.cs b/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelRequest/PseudoTerminalInfoTest.cs
index 5b20fa3f0..a3609d2d2 100644
--- a/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelRequest/PseudoTerminalInfoTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelRequest/PseudoTerminalInfoTest.cs
@@ -59,7 +59,7 @@ public void GetBytes()
expectedBytesLength += 4; // Length of "encoded terminal modes"
expectedBytesLength += (_terminalModeValues.Count * (1 + 4)) + 1; // encoded terminal modes
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
@@ -95,7 +95,7 @@ public void GetBytes_TerminalModeValues_Null()
expectedBytesLength += 4; // PixelHeight
expectedBytesLength += 4; // Length of "encoded terminal modes"
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
@@ -131,7 +131,7 @@ public void GetBytes_TerminalModeValues_Empty()
expectedBytesLength += 4; // PixelHeight
expectedBytesLength += 4; // Length of "encoded terminal modes"
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Messages/Transport/IgnoreMessageTest.cs b/test/Renci.SshNet.Tests/Classes/Messages/Transport/IgnoreMessageTest.cs
index 3b112b152..33d472e6d 100644
--- a/test/Renci.SshNet.Tests/Classes/Messages/Transport/IgnoreMessageTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Messages/Transport/IgnoreMessageTest.cs
@@ -27,7 +27,7 @@ public void DefaultConstructor()
{
var target = new IgnoreMessage();
Assert.IsNotNull(target.Data);
- Assert.AreEqual(0, target.Data.Length);
+ Assert.IsEmpty(target.Data);
}
[TestMethod]
@@ -66,7 +66,7 @@ public void GetBytes()
expectedBytesLength += 4; // Data length
expectedBytesLength += _data.Length; // Data
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
@@ -90,7 +90,7 @@ public void Load_IgnoresData()
target.Load(bytes, 1, bytes.Length - 1);
Assert.IsNotNull(target.Data);
- Assert.AreEqual(0, target.Data.Length);
+ Assert.IsEmpty(target.Data);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeRequestTest.cs
index 35e401c66..c63d910e5 100644
--- a/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeRequestTest.cs
@@ -42,7 +42,7 @@ public void Test_KeyExchangeDhGroupExchangeRequest_GetBytes()
expectedBytesLength += 4; // Preferred
expectedBytesLength += 4; // Maximum
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/OrderedDictionaryTest.cs b/test/Renci.SshNet.Tests/Classes/OrderedDictionaryTest.cs
index 9677d5bc7..0b8528512 100644
--- a/test/Renci.SshNet.Tests/Classes/OrderedDictionaryTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/OrderedDictionaryTest.cs
@@ -1,4 +1,5 @@
-using System;
+#pragma warning disable MSTEST0037 // Use proper 'Assert' methods
+using System;
using System.Collections.Generic;
using System.Linq;
diff --git a/test/Renci.SshNet.Tests/Classes/PrivateKeyFileTest.cs b/test/Renci.SshNet.Tests/Classes/PrivateKeyFileTest.cs
index 8a6da1e1d..f18cef76e 100644
--- a/test/Renci.SshNet.Tests/Classes/PrivateKeyFileTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/PrivateKeyFileTest.cs
@@ -401,7 +401,7 @@ public void Test_Certificate_OPENSSH_RSA()
Assert.AreEqual(Certificate.CertificateType.User, cert.Type);
Assert.AreEqual("rsa-cert-rsa", cert.KeyId);
CollectionAssert.AreEqual(new string[] { "sshnet" }, cert.ValidPrincipals.ToList());
- Assert.AreEqual(0, cert.CriticalOptions.Count);
+ Assert.IsEmpty(cert.CriticalOptions);
Assert.IsTrue(cert.ValidAfter.EqualsExact(new DateTimeOffset(2024, 07, 17, 20, 50, 34, TimeSpan.Zero)));
Assert.AreEqual(ulong.MaxValue, cert.ValidBeforeUnixSeconds);
Assert.AreEqual(DateTimeOffset.MaxValue, cert.ValidBefore);
@@ -415,7 +415,7 @@ public void Test_Certificate_OPENSSH_RSA()
}, new Dictionary(cert.Extensions));
Assert.AreEqual("NqLEgdYti0XjUkYjGyQv2Ddy1O5v2NZDZFRtlfESLIA", cert.CertificateAuthorityKeyFingerPrint);
- Assert.AreEqual(6, pkFile.HostKeyAlgorithms.Count);
+ Assert.HasCount(6, pkFile.HostKeyAlgorithms);
var algorithms = pkFile.HostKeyAlgorithms.ToList();
@@ -460,7 +460,7 @@ public void Test_Certificate_OPENSSH_ECDSA()
Assert.AreEqual(Certificate.CertificateType.User, cert.Type);
Assert.AreEqual("ecdsa521certEcdsa", cert.KeyId);
CollectionAssert.AreEqual(new string[] { "sshnet" }, cert.ValidPrincipals.ToList());
- Assert.AreEqual(0, cert.CriticalOptions.Count);
+ Assert.IsEmpty(cert.CriticalOptions);
Assert.AreEqual(0UL, cert.ValidAfterUnixSeconds);
Assert.IsTrue(cert.ValidAfter.EqualsExact(UnixEpoch));
Assert.AreEqual(ulong.MaxValue, cert.ValidBeforeUnixSeconds);
@@ -475,7 +475,7 @@ public void Test_Certificate_OPENSSH_ECDSA()
}, new Dictionary(cert.Extensions));
Assert.AreEqual("r/t6I+bZQzN5BhSuntFSHDHlrnNHVM2lAo6gbvynG/4", cert.CertificateAuthorityKeyFingerPrint);
- Assert.AreEqual(2, pkFile.HostKeyAlgorithms.Count);
+ Assert.HasCount(2, pkFile.HostKeyAlgorithms);
var algorithms = pkFile.HostKeyAlgorithms.ToList();
@@ -635,7 +635,7 @@ private static void TestRsaKeyFile(PrivateKeyFile rsaPrivateKeyFile)
{
Assert.IsInstanceOfType(rsaPrivateKeyFile.Key);
Assert.IsNotNull(rsaPrivateKeyFile.HostKeyAlgorithms);
- Assert.AreEqual(3, rsaPrivateKeyFile.HostKeyAlgorithms.Count);
+ Assert.HasCount(3, rsaPrivateKeyFile.HostKeyAlgorithms);
var algorithms = rsaPrivateKeyFile.HostKeyAlgorithms.ToList();
diff --git a/test/Renci.SshNet.Tests/Classes/ScpClientTest.cs b/test/Renci.SshNet.Tests/Classes/ScpClientTest.cs
index 89be6801e..e85b0b536 100644
--- a/test/Renci.SshNet.Tests/Classes/ScpClientTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/ScpClientTest.cs
@@ -77,7 +77,7 @@ public void Ctor_HostAndPortAndUsernameAndPassword()
Assert.AreEqual(port, passwordConnectionInfo.Port);
Assert.AreSame(userName, passwordConnectionInfo.Username);
Assert.IsNotNull(passwordConnectionInfo.AuthenticationMethods);
- Assert.AreEqual(1, passwordConnectionInfo.AuthenticationMethods.Count);
+ Assert.HasCount(1, passwordConnectionInfo.AuthenticationMethods);
var passwordAuthentication = passwordConnectionInfo.AuthenticationMethods[0] as PasswordAuthenticationMethod;
Assert.IsNotNull(passwordAuthentication);
@@ -107,7 +107,7 @@ public void Ctor_HostAndUsernameAndPassword()
Assert.AreEqual(22, passwordConnectionInfo.Port);
Assert.AreSame(userName, passwordConnectionInfo.Username);
Assert.IsNotNull(passwordConnectionInfo.AuthenticationMethods);
- Assert.AreEqual(1, passwordConnectionInfo.AuthenticationMethods.Count);
+ Assert.HasCount(1, passwordConnectionInfo.AuthenticationMethods);
var passwordAuthentication = passwordConnectionInfo.AuthenticationMethods[0] as PasswordAuthenticationMethod;
Assert.IsNotNull(passwordAuthentication);
@@ -138,15 +138,15 @@ public void Ctor_HostAndPortAndUsernameAndPrivateKeys()
Assert.AreEqual(port, privateKeyConnectionInfo.Port);
Assert.AreSame(userName, privateKeyConnectionInfo.Username);
Assert.IsNotNull(privateKeyConnectionInfo.AuthenticationMethods);
- Assert.AreEqual(1, privateKeyConnectionInfo.AuthenticationMethods.Count);
+ Assert.HasCount(1, privateKeyConnectionInfo.AuthenticationMethods);
var privateKeyAuthentication = privateKeyConnectionInfo.AuthenticationMethods[0] as PrivateKeyAuthenticationMethod;
Assert.IsNotNull(privateKeyAuthentication);
Assert.AreEqual(userName, privateKeyAuthentication.Username);
Assert.IsNotNull(privateKeyAuthentication.KeyFiles);
- Assert.AreEqual(privateKeys.Length, privateKeyAuthentication.KeyFiles.Count);
- Assert.IsTrue(privateKeyAuthentication.KeyFiles.Contains(privateKeys[0]));
- Assert.IsTrue(privateKeyAuthentication.KeyFiles.Contains(privateKeys[1]));
+ Assert.HasCount(privateKeys.Length, privateKeyAuthentication.KeyFiles);
+ Assert.Contains(privateKeys[0], privateKeyAuthentication.KeyFiles);
+ Assert.Contains(privateKeys[1], privateKeyAuthentication.KeyFiles);
}
[TestMethod]
@@ -171,15 +171,15 @@ public void Ctor_HostAndUsernameAndPrivateKeys()
Assert.AreEqual(22, privateKeyConnectionInfo.Port);
Assert.AreSame(userName, privateKeyConnectionInfo.Username);
Assert.IsNotNull(privateKeyConnectionInfo.AuthenticationMethods);
- Assert.AreEqual(1, privateKeyConnectionInfo.AuthenticationMethods.Count);
+ Assert.HasCount(1, privateKeyConnectionInfo.AuthenticationMethods);
var privateKeyAuthentication = privateKeyConnectionInfo.AuthenticationMethods[0] as PrivateKeyAuthenticationMethod;
Assert.IsNotNull(privateKeyAuthentication);
Assert.AreEqual(userName, privateKeyAuthentication.Username);
Assert.IsNotNull(privateKeyAuthentication.KeyFiles);
- Assert.AreEqual(privateKeys.Length, privateKeyAuthentication.KeyFiles.Count);
- Assert.IsTrue(privateKeyAuthentication.KeyFiles.Contains(privateKeys[0]));
- Assert.IsTrue(privateKeyAuthentication.KeyFiles.Contains(privateKeys[1]));
+ Assert.HasCount(privateKeys.Length, privateKeyAuthentication.KeyFiles);
+ Assert.Contains(privateKeys[0], privateKeyAuthentication.KeyFiles);
+ Assert.Contains(privateKeys[1], privateKeyAuthentication.KeyFiles);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/ScpClientTest_Download_PathAndDirectoryInfo_SendExecRequestReturnsFalse.cs b/test/Renci.SshNet.Tests/Classes/ScpClientTest_Download_PathAndDirectoryInfo_SendExecRequestReturnsFalse.cs
index c3aba4b25..7e6f1aebf 100644
--- a/test/Renci.SshNet.Tests/Classes/ScpClientTest_Download_PathAndDirectoryInfo_SendExecRequestReturnsFalse.cs
+++ b/test/Renci.SshNet.Tests/Classes/ScpClientTest_Download_PathAndDirectoryInfo_SendExecRequestReturnsFalse.cs
@@ -111,7 +111,7 @@ public void DisposeOnPipeStreamShouldBeInvokedOnce()
[TestMethod]
public void UploadingShouldNeverHaveFired()
{
- Assert.AreEqual(0, _uploadingRegister.Count);
+ Assert.IsEmpty(_uploadingRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ScpClientTest_Download_PathAndFileInfo_SendExecRequestReturnsFalse.cs b/test/Renci.SshNet.Tests/Classes/ScpClientTest_Download_PathAndFileInfo_SendExecRequestReturnsFalse.cs
index 0d8815fb2..ca638f465 100644
--- a/test/Renci.SshNet.Tests/Classes/ScpClientTest_Download_PathAndFileInfo_SendExecRequestReturnsFalse.cs
+++ b/test/Renci.SshNet.Tests/Classes/ScpClientTest_Download_PathAndFileInfo_SendExecRequestReturnsFalse.cs
@@ -110,7 +110,7 @@ public void DisposeOnPipeStreamShouldBeInvokedOnce()
[TestMethod]
public void UploadingShouldNeverHaveFired()
{
- Assert.AreEqual(0, _uploadingRegister.Count);
+ Assert.IsEmpty(_uploadingRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ScpClientTest_Download_PathAndStream_SendExecRequestReturnsFalse.cs b/test/Renci.SshNet.Tests/Classes/ScpClientTest_Download_PathAndStream_SendExecRequestReturnsFalse.cs
index 0be4c9623..0c8d1d7a1 100644
--- a/test/Renci.SshNet.Tests/Classes/ScpClientTest_Download_PathAndStream_SendExecRequestReturnsFalse.cs
+++ b/test/Renci.SshNet.Tests/Classes/ScpClientTest_Download_PathAndStream_SendExecRequestReturnsFalse.cs
@@ -126,7 +126,7 @@ public void DisposeOnPipeStreamShouldBeInvokedOnce()
[TestMethod]
public void UploadingShouldNeverHaveFired()
{
- Assert.AreEqual(0, _uploadingRegister.Count);
+ Assert.IsEmpty(_uploadingRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_DirectoryInfoAndPath_SendExecRequestReturnsFalse.cs b/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_DirectoryInfoAndPath_SendExecRequestReturnsFalse.cs
index 75b1071c4..68001f51d 100644
--- a/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_DirectoryInfoAndPath_SendExecRequestReturnsFalse.cs
+++ b/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_DirectoryInfoAndPath_SendExecRequestReturnsFalse.cs
@@ -110,7 +110,7 @@ public void DisposeOnPipeStreamShouldBeInvokedOnce()
[TestMethod]
public void UploadingShouldNeverHaveFired()
{
- Assert.AreEqual(0, _uploadingRegister.Count);
+ Assert.IsEmpty(_uploadingRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_FileInfoAndPath_SendExecRequestReturnsFalse.cs b/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_FileInfoAndPath_SendExecRequestReturnsFalse.cs
index 9fda30566..8d677f1fc 100644
--- a/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_FileInfoAndPath_SendExecRequestReturnsFalse.cs
+++ b/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_FileInfoAndPath_SendExecRequestReturnsFalse.cs
@@ -127,7 +127,7 @@ public void DisposeOnPipeStreamShouldBeInvokedOnce()
[TestMethod]
public void UploadingShouldNeverHaveFired()
{
- Assert.AreEqual(0, _uploadingRegister.Count);
+ Assert.IsEmpty(_uploadingRegister);
}
private string CreateTemporaryFile(byte[] content)
diff --git a/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_FileInfoAndPath_Success.cs b/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_FileInfoAndPath_Success.cs
index 5a562fe38..63610f34d 100644
--- a/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_FileInfoAndPath_Success.cs
+++ b/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_FileInfoAndPath_Success.cs
@@ -151,7 +151,7 @@ public void DisposeOnPipeStreamShouldBeInvokedOnce()
[TestMethod]
public void UploadingShouldHaveFiredTwice()
{
- Assert.AreEqual(2, _uploadingRegister.Count);
+ Assert.HasCount(2, _uploadingRegister);
var uploading = _uploadingRegister[0];
Assert.IsNotNull(uploading);
diff --git a/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_StreamAndPath_SendExecRequestReturnsFalse.cs b/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_StreamAndPath_SendExecRequestReturnsFalse.cs
index 64fd8bc24..2800b88c1 100644
--- a/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_StreamAndPath_SendExecRequestReturnsFalse.cs
+++ b/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_StreamAndPath_SendExecRequestReturnsFalse.cs
@@ -129,7 +129,7 @@ public void DisposeOnPipeStreamShouldBeInvokedOnce()
[TestMethod]
public void UploadingShouldNeverHaveFired()
{
- Assert.AreEqual(0, _uploadingRegister.Count);
+ Assert.IsEmpty(_uploadingRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/Security/CertificateHostAlgorithmTest.cs b/test/Renci.SshNet.Tests/Classes/Security/CertificateHostAlgorithmTest.cs
index fc2bee7ab..a18a63b3f 100644
--- a/test/Renci.SshNet.Tests/Classes/Security/CertificateHostAlgorithmTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Security/CertificateHostAlgorithmTest.cs
@@ -69,7 +69,7 @@ public void HostAlgorithmData_IsRawCertificateBytes()
List certAlgs = pkFile.HostKeyAlgorithms.OfType().ToList();
- Assert.AreEqual(3, certAlgs.Count);
+ Assert.HasCount(3, certAlgs);
for (int i = 0; i < 3; i++)
{
diff --git a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/BlockCipherTest.cs b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/BlockCipherTest.cs
index 04bb15e01..b1fc791fc 100644
--- a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/BlockCipherTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/BlockCipherTest.cs
@@ -25,7 +25,7 @@ public void EncryptShouldTakeIntoAccountPaddingForLengthOfInputBufferPassedToEnc
{
EncryptBlockDelegate = (inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset) =>
{
- Assert.AreEqual(8, inputBuffer.Length);
+ Assert.HasCount(8, inputBuffer);
Buffer.BlockCopy(output, 0, outputBuffer, 0, output.Length);
return inputBuffer.Length;
}
@@ -46,7 +46,7 @@ public void EncryptShouldTakeIntoAccountPaddingForLengthOfInputBufferPassedToEnc
{
EncryptBlockDelegate = (inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset) =>
{
- Assert.AreEqual(8, inputBuffer.Length);
+ Assert.HasCount(8, inputBuffer);
Buffer.BlockCopy(output, 0, outputBuffer, 0, output.Length);
return inputBuffer.Length;
}
@@ -67,7 +67,7 @@ public void EncryptShouldTakeIntoAccountManualPaddingForLengthOfInputBufferPasse
{
EncryptBlockDelegate = (inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset) =>
{
- Assert.AreEqual(8, inputBuffer.Length);
+ Assert.HasCount(8, inputBuffer);
Buffer.BlockCopy(output, 0, outputBuffer, 0, output.Length);
return inputBuffer.Length;
}
@@ -89,7 +89,7 @@ public void DecryptShouldTakeIntoAccountUnPaddingForTheFinalOutput()
{
DecryptBlockDelegate = (inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset) =>
{
- Assert.AreEqual(8, outputBuffer.Length);
+ Assert.HasCount(8, outputBuffer);
Buffer.BlockCopy(output, 0, outputBuffer, 0, output.Length);
Buffer.BlockCopy(padding, 0, outputBuffer, output.Length, padding.Length);
return inputBuffer.Length;
@@ -111,7 +111,7 @@ public void DecryptShouldTakeIntoAccountManualPaddingForLengthOfInputBufferPasse
{
DecryptBlockDelegate = (inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset) =>
{
- Assert.AreEqual(8, inputBuffer.Length);
+ Assert.HasCount(8, inputBuffer);
Buffer.BlockCopy(output, 0, outputBuffer, 0, output.Length);
return inputBuffer.Length;
}
diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected.cs
index daffc6bdf..8b5da5817 100644
--- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected.cs
+++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected.cs
@@ -45,7 +45,7 @@ public void ClientVersionIsRenciSshNet()
public void IncludeStrictKexPseudoAlgorithmInInitKex()
{
Assert.IsTrue(FirstKexReceived.Wait(1000));
- Assert.IsTrue(ServerBytesReceivedRegister.Count > 0);
+ Assert.IsNotEmpty(ServerBytesReceivedRegister);
var kexInitMessage = new KeyExchangeInitMessage();
kexInitMessage.Load(ServerBytesReceivedRegister[0], 4 + 1 + 1, ServerBytesReceivedRegister[0].Length - 4 - 1 - 1);
@@ -106,7 +106,7 @@ public void SendMessageShouldSendPacketToServer()
// give session time to process message
Thread.Sleep(100);
- Assert.AreEqual(1, ServerBytesReceivedRegister.Count);
+ Assert.HasCount(1, ServerBytesReceivedRegister);
}
[TestMethod]
@@ -128,16 +128,16 @@ public void UnknownGlobalRequestWithWantReply(bool wantReply)
if (wantReply)
{
// Should have sent a failure reply.
- Assert.AreEqual(1, ServerBytesReceivedRegister.Count);
+ Assert.HasCount(1, ServerBytesReceivedRegister);
Assert.AreEqual(82, ServerBytesReceivedRegister[0][5], "Expected to have sent SSH_MSG_REQUEST_FAILURE(82)");
}
else
{
// Should not have sent any reply.
- Assert.AreEqual(0, ServerBytesReceivedRegister.Count);
+ Assert.IsEmpty(ServerBytesReceivedRegister);
}
- Assert.AreEqual(0, ErrorOccurredRegister.Count);
+ Assert.IsEmpty(ErrorOccurredRegister);
}
[TestMethod]
@@ -218,7 +218,7 @@ public void ISession_SendMessageShouldSendPacketToServer()
// give session time to process message
Thread.Sleep(100);
- Assert.AreEqual(1, ServerBytesReceivedRegister.Count);
+ Assert.HasCount(1, ServerBytesReceivedRegister);
}
[TestMethod]
@@ -235,7 +235,7 @@ public void ISession_TrySendMessageShouldSendPacketToServerAndReturnTrue()
Thread.Sleep(100);
Assert.IsTrue(actual);
- Assert.AreEqual(1, ServerBytesReceivedRegister.Count);
+ Assert.HasCount(1, ServerBytesReceivedRegister);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ConnectionReset.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ConnectionReset.cs
index a09999b36..522c0871e 100644
--- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ConnectionReset.cs
+++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ConnectionReset.cs
@@ -35,25 +35,25 @@ public void DisconnectShouldFinishImmediately()
Session.Disconnect();
stopwatch.Stop();
- Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+ Assert.IsLessThan(500, stopwatch.ElapsedMilliseconds);
}
[TestMethod]
public void DisconnectedIsNeverRaised()
{
- Assert.AreEqual(0, DisconnectedRegister.Count);
+ Assert.IsEmpty(DisconnectedRegister);
}
[TestMethod]
public void DisconnectReceivedIsNeverRaised()
{
- Assert.AreEqual(0, DisconnectReceivedRegister.Count);
+ Assert.IsEmpty(DisconnectReceivedRegister);
}
[TestMethod]
public void ErrorOccurredIsRaisedOnce()
{
- Assert.AreEqual(1, ErrorOccurredRegister.Count, ErrorOccurredRegister.AsString());
+ Assert.HasCount(1, ErrorOccurredRegister, ErrorOccurredRegister.AsString());
var errorOccurred = ErrorOccurredRegister[0];
Assert.IsNotNull(errorOccurred);
@@ -75,7 +75,7 @@ public void DisposeShouldFinishImmediately()
Session.Dispose();
stopwatch.Stop();
- Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+ Assert.IsLessThan(500, stopwatch.ElapsedMilliseconds);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_Disconnect.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_Disconnect.cs
index 5710a9985..22e07d8e3 100644
--- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_Disconnect.cs
+++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_Disconnect.cs
@@ -36,25 +36,25 @@ public void DisconnectShouldFinishImmediately()
Session.Disconnect();
stopwatch.Stop();
- Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+ Assert.IsLessThan(500, stopwatch.ElapsedMilliseconds);
}
[TestMethod]
public void DisconnectedIsNeverRaised()
{
- Assert.AreEqual(0, DisconnectedRegister.Count);
+ Assert.IsEmpty(DisconnectedRegister);
}
[TestMethod]
public void DisconnectReceivedIsNeverRaised()
{
- Assert.AreEqual(0, DisconnectReceivedRegister.Count);
+ Assert.IsEmpty(DisconnectReceivedRegister);
}
[TestMethod]
public void ErrorOccurredIsNeverRaised()
{
- Assert.AreEqual(0, ErrorOccurredRegister.Count, ErrorOccurredRegister.AsString());
+ Assert.IsEmpty(ErrorOccurredRegister, ErrorOccurredRegister.AsString());
}
[TestMethod]
@@ -66,7 +66,7 @@ public void DisposeShouldFinishImmediately()
Session.Dispose();
stopwatch.Stop();
- Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+ Assert.IsLessThan(500, stopwatch.ElapsedMilliseconds);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_GlobalRequestMessageAfterAuthenticationRace.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_GlobalRequestMessageAfterAuthenticationRace.cs
index 64ea76d74..8996ecdac 100644
--- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_GlobalRequestMessageAfterAuthenticationRace.cs
+++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_GlobalRequestMessageAfterAuthenticationRace.cs
@@ -36,7 +36,7 @@ protected override void ClientAuthentication_Callback()
[TestMethod]
public void ErrorOccurredShouldNotBeRaised()
{
- Assert.AreEqual(0, ErrorOccurredRegister.Count, ErrorOccurredRegister.AsString());
+ Assert.IsEmpty(ErrorOccurredRegister, ErrorOccurredRegister.AsString());
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsBadPacket.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsBadPacket.cs
index 61f1b494e..e1ba37c38 100644
--- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsBadPacket.cs
+++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsBadPacket.cs
@@ -45,25 +45,25 @@ public void DisconnectShouldFinishImmediately()
Session.Disconnect();
stopwatch.Stop();
- Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+ Assert.IsLessThan(500, stopwatch.ElapsedMilliseconds);
}
[TestMethod]
public void DisconnectedIsNeverRaised()
{
- Assert.AreEqual(0, DisconnectedRegister.Count);
+ Assert.IsEmpty(DisconnectedRegister);
}
[TestMethod]
public void DisconnectReceivedIsNeverRaised()
{
- Assert.AreEqual(0, DisconnectReceivedRegister.Count);
+ Assert.IsEmpty(DisconnectReceivedRegister);
}
[TestMethod]
public void ErrorOccurredIsRaisedOnce()
{
- Assert.AreEqual(1, ErrorOccurredRegister.Count, ErrorOccurredRegister.AsString());
+ Assert.HasCount(1, ErrorOccurredRegister, ErrorOccurredRegister.AsString());
var errorOccurred = ErrorOccurredRegister[0];
Assert.IsNotNull(errorOccurred);
@@ -87,7 +87,7 @@ public void DisposeShouldFinishImmediately()
Session.Dispose();
stopwatch.Stop();
- Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+ Assert.IsLessThan(500, stopwatch.ElapsedMilliseconds);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsDisconnectMessage.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsDisconnectMessage.cs
index 1ae6737d4..b4606b37b 100644
--- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsDisconnectMessage.cs
+++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsDisconnectMessage.cs
@@ -48,19 +48,19 @@ public void DisconnectShouldFinishImmediately()
Session.Disconnect();
stopwatch.Stop();
- Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+ Assert.IsLessThan(500, stopwatch.ElapsedMilliseconds);
}
[TestMethod]
public void DisconnectedIsRaisedOnce()
{
- Assert.AreEqual(1, DisconnectedRegister.Count);
+ Assert.HasCount(1, DisconnectedRegister);
}
[TestMethod]
public void DisconnectReceivedIsRaisedOnce()
{
- Assert.AreEqual(1, DisconnectReceivedRegister.Count);
+ Assert.HasCount(1, DisconnectReceivedRegister);
var disconnectMessage = DisconnectReceivedRegister[0].Message;
Assert.IsNotNull(disconnectMessage);
@@ -72,7 +72,7 @@ public void DisconnectReceivedIsRaisedOnce()
[TestMethod]
public void ErrorOccurredIsNeverRaised()
{
- Assert.AreEqual(0, ErrorOccurredRegister.Count, ErrorOccurredRegister.AsString());
+ Assert.IsEmpty(ErrorOccurredRegister, ErrorOccurredRegister.AsString());
}
[TestMethod]
@@ -84,7 +84,7 @@ public void DisposeShouldFinishImmediately()
Session.Dispose();
stopwatch.Stop();
- Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+ Assert.IsLessThan(500, stopwatch.ElapsedMilliseconds);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsDisconnectMessageAndShutsDownSocket.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsDisconnectMessageAndShutsDownSocket.cs
index 220c1bbe2..9c00119bb 100644
--- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsDisconnectMessageAndShutsDownSocket.cs
+++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsDisconnectMessageAndShutsDownSocket.cs
@@ -52,19 +52,19 @@ public void DisconnectShouldFinishImmediately()
Session.Disconnect();
stopwatch.Stop();
- Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+ Assert.IsLessThan(500, stopwatch.ElapsedMilliseconds);
}
[TestMethod]
public void DisconnectedIsRaisedOnce()
{
- Assert.AreEqual(1, DisconnectedRegister.Count);
+ Assert.HasCount(1, DisconnectedRegister);
}
[TestMethod]
public void DisconnectReceivedIsRaisedOnce()
{
- Assert.AreEqual(1, DisconnectReceivedRegister.Count);
+ Assert.HasCount(1, DisconnectReceivedRegister);
var disconnectMessage = DisconnectReceivedRegister[0].Message;
Assert.IsNotNull(disconnectMessage);
@@ -76,7 +76,7 @@ public void DisconnectReceivedIsRaisedOnce()
[TestMethod]
public void ErrorOccurredIsNeverRaised()
{
- Assert.AreEqual(0, ErrorOccurredRegister.Count, ErrorOccurredRegister.AsString());
+ Assert.IsEmpty(ErrorOccurredRegister, ErrorOccurredRegister.AsString());
}
[TestMethod]
@@ -88,7 +88,7 @@ public void DisposeShouldFinishImmediately()
Session.Dispose();
stopwatch.Stop();
- Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+ Assert.IsLessThan(500, stopwatch.ElapsedMilliseconds);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsUnsupportedMessageType.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsUnsupportedMessageType.cs
index b92d0acbe..aca85662a 100644
--- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsUnsupportedMessageType.cs
+++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsUnsupportedMessageType.cs
@@ -50,25 +50,25 @@ public void DisconnectShouldFinishImmediately()
Session.Disconnect();
stopwatch.Stop();
- Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+ Assert.IsLessThan(500, stopwatch.ElapsedMilliseconds);
}
[TestMethod]
public void DisconnectedIsNeverRaised()
{
- Assert.AreEqual(0, DisconnectedRegister.Count);
+ Assert.IsEmpty(DisconnectedRegister);
}
[TestMethod]
public void DisconnectReceivedIsNeverRaised()
{
- Assert.AreEqual(0, DisconnectReceivedRegister.Count);
+ Assert.IsEmpty(DisconnectReceivedRegister);
}
[TestMethod]
public void ErrorOccurredIsRaisedOnce()
{
- Assert.AreEqual(1, ErrorOccurredRegister.Count, ErrorOccurredRegister.AsString());
+ Assert.HasCount(1, ErrorOccurredRegister, ErrorOccurredRegister.AsString());
var errorOccurred = ErrorOccurredRegister[0];
Assert.IsNotNull(errorOccurred);
@@ -91,7 +91,7 @@ public void DisposeShouldFinishImmediately()
Session.Dispose();
stopwatch.Stop();
- Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+ Assert.IsLessThan(500, stopwatch.ElapsedMilliseconds);
}
[TestMethod]
@@ -123,7 +123,7 @@ public void SendMessageShouldSendMessageToServer()
Thread.Sleep(100);
Assert.IsNotNull(bytesReceivedByServer);
- Assert.AreEqual(24, bytesReceivedByServer.Length);
+ Assert.HasCount(24, bytesReceivedByServer);
}
[TestMethod]
@@ -149,7 +149,7 @@ public void ISession_SendMessageShouldSendMessageToServer()
Thread.Sleep(100);
Assert.IsNotNull(bytesReceivedByServer);
- Assert.AreEqual(24, bytesReceivedByServer.Length);
+ Assert.HasCount(24, bytesReceivedByServer);
}
[TestMethod]
@@ -168,7 +168,7 @@ public void ISession_TrySendMessageShouldReturnTrueAndSendMessageToServer()
Thread.Sleep(100);
Assert.IsNotNull(bytesReceivedByServer);
- Assert.AreEqual(24, bytesReceivedByServer.Length);
+ Assert.HasCount(24, bytesReceivedByServer);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSendAfterSendingIncompletePacket.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSendAfterSendingIncompletePacket.cs
index 81eccac38..b2c8e1bef 100644
--- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSendAfterSendingIncompletePacket.cs
+++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSendAfterSendingIncompletePacket.cs
@@ -43,25 +43,25 @@ public void DisconnectShouldFinishImmediately()
Session.Disconnect();
stopwatch.Stop();
- Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+ Assert.IsLessThan(500, stopwatch.ElapsedMilliseconds);
}
[TestMethod]
public void DisconnectedIsNeverRaised()
{
- Assert.AreEqual(0, DisconnectedRegister.Count);
+ Assert.IsEmpty(DisconnectedRegister);
}
[TestMethod]
public void DisconnectReceivedIsNeverRaised()
{
- Assert.AreEqual(0, DisconnectReceivedRegister.Count);
+ Assert.IsEmpty(DisconnectReceivedRegister);
}
[TestMethod]
public void ErrorOccurredIsRaisedOnce()
{
- Assert.AreEqual(1, ErrorOccurredRegister.Count, ErrorOccurredRegister.AsString());
+ Assert.HasCount(1, ErrorOccurredRegister, ErrorOccurredRegister.AsString());
var errorOccurred = ErrorOccurredRegister[0];
Assert.IsNotNull(errorOccurred);
@@ -85,7 +85,7 @@ public void DisposeShouldFinishImmediately()
Session.Dispose();
stopwatch.Stop();
- Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+ Assert.IsLessThan(500, stopwatch.ElapsedMilliseconds);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSocket.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSocket.cs
index d41f270a2..7c5f8a3b9 100644
--- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSocket.cs
+++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSocket.cs
@@ -37,25 +37,25 @@ public void DisconnectShouldFinishImmediately()
Session.Disconnect();
stopwatch.Stop();
- Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+ Assert.IsLessThan(500, stopwatch.ElapsedMilliseconds);
}
[TestMethod]
public void DisconnectedIsNeverRaised()
{
- Assert.AreEqual(0, DisconnectedRegister.Count);
+ Assert.IsEmpty(DisconnectedRegister);
}
[TestMethod]
public void DisconnectReceivedIsNeverRaised()
{
- Assert.AreEqual(0, DisconnectReceivedRegister.Count);
+ Assert.IsEmpty(DisconnectReceivedRegister);
}
[TestMethod]
public void ErrorOccurredIsRaisedOnce()
{
- Assert.AreEqual(1, ErrorOccurredRegister.Count, ErrorOccurredRegister.AsString());
+ Assert.HasCount(1, ErrorOccurredRegister, ErrorOccurredRegister.AsString());
var errorOccurred = ErrorOccurredRegister[0];
Assert.IsNotNull(errorOccurred);
@@ -79,7 +79,7 @@ public void DisposeShouldFinishImmediately()
Session.Dispose();
stopwatch.Stop();
- Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+ Assert.IsLessThan(500, stopwatch.ElapsedMilliseconds);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/FStatVfsRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/FStatVfsRequestTest.cs
index 0eac5be2f..e516adfe8 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/FStatVfsRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/FStatVfsRequestTest.cs
@@ -60,9 +60,9 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
- Assert.AreEqual(0, extendedReplyActionInvocations.Count);
+ Assert.IsEmpty(extendedReplyActionInvocations);
}
[TestMethod]
@@ -79,8 +79,8 @@ public void Complete_SftpExtendedReplyResponse()
request.Complete(extendedReplyResponse);
- Assert.AreEqual(0, statusActionInvocations.Count);
- Assert.AreEqual(1, extendedReplyActionInvocations.Count);
+ Assert.IsEmpty(statusActionInvocations);
+ Assert.HasCount(1, extendedReplyActionInvocations);
Assert.AreSame(extendedReplyResponse, extendedReplyActionInvocations[0]);
}
@@ -100,7 +100,7 @@ public void GetBytes()
expectedBytesLength += 4; // Handle length
expectedBytesLength += _handle.Length; // Handle
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/HardLinkRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/HardLinkRequestTest.cs
index d89f17106..18f6315c2 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/HardLinkRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/HardLinkRequestTest.cs
@@ -65,7 +65,7 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
}
@@ -87,7 +87,7 @@ public void GetBytes()
expectedBytesLength += 4; // NewPath length
expectedBytesLength += _newPathBytes.Length; // NewPath
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/PosixRenameRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/PosixRenameRequestTest.cs
index fe58f5f67..4274f4378 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/PosixRenameRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/PosixRenameRequestTest.cs
@@ -69,7 +69,7 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
}
@@ -91,7 +91,7 @@ public void GetBytes()
expectedBytesLength += 4; // NewPath length
expectedBytesLength += _newPathBytes.Length; // NewPath
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/StatVfsRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/StatVfsRequestTest.cs
index 6bd9fc56c..bc54cb028 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/StatVfsRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/StatVfsRequestTest.cs
@@ -66,9 +66,9 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
- Assert.AreEqual(0, extendedReplyActionInvocations.Count);
+ Assert.IsEmpty(extendedReplyActionInvocations);
}
[TestMethod]
@@ -85,8 +85,8 @@ public void Complete_SftpExtendedReplyResponse()
request.Complete(extendedReplyResponse);
- Assert.AreEqual(0, statusActionInvocations.Count);
- Assert.AreEqual(1, extendedReplyActionInvocations.Count);
+ Assert.IsEmpty(statusActionInvocations);
+ Assert.HasCount(1, extendedReplyActionInvocations);
Assert.AreSame(extendedReplyResponse, extendedReplyActionInvocations[0]);
}
@@ -106,7 +106,7 @@ public void GetBytes()
expectedBytesLength += 4; // Path length
expectedBytesLength += _pathBytes.Length; // Path
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpBlockRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpBlockRequestTest.cs
index f65ab012b..2542d154c 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpBlockRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpBlockRequestTest.cs
@@ -61,7 +61,7 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
}
@@ -82,7 +82,7 @@ public void GetBytes()
expectedBytesLength += 8; // Length
expectedBytesLength += 4; // LockMask
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpCloseRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpCloseRequestTest.cs
index a8755b58d..d477e908c 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpCloseRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpCloseRequestTest.cs
@@ -52,7 +52,7 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
}
@@ -70,7 +70,7 @@ public void GetBytes()
expectedBytesLength += 4; // Handle length
expectedBytesLength += _handle.Length; // Handle
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFSetStatRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFSetStatRequestTest.cs
index 2fd3bd1e7..79e43344e 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFSetStatRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFSetStatRequestTest.cs
@@ -57,7 +57,7 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
}
@@ -76,7 +76,7 @@ public void GetBytes()
expectedBytesLength += _handle.Length; // Handle
expectedBytesLength += _attributesBytes.Length; // Attributes
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFStatRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFStatRequestTest.cs
index df49690a5..27470af9b 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFStatRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFStatRequestTest.cs
@@ -54,8 +54,8 @@ public void Complete_SftpAttrsResponse()
request.Complete(attrsResponse);
- Assert.AreEqual(0, statusActionInvocations.Count);
- Assert.AreEqual(1, attrsActionInvocations.Count);
+ Assert.IsEmpty(statusActionInvocations);
+ Assert.HasCount(1, attrsActionInvocations);
Assert.AreSame(attrsResponse, attrsActionInvocations[0]);
}
@@ -73,9 +73,9 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
- Assert.AreEqual(0, attrsActionInvocations.Count);
+ Assert.IsEmpty(attrsActionInvocations);
}
[TestMethod]
@@ -92,7 +92,7 @@ public void GetBytes()
expectedBytesLength += 4; // Handle length
expectedBytesLength += _handle.Length; // Handle
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLStatRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLStatRequestTest.cs
index 480639230..73fe25fa2 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLStatRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLStatRequestTest.cs
@@ -60,8 +60,8 @@ public void Complete_SftpAttrsResponse()
request.Complete(attrsResponse);
- Assert.AreEqual(0, statusActionInvocations.Count);
- Assert.AreEqual(1, attrsActionInvocations.Count);
+ Assert.IsEmpty(statusActionInvocations);
+ Assert.HasCount(1, attrsActionInvocations);
Assert.AreSame(attrsResponse, attrsActionInvocations[0]);
}
@@ -79,9 +79,9 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
- Assert.AreEqual(0, attrsActionInvocations.Count);
+ Assert.IsEmpty(attrsActionInvocations);
}
[TestMethod]
@@ -98,7 +98,7 @@ public void GetBytes()
expectedBytesLength += 4; // Pah length
expectedBytesLength += _pathBytes.Length; // Path
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLinkRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLinkRequestTest.cs
index 1f1c571d2..9aab57d14 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLinkRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLinkRequestTest.cs
@@ -65,7 +65,7 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
}
@@ -86,7 +86,7 @@ public void GetBytes()
expectedBytesLength += _existingPathBytes.Length; // ExistingPath
expectedBytesLength += 1; // IsSymLink
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpMkDirRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpMkDirRequestTest.cs
index e01d3f7f7..6d92591ca 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpMkDirRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpMkDirRequestTest.cs
@@ -63,7 +63,7 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
}
@@ -82,7 +82,7 @@ public void GetBytes()
expectedBytesLength += _pathBytes.Length; // Path
expectedBytesLength += _attributesBytes.Length; // Attributes
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenDirRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenDirRequestTest.cs
index efa6c692f..2178b05d4 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenDirRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenDirRequestTest.cs
@@ -60,8 +60,8 @@ public void Complete_SftpHandleResponse()
request.Complete(handleResponse);
- Assert.AreEqual(0, statusActionInvocations.Count);
- Assert.AreEqual(1, handleActionInvocations.Count);
+ Assert.IsEmpty(statusActionInvocations);
+ Assert.HasCount(1, handleActionInvocations);
Assert.AreSame(handleResponse, handleActionInvocations[0]);
}
@@ -79,9 +79,9 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
- Assert.AreEqual(0, handleActionInvocations.Count);
+ Assert.IsEmpty(handleActionInvocations);
}
[TestMethod]
@@ -98,7 +98,7 @@ public void GetBytes()
expectedBytesLength += 4; // Path length
expectedBytesLength += _pathBytes.Length; // Path
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenRequestTest.cs
index dd7e407a3..7bc6f5a13 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenRequestTest.cs
@@ -74,8 +74,8 @@ public void Complete_SftpHandleResponse()
request.Complete(handleResponse);
- Assert.AreEqual(0, statusActionInvocations.Count);
- Assert.AreEqual(1, handleActionInvocations.Count);
+ Assert.IsEmpty(statusActionInvocations);
+ Assert.HasCount(1, handleActionInvocations);
Assert.AreSame(handleResponse, handleActionInvocations[0]);
}
@@ -100,9 +100,9 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
- Assert.AreEqual(0, handleActionInvocations.Count);
+ Assert.IsEmpty(handleActionInvocations);
}
[TestMethod]
@@ -121,7 +121,7 @@ public void GetBytes()
expectedBytesLength += 4; // Flags
expectedBytesLength += _attributesBytes.Length; // Attributes
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadDirRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadDirRequestTest.cs
index 07916fe63..aec34f0b9 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadDirRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadDirRequestTest.cs
@@ -55,8 +55,8 @@ public void Complete_SftpAttrsResponse()
request.Complete(nameResponse);
- Assert.AreEqual(0, statusActionInvocations.Count);
- Assert.AreEqual(1, nameActionInvocations.Count);
+ Assert.IsEmpty(statusActionInvocations);
+ Assert.HasCount(1, nameActionInvocations);
Assert.AreSame(nameResponse, nameActionInvocations[0]);
}
@@ -74,9 +74,9 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
- Assert.AreEqual(0, nameActionInvocations.Count);
+ Assert.IsEmpty(nameActionInvocations);
}
[TestMethod]
@@ -93,7 +93,7 @@ public void GetBytes()
expectedBytesLength += 4; // Handle length
expectedBytesLength += _handle.Length; // Handle
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadLinkRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadLinkRequestTest.cs
index 84bca0ca6..8dab037a9 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadLinkRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadLinkRequestTest.cs
@@ -66,8 +66,8 @@ public void Complete_SftpNameResponse()
request.Complete(nameResponse);
- Assert.AreEqual(0, statusActionInvocations.Count);
- Assert.AreEqual(1, nameActionInvocations.Count);
+ Assert.IsEmpty(statusActionInvocations);
+ Assert.HasCount(1, nameActionInvocations);
Assert.AreSame(nameResponse, nameActionInvocations[0]);
}
@@ -91,9 +91,9 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
- Assert.AreEqual(0, nameActionInvocations.Count);
+ Assert.IsEmpty(nameActionInvocations);
}
[TestMethod]
@@ -110,7 +110,7 @@ public void GetBytes()
expectedBytesLength += 4; // Path length
expectedBytesLength += _pathBytes.Length; // Path
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadRequestTest.cs
index 803a0d5aa..4f54a174b 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadRequestTest.cs
@@ -67,8 +67,8 @@ public void Complete_SftpDataResponse()
request.Complete(dataResponse);
- Assert.AreEqual(0, statusActionInvocations.Count);
- Assert.AreEqual(1, dataActionInvocations.Count);
+ Assert.IsEmpty(statusActionInvocations);
+ Assert.HasCount(1, dataActionInvocations);
Assert.AreSame(dataResponse, dataActionInvocations[0]);
}
@@ -93,9 +93,9 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
- Assert.AreEqual(0, dataActionInvocations.Count);
+ Assert.IsEmpty(dataActionInvocations);
}
[TestMethod]
@@ -114,7 +114,7 @@ public void GetBytes()
expectedBytesLength += 8; // Offset
expectedBytesLength += 4; // Length
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRealPathRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRealPathRequestTest.cs
index 58bffd0c3..da9b9118e 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRealPathRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRealPathRequestTest.cs
@@ -72,8 +72,8 @@ public void Complete_SftpNameResponse()
request.Complete(nameResponse);
- Assert.AreEqual(0, statusActionInvocations.Count);
- Assert.AreEqual(1, nameActionInvocations.Count);
+ Assert.IsEmpty(statusActionInvocations);
+ Assert.HasCount(1, nameActionInvocations);
Assert.AreSame(nameResponse, nameActionInvocations[0]);
}
@@ -97,9 +97,9 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
- Assert.AreEqual(0, nameActionInvocations.Count);
+ Assert.IsEmpty(nameActionInvocations);
}
[TestMethod]
@@ -126,7 +126,7 @@ public void GetBytes()
expectedBytesLength += 4; // Path length
expectedBytesLength += _pathBytes.Length; // Path
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRemoveRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRemoveRequestTest.cs
index e11bff8a0..19e4233e3 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRemoveRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRemoveRequestTest.cs
@@ -58,7 +58,7 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
}
@@ -76,7 +76,7 @@ public void GetBytes()
expectedBytesLength += 4; // Filename length
expectedBytesLength += _filenameBytes.Length; // Filename
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRenameRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRenameRequestTest.cs
index 705fb41b8..fab3d4967 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRenameRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRenameRequestTest.cs
@@ -63,7 +63,7 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
}
@@ -83,7 +83,7 @@ public void GetBytes()
expectedBytesLength += 4; // NewPath length
expectedBytesLength += _newPathBytes.Length; // NewPath
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRmDirRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRmDirRequestTest.cs
index 97a7964b7..9977aef16 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRmDirRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRmDirRequestTest.cs
@@ -57,7 +57,7 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
}
@@ -78,7 +78,7 @@ public void GetBytes()
expectedBytesLength += 4; // Path length
expectedBytesLength += _pathBytes.Length; // Path
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSetStatRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSetStatRequestTest.cs
index ae2e22311..728669fe7 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSetStatRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSetStatRequestTest.cs
@@ -68,7 +68,7 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
}
@@ -87,7 +87,7 @@ public void GetBytes()
expectedBytesLength += _pathBytes.Length; // Path
expectedBytesLength += _attributesBytes.Length; // Attributes
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpStatRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpStatRequestTest.cs
index 2bdbbdbb4..46714373c 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpStatRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpStatRequestTest.cs
@@ -59,8 +59,8 @@ public void Complete_SftpAttrsResponse()
request.Complete(attrsResponse);
- Assert.AreEqual(0, statusActionInvocations.Count);
- Assert.AreEqual(1, attrsActionInvocations.Count);
+ Assert.IsEmpty(statusActionInvocations);
+ Assert.HasCount(1, attrsActionInvocations);
Assert.AreSame(attrsResponse, attrsActionInvocations[0]);
}
@@ -77,8 +77,8 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
- Assert.AreEqual(0, attrsActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
+ Assert.IsEmpty(attrsActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
}
@@ -96,7 +96,7 @@ public void GetBytes()
expectedBytesLength += 4; // Path length
expectedBytesLength += _pathBytes.Length; // Path
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSymLinkRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSymLinkRequestTest.cs
index 9b95732f2..febce2254 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSymLinkRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSymLinkRequestTest.cs
@@ -75,7 +75,7 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
}
@@ -101,7 +101,7 @@ public void GetBytes()
expectedBytesLength += 4; // ExistingPath length
expectedBytesLength += _existingPathBytes.Length; // ExistingPath
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpUnblockRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpUnblockRequestTest.cs
index 6e1ec406e..163f28fe3 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpUnblockRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpUnblockRequestTest.cs
@@ -55,7 +55,7 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
}
@@ -75,7 +75,7 @@ public void GetBytes()
expectedBytesLength += 8; // Offset
expectedBytesLength += 8; // Length
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpWriteRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpWriteRequestTest.cs
index d2afdf8c8..6083455fa 100644
--- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpWriteRequestTest.cs
+++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpWriteRequestTest.cs
@@ -72,7 +72,7 @@ public void Complete_SftpStatusResponse()
request.Complete(statusResponse);
- Assert.AreEqual(1, statusActionInvocations.Count);
+ Assert.HasCount(1, statusActionInvocations);
Assert.AreSame(statusResponse, statusActionInvocations[0]);
}
@@ -93,7 +93,7 @@ public void GetBytes()
expectedBytesLength += 4; // Data length
expectedBytesLength += _length; // Data
- Assert.AreEqual(expectedBytesLength, bytes.Length);
+ Assert.HasCount(expectedBytesLength, bytes);
var sshDataStream = new SshDataStream(bytes);
diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteLessBytesThanBufferCanContain.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteLessBytesThanBufferCanContain.cs
index f4739bd2e..77f11a81a 100644
--- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteLessBytesThanBufferCanContain.cs
+++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteLessBytesThanBufferCanContain.cs
@@ -136,7 +136,7 @@ public void FlushShouldSendWrittenBytesToServer()
_shellStream.Flush();
Assert.IsNotNull(bytesSent);
- Assert.AreEqual(_bufferData.Length + _count, bytesSent.Length);
+ Assert.HasCount(_bufferData.Length + _count, bytesSent);
Assert.IsTrue(_bufferData.IsEqualTo(bytesSent.Take(_bufferData.Length)));
Assert.IsTrue(_data.Take(0, _count).IsEqualTo(bytesSent.Take(_bufferData.Length, _count)));
diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteMoreBytesThanBufferCanContain.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteMoreBytesThanBufferCanContain.cs
index 868175985..6e510b9f7 100644
--- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteMoreBytesThanBufferCanContain.cs
+++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteMoreBytesThanBufferCanContain.cs
@@ -142,7 +142,7 @@ public void FlushShouldSendRemainingBytesInBufferToServer()
_shellStream.Flush();
Assert.IsNotNull(actualBytesSent);
- Assert.AreEqual(expectedBytesSent.Length, actualBytesSent.Length);
+ Assert.HasCount(expectedBytesSent.Length, actualBytesSent);
Assert.IsTrue(expectedBytesSent.IsEqualTo(actualBytesSent));
_channelSessionMock.VerifyAll();
diff --git a/test/Renci.SshNet.Tests/Classes/SshClientTest_Dispose_ForwardedPortStarted.cs b/test/Renci.SshNet.Tests/Classes/SshClientTest_Dispose_ForwardedPortStarted.cs
index e7badbf36..de213dc19 100644
--- a/test/Renci.SshNet.Tests/Classes/SshClientTest_Dispose_ForwardedPortStarted.cs
+++ b/test/Renci.SshNet.Tests/Classes/SshClientTest_Dispose_ForwardedPortStarted.cs
@@ -77,8 +77,7 @@ public void IsConnectedShouldThrowObjectDisposedException()
try
{
var connected = _sshClient.IsConnected;
- Assert.Fail("IsConnected should have thrown {0} but returned {1}.",
- typeof(ObjectDisposedException).FullName, connected);
+ Assert.Fail($"IsConnected should have thrown {typeof(ObjectDisposedException).FullName} but returned {connected}.");
}
catch (ObjectDisposedException)
{
diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Connected.cs
index 7496a03a1..091430b07 100644
--- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Connected.cs
+++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Connected.cs
@@ -83,13 +83,13 @@ public void ConnectShouldHaveThrownInvalidOperationException()
[TestMethod]
public void DisconnectHasNeverFired()
{
- Assert.AreEqual(0, _disconnectedRegister.Count);
+ Assert.IsEmpty(_disconnectedRegister);
}
[TestMethod]
public void ErrorOccurredHasNeverFired()
{
- Assert.AreEqual(0, _errorOccurredRegister.Count);
+ Assert.IsEmpty(_errorOccurredRegister);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Disconnected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Disconnected.cs
index af31b6a5f..5e66a164e 100644
--- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Disconnected.cs
+++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Disconnected.cs
@@ -83,13 +83,13 @@ protected void Act()
[TestMethod]
public void DisconnectHasNeverFired()
{
- Assert.AreEqual(0, _disconnectedRegister.Count);
+ Assert.IsEmpty(_disconnectedRegister);
}
[TestMethod]
public void ErrorOccurredHasNeverFired()
{
- Assert.AreEqual(0, _errorOccurredRegister.Count);
+ Assert.IsEmpty(_errorOccurredRegister);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Disposed.cs
index 8d844788e..3eef70598 100644
--- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Disposed.cs
+++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Disposed.cs
@@ -86,13 +86,13 @@ public void ConnectShouldThrowObjectDisposedException()
[TestMethod]
public void DisconnectHasNeverFired()
{
- Assert.AreEqual(0, _disconnectedRegister.Count);
+ Assert.IsEmpty(_disconnectedRegister);
}
[TestMethod]
public void ErrorOccurredHasNeverFired()
{
- Assert.AreEqual(0, _errorOccurredRegister.Count);
+ Assert.IsEmpty(_errorOccurredRegister);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_SendSubsystemRequestFails.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_SendSubsystemRequestFails.cs
index 89580f90b..eeb0f5dd5 100644
--- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_SendSubsystemRequestFails.cs
+++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_SendSubsystemRequestFails.cs
@@ -87,13 +87,13 @@ public void ChannelShouldBeNull()
[TestMethod]
public void DisconnectHasNeverFired()
{
- Assert.AreEqual(0, _disconnectedRegister.Count);
+ Assert.IsEmpty(_disconnectedRegister);
}
[TestMethod]
public void ErrorOccurredHasNeverFired()
{
- Assert.AreEqual(0, _errorOccurredRegister.Count);
+ Assert.IsEmpty(_errorOccurredRegister);
}
[TestMethod]
@@ -113,7 +113,7 @@ public void ErrorOccurredOnSessionShouldNoLongerBeSignaledViaErrorOccurredOnSubs
{
_sessionMock.Raise(p => p.ErrorOccured += null, new ExceptionEventArgs(new Exception()));
- Assert.AreEqual(0, _errorOccurredRegister.Count);
+ Assert.IsEmpty(_errorOccurredRegister);
}
[TestMethod]
@@ -121,7 +121,7 @@ public void DisconnectedOnSessionShouldNoLongerBeSignaledViaDisconnectedOnSubsys
{
_sessionMock.Raise(p => p.Disconnected += null, new EventArgs());
- Assert.AreEqual(0, _disconnectedRegister.Count);
+ Assert.IsEmpty(_disconnectedRegister);
}
}
}
diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_Connected.cs
index a78fd44f7..31d3771a3 100644
--- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_Connected.cs
+++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_Connected.cs
@@ -73,13 +73,13 @@ protected void Act()
[TestMethod]
public void DisconnectHasNeverFired()
{
- Assert.AreEqual(0, _disconnectedRegister.Count);
+ Assert.IsEmpty(_disconnectedRegister);
}
[TestMethod]
public void ErrorOccurredHasNeverFired()
{
- Assert.AreEqual(0, _errorOccurredRegister.Count);
+ Assert.IsEmpty(_errorOccurredRegister);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_Disposed.cs
index a375e4376..63030b984 100644
--- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_Disposed.cs
+++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_Disposed.cs
@@ -72,13 +72,13 @@ protected void Act()
[TestMethod]
public void DisconnectHasNeverFired()
{
- Assert.AreEqual(0, _disconnectedRegister.Count);
+ Assert.IsEmpty(_disconnectedRegister);
}
[TestMethod]
public void ErrorOccurredHasNeverFired()
{
- Assert.AreEqual(0, _errorOccurredRegister.Count);
+ Assert.IsEmpty(_errorOccurredRegister);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_NeverConnected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_NeverConnected.cs
index ddfde8d92..871f7bc67 100644
--- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_NeverConnected.cs
+++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Disconnect_NeverConnected.cs
@@ -54,13 +54,13 @@ protected void Act()
[TestMethod]
public void DisconnectHasNeverFired()
{
- Assert.AreEqual(0, _disconnectedRegister.Count);
+ Assert.IsEmpty(_disconnectedRegister);
}
[TestMethod]
public void ErrorOccurredHasNeverFired()
{
- Assert.AreEqual(0, _errorOccurredRegister.Count);
+ Assert.IsEmpty(_errorOccurredRegister);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Connected.cs
index b25bad65e..73c0297db 100644
--- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Connected.cs
+++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Connected.cs
@@ -63,13 +63,13 @@ protected void Act()
[TestMethod]
public void DisconnectHasNeverFired()
{
- Assert.AreEqual(0, _disconnectedRegister.Count);
+ Assert.IsEmpty(_disconnectedRegister);
}
[TestMethod]
public void ErrorOccurredHasNeverFired()
{
- Assert.AreEqual(0, _errorOccurredRegister.Count);
+ Assert.IsEmpty(_errorOccurredRegister);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Disconnected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Disconnected.cs
index c6aba3ce4..6c56ffd96 100644
--- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Disconnected.cs
+++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Disconnected.cs
@@ -73,13 +73,13 @@ protected void Act()
[TestMethod]
public void DisconnectHasNeverFired()
{
- Assert.AreEqual(0, _disconnectedRegister.Count);
+ Assert.IsEmpty(_disconnectedRegister);
}
[TestMethod]
public void ErrorOccurredHasNeverFired()
{
- Assert.AreEqual(0, _errorOccurredRegister.Count);
+ Assert.IsEmpty(_errorOccurredRegister);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Disposed.cs
index 5eb881f5d..d715484f1 100644
--- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Disposed.cs
+++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_Disposed.cs
@@ -73,13 +73,13 @@ protected void Act()
[TestMethod]
public void DisconnectHasNeverFired()
{
- Assert.AreEqual(0, _disconnectedRegister.Count);
+ Assert.IsEmpty(_disconnectedRegister);
}
[TestMethod]
public void ErrorOccurredHasNeverFired()
{
- Assert.AreEqual(0, _errorOccurredRegister.Count);
+ Assert.IsEmpty(_errorOccurredRegister);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_NeverConnected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_NeverConnected.cs
index 17c1c8977..14c31749b 100644
--- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_NeverConnected.cs
+++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Dispose_NeverConnected.cs
@@ -55,13 +55,13 @@ protected void Act()
[TestMethod]
public void DisconnectHasNeverFired()
{
- Assert.AreEqual(0, _disconnectedRegister.Count);
+ Assert.IsEmpty(_disconnectedRegister);
}
[TestMethod]
public void ErrorOccurredHasNeverFired()
{
- Assert.AreEqual(0, _errorOccurredRegister.Count);
+ Assert.IsEmpty(_errorOccurredRegister);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Connected.cs
index 2629c90fa..595ad5589 100644
--- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Connected.cs
+++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Connected.cs
@@ -69,19 +69,19 @@ protected void Act()
[TestMethod]
public void DisconnectHasNeverFired()
{
- Assert.AreEqual(0, _disconnectedRegister.Count);
+ Assert.IsEmpty(_disconnectedRegister);
}
[TestMethod]
public void ErrorOccurredHasNeverFired()
{
- Assert.AreEqual(0, _errorOccurredRegister.Count);
+ Assert.IsEmpty(_errorOccurredRegister);
}
[TestMethod]
public void OnDataReceivedShouldBeInvokedOnce()
{
- Assert.AreEqual(1, _subsystemSession.OnDataReceivedInvocations.Count);
+ Assert.HasCount(1, _subsystemSession.OnDataReceivedInvocations);
var received = _subsystemSession.OnDataReceivedInvocations[0];
Assert.AreEqual(_channelDataEventArgs.Data, received.Data);
diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Disposed.cs
index fc4b29600..1d1690093 100644
--- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Disposed.cs
+++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Disposed.cs
@@ -70,19 +70,19 @@ protected void Act()
[TestMethod]
public void DisconnectHasNeverFired()
{
- Assert.AreEqual(0, _disconnectedRegister.Count);
+ Assert.IsEmpty(_disconnectedRegister);
}
[TestMethod]
public void ErrorOccurredHasNeverFired()
{
- Assert.AreEqual(0, _errorOccurredRegister.Count);
+ Assert.IsEmpty(_errorOccurredRegister);
}
[TestMethod]
public void OnDataReceivedShouldNeverBeInvoked()
{
- Assert.AreEqual(0, _subsystemSession.OnDataReceivedInvocations.Count);
+ Assert.IsEmpty(_subsystemSession.OnDataReceivedInvocations);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_OnDataReceived_Exception.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_OnDataReceived_Exception.cs
index 7a81fc59c..31517d243 100644
--- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_OnDataReceived_Exception.cs
+++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_OnDataReceived_Exception.cs
@@ -72,20 +72,20 @@ protected void Act()
[TestMethod]
public void DisconnectHasNeverFired()
{
- Assert.AreEqual(0, _disconnectedRegister.Count);
+ Assert.IsEmpty(_disconnectedRegister);
}
[TestMethod]
public void ErrorOccurredHaveFiredOnce()
{
- Assert.AreEqual(1, _errorOccurredRegister.Count, _errorOccurredRegister.AsString());
+ Assert.HasCount(1, _errorOccurredRegister, _errorOccurredRegister.AsString());
Assert.AreSame(_onDataReceivedException, _errorOccurredRegister[0].Exception, _errorOccurredRegister.AsString());
}
[TestMethod]
public void OnDataReceivedShouldBeInvokedOnce()
{
- Assert.AreEqual(1, _subsystemSession.OnDataReceivedInvocations.Count);
+ Assert.HasCount(1, _subsystemSession.OnDataReceivedInvocations);
var received = _subsystemSession.OnDataReceivedInvocations[0];
Assert.AreEqual(_channelDataEventArgs.Data, received.Data);
diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Connected.cs
index 7c042c84d..bd19da3ec 100644
--- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Connected.cs
+++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Connected.cs
@@ -68,13 +68,13 @@ protected void Act()
[TestMethod]
public void DisconnectHasNeverFired()
{
- Assert.AreEqual(0, _disconnectedRegister.Count);
+ Assert.IsEmpty(_disconnectedRegister);
}
[TestMethod]
public void ErrorOccurredHasFiredOnce()
{
- Assert.AreEqual(1, _errorOccurredRegister.Count, _errorOccurredRegister.AsString());
+ Assert.HasCount(1, _errorOccurredRegister, _errorOccurredRegister.AsString());
Assert.AreSame(_channelExceptionEventArgs.Exception, _errorOccurredRegister[0].Exception, _errorOccurredRegister.AsString());
}
diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Disposed.cs
index 0f63f1934..d9e970b49 100644
--- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Disposed.cs
+++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Disposed.cs
@@ -78,13 +78,13 @@ protected void Act()
[TestMethod]
public void DisconnectHasNeverFired()
{
- Assert.AreEqual(0, _disconnectedRegister.Count);
+ Assert.IsEmpty(_disconnectedRegister);
}
[TestMethod]
public void ErrorOccurredHasNeverFired()
{
- Assert.AreEqual(0, _errorOccurredRegister.Count);
+ Assert.IsEmpty(_errorOccurredRegister);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionDisconnected_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionDisconnected_Connected.cs
index 5d6fbe463..ed415466e 100644
--- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionDisconnected_Connected.cs
+++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionDisconnected_Connected.cs
@@ -70,13 +70,13 @@ protected void Act()
[TestMethod]
public void DisconnectHasFiredOnce()
{
- Assert.AreEqual(1, _disconnectedRegister.Count);
+ Assert.HasCount(1, _disconnectedRegister);
}
[TestMethod]
public void ErrorOccurredHasNeverFired()
{
- Assert.AreEqual(0, _errorOccurredRegister.Count);
+ Assert.IsEmpty(_errorOccurredRegister);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionDisconnected_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionDisconnected_Disposed.cs
index c2416ebc5..f24fae94e 100644
--- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionDisconnected_Disposed.cs
+++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionDisconnected_Disposed.cs
@@ -72,13 +72,13 @@ protected void Act()
[TestMethod]
public void DisconnectHasNeverFired()
{
- Assert.AreEqual(0, _disconnectedRegister.Count);
+ Assert.IsEmpty(_disconnectedRegister);
}
[TestMethod]
public void ErrorOccurredHasNeverFired()
{
- Assert.AreEqual(0, _errorOccurredRegister.Count);
+ Assert.IsEmpty(_errorOccurredRegister);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Connected.cs
index a11764752..efde0055f 100644
--- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Connected.cs
+++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Connected.cs
@@ -68,13 +68,13 @@ protected void Act()
[TestMethod]
public void DisconnectHasNeverFired()
{
- Assert.AreEqual(0, _disconnectedRegister.Count);
+ Assert.IsEmpty(_disconnectedRegister);
}
[TestMethod]
public void ErrorOccurredHasFiredOnce()
{
- Assert.AreEqual(1, _errorOccurredRegister.Count, _errorOccurredRegister.AsString());
+ Assert.HasCount(1, _errorOccurredRegister, _errorOccurredRegister.AsString());
Assert.AreSame(_errorOccurredEventArgs.Exception, _errorOccurredRegister[0].Exception, _errorOccurredRegister.AsString());
}
diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Disposed.cs
index d3301c03d..b5e8d4ed3 100644
--- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Disposed.cs
+++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Disposed.cs
@@ -68,13 +68,13 @@ protected void Act()
[TestMethod]
public void DisconnectHasNeverFired()
{
- Assert.AreEqual(0, _disconnectedRegister.Count);
+ Assert.IsEmpty(_disconnectedRegister);
}
[TestMethod]
public void ErrorOccurredHasNeverFired()
{
- Assert.AreEqual(0, _errorOccurredRegister.Count);
+ Assert.IsEmpty(_errorOccurredRegister);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Connected.cs
index eac62bb26..eb19eac14 100644
--- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Connected.cs
+++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Connected.cs
@@ -69,13 +69,13 @@ protected void Act()
[TestMethod]
public void DisconnectHasNeverFired()
{
- Assert.AreEqual(0, _disconnectedRegister.Count);
+ Assert.IsEmpty(_disconnectedRegister);
}
[TestMethod]
public void ErrorOccurredHasNeverFired()
{
- Assert.AreEqual(0, _errorOccurredRegister.Count);
+ Assert.IsEmpty(_errorOccurredRegister);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Disposed.cs
index 4fb93ce24..b90d3d2f9 100644
--- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Disposed.cs
+++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Disposed.cs
@@ -82,13 +82,13 @@ public void SendDataShouldThrowObjectDisposedException()
[TestMethod]
public void DisconnectHasNeverFired()
{
- Assert.AreEqual(0, _disconnectedRegister.Count);
+ Assert.IsEmpty(_disconnectedRegister);
}
[TestMethod]
public void ErrorOccurredHasNeverFired()
{
- Assert.AreEqual(0, _errorOccurredRegister.Count);
+ Assert.IsEmpty(_errorOccurredRegister);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_NeverConnected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_NeverConnected.cs
index 3521b22c9..ddc635c89 100644
--- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_NeverConnected.cs
+++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_NeverConnected.cs
@@ -83,13 +83,13 @@ public void SendDataShouldHaveThrownInvalidOperationException()
[TestMethod]
public void DisconnectHasNeverFired()
{
- Assert.AreEqual(0, _disconnectedRegister.Count);
+ Assert.IsEmpty(_disconnectedRegister);
}
[TestMethod]
public void ErrorOccurredHasNeverFired()
{
- Assert.AreEqual(0, _errorOccurredRegister.Count);
+ Assert.IsEmpty(_errorOccurredRegister);
}
[TestMethod]
diff --git a/test/Renci.SshNet.Tests/Common/TestMethodForPlatformAttribute.cs b/test/Renci.SshNet.Tests/Common/TestMethodForPlatformAttribute.cs
index c8db5f635..dbccbb22a 100644
--- a/test/Renci.SshNet.Tests/Common/TestMethodForPlatformAttribute.cs
+++ b/test/Renci.SshNet.Tests/Common/TestMethodForPlatformAttribute.cs
@@ -1,5 +1,7 @@
using System;
+using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
+using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -8,18 +10,18 @@ namespace Renci.SshNet.Tests.Common
[AttributeUsage(AttributeTargets.Method)]
public sealed class TestMethodForPlatformAttribute : TestMethodAttribute
{
- public TestMethodForPlatformAttribute(string platform)
+ public TestMethodForPlatformAttribute(string platform, [CallerFilePath] string callerFilePath = "", [CallerLineNumber] int callerLineNumber = -1) : base(callerFilePath, callerLineNumber)
{
Platform = platform;
}
public string Platform { get; }
- public override TestResult[] Execute(ITestMethod testMethod)
+ public override async Task ExecuteAsync(ITestMethod testMethod)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Create(Platform)))
{
- return base.Execute(testMethod);
+ return await base.ExecuteAsync(testMethod);
}
var message = $"Test not executed. The test is intended for the '{Platform}' platform only.";
diff --git a/test/Renci.SshNet.Tests/Properties/AssemblyInfo.cs b/test/Renci.SshNet.Tests/Properties/AssemblyInfo.cs
index 886e59996..31641efd3 100644
--- a/test/Renci.SshNet.Tests/Properties/AssemblyInfo.cs
+++ b/test/Renci.SshNet.Tests/Properties/AssemblyInfo.cs
@@ -1,5 +1,10 @@
-#if NET
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+#if NET
using System.Diagnostics.CodeAnalysis;
+
[assembly: ExcludeFromCodeCoverage]
#endif // NET
+
+[assembly: DoNotParallelize]