From 933613e31c0ecee919748341e36e844f255de27e Mon Sep 17 00:00:00 2001 From: mus65 Date: Fri, 14 Nov 2025 22:09:13 +0100 Subject: [PATCH] Update to MSTest 4 (#1721) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update to MSTest 4 * fix TestMethodForPlatformAttribute replace Execute with ExecuteAsync and fix MSTEST0057 https://learn.microsoft.com/en-us/dotnet/core/testing/mstest-analyzers/mstest0057 (link currently dead) * fix compilation error * fix MSTEST0037 https://learn.microsoft.com/en-us/dotnet/core/testing/mstest-analyzers/mstest0037 * fix MSTEST0052 https://learn.microsoft.com/en-us/dotnet/core/testing/mstest-analyzers/mstest0052 * fix MSTEST0045 Fixing this properly would require the tests to respect testContext.CancellationToken. I'm not sure this is worth fixing or how to even do it for the sync methods. https://learn.microsoft.com/en-us/dotnet/core/testing/mstest-analyzers/mstest0045 * fix MSTEST0001 I assume that parallelization would break a lot of stuff. https://learn.microsoft.com/en-us/dotnet/core/testing/mstest-analyzers/mstest0001 * Workaround for new Sonar warnings because of MSTest4 * revert analyzer fixes in OrderedDictionaryTest * use custom sync console logger for MSTest to work around https://github.com/microsoft/testfx/issues/6457 * remove redundant args --------- Co-authored-by: Wojciech Nagórski Co-authored-by: Rob Hague --- Directory.Packages.props | 2 +- test/.editorconfig | 6 +++ .../Properties/AssemblyInfo.cs | 1 + .../AuthenticationTests.cs | 2 +- .../ConnectivityTests.cs | 2 +- .../Logging/TestConsoleLogger.cs | 40 ++++++++++++++ .../Logging/TestConsoleLoggerProvider.cs | 18 +++++++ .../TestConsoleLoggerProviderExtensions.cs | 16 ++++++ .../SftpClientTest.ListDirectory.cs | 16 +++--- .../SftpClientTest.SynchronizeDirectories.cs | 4 +- .../OldIntegrationTests/SshCommandTest.cs | 8 +-- .../Properties/AssemblyInfo.cs | 2 + .../Renci.SshNet.IntegrationTests/ScpTests.cs | 52 +++++++++---------- .../SftpTests.cs | 4 +- .../Renci.SshNet.IntegrationTests/SshTests.cs | 16 +++--- .../SshTests_TTYDisabled.cs | 4 +- .../TestsFixtures/InfrastructureFixture.cs | 4 +- .../Classes/AbstractionsTest.cs | 6 +-- ...pose_SessionIsConnectedAndChannelIsOpen.cs | 4 +- .../ChannelSessionTest_Dispose_Disposed.cs | 4 +- ...hannelEofReceived_DisposeInEventHandler.cs | 4 +- ...Received_SendChannelCloseMessageFailure.cs | 4 +- ...Received_SendChannelCloseMessageSuccess.cs | 4 +- ...Received_SendChannelCloseMessageFailure.cs | 4 +- ...Received_SendChannelCloseMessageSuccess.cs | 4 +- ...Received_SendChannelCloseMessageFailure.cs | 4 +- ...Received_SendChannelCloseMessageSuccess.cs | 4 +- ...Open_NoChannelCloseOrChannelEofReceived.cs | 4 +- ...ofReceived_SendChannelEofMessageFailure.cs | 4 +- ...sOpen_ChannelCloseAndChannelEofReceived.cs | 4 +- ...edAndChannelIsOpen_ChannelCloseReceived.cs | 4 +- ...Open_NoChannelCloseOrChannelEofReceived.cs | 4 +- ...ived_SessionIsConnectedAndChannelIsOpen.cs | 4 +- ...Open_ExceptionWaitingOnOpenConfirmation.cs | 4 +- ...nOpenFailureReceived_NoRetriesAvailable.cs | 4 +- ..._OnOpenFailureReceived_RetriesAvailable.cs | 4 +- ...e_SessionIsConnectedAndChannelIsNotOpen.cs | 4 +- ...onnectedAndChannelIsOpen_EofNotReceived.cs | 6 +-- ...nelIsOpen_EofNotReceived_SendEofInvoked.cs | 6 +-- ...IsConnectedAndChannelIsOpen_EofReceived.cs | 6 +-- ...DisconnectWaitingForChannelCloseMessage.cs | 6 +-- ...ed_TimeoutWaitingForChannelCloseMessage.cs | 6 +-- ...essionIsNotConnectedAndChannelIsNotOpen.cs | 4 +- ...e_SessionIsNotConnectedAndChannelIsOpen.cs | 4 +- ...nChannelCloseReceived_OnClose_Exception.cs | 4 +- ...Open_DisposeChannelInClosedEventHandler.cs | 6 +-- ...onnectedAndChannelIsOpen_EofNotReceived.cs | 4 +- ...IsConnectedAndChannelIsOpen_EofReceived.cs | 4 +- ...ionChannelDataReceived_OnData_Exception.cs | 4 +- ...ssionChannelEofReceived_OnEof_Exception.cs | 4 +- ...edDataReceived_OnExtendedData_Exception.cs | 4 +- ...nnelFailureReceived_OnFailure_Exception.cs | 4 +- ...nelRequestReceived_HandleUnknownMessage.cs | 2 +- ...nnelRequestReceived_OnRequest_Exception.cs | 4 +- ...nnelSuccessReceived_OnSuccess_Exception.cs | 4 +- ...AdjustReceived_OnWindowAdjust_Exception.cs | 4 +- ...onDisconnected_OnDisconnected_Exception.cs | 4 +- ...cted_SessionIsConnectedAndChannelIsOpen.cs | 4 +- ...ErrorOccurred_OnErrorOccurred_Exception.cs | 4 +- .../ChannelTest_SendEof_ChannelIsNotOpen.cs | 4 +- .../ChannelTest_SendEof_ChannelIsOpen.cs | 4 +- ...onReceived_OnOpenConfirmation_Exception.cs | 4 +- ...FailureReceived_OnOpenFailure_Exception.cs | 4 +- .../Classes/Common/ExtensionsTest_Concat.cs | 2 +- .../Classes/Common/ExtensionsTest_Pad.cs | 4 +- .../Common/ExtensionsTest_Take_Count.cs | 4 +- .../ExtensionsTest_Take_OffsetAndCount.cs | 8 +-- .../Common/ExtensionsTest_ToBigInteger2.cs | 4 +- .../Common/ExtensionsTest_TrimLeadingZeros.cs | 8 +-- ...rTest_Connect_ConnectionRefusedByServer.cs | 2 +- ...nnectorTest_Connect_ConnectionSucceeded.cs | 2 +- ...rTest_Connect_TimeoutConnectingToServer.cs | 4 +- ...orTest_Connect_ConnectionToProxyRefused.cs | 2 +- ...orTest_Connect_TimeoutConnectingToProxy.cs | 4 +- ...rTest_Connect_TimeoutReadingHttpContent.cs | 4 +- ...orTest_Connect_TimeoutReadingStatusLine.cs | 4 +- ...ectionClosedByServer_NoDataSentByServer.cs | 2 +- ...est_ServerResponseContainsNullCharacter.cs | 2 +- ...entificationOnlyContainsProtocolVersion.cs | 2 +- ...changeTest_ServerResponseValid_Comments.cs | 2 +- ...erverResponseValid_EmptySoftwareVersion.cs | 2 +- ...angeTest_ServerResponseValid_NoComments.cs | 2 +- ...rminatedByLineFeedWithoutCarriageReturn.cs | 2 +- ...Test_TimeoutReadingIdentificationString.cs | 2 +- ...orTest_Connect_ConnectionToProxyRefused.cs | 2 +- ...orTest_Connect_TimeoutConnectingToProxy.cs | 4 +- ...onnect_TimeoutReadingDestinationAddress.cs | 4 +- ...torTest_Connect_TimeoutReadingReplyCode.cs | 4 +- ...Test_Connect_TimeoutReadingReplyVersion.cs | 4 +- ...orTest_Connect_ConnectionToProxyRefused.cs | 2 +- ...orTest_Connect_TimeoutConnectingToProxy.cs | 4 +- ...ctorTest_Connect_TimeoutConnectionReply.cs | 4 +- ...dedPortDynamicTest_Dispose_PortDisposed.cs | 4 +- ...ortDynamicTest_Dispose_PortNeverStarted.cs | 4 +- ...icTest_Dispose_PortStarted_ChannelBound.cs | 4 +- ...est_Dispose_PortStarted_ChannelNotBound.cs | 4 +- ...rdedPortDynamicTest_Dispose_PortStopped.cs | 4 +- ...cTest_SessionErrorOccurred_ChannelBound.cs | 4 +- ...ardedPortDynamicTest_Start_PortDisposed.cs | 4 +- ...dPortDynamicTest_Start_PortNeverStarted.cs | 4 +- ...wardedPortDynamicTest_Start_PortStarted.cs | 4 +- ...wardedPortDynamicTest_Start_PortStopped.cs | 4 +- ...rtDynamicTest_Start_SessionNotConnected.cs | 4 +- ...wardedPortDynamicTest_Start_SessionNull.cs | 4 +- ...t_Started_SocketSendShutdownImmediately.cs | 4 +- ...cTest_Started_SocketVersionNotSupported.cs | 4 +- ...wardedPortDynamicTest_Stop_PortDisposed.cs | 4 +- ...edPortDynamicTest_Stop_PortNeverStarted.cs | 4 +- ...namicTest_Stop_PortStarted_ChannelBound.cs | 4 +- ...icTest_Stop_PortStarted_ChannelNotBound.cs | 4 +- ...rwardedPortDynamicTest_Stop_PortStopped.cs | 4 +- ...ardedPortLocalTest_Dispose_PortDisposed.cs | 4 +- ...lTest_Dispose_PortDisposed_NeverStarted.cs | 4 +- ...dPortLocalTest_Dispose_PortNeverStarted.cs | 4 +- ...alTest_Dispose_PortStarted_ChannelBound.cs | 4 +- ...est_Dispose_PortStarted_ChannelNotBound.cs | 4 +- ...wardedPortLocalTest_Dispose_PortStopped.cs | 4 +- ...rwardedPortLocalTest_Start_PortDisposed.cs | 4 +- ...dedPortLocalTest_Start_PortNeverStarted.cs | 4 +- ...orwardedPortLocalTest_Start_PortStarted.cs | 4 +- ...orwardedPortLocalTest_Start_PortStopped.cs | 4 +- ...PortLocalTest_Start_SessionNotConnected.cs | 4 +- ...orwardedPortLocalTest_Start_SessionNull.cs | 4 +- ...orwardedPortLocalTest_Stop_PortDisposed.cs | 4 +- ...rdedPortLocalTest_Stop_PortNeverStarted.cs | 4 +- ...LocalTest_Stop_PortStarted_ChannelBound.cs | 4 +- ...alTest_Stop_PortStarted_ChannelNotBound.cs | 4 +- ...ForwardedPortLocalTest_Stop_PortStopped.cs | 4 +- ...rdedPortRemoteTest_Dispose_PortDisposed.cs | 4 +- ...PortRemoteTest_Dispose_PortNeverStarted.cs | 4 +- ...teTest_Dispose_PortStarted_ChannelBound.cs | 4 +- ...ardedPortRemoteTest_Dispose_PortStopped.cs | 4 +- ...wardedPortRemoteTest_Start_PortDisposed.cs | 4 +- ...edPortRemoteTest_Start_PortNeverStarted.cs | 4 +- ...rwardedPortRemoteTest_Start_PortStarted.cs | 4 +- ...rwardedPortRemoteTest_Start_PortStopped.cs | 4 +- ...ortRemoteTest_Start_SessionNotConnected.cs | 4 +- ...rwardedPortRemoteTest_Start_SessionNull.cs | 4 +- .../ForwardedPortRemoteTest_Started.cs | 16 +++--- ...rwardedPortRemoteTest_Stop_PortDisposed.cs | 4 +- ...dedPortRemoteTest_Stop_PortNeverStarted.cs | 4 +- .../Connection/ChannelDataMessageTest.cs | 2 +- .../ChannelOpen/ChannelOpenMessageTest.cs | 2 +- .../ChannelRequest/PseudoTerminalInfoTest.cs | 6 +-- .../Messages/Transport/IgnoreMessageTest.cs | 6 +-- .../KeyExchangeDhGroupExchangeRequestTest.cs | 2 +- .../Classes/OrderedDictionaryTest.cs | 3 +- .../Classes/PrivateKeyFileTest.cs | 10 ++-- .../Classes/ScpClientTest.cs | 20 +++---- ...rectoryInfo_SendExecRequestReturnsFalse.cs | 2 +- ...AndFileInfo_SendExecRequestReturnsFalse.cs | 2 +- ...thAndStream_SendExecRequestReturnsFalse.cs | 2 +- ...InfoAndPath_SendExecRequestReturnsFalse.cs | 2 +- ...InfoAndPath_SendExecRequestReturnsFalse.cs | 2 +- ...ientTest_Upload_FileInfoAndPath_Success.cs | 2 +- ...reamAndPath_SendExecRequestReturnsFalse.cs | 2 +- .../Security/CertificateHostAlgorithmTest.cs | 2 +- .../Security/Cryptography/BlockCipherTest.cs | 10 ++-- .../Classes/SessionTest_Connected.cs | 14 ++--- .../SessionTest_Connected_ConnectionReset.cs | 10 ++-- .../SessionTest_Connected_Disconnect.cs | 10 ++-- ...alRequestMessageAfterAuthenticationRace.cs | 2 +- ...sionTest_Connected_ServerSendsBadPacket.cs | 10 ++-- ..._Connected_ServerSendsDisconnectMessage.cs | 10 ++-- ...endsDisconnectMessageAndShutsDownSocket.cs | 10 ++-- ...ected_ServerSendsUnsupportedMessageType.cs | 16 +++--- ...utsDownSendAfterSendingIncompletePacket.cs | 10 ++-- ...ionTest_Connected_ServerShutsDownSocket.cs | 10 ++-- .../ExtendedRequests/FStatVfsRequestTest.cs | 10 ++-- .../ExtendedRequests/HardLinkRequestTest.cs | 4 +- .../PosixRenameRequestTest.cs | 4 +- .../ExtendedRequests/StatVfsRequestTest.cs | 10 ++-- .../Sftp/Requests/SftpBlockRequestTest.cs | 4 +- .../Sftp/Requests/SftpCloseRequestTest.cs | 4 +- .../Sftp/Requests/SftpFSetStatRequestTest.cs | 4 +- .../Sftp/Requests/SftpFStatRequestTest.cs | 10 ++-- .../Sftp/Requests/SftpLStatRequestTest.cs | 10 ++-- .../Sftp/Requests/SftpLinkRequestTest.cs | 4 +- .../Sftp/Requests/SftpMkDirRequestTest.cs | 4 +- .../Sftp/Requests/SftpOpenDirRequestTest.cs | 10 ++-- .../Sftp/Requests/SftpOpenRequestTest.cs | 10 ++-- .../Sftp/Requests/SftpReadDirRequestTest.cs | 10 ++-- .../Sftp/Requests/SftpReadLinkRequestTest.cs | 10 ++-- .../Sftp/Requests/SftpReadRequestTest.cs | 10 ++-- .../Sftp/Requests/SftpRealPathRequestTest.cs | 10 ++-- .../Sftp/Requests/SftpRemoveRequestTest.cs | 4 +- .../Sftp/Requests/SftpRenameRequestTest.cs | 4 +- .../Sftp/Requests/SftpRmDirRequestTest.cs | 4 +- .../Sftp/Requests/SftpSetStatRequestTest.cs | 4 +- .../Sftp/Requests/SftpStatRequestTest.cs | 10 ++-- .../Sftp/Requests/SftpSymLinkRequestTest.cs | 4 +- .../Sftp/Requests/SftpUnblockRequestTest.cs | 4 +- .../Sftp/Requests/SftpWriteRequestTest.cs | 4 +- ...tyAndWriteLessBytesThanBufferCanContain.cs | 2 +- ...tyAndWriteMoreBytesThanBufferCanContain.cs | 2 +- ...ClientTest_Dispose_ForwardedPortStarted.cs | 3 +- .../SubsystemSession_Connect_Connected.cs | 4 +- .../SubsystemSession_Connect_Disconnected.cs | 4 +- .../SubsystemSession_Connect_Disposed.cs | 4 +- ...ssion_Connect_SendSubsystemRequestFails.cs | 8 +-- .../SubsystemSession_Disconnect_Connected.cs | 4 +- .../SubsystemSession_Disconnect_Disposed.cs | 4 +- ...systemSession_Disconnect_NeverConnected.cs | 4 +- .../SubsystemSession_Dispose_Connected.cs | 4 +- .../SubsystemSession_Dispose_Disconnected.cs | 4 +- .../SubsystemSession_Dispose_Disposed.cs | 4 +- ...SubsystemSession_Dispose_NeverConnected.cs | 4 +- ...Session_OnChannelDataReceived_Connected.cs | 6 +-- ...mSession_OnChannelDataReceived_Disposed.cs | 6 +-- ...elDataReceived_OnDataReceived_Exception.cs | 6 +-- ...temSession_OnChannelException_Connected.cs | 4 +- ...stemSession_OnChannelException_Disposed.cs | 4 +- ...Session_OnSessionDisconnected_Connected.cs | 4 +- ...mSession_OnSessionDisconnected_Disposed.cs | 4 +- ...ession_OnSessionErrorOccurred_Connected.cs | 4 +- ...Session_OnSessionErrorOccurred_Disposed.cs | 4 +- .../SubsystemSession_SendData_Connected.cs | 4 +- .../SubsystemSession_SendData_Disposed.cs | 4 +- ...ubsystemSession_SendData_NeverConnected.cs | 4 +- .../Common/TestMethodForPlatformAttribute.cs | 8 +-- .../Properties/AssemblyInfo.cs | 7 ++- 221 files changed, 627 insertions(+), 539 deletions(-) create mode 100644 test/Renci.SshNet.IntegrationBenchmarks/Properties/AssemblyInfo.cs create mode 100644 test/Renci.SshNet.IntegrationTests/Logging/TestConsoleLogger.cs create mode 100644 test/Renci.SshNet.IntegrationTests/Logging/TestConsoleLoggerProvider.cs create mode 100644 test/Renci.SshNet.IntegrationTests/Logging/TestConsoleLoggerProviderExtensions.cs diff --git a/Directory.Packages.props b/Directory.Packages.props index cb2caaa3..960200c3 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -14,7 +14,7 @@ - + diff --git a/test/.editorconfig b/test/.editorconfig index 5cc9439f..ff7e4853 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 00000000..a972a5d8 --- /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 9f143eee..3f3efde9 100644 --- a/test/Renci.SshNet.IntegrationTests/AuthenticationTests.cs +++ b/test/Renci.SshNet.IntegrationTests/AuthenticationTests.cs @@ -436,7 +436,7 @@ namespace Renci.SshNet.IntegrationTests catch (SshAuthenticationException ex) { Assert.IsNull(ex.InnerException); - Assert.IsTrue(ex.Message.StartsWith("AuthenticationPrompt.Response is null for prompt \"Password: \""), $"Message was \"{ex.Message}\""); + Assert.StartsWith("AuthenticationPrompt.Response is null for prompt \"Password: \"", ex.Message); } } } diff --git a/test/Renci.SshNet.IntegrationTests/ConnectivityTests.cs b/test/Renci.SshNet.IntegrationTests/ConnectivityTests.cs index bbe6f906..4791c188 100644 --- a/test/Renci.SshNet.IntegrationTests/ConnectivityTests.cs +++ b/test/Renci.SshNet.IntegrationTests/ConnectivityTests.cs @@ -432,7 +432,7 @@ namespace Renci.SshNet.IntegrationTests 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); } } diff --git a/test/Renci.SshNet.IntegrationTests/Logging/TestConsoleLogger.cs b/test/Renci.SshNet.IntegrationTests/Logging/TestConsoleLogger.cs new file mode 100644 index 00000000..10b58b2c --- /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 00000000..4a9c2357 --- /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 00000000..7168e6ba --- /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 f85f951e..9200b650 100644 --- a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.ListDirectory.cs +++ b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.ListDirectory.cs @@ -43,7 +43,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests var files = sftp.ListDirectory("."); - Assert.IsTrue(files.Count() > 0); + Assert.IsGreaterThan(0, files.Count()); foreach (var file in files) { @@ -71,7 +71,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests Debug.WriteLine(file.FullName); } - Assert.IsTrue(count > 0); + Assert.IsGreaterThan(0, count); sftp.Disconnect(); } @@ -87,7 +87,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests var files = sftp.ListDirectory(string.Empty); - Assert.IsTrue(files.Count() > 0); + Assert.IsGreaterThan(0, files.Count()); foreach (var file in files) { @@ -128,7 +128,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests var files = sftp.ListDirectory("."); // Ensure that directory has at least 10000 items - Assert.IsTrue(files.Count() > 10000); + Assert.IsGreaterThan(10000, files.Count()); sftp.Disconnect(); } @@ -158,7 +158,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests var files = sftp.ListDirectory("."); - Assert.IsTrue(files.First().FullName.StartsWith(string.Format("{0}", sftp.WorkingDirectory))); + Assert.StartsWith(string.Format("{0}", sftp.WorkingDirectory), files.First().FullName); sftp.ChangeDirectory("test1_1"); @@ -178,7 +178,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests files = sftp.ListDirectory("test1/test1_1"); - Assert.IsTrue(files.First().FullName.StartsWith(string.Format("{0}/test1/test1_1", sftp.WorkingDirectory))); + Assert.StartsWith(string.Format("{0}/test1/test1_1", sftp.WorkingDirectory), files.First().FullName); sftp.ChangeDirectory("test1/test1_1"); @@ -227,7 +227,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests var files = sftp.ListDirectory("."); - Assert.IsTrue(files.First().FullName.StartsWith(string.Format("{0}", sftp.WorkingDirectory))); + Assert.StartsWith(string.Format("{0}", sftp.WorkingDirectory), files.First().FullName); await sftp.ChangeDirectoryAsync("test1_1", CancellationToken.None).ConfigureAwait(false); @@ -247,7 +247,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests files = sftp.ListDirectory("test1/test1_1"); - Assert.IsTrue(files.First().FullName.StartsWith(string.Format("{0}/test1/test1_1", sftp.WorkingDirectory))); + Assert.StartsWith(string.Format("{0}/test1/test1_1", sftp.WorkingDirectory), files.First().FullName); await sftp.ChangeDirectoryAsync("test1/test1_1", CancellationToken.None).ConfigureAwait(false); diff --git a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.SynchronizeDirectories.cs b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.SynchronizeDirectories.cs index 4964715e..60e1f124 100644 --- a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.SynchronizeDirectories.cs +++ b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.SynchronizeDirectories.cs @@ -24,7 +24,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests string searchPattern = Path.GetFileName(uploadedFileName); var upLoadedFiles = sftp.SynchronizeDirectories(sourceDir, destDir, searchPattern); - Assert.IsTrue(upLoadedFiles.Count() > 0); + Assert.IsGreaterThan(0, upLoadedFiles.Count()); foreach (var file in upLoadedFiles) { @@ -63,7 +63,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests var upLoadedFiles = sftp.EndSynchronizeDirectories(asyncResult); - Assert.IsTrue(upLoadedFiles.Count() > 0); + Assert.IsGreaterThan(0, upLoadedFiles.Count()); foreach (var file in upLoadedFiles) { diff --git a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SshCommandTest.cs b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SshCommandTest.cs index e68fd7cb..c5a26342 100644 --- a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SshCommandTest.cs +++ b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SshCommandTest.cs @@ -54,7 +54,6 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests } [TestMethod] - [Timeout(5000)] public void Test_CancelAsync_Unfinished_Command() { using var client = new SshClient(SshServerHostName, SshServerPort, User.UserName, User.Password); @@ -76,7 +75,6 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests } [TestMethod] - [Timeout(5000)] public async Task Test_CancelAsync_Kill_Unfinished_Command() { using var client = new SshClient(SshServerHostName, SshServerPort, User.UserName, User.Password); @@ -122,7 +120,6 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests } [TestMethod] - [Timeout(5000)] public async Task Test_ExecuteAsync_CancellationToken() { using var client = new SshClient(SshServerHostName, SshServerPort, User.UserName, User.Password); @@ -195,7 +192,6 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests } [TestMethod] - [Timeout(15000)] public async Task Test_ExecuteAsync_Disconnect() { using (var client = new SshClient(SshServerHostName, SshServerPort, User.UserName, User.Password)) @@ -226,7 +222,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests { Assert.Fail("Operation should fail"); } - Assert.IsTrue(cmd.ExitStatus > 0); + Assert.IsGreaterThan(0, cmd.ExitStatus.Value); client.Disconnect(); } @@ -244,7 +240,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests { Assert.Fail("Operation should fail"); } - Assert.IsTrue(cmd.ExitStatus > 0); + Assert.IsGreaterThan(0, cmd.ExitStatus.Value); var result = ExecuteTestCommand(client); diff --git a/test/Renci.SshNet.IntegrationTests/Properties/AssemblyInfo.cs b/test/Renci.SshNet.IntegrationTests/Properties/AssemblyInfo.cs index 886e5999..9a9f8c45 100644 --- a/test/Renci.SshNet.IntegrationTests/Properties/AssemblyInfo.cs +++ b/test/Renci.SshNet.IntegrationTests/Properties/AssemblyInfo.cs @@ -3,3 +3,5 @@ using System.Diagnostics.CodeAnalysis; [assembly: ExcludeFromCodeCoverage] #endif // NET + +[assembly: DoNotParallelize] diff --git a/test/Renci.SshNet.IntegrationTests/ScpTests.cs b/test/Renci.SshNet.IntegrationTests/ScpTests.cs index 8433bf70..2df8eef4 100644 --- a/test/Renci.SshNet.IntegrationTests/ScpTests.cs +++ b/test/Renci.SshNet.IntegrationTests/ScpTests.cs @@ -20,7 +20,7 @@ namespace Renci.SshNet.IntegrationTests } [TestMethod] - [DynamicData(nameof(GetScpDownloadStreamDirectoryDoesNotExistData), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetScpDownloadStreamDirectoryDoesNotExistData))] public void Scp_Download_Stream_DirectoryDoesNotExist(IRemotePathTransformation remotePathTransformation, string remotePath, string remoteFile) @@ -94,7 +94,7 @@ namespace Renci.SshNet.IntegrationTests } [TestMethod] - [DynamicData(nameof(GetScpDownloadStreamFileDoesNotExistData), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetScpDownloadStreamFileDoesNotExistData))] public void Scp_Download_Stream_FileDoesNotExist(IRemotePathTransformation remotePathTransformation, string remotePath, string remoteFile) @@ -170,7 +170,7 @@ namespace Renci.SshNet.IntegrationTests } [TestMethod] - [DynamicData(nameof(GetScpDownloadDirectoryInfoDirectoryDoesNotExistData), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetScpDownloadDirectoryInfoDirectoryDoesNotExistData))] public void Scp_Download_DirectoryInfo_DirectoryDoesNotExist(IRemotePathTransformation remotePathTransformation, string remotePath) { @@ -228,7 +228,7 @@ namespace Renci.SshNet.IntegrationTests } [TestMethod] - [DynamicData(nameof(GetScpDownloadDirectoryInfoExistingFileData), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetScpDownloadDirectoryInfoExistingFileData))] public void Scp_Download_DirectoryInfo_ExistingFile(IRemotePathTransformation remotePathTransformation, string remotePath) { @@ -291,7 +291,7 @@ namespace Renci.SshNet.IntegrationTests } [TestMethod] - [DynamicData(nameof(GetScpDownloadDirectoryInfoExistingDirectoryData), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetScpDownloadDirectoryInfoExistingDirectoryData))] public void Scp_Download_DirectoryInfo_ExistingDirectory(IRemotePathTransformation remotePathTransformation, string remotePath) { @@ -380,19 +380,19 @@ namespace Renci.SshNet.IntegrationTests } var localFiles = Directory.GetFiles(localDirectory); - Assert.AreEqual(2, localFiles.Length); + Assert.HasCount(2, localFiles); Assert.IsTrue(localFiles.Contains(localPathFile1)); Assert.IsTrue(localFiles.Contains(localPathFile2)); var localSubDirecties = Directory.GetDirectories(localDirectory); - Assert.AreEqual(1, localSubDirecties.Length); + Assert.HasCount(1, localSubDirecties); Assert.AreEqual(localPathSubDirectory, localSubDirecties[0]); var localFilesSubDirectory = Directory.GetFiles(localPathSubDirectory); - Assert.AreEqual(1, localFilesSubDirectory.Length); + Assert.HasCount(1, localFilesSubDirectory); Assert.AreEqual(localPathFile3, localFilesSubDirectory[0]); - Assert.AreEqual(0, Directory.GetDirectories(localPathSubDirectory).Length); + Assert.IsEmpty(Directory.GetDirectories(localPathSubDirectory)); } finally { @@ -434,7 +434,7 @@ namespace Renci.SshNet.IntegrationTests } [TestMethod] - [DynamicData(nameof(GetScpDownloadFileInfoDirectoryDoesNotExistData), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetScpDownloadFileInfoDirectoryDoesNotExistData))] public void Scp_Download_FileInfo_DirectoryDoesNotExist(IRemotePathTransformation remotePathTransformation, string remotePath, string remoteFile) @@ -506,7 +506,7 @@ namespace Renci.SshNet.IntegrationTests } [TestMethod] - [DynamicData(nameof(GetScpDownloadFileInfoFileDoesNotExistData), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetScpDownloadFileInfoFileDoesNotExistData))] public void Scp_Download_FileInfo_FileDoesNotExist(IRemotePathTransformation remotePathTransformation, string remotePath, string remoteFile) @@ -580,7 +580,7 @@ namespace Renci.SshNet.IntegrationTests } [TestMethod] - [DynamicData(nameof(GetScpDownloadFileInfoExistingDirectoryData), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetScpDownloadFileInfoExistingDirectoryData))] public void Scp_Download_FileInfo_ExistingDirectory(IRemotePathTransformation remotePathTransformation, string remotePath) { @@ -649,7 +649,7 @@ namespace Renci.SshNet.IntegrationTests } [TestMethod] - [DynamicData(nameof(GetScpDownloadFileInfoExistingFileData), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetScpDownloadFileInfoExistingFileData))] public void Scp_Download_FileInfo_ExistingFile(IRemotePathTransformation remotePathTransformation, string remotePath, string remoteFile, @@ -741,7 +741,7 @@ namespace Renci.SshNet.IntegrationTests } [TestMethod] - [DynamicData(nameof(GetScpDownloadStreamExistingDirectoryData), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetScpDownloadStreamExistingDirectoryData))] public void Scp_Download_Stream_ExistingDirectory(IRemotePathTransformation remotePathTransformation, string remotePath) { @@ -809,7 +809,7 @@ namespace Renci.SshNet.IntegrationTests } [TestMethod] - [DynamicData(nameof(GetScpDownloadStreamExistingFileData), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetScpDownloadStreamExistingFileData))] public void Scp_Download_Stream_ExistingFile(IRemotePathTransformation remotePathTransformation, string remotePath, string remoteFile, @@ -896,7 +896,7 @@ namespace Renci.SshNet.IntegrationTests } [TestMethod] - [DynamicData(nameof(GetScpUploadFileStreamDirectoryDoesNotExistData), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetScpUploadFileStreamDirectoryDoesNotExistData))] public void Scp_Upload_FileStream_DirectoryDoesNotExist(IRemotePathTransformation remotePathTransformation, string remotePath, string remoteFile) @@ -966,7 +966,7 @@ namespace Renci.SshNet.IntegrationTests } [TestMethod] - [DynamicData(nameof(GetScpUploadFileStreamExistingDirectoryData), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetScpUploadFileStreamExistingDirectoryData))] public void Scp_Upload_FileStream_ExistingDirectory(IRemotePathTransformation remotePathTransformation, string remoteFile) { @@ -1029,7 +1029,7 @@ namespace Renci.SshNet.IntegrationTests } [TestMethod] - [DynamicData(nameof(ScpUploadFileStreamExistingFileData), DynamicDataSourceType.Method)] + [DynamicData(nameof(ScpUploadFileStreamExistingFileData))] public void Scp_Upload_FileStream_ExistingFile(IRemotePathTransformation remotePathTransformation, string remoteFile) { @@ -1098,7 +1098,7 @@ namespace Renci.SshNet.IntegrationTests } [TestMethod] - [DynamicData(nameof(GetScpUploadFileStreamFileDoesNotExistData), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetScpUploadFileStreamFileDoesNotExistData))] public void Scp_Upload_FileStream_FileDoesNotExist(IRemotePathTransformation remotePathTransformation, string remotePath, string remoteFile, @@ -1197,7 +1197,7 @@ namespace Renci.SshNet.IntegrationTests /// https://github.com/sshnet/SSH.NET/issues/289 /// [TestMethod] - [DynamicData(nameof(GetScpUploadFileInfoDirectoryDoesNotExistData), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetScpUploadFileInfoDirectoryDoesNotExistData))] public void Scp_Upload_FileInfo_DirectoryDoesNotExist(IRemotePathTransformation remotePathTransformation, string remotePath, string remoteFile) @@ -1277,7 +1277,7 @@ namespace Renci.SshNet.IntegrationTests /// https://github.com/sshnet/SSH.NET/issues/286 /// [TestMethod] - [DynamicData(nameof(GetScpUploadFileInfoExistingDirectoryData), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetScpUploadFileInfoExistingDirectoryData))] public void Scp_Upload_FileInfo_ExistingDirectory(IRemotePathTransformation remotePathTransformation, string remoteFile) { @@ -1339,7 +1339,7 @@ namespace Renci.SshNet.IntegrationTests } [TestMethod] - [DynamicData(nameof(GetScpUploadFileInfoExistingFileData), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetScpUploadFileInfoExistingFileData))] public void Scp_Upload_FileInfo_ExistingFile(IRemotePathTransformation remotePathTransformation, string remoteFile) { @@ -1417,7 +1417,7 @@ namespace Renci.SshNet.IntegrationTests } [TestMethod] - [DynamicData(nameof(GetScpUploadFileInfoFileDoesNotExistData), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetScpUploadFileInfoFileDoesNotExistData))] public void Scp_Upload_FileInfo_FileDoesNotExist(IRemotePathTransformation remotePathTransformation, string remotePath, string remoteFile, @@ -1522,7 +1522,7 @@ namespace Renci.SshNet.IntegrationTests } [TestMethod] - [DynamicData(nameof(GetScpUploadDirectoryInfoDirectoryDoesNotExistData), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetScpUploadDirectoryInfoDirectoryDoesNotExistData))] public void Scp_Upload_DirectoryInfo_DirectoryDoesNotExist(IRemotePathTransformation remotePathTransformation, string remoteDirectory) { @@ -1587,7 +1587,7 @@ namespace Renci.SshNet.IntegrationTests } [TestMethod] - [DynamicData(nameof(GetScpUploadDirectoryInfoExistingDirectoryData), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetScpUploadDirectoryInfoExistingDirectoryData))] public void Scp_Upload_DirectoryInfo_ExistingDirectory(IRemotePathTransformation remotePathTransformation, string remoteDirectory) { @@ -1791,7 +1791,7 @@ namespace Renci.SshNet.IntegrationTests } [TestMethod] - [DynamicData(nameof(GetScpUploadDirectoryInfoExistingFileData), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetScpUploadDirectoryInfoExistingFileData))] public void Scp_Upload_DirectoryInfo_ExistingFile(IRemotePathTransformation remotePathTransformation, string remoteDirectory) { diff --git a/test/Renci.SshNet.IntegrationTests/SftpTests.cs b/test/Renci.SshNet.IntegrationTests/SftpTests.cs index bc404d43..3e43890c 100644 --- a/test/Renci.SshNet.IntegrationTests/SftpTests.cs +++ b/test/Renci.SshNet.IntegrationTests/SftpTests.cs @@ -26,7 +26,7 @@ namespace Renci.SshNet.IntegrationTests } [TestMethod] - [DynamicData(nameof(GetSftpUploadFileFileStreamData), DynamicDataSourceType.Method)] + [DynamicData(nameof(GetSftpUploadFileFileStreamData))] public void Sftp_UploadFile_FileStream(int size) { var file = CreateTempFile(size); @@ -3669,7 +3669,7 @@ namespace Renci.SshNet.IntegrationTests client.ChangeDirectory(remoteDirectory); var directoryContent = client.ListDirectory(".").OrderBy(p => p.Name).ToList(); - Assert.AreEqual(5, directoryContent.Count); + Assert.HasCount(5, directoryContent); Assert.AreEqual(".", directoryContent[0].Name); Assert.AreEqual($"{remoteDirectory}/.", directoryContent[0].FullName); diff --git a/test/Renci.SshNet.IntegrationTests/SshTests.cs b/test/Renci.SshNet.IntegrationTests/SshTests.cs index ee9f5d90..ddf04851 100644 --- a/test/Renci.SshNet.IntegrationTests/SshTests.cs +++ b/test/Renci.SshNet.IntegrationTests/SshTests.cs @@ -74,7 +74,7 @@ namespace Renci.SshNet.IntegrationTests var line = shellStream.ReadLine(); Assert.IsNotNull(line); - Assert.IsTrue(line.EndsWith("Hello!"), line); + Assert.EndsWith("Hello!", line); Assert.IsTrue(shellStream.ReadLine() is null || shellStream.ReadLine() is null); // we might first get e.g. "renci-ssh-tests-server:~$" } @@ -94,7 +94,7 @@ namespace Renci.SshNet.IntegrationTests shellStream.WriteLine($"echo {foo}"); var line = shellStream.ReadLine(TimeSpan.FromSeconds(1)); Assert.IsNotNull(line); - Assert.IsTrue(line.EndsWith(foo), line); + Assert.EndsWith(foo, line); } } } @@ -221,7 +221,7 @@ namespace Renci.SshNet.IntegrationTests var outputString = outputReader.ReadLine(); Assert.IsNotNull(outputString); - Assert.IsTrue(outputString.EndsWith(foo), outputString); + Assert.EndsWith(foo, outputString); shell.Stop(); } @@ -341,7 +341,7 @@ namespace Renci.SshNet.IntegrationTests lines.Add(line); } - Assert.AreEqual(6, lines.Count, string.Join("\n", lines)); + Assert.HasCount(6, lines, string.Join("\n", lines)); Assert.AreEqual(expectedResult, string.Join("\n", lines)); } @@ -383,7 +383,7 @@ namespace Renci.SshNet.IntegrationTests socksSocket.Send(httpGetRequest); var httpResponse = GetHttpResponse(socksSocket, Encoding.ASCII); - Assert.IsTrue(httpResponse.Contains(searchText), httpResponse); + Assert.Contains(searchText, httpResponse); } Assert.IsTrue(socksSocket.Connected); @@ -427,7 +427,7 @@ namespace Renci.SshNet.IntegrationTests socksSocket.Send(httpGetRequest); var httpResponse = GetHttpResponse(socksSocket, Encoding.ASCII); - Assert.IsTrue(httpResponse.Contains(searchText), httpResponse); + Assert.Contains(searchText, httpResponse); // Verify if port is still open socksSocket.Send(httpGetRequest); @@ -447,7 +447,7 @@ namespace Renci.SshNet.IntegrationTests socksSocket.Send(httpGetRequest); httpResponse = GetHttpResponse(socksSocket, Encoding.ASCII); - Assert.IsTrue(httpResponse.Contains(searchText), httpResponse); + Assert.Contains(searchText, httpResponse); forwardedPort.Dispose(); @@ -496,7 +496,7 @@ namespace Renci.SshNet.IntegrationTests socksSocket.Send(httpGetRequest); var httpResponse = GetHttpResponse(socksSocket, Encoding.ASCII); - Assert.IsTrue(httpResponse.Contains(searchText), httpResponse); + Assert.Contains(searchText, httpResponse); forwardedPort.Dispose(); diff --git a/test/Renci.SshNet.IntegrationTests/SshTests_TTYDisabled.cs b/test/Renci.SshNet.IntegrationTests/SshTests_TTYDisabled.cs index 6150e128..37039ec5 100644 --- a/test/Renci.SshNet.IntegrationTests/SshTests_TTYDisabled.cs +++ b/test/Renci.SshNet.IntegrationTests/SshTests_TTYDisabled.cs @@ -62,7 +62,7 @@ namespace Renci.SshNet.IntegrationTests shellStream.WriteLine($"echo {foo}"); var line = shellStream.ReadLine(TimeSpan.FromSeconds(1)); Assert.IsNotNull(line); - Assert.IsTrue(line.EndsWith(foo), line); + Assert.EndsWith(foo, line); } } } @@ -122,7 +122,7 @@ namespace Renci.SshNet.IntegrationTests var outputString = outputReader.ReadLine(); Assert.IsNotNull(outputString); - Assert.IsTrue(outputString.EndsWith(foo), outputString); + Assert.EndsWith(foo, outputString); shell.Stop(); } diff --git a/test/Renci.SshNet.IntegrationTests/TestsFixtures/InfrastructureFixture.cs b/test/Renci.SshNet.IntegrationTests/TestsFixtures/InfrastructureFixture.cs index 304f294a..b16938eb 100644 --- a/test/Renci.SshNet.IntegrationTests/TestsFixtures/InfrastructureFixture.cs +++ b/test/Renci.SshNet.IntegrationTests/TestsFixtures/InfrastructureFixture.cs @@ -6,6 +6,8 @@ using DotNet.Testcontainers.Images; using Microsoft.Extensions.Logging; +using Renci.SshNet.IntegrationTests.Logging; + namespace Renci.SshNet.IntegrationTests.TestsFixtures { public sealed class InfrastructureFixture : IDisposable @@ -16,7 +18,7 @@ namespace Renci.SshNet.IntegrationTests.TestsFixtures { builder.SetMinimumLevel(LogLevel.Debug); builder.AddFilter("testcontainers", LogLevel.Information); - builder.AddConsole(); + builder.AddTestConsoleLogger(); }); SshNetLoggingConfiguration.InitializeLogging(_loggerFactory); diff --git a/test/Renci.SshNet.Tests/Classes/AbstractionsTest.cs b/test/Renci.SshNet.Tests/Classes/AbstractionsTest.cs index c37b3dcf..2fd7d942 100644 --- a/test/Renci.SshNet.Tests/Classes/AbstractionsTest.cs +++ b/test/Renci.SshNet.Tests/Classes/AbstractionsTest.cs @@ -11,7 +11,7 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void CryptoAbstraction_GenerateRandom_ShouldPerformNoOpWhenDataIsZeroLength() { - Assert.AreEqual(0, CryptoAbstraction.GenerateRandom(0).Length); + Assert.IsEmpty(CryptoAbstraction.GenerateRandom(0)); } [TestMethod] @@ -22,8 +22,8 @@ namespace Renci.SshNet.Tests.Classes 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 8617aba3..c00654dc 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ChannelShouldShutdownSocketToRemoteListener() { - Assert.AreEqual(1, _connectedRegister.Count); - Assert.AreEqual(1, _disconnectedRegister.Count); + Assert.HasCount(1, _connectedRegister); + Assert.HasCount(1, _disconnectedRegister); Assert.AreSame(_connectedRegister[0], _disconnectedRegister[0]); } 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 42ef9874..d2d14eee 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } [TestMethod] public void ClosedEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelClosedRegister.Count); + Assert.HasCount(1, _channelClosedRegister); Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber); } 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 da7438b9..135c2f81 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count, _channelExceptionRegister.AsString()); + Assert.IsEmpty(_channelExceptionRegister, _channelExceptionRegister.AsString()); } [TestMethod] public void ClosedEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelClosedRegister.Count); + Assert.HasCount(1, _channelClosedRegister); Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber); } 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 80fc2e03..a13ce473 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } [TestMethod] public void ClosedEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelClosedRegister.Count); + Assert.HasCount(1, _channelClosedRegister); Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber); } 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 1684b364..f58bc4db 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count, _channelExceptionRegister.AsString()); + Assert.IsEmpty(_channelExceptionRegister, _channelExceptionRegister.AsString()); } [TestMethod] public void ClosedEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelClosedRegister.Count); + Assert.HasCount(1, _channelClosedRegister); Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber); } 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 3fbba4e9..75882814 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } [TestMethod] public void ClosedEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelClosedRegister.Count); + Assert.HasCount(1, _channelClosedRegister); Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber); } 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 075b02a5..24a8798e 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count, _channelExceptionRegister.AsString()); + Assert.IsEmpty(_channelExceptionRegister, _channelExceptionRegister.AsString()); } [TestMethod] public void ClosedEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelClosedRegister.Count); + Assert.HasCount(1, _channelClosedRegister); Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber); } 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 44e66170..4ac84465 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } [TestMethod] public void ClosedEventShouldNeverHaveFired() { - Assert.AreEqual(0, _channelClosedRegister.Count); + Assert.IsEmpty(_channelClosedRegister); } [TestMethod] 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 3d6a4407..7c35fe49 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } [TestMethod] public void ClosedEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelClosedRegister.Count); + Assert.HasCount(1, _channelClosedRegister); Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber); } 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 0824ace2..4c5f5f32 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } [TestMethod] public void ClosedEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelClosedRegister.Count); + Assert.HasCount(1, _channelClosedRegister); Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber); } 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 d7a14aa2..0f1ba318 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } [TestMethod] public void ClosedEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelClosedRegister.Count); + Assert.HasCount(1, _channelClosedRegister); Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber); } 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 3c3b30bb..984cde46 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } [TestMethod] public void ClosedEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelClosedRegister.Count); + Assert.HasCount(1, _channelClosedRegister); Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber); } 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 b584fa2d..f76a4e88 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } [TestMethod] public void ClosedEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelClosedRegister.Count); + Assert.HasCount(1, _channelClosedRegister); Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber); } 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 23a619c5..f9a565ca 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } [TestMethod] public void ClosedEventShouldNotHaveFired() { - Assert.AreEqual(0, _channelClosedRegister.Count); + Assert.IsEmpty(_channelClosedRegister); } [TestMethod] 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 22bb7dda..7cdf6c9f 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count, _channelExceptionRegister.AsString()); + Assert.IsEmpty(_channelExceptionRegister, _channelExceptionRegister.AsString()); } [TestMethod] public void ClosedEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelClosedRegister.Count); + Assert.HasCount(1, _channelClosedRegister); Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber); } 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 43a19936..ab387ab5 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } [TestMethod] public void ClosedEventShouldNeverHaveFired() { - Assert.AreEqual(0, _channelClosedRegister.Count); + Assert.IsEmpty(_channelClosedRegister); } [TestMethod] 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 5ff15cec..e9e2f719 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } [TestMethod] public void ClosedEventShouldNeverHaveFired() { - Assert.AreEqual(0, _channelClosedRegister.Count); + Assert.IsEmpty(_channelClosedRegister); } [TestMethod] 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 78ffa1ec..0a80ce42 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } [TestMethod] public void ClosedEventShouldNeverHaveFired() { - Assert.AreEqual(0, _channelClosedRegister.Count); + Assert.IsEmpty(_channelClosedRegister); } [TestMethod] 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 a6fa8418..ac6b2357 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ClosedEventShouldNeverHaveFired() { - Assert.AreEqual(0, _channelClosedRegister.Count); + Assert.IsEmpty(_channelClosedRegister); } [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } } } 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 db844003..e3aabec9 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void WaitOnHandleOnSessionShouldWaitForChannelCloseMessageToBeReceived() { - Assert.IsTrue(_closeTimer.ElapsedMilliseconds >= 100, "Elapsed milliseconds=" + _closeTimer.ElapsedMilliseconds); + Assert.IsGreaterThanOrEqualTo(100, _closeTimer.ElapsedMilliseconds, "Elapsed milliseconds=" + _closeTimer.ElapsedMilliseconds); } [TestMethod] public void ClosedEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelClosedRegister.Count); + Assert.HasCount(1, _channelClosedRegister); Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber); } @@ -152,7 +152,7 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } } } 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 f6eb2933..f21f593a 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void WaitOnHandleOnSessionShouldWaitForChannelCloseMessageToBeReceived() { - Assert.IsTrue(_closeTimer.ElapsedMilliseconds >= 100, "Elapsed milliseconds=" + _closeTimer.ElapsedMilliseconds); + Assert.IsGreaterThanOrEqualTo(100, _closeTimer.ElapsedMilliseconds, "Elapsed milliseconds=" + _closeTimer.ElapsedMilliseconds); } [TestMethod] public void ClosedEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelClosedRegister.Count); + Assert.HasCount(1, _channelClosedRegister); Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber); } @@ -158,7 +158,7 @@ namespace Renci.SshNet.Tests.Classes.Channels [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 4f11009b..151c98ec 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ClosedEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelClosedRegister.Count); + Assert.HasCount(1, _channelClosedRegister); Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber); } [TestMethod] public void EndOfDataEventShouldNotHaveFired() { - Assert.AreEqual(1, _channelEndOfDataRegister.Count); + Assert.HasCount(1, _channelEndOfDataRegister); Assert.AreEqual(_localChannelNumber, _channelEndOfDataRegister[0].ChannelNumber); } [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } [TestMethod] 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 a9ea7782..1d4cb09c 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ClosedEventShouldNotHaveFired() { - Assert.AreEqual(0, _channelClosedRegister.Count); + Assert.IsEmpty(_channelClosedRegister); } [TestMethod] public void EndOfDataEventShouldNotHaveFired() { - Assert.AreEqual(1, _channelEndOfDataRegister.Count); + Assert.HasCount(1, _channelEndOfDataRegister); Assert.AreEqual(_localChannelNumber, _channelEndOfDataRegister[0].ChannelNumber); } [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } } } 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 cc3f8547..6b1777c6 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ClosedEventShouldNotHaveFired() { - Assert.AreEqual(0, _channelClosedRegister.Count); + Assert.IsEmpty(_channelClosedRegister); } [TestMethod] public void EndOfDataEventShouldNotHaveFired() { - Assert.AreEqual(1, _channelEndOfDataRegister.Count); + Assert.HasCount(1, _channelEndOfDataRegister); Assert.AreEqual(_localChannelNumber, _channelEndOfDataRegister[0].ChannelNumber); } [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } } } 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 2cd62244..0fe89eb1 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ClosedEventShouldNeverHaveFired() { - Assert.AreEqual(0, _channelClosedRegister.Count); + Assert.IsEmpty(_channelClosedRegister); } [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } } } 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 f0553cce..39419763 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ClosedEventShouldNeverHaveFired() { - Assert.AreEqual(0, _channelClosedRegister.Count); + Assert.IsEmpty(_channelClosedRegister); } [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } } } 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 964ae98b..541ff3fe 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelExceptionRegister.Count); + Assert.HasCount(1, _channelExceptionRegister); Assert.AreSame(_onCloseException, _channelExceptionRegister[0].Exception); } [TestMethod] public void OnErrorOccurredShouldBeInvokedOnce() { - Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count); + Assert.HasCount(1, _channel.OnErrorOccurredInvocations); Assert.AreSame(_onCloseException, _channel.OnErrorOccurredInvocations[0]); } } 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 27a1929e..4deda5ad 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ClosedEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelClosedRegister.Count); + Assert.HasCount(1, _channelClosedRegister); Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber); } [TestMethod] public void EndOfDataEventShouldNeverHaveFired() { - Assert.AreEqual(0, _channelEndOfDataRegister.Count); + Assert.IsEmpty(_channelEndOfDataRegister); } [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } [TestMethod] 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 c9227791..9e318f10 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ClosedEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelClosedRegister.Count); + Assert.HasCount(1, _channelClosedRegister); Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber); } [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count, _channelExceptionRegister.AsString()); + Assert.IsEmpty(_channelExceptionRegister, _channelExceptionRegister.AsString()); } [TestMethod] 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 101c169d..81acb43e 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ClosedEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelClosedRegister.Count); + Assert.HasCount(1, _channelClosedRegister); Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber); } [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count, _channelExceptionRegister.AsString()); + Assert.IsEmpty(_channelExceptionRegister, _channelExceptionRegister.AsString()); } [TestMethod] 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 6ad785d8..7d37e79d 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelExceptionRegister.Count); + Assert.HasCount(1, _channelExceptionRegister); Assert.AreSame(_onDataException, _channelExceptionRegister[0].Exception); } [TestMethod] public void OnErrorOccurredShouldBeInvokedOnce() { - Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count); + Assert.HasCount(1, _channel.OnErrorOccurredInvocations); Assert.AreSame(_onDataException, _channel.OnErrorOccurredInvocations[0]); } } 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 c4f7f433..ee72ec77 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelExceptionRegister.Count); + Assert.HasCount(1, _channelExceptionRegister); Assert.AreSame(_onEofException, _channelExceptionRegister[0].Exception); } [TestMethod] public void OnErrorOccurredShouldBeInvokedOnce() { - Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count); + Assert.HasCount(1, _channel.OnErrorOccurredInvocations); Assert.AreSame(_onEofException, _channel.OnErrorOccurredInvocations[0]); } } 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 84892795..07a670a4 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelExceptionRegister.Count); + Assert.HasCount(1, _channelExceptionRegister); Assert.AreSame(_onExtendedDataException, _channelExceptionRegister[0].Exception); } [TestMethod] public void OnErrorOccurredShouldBeInvokedOnce() { - Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count); + Assert.HasCount(1, _channel.OnErrorOccurredInvocations); Assert.AreSame(_onExtendedDataException, _channel.OnErrorOccurredInvocations[0]); } } 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 b0b3d813..f1b856ac 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelExceptionRegister.Count); + Assert.HasCount(1, _channelExceptionRegister); Assert.AreSame(_onFailureException, _channelExceptionRegister[0].Exception); } [TestMethod] public void OnErrorOccurredShouldBeInvokedOnce() { - Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count); + Assert.HasCount(1, _channel.OnErrorOccurredInvocations); Assert.AreSame(_onFailureException, _channel.OnErrorOccurredInvocations[0]); } } 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 fa02dc49..a861e33c 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [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 860fc684..f5a505f4 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelExceptionRegister.Count); + Assert.HasCount(1, _channelExceptionRegister); Assert.AreSame(_onRequestException, _channelExceptionRegister[0].Exception); } [TestMethod] public void OnErrorOccurredShouldBeInvokedOnce() { - Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count); + Assert.HasCount(1, _channel.OnErrorOccurredInvocations); Assert.AreSame(_onRequestException, _channel.OnErrorOccurredInvocations[0]); } } 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 a1275306..1162d394 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelExceptionRegister.Count); + Assert.HasCount(1, _channelExceptionRegister); Assert.AreSame(_onSuccessException, _channelExceptionRegister[0].Exception); } [TestMethod] public void OnErrorOccurredShouldBeInvokedOnce() { - Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count); + Assert.HasCount(1, _channel.OnErrorOccurredInvocations); Assert.AreSame(_onSuccessException, _channel.OnErrorOccurredInvocations[0]); } } 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 5f0686ef..486be139 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelExceptionRegister.Count); + Assert.HasCount(1, _channelExceptionRegister); Assert.AreSame(_onWindowAdjustException, _channelExceptionRegister[0].Exception); } [TestMethod] public void OnErrorOccurredShouldBeInvokedOnce() { - Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count); + Assert.HasCount(1, _channel.OnErrorOccurredInvocations); Assert.AreSame(_onWindowAdjustException, _channel.OnErrorOccurredInvocations[0]); } } 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 6900ac72..08b6c127 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelExceptionRegister.Count); + Assert.HasCount(1, _channelExceptionRegister); Assert.AreSame(_onDisconnectedException, _channelExceptionRegister[0].Exception); } [TestMethod] public void OnErrorOccurredShouldBeInvokedOnce() { - Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count); + Assert.HasCount(1, _channel.OnErrorOccurredInvocations); Assert.AreSame(_onDisconnectedException, _channel.OnErrorOccurredInvocations[0]); } } 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 d7f04dab..c9174f53 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ClosedEventShouldNeverHaveFired() { - Assert.AreEqual(0, _channelClosedRegister.Count); + Assert.IsEmpty(_channelClosedRegister); } [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } } } 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 eabb0eab..40202e80 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelExceptionRegister.Count); + Assert.HasCount(1, _channelExceptionRegister); Assert.AreSame(_onErrorOccurredException, _channelExceptionRegister[0].Exception); } [TestMethod] public void OnErrorOccurredShouldBeInvokedOnce() { - Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count); + Assert.HasCount(1, _channel.OnErrorOccurredInvocations); Assert.AreSame(_errorOccurredException, _channel.OnErrorOccurredInvocations[0]); } } 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 4a922ad3..31303cf9 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ClosedEventShouldNeverHaveFired() { - Assert.AreEqual(0, _channelClosedRegister.Count); + Assert.IsEmpty(_channelClosedRegister); } [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } } } 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 fe809225..317ea04b 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ClosedEventShouldNeverHaveFired() { - Assert.AreEqual(0, _channelClosedRegister.Count); + Assert.IsEmpty(_channelClosedRegister); } [TestMethod] public void ExceptionShouldNeverHaveFired() { - Assert.AreEqual(0, _channelExceptionRegister.Count); + Assert.IsEmpty(_channelExceptionRegister); } } } 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 123cf9a9..e9ad92ab 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelExceptionRegister.Count); + Assert.HasCount(1, _channelExceptionRegister); Assert.AreSame(_onOpenConfirmationException, _channelExceptionRegister[0].Exception); } [TestMethod] public void OnErrorOccurredShouldBeInvokedOnce() { - Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count); + Assert.HasCount(1, _channel.OnErrorOccurredInvocations); Assert.AreSame(_onOpenConfirmationException, _channel.OnErrorOccurredInvocations[0]); } } 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 20082a6a..a2319987 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 @@ namespace Renci.SshNet.Tests.Classes.Channels [TestMethod] public void ExceptionEventShouldHaveFiredOnce() { - Assert.AreEqual(1, _channelExceptionRegister.Count); + Assert.HasCount(1, _channelExceptionRegister); Assert.AreSame(_onOpenFailureException, _channelExceptionRegister[0].Exception); } [TestMethod] public void OnErrorOccurredShouldBeInvokedOnce() { - Assert.AreEqual(1, _channel.OnErrorOccurredInvocations.Count); + Assert.HasCount(1, _channel.OnErrorOccurredInvocations); Assert.AreSame(_onOpenFailureException, _channel.OnErrorOccurredInvocations[0]); } } diff --git a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Concat.cs b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Concat.cs index bbae3afa..2581826b 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 @@ namespace Renci.SshNet.Tests.Classes.Common var actual = Extensions.Concat(first, second); Assert.IsNotNull(actual); - Assert.AreEqual(first.Length + second.Length, actual.Length); + Assert.HasCount(first.Length + second.Length, actual); Assert.AreEqual(first[0], actual[0]); Assert.AreEqual(first[1], actual[1]); Assert.AreEqual(first[2], actual[2]); diff --git a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Pad.cs b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Pad.cs index 3a7bb32f..d14a4e17 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 @@ namespace Renci.SshNet.Tests.Classes.Common byte[] value = { 0x0a, 0x0d }; var padded = value.Pad(2); Assert.AreEqual(value, padded); - Assert.AreEqual(value.Length, padded.Length); + Assert.HasCount(value.Length, padded); } [TestMethod] @@ -21,7 +21,7 @@ namespace Renci.SshNet.Tests.Classes.Common { byte[] value = { 0x0a, 0x0d }; var padded = value.Pad(3); - Assert.AreEqual(value.Length + 1, padded.Length); + Assert.HasCount(value.Length + 1, padded); Assert.AreEqual(0x00, padded[0]); Assert.AreEqual(0x0a, padded[1]); Assert.AreEqual(0x0d, padded[2]); 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 0f30c0ae..5a20af68 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 @@ namespace Renci.SshNet.Tests.Classes.Common var actual = Extensions.Take(value, count); Assert.IsNotNull(actual); - Assert.AreEqual(0, actual.Length); + Assert.IsEmpty(actual); } [TestMethod] @@ -68,7 +68,7 @@ namespace Renci.SshNet.Tests.Classes.Common var actual = Extensions.Take(value, count); Assert.IsNotNull(actual); - Assert.AreEqual(count, actual.Length); + Assert.HasCount(count, actual); Assert.AreEqual(value[0], actual[0]); Assert.AreEqual(value[1], actual[1]); Assert.AreEqual(value[2], actual[2]); 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 f455915d..85978bd2 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 @@ namespace Renci.SshNet.Tests.Classes.Common var actual = Extensions.Take(value, offset, count); Assert.IsNotNull(actual); - Assert.AreEqual(0, actual.Length); + Assert.IsEmpty(actual); } [TestMethod] @@ -60,7 +60,7 @@ namespace Renci.SshNet.Tests.Classes.Common var actual = Extensions.Take(value, offset, count); Assert.IsNotNull(actual); - Assert.AreEqual(value.Length, actual.Length); + Assert.HasCount(value.Length, actual); Assert.AreEqual(value, actual); } @@ -74,7 +74,7 @@ namespace Renci.SshNet.Tests.Classes.Common var actual = Extensions.Take(value, offset, count); Assert.IsNotNull(actual); - Assert.AreEqual(count, actual.Length); + Assert.HasCount(count, actual); Assert.AreEqual(value[0], actual[0]); Assert.AreEqual(value[1], actual[1]); Assert.AreEqual(value[2], actual[2]); @@ -92,7 +92,7 @@ namespace Renci.SshNet.Tests.Classes.Common var actual = Extensions.Take(value, offset, count); Assert.IsNotNull(actual); - Assert.AreEqual(count, actual.Length); + Assert.HasCount(count, actual); Assert.AreEqual(value[3], actual[0]); Assert.AreEqual(value[4], actual[1]); Assert.AreEqual(value[5], actual[2]); diff --git a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_ToBigInteger2.cs b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_ToBigInteger2.cs index d655f3d7..20d40ac5 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 @@ namespace Renci.SshNet.Tests.Classes.Common var actual = value.ToBigInteger2().ToByteArray(isBigEndian: true); Assert.IsNotNull(actual); - Assert.AreEqual(2, actual.Length); + Assert.HasCount(2, actual); Assert.AreEqual(0x0a, actual[0]); Assert.AreEqual(0x0d, actual[1]); } @@ -28,7 +28,7 @@ namespace Renci.SshNet.Tests.Classes.Common var actual = value.ToBigInteger2().ToByteArray(isBigEndian: true); Assert.IsNotNull(actual); - Assert.AreEqual(4, actual.Length); + Assert.HasCount(4, actual); Assert.AreEqual(0x00, actual[0]); Assert.AreEqual(0xff, actual[1]); Assert.AreEqual(0x0a, actual[2]); diff --git a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_TrimLeadingZeros.cs b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_TrimLeadingZeros.cs index dee706b0..d3b537ea 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 @@ namespace Renci.SshNet.Tests.Classes.Common var actual = Extensions.TrimLeadingZeros(value); Assert.IsNotNull(actual); - Assert.AreEqual(2, actual.Length); + Assert.HasCount(2, actual); Assert.AreEqual(0x0a, actual[0]); Assert.AreEqual(0x0d, actual[1]); } @@ -47,7 +47,7 @@ namespace Renci.SshNet.Tests.Classes.Common var actual = Extensions.TrimLeadingZeros(value); Assert.IsNotNull(actual); - Assert.AreEqual(4, actual.Length); + Assert.HasCount(4, actual); Assert.AreEqual(0x0a, actual[0]); Assert.AreEqual(0x00, actual[1]); Assert.AreEqual(0x0d, actual[2]); @@ -62,7 +62,7 @@ namespace Renci.SshNet.Tests.Classes.Common var actual = Extensions.TrimLeadingZeros(value); Assert.IsNotNull(actual); - Assert.AreEqual(3, actual.Length); + Assert.HasCount(3, actual); Assert.AreEqual(0x0a, actual[0]); Assert.AreEqual(0x00, actual[1]); Assert.AreEqual(0x0d, actual[2]); @@ -76,7 +76,7 @@ namespace Renci.SshNet.Tests.Classes.Common var actual = Extensions.TrimLeadingZeros(value); Assert.IsNotNull(actual); - Assert.AreEqual(0, actual.Length); + Assert.IsEmpty(actual); } } } 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 3037134c..81a9ff38 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 @@ namespace Renci.SshNet.Tests.Classes.Connection _connectionInfo.Timeout.TotalMilliseconds); // Compare elapsed time with configured timeout, allowing for a margin of error - Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText); + Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText); } [TestMethod] 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 17d98426..55a8b126 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 @@ namespace Renci.SshNet.Tests.Classes.Connection _connectionInfo.Timeout.TotalMilliseconds); // Compare elapsed time with configured timeout, allowing for a margin of error - Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText); + Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText); } [TestMethod] 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 82623bc3..46a45a35 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 @@ namespace Renci.SshNet.Tests.Classes.Connection _connectionInfo.Timeout.TotalMilliseconds); // Compare elapsed time with configured timeout, allowing for a margin of error - Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText); - Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText); + Assert.IsGreaterThanOrEqualTo(_connectionInfo.Timeout.TotalMilliseconds - 10, _stopWatch.ElapsedMilliseconds, errorText); + Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText); } [TestMethod] 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 fd7d9c72..01270c6d 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 @@ namespace Renci.SshNet.Tests.Classes.Connection _connectionInfo.Timeout.TotalMilliseconds); // Compare elapsed time with configured timeout, allowing for a margin of error - Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText); + Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText); } [TestMethod] 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 0e8b0935..eb466816 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 @@ namespace Renci.SshNet.Tests.Classes.Connection _connectionInfo.Timeout.TotalMilliseconds); // Compare elapsed time with configured timeout, allowing for a margin of error - Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText); - Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText); + Assert.IsGreaterThanOrEqualTo(_connectionInfo.Timeout.TotalMilliseconds - 10, _stopWatch.ElapsedMilliseconds, errorText); + Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText); } [TestMethod] 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 45d9a59e..817cc27a 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 @@ namespace Renci.SshNet.Tests.Classes.Connection _connectionInfo.Timeout.TotalMilliseconds); // Compare elapsed time with configured timeout, allowing for a margin of error - Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText); - Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText); + Assert.IsGreaterThanOrEqualTo(_connectionInfo.Timeout.TotalMilliseconds - 10, _stopWatch.ElapsedMilliseconds, errorText); + Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText); } [TestMethod] 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 4610c521..e325c88f 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 @@ namespace Renci.SshNet.Tests.Classes.Connection _connectionInfo.Timeout.TotalMilliseconds); // Compare elapsed time with configured timeout, allowing for a margin of error - Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText); - Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText); + Assert.IsGreaterThanOrEqualTo(_connectionInfo.Timeout.TotalMilliseconds - 10, _stopWatch.ElapsedMilliseconds, errorText); + Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText); } [TestMethod] 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 43aa9a3b..e9460cd8 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 @@ namespace Renci.SshNet.Tests.Classes.Connection [TestMethod] public void ClientIdentificationWasSentToServer() { - Assert.AreEqual(5, _dataReceivedByServer.Count); + Assert.HasCount(5, _dataReceivedByServer); Assert.AreEqual(0xed, _dataReceivedByServer[0]); Assert.AreEqual(0x95, _dataReceivedByServer[1]); diff --git a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseContainsNullCharacter.cs b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseContainsNullCharacter.cs index 164cb6a7..804fd20d 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 @@ namespace Renci.SshNet.Tests.Classes.Connection { var expected = Encoding.UTF8.GetBytes(_clientVersion); - Assert.AreEqual(expected.Length + 2, _dataReceivedByServer.Count); + Assert.HasCount(expected.Length + 2, _dataReceivedByServer); Assert.IsTrue(expected.SequenceEqual(_dataReceivedByServer.Take(expected.Length))); Assert.AreEqual(Session.CarriageReturn, _dataReceivedByServer[_dataReceivedByServer.Count - 2]); 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 3b064951..25be7f94 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 @@ namespace Renci.SshNet.Tests.Classes.Connection { var expected = Encoding.UTF8.GetBytes(_clientVersion); - Assert.AreEqual(expected.Length + 2, _dataReceivedByServer.Count); + Assert.HasCount(expected.Length + 2, _dataReceivedByServer); Assert.IsTrue(expected.SequenceEqual(_dataReceivedByServer.Take(expected.Length))); Assert.AreEqual(Session.CarriageReturn, _dataReceivedByServer[_dataReceivedByServer.Count - 2]); 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 2af8062b..c00b69d0 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 @@ namespace Renci.SshNet.Tests.Classes.Connection { var expected = Encoding.UTF8.GetBytes(_clientVersion); - Assert.AreEqual(expected.Length + 2, _dataReceivedByServer.Count); + Assert.HasCount(expected.Length + 2, _dataReceivedByServer); Assert.IsTrue(expected.SequenceEqual(_dataReceivedByServer.Take(expected.Length))); Assert.AreEqual(Session.CarriageReturn, _dataReceivedByServer[_dataReceivedByServer.Count - 2]); 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 c7daaf14..1770ecd9 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 @@ namespace Renci.SshNet.Tests.Classes.Connection { var expected = Encoding.UTF8.GetBytes(_clientVersion); - Assert.AreEqual(expected.Length + 2, _dataReceivedByServer.Count); + Assert.HasCount(expected.Length + 2, _dataReceivedByServer); Assert.IsTrue(expected.SequenceEqual(_dataReceivedByServer.Take(expected.Length))); Assert.AreEqual(Session.CarriageReturn, _dataReceivedByServer[_dataReceivedByServer.Count - 2]); 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 36596720..9719a2a0 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 @@ namespace Renci.SshNet.Tests.Classes.Connection { var expected = Encoding.UTF8.GetBytes(_clientVersion); - Assert.AreEqual(expected.Length + 2, _dataReceivedByServer.Count); + Assert.HasCount(expected.Length + 2, _dataReceivedByServer); Assert.IsTrue(expected.SequenceEqual(_dataReceivedByServer.Take(expected.Length))); Assert.AreEqual(Session.CarriageReturn, _dataReceivedByServer[_dataReceivedByServer.Count - 2]); 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 2c35bce5..29873c86 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 @@ namespace Renci.SshNet.Tests.Classes.Connection { var expected = Encoding.UTF8.GetBytes(_clientVersion); - Assert.AreEqual(expected.Length + 2, _dataReceivedByServer.Count); + Assert.HasCount(expected.Length + 2, _dataReceivedByServer); Assert.IsTrue(expected.SequenceEqual(_dataReceivedByServer.Take(expected.Length))); Assert.AreEqual(Session.CarriageReturn, _dataReceivedByServer[_dataReceivedByServer.Count - 2]); diff --git a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_TimeoutReadingIdentificationString.cs b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_TimeoutReadingIdentificationString.cs index 3710e206..91751627 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 @@ namespace Renci.SshNet.Tests.Classes.Connection { var expected = Encoding.UTF8.GetBytes(_clientVersion); - Assert.AreEqual(expected.Length + 2, _dataReceivedByServer.Count); + Assert.HasCount(expected.Length + 2, _dataReceivedByServer); Assert.IsTrue(expected.SequenceEqual(_dataReceivedByServer.Take(expected.Length))); Assert.AreEqual(Session.CarriageReturn, _dataReceivedByServer[_dataReceivedByServer.Count - 2]); 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 96e094a1..541eae14 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 @@ namespace Renci.SshNet.Tests.Classes.Connection _connectionInfo.Timeout.TotalMilliseconds); // Compare elapsed time with configured timeout, allowing for a margin of error - Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText); + Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText); } [TestMethod] 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 639a603c..b0ae1d88 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 @@ namespace Renci.SshNet.Tests.Classes.Connection _connectionInfo.Timeout.TotalMilliseconds); // Compare elapsed time with configured timeout, allowing for a margin of error - Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText); - Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText); + Assert.IsGreaterThanOrEqualTo(_connectionInfo.Timeout.TotalMilliseconds - 10, _stopWatch.ElapsedMilliseconds, errorText); + Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText); } [TestMethod] 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 efcd0252..35fe071a 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 @@ namespace Renci.SshNet.Tests.Classes.Connection _connectionInfo.Timeout.TotalMilliseconds); // Compare elapsed time with configured timeout, allowing for a margin of error - Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText); - Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText); + Assert.IsGreaterThanOrEqualTo(_connectionInfo.Timeout.TotalMilliseconds - 10, _stopWatch.ElapsedMilliseconds, errorText); + Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText); } [TestMethod] 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 92b8843e..e101b903 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 @@ namespace Renci.SshNet.Tests.Classes.Connection _connectionInfo.Timeout.TotalMilliseconds); // Compare elapsed time with configured timeout, allowing for a margin of error - Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText); - Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText); + Assert.IsGreaterThanOrEqualTo(_connectionInfo.Timeout.TotalMilliseconds - 10, _stopWatch.ElapsedMilliseconds, errorText); + Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText); } [TestMethod] 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 fcb5ffb0..d01b1c56 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 @@ namespace Renci.SshNet.Tests.Classes.Connection _connectionInfo.Timeout.TotalMilliseconds); // Compare elapsed time with configured timeout, allowing for a margin of error - Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText); - Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText); + Assert.IsGreaterThanOrEqualTo(_connectionInfo.Timeout.TotalMilliseconds - 10, _stopWatch.ElapsedMilliseconds, errorText); + Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText); } [TestMethod] 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 51d6edda..65cf4e3f 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 @@ namespace Renci.SshNet.Tests.Classes.Connection _connectionInfo.Timeout.TotalMilliseconds); // Compare elapsed time with configured timeout, allowing for a margin of error - Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText); + Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText); } [TestMethod] 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 1bf0f80d..59e5e0bc 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 @@ namespace Renci.SshNet.Tests.Classes.Connection _connectionInfo.Timeout.TotalMilliseconds); // Compare elapsed time with configured timeout, allowing for a margin of error - Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText); - Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText); + Assert.IsGreaterThanOrEqualTo(_connectionInfo.Timeout.TotalMilliseconds - 10, _stopWatch.ElapsedMilliseconds, errorText); + Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText); } [TestMethod] 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 40d07854..a1dfb236 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 @@ namespace Renci.SshNet.Tests.Classes.Connection _connectionInfo.Timeout.TotalMilliseconds); // Compare elapsed time with configured timeout, allowing for a margin of error - Assert.IsTrue(_stopWatch.ElapsedMilliseconds >= _connectionInfo.Timeout.TotalMilliseconds - 10, errorText); - Assert.IsTrue(_stopWatch.ElapsedMilliseconds < _connectionInfo.Timeout.TotalMilliseconds + 100, errorText); + Assert.IsGreaterThanOrEqualTo(_connectionInfo.Timeout.TotalMilliseconds - 10, _stopWatch.ElapsedMilliseconds, errorText); + Assert.IsLessThan(_connectionInfo.Timeout.TotalMilliseconds + 100, _stopWatch.ElapsedMilliseconds, errorText); } [TestMethod] diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortDisposed.cs index d39a91fa..5eed1748 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortNeverStarted.cs index a9ce2b49..7f0c08a1 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } 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 692afe88..d08c8132 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldHaveFiredOnce() { - Assert.AreEqual(1, _closingRegister.Count); + Assert.HasCount(1, _closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count, _exceptionRegister.AsString()); + Assert.IsEmpty(_exceptionRegister, _exceptionRegister.AsString()); } [TestMethod] 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 5804f6db..c59117a0 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldHaveFiredOnce() { - Assert.AreEqual(1, _closingRegister.Count); + Assert.HasCount(1, _closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } [TestMethod] diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStopped.cs index 85ef70f8..9445c0ea 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_SessionErrorOccurred_ChannelBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_SessionErrorOccurred_ChannelBound.cs index c98784ed..fa2aab65 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 @@ namespace Renci.SshNet.Tests.Classes [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 2ceac31e..a51cba11 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortNeverStarted.cs index adc55951..f52bf968 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStarted.cs index d39263b5..69b2cd7e 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStopped.cs index ad71d804..35d293ab 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNotConnected.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNotConnected.cs index ac2211cd..d5d0faf6 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNull.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNull.cs index c326c00d..99556cd6 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketSendShutdownImmediately.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketSendShutdownImmediately.cs index e58bf3d9..0c2e02a8 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 @@ namespace Renci.SshNet.Tests.Classes [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 d28c311b..3ad55347 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 @@ namespace Renci.SshNet.Tests.Classes [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 58b02032..d0fbbb54 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortNeverStarted.cs index 118b075e..8a494851 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } 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 fcfc88a0..aa09011a 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldHaveFiredOnce() { - Assert.AreEqual(1, _closingRegister.Count); + Assert.HasCount(1, _closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } [TestMethod] 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 fa716b6b..3e7ad6ac 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldHaveFiredOnce() { - Assert.AreEqual(1, _closingRegister.Count); + Assert.HasCount(1, _closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } [TestMethod] diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStopped.cs index dbc73880..42727dcc 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortDisposed.cs index 66cc6d57..c4cbdadf 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldHaveFiredOnce() { - Assert.AreEqual(1, _closingRegister.Count); + Assert.HasCount(1, _closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } [TestMethod] 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 fb74e217..4631ca5d 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortNeverStarted.cs index 22a1ae9f..456cddc8 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } 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 6980d366..814f645b 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldHaveFiredOnce() { - Assert.AreEqual(1, _closingRegister.Count); + Assert.HasCount(1, _closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } [TestMethod] 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 0f3b0a57..a541d975 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldHaveFiredOnce() { - Assert.AreEqual(1, _closingRegister.Count); + Assert.HasCount(1, _closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStopped.cs index a9dacf9a..7c6f2acc 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortDisposed.cs index 6d841b9c..5469293c 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortNeverStarted.cs index 9d003ff1..e49d648d 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStarted.cs index 60718f7b..725a9cac 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStopped.cs index c7d13ec3..288b014d 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNotConnected.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNotConnected.cs index 9887f7d5..cd41d71c 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNull.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNull.cs index 06c28845..758467ec 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortDisposed.cs index 2806ec54..de566395 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortNeverStarted.cs index 3b2c4a1d..e344f8e1 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } 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 a6432f38..1deb4667 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldHaveFiredOnce() { - Assert.AreEqual(1, _closingRegister.Count); + Assert.HasCount(1, _closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } [TestMethod] 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 b8e893db..0c5d9cea 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldHaveFiredOnce() { - Assert.AreEqual(1, _closingRegister.Count); + Assert.HasCount(1, _closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStopped.cs index 7ec8bde3..c5a66ef4 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortDisposed.cs index 2cedfbe5..a0e15b2f 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortNeverStarted.cs index 37f526e4..c2fa6657 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } 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 eea751b1..e60398ce 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldHaveFiredOnce() { - Assert.AreEqual(1, _closingRegister.Count); + Assert.HasCount(1, _closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } [TestMethod] diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStopped.cs index ecb1a2ac..5e58d8a2 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldHaveFiredOnce() { - Assert.AreEqual(1, _closingRegister.Count); + Assert.HasCount(1, _closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortDisposed.cs index 8b0b0511..99a5ab8f 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs index ede0df79..a090242a 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 @@ namespace Renci.SshNet.Tests.Classes [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 386da013..e840aba8 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 @@ namespace Renci.SshNet.Tests.Classes [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 b952bad9..399f1c32 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 @@ namespace Renci.SshNet.Tests.Classes [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 681bffb0..7792664a 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNull.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNull.cs index 9cd3a304..0dea954d 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Started.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Started.cs index 5fe0ee30..416db270 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Started.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Started.cs @@ -127,8 +127,8 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes _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 @@ namespace Renci.SshNet.Tests.Classes _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 @@ namespace Renci.SshNet.Tests.Classes _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 796bdda4..09fe0247 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ClosingShouldNotHaveFired() { - Assert.AreEqual(0, _closingRegister.Count); + Assert.IsEmpty(_closingRegister); } [TestMethod] public void ExceptionShouldNotHaveFired() { - Assert.AreEqual(0, _exceptionRegister.Count); + Assert.IsEmpty(_exceptionRegister); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortNeverStarted.cs index a95c54ca..fdb83d22 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 @@ namespace Renci.SshNet.Tests.Classes [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 2f96b11d..05229be1 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 @@ namespace Renci.SshNet.Tests.Classes.Messages.Connection 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 cc6fb086..51f7774b 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 @@ namespace Renci.SshNet.Tests.Classes.Messages.Connection 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 5b20fa3f..a3609d2d 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 @@ namespace Renci.SshNet.Tests.Classes.Messages.Connection 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 @@ namespace Renci.SshNet.Tests.Classes.Messages.Connection 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 @@ namespace Renci.SshNet.Tests.Classes.Messages.Connection 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 3b112b15..33d472e6 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 @@ namespace Renci.SshNet.Tests.Classes.Messages.Transport { var target = new IgnoreMessage(); Assert.IsNotNull(target.Data); - Assert.AreEqual(0, target.Data.Length); + Assert.IsEmpty(target.Data); } [TestMethod] @@ -66,7 +66,7 @@ namespace Renci.SshNet.Tests.Classes.Messages.Transport 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 @@ namespace Renci.SshNet.Tests.Classes.Messages.Transport 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 35e401c6..c63d910e 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 @@ namespace Renci.SshNet.Tests.Classes.Messages.Transport 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 9677d5bc..f17594e8 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: some tests are for specific interface implementations. +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 8a6da1e1..f18cef76 100644 --- a/test/Renci.SshNet.Tests/Classes/PrivateKeyFileTest.cs +++ b/test/Renci.SshNet.Tests/Classes/PrivateKeyFileTest.cs @@ -401,7 +401,7 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes }, 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 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes }, 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 @@ namespace Renci.SshNet.Tests.Classes { 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 89be6801..e85b0b53 100644 --- a/test/Renci.SshNet.Tests/Classes/ScpClientTest.cs +++ b/test/Renci.SshNet.Tests/Classes/ScpClientTest.cs @@ -77,7 +77,7 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes 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 c3aba4b2..7e6f1aeb 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 @@ namespace Renci.SshNet.Tests.Classes [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 0d8815fb..ca638f46 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 @@ namespace Renci.SshNet.Tests.Classes [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 0be4c962..0c8d1d7a 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 @@ namespace Renci.SshNet.Tests.Classes [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 75b1071c..68001f51 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 @@ namespace Renci.SshNet.Tests.Classes [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 9fda3056..8d677f1f 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 @@ namespace Renci.SshNet.Tests.Classes [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 5a562fe3..63610f34 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 @@ namespace Renci.SshNet.Tests.Classes [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 64fd8bc2..2800b88c 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 @@ namespace Renci.SshNet.Tests.Classes [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 fc2bee7a..a18a63b3 100644 --- a/test/Renci.SshNet.Tests/Classes/Security/CertificateHostAlgorithmTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Security/CertificateHostAlgorithmTest.cs @@ -69,7 +69,7 @@ namespace Renci.SshNet.Tests.Classes.Security 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 04bb15e0..b1fc791f 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography { 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography { 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography { 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography { 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography { 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 daffc6bd..8b5da581 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected.cs @@ -45,7 +45,7 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes // give session time to process message Thread.Sleep(100); - Assert.AreEqual(1, ServerBytesReceivedRegister.Count); + Assert.HasCount(1, ServerBytesReceivedRegister); } [TestMethod] @@ -128,16 +128,16 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes // give session time to process message Thread.Sleep(100); - Assert.AreEqual(1, ServerBytesReceivedRegister.Count); + Assert.HasCount(1, ServerBytesReceivedRegister); } [TestMethod] @@ -235,7 +235,7 @@ namespace Renci.SshNet.Tests.Classes 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 a09999b3..522c0871 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 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes 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 5710a998..22e07d8e 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 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes 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 64ea76d7..8996ecda 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 @@ namespace Renci.SshNet.Tests.Classes [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 61f1b494..e1ba37c3 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 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes 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 1ae6737d..b4606b37 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 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ErrorOccurredIsNeverRaised() { - Assert.AreEqual(0, ErrorOccurredRegister.Count, ErrorOccurredRegister.AsString()); + Assert.IsEmpty(ErrorOccurredRegister, ErrorOccurredRegister.AsString()); } [TestMethod] @@ -84,7 +84,7 @@ namespace Renci.SshNet.Tests.Classes 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 220c1bbe..9c00119b 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 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ErrorOccurredIsNeverRaised() { - Assert.AreEqual(0, ErrorOccurredRegister.Count, ErrorOccurredRegister.AsString()); + Assert.IsEmpty(ErrorOccurredRegister, ErrorOccurredRegister.AsString()); } [TestMethod] @@ -88,7 +88,7 @@ namespace Renci.SshNet.Tests.Classes 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 b92d0acb..aca85662 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 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes Session.Dispose(); stopwatch.Stop(); - Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500); + Assert.IsLessThan(500, stopwatch.ElapsedMilliseconds); } [TestMethod] @@ -123,7 +123,7 @@ namespace Renci.SshNet.Tests.Classes Thread.Sleep(100); Assert.IsNotNull(bytesReceivedByServer); - Assert.AreEqual(24, bytesReceivedByServer.Length); + Assert.HasCount(24, bytesReceivedByServer); } [TestMethod] @@ -149,7 +149,7 @@ namespace Renci.SshNet.Tests.Classes Thread.Sleep(100); Assert.IsNotNull(bytesReceivedByServer); - Assert.AreEqual(24, bytesReceivedByServer.Length); + Assert.HasCount(24, bytesReceivedByServer); } [TestMethod] @@ -168,7 +168,7 @@ namespace Renci.SshNet.Tests.Classes 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 81eccac3..b2c8e1be 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 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes 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 d41f270a..7c5f8a3b 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 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes 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 0eac5be2..e516adfe 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests 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 d89f1710..18f6315c 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests request.Complete(statusResponse); - Assert.AreEqual(1, statusActionInvocations.Count); + Assert.HasCount(1, statusActionInvocations); Assert.AreSame(statusResponse, statusActionInvocations[0]); } @@ -87,7 +87,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests 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 fe58f5f6..4274f437 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests request.Complete(statusResponse); - Assert.AreEqual(1, statusActionInvocations.Count); + Assert.HasCount(1, statusActionInvocations); Assert.AreSame(statusResponse, statusActionInvocations[0]); } @@ -91,7 +91,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests 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 6bd9fc56..bc54cb02 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests 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 f65ab012..2542d154 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests request.Complete(statusResponse); - Assert.AreEqual(1, statusActionInvocations.Count); + Assert.HasCount(1, statusActionInvocations); Assert.AreSame(statusResponse, statusActionInvocations[0]); } @@ -82,7 +82,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 a8755b58..d477e908 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests request.Complete(statusResponse); - Assert.AreEqual(1, statusActionInvocations.Count); + Assert.HasCount(1, statusActionInvocations); Assert.AreSame(statusResponse, statusActionInvocations[0]); } @@ -70,7 +70,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 2fd3bd1e..79e43344 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests request.Complete(statusResponse); - Assert.AreEqual(1, statusActionInvocations.Count); + Assert.HasCount(1, statusActionInvocations); Assert.AreSame(statusResponse, statusActionInvocations[0]); } @@ -76,7 +76,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 df49690a..27470af9 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 48063923..73fe25fa 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 1f1c571d..9aab57d1 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests request.Complete(statusResponse); - Assert.AreEqual(1, statusActionInvocations.Count); + Assert.HasCount(1, statusActionInvocations); Assert.AreSame(statusResponse, statusActionInvocations[0]); } @@ -86,7 +86,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 e01d3f7f..6d92591c 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests request.Complete(statusResponse); - Assert.AreEqual(1, statusActionInvocations.Count); + Assert.HasCount(1, statusActionInvocations); Assert.AreSame(statusResponse, statusActionInvocations[0]); } @@ -82,7 +82,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 efa6c692..2178b05d 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 dd7e407a..7bc6f5a1 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 07916fe6..aec34f0b 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 84bca0ca..8dab037a 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 803a0d5a..4f54a174 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 58bffd0c..da9b9118 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 e11bff8a..19e4233e 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests request.Complete(statusResponse); - Assert.AreEqual(1, statusActionInvocations.Count); + Assert.HasCount(1, statusActionInvocations); Assert.AreSame(statusResponse, statusActionInvocations[0]); } @@ -76,7 +76,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 705fb41b..fab3d496 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests request.Complete(statusResponse); - Assert.AreEqual(1, statusActionInvocations.Count); + Assert.HasCount(1, statusActionInvocations); Assert.AreSame(statusResponse, statusActionInvocations[0]); } @@ -83,7 +83,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 97a7964b..9977aef1 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests request.Complete(statusResponse); - Assert.AreEqual(1, statusActionInvocations.Count); + Assert.HasCount(1, statusActionInvocations); Assert.AreSame(statusResponse, statusActionInvocations[0]); } @@ -78,7 +78,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 ae2e2231..728669fe 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests request.Complete(statusResponse); - Assert.AreEqual(1, statusActionInvocations.Count); + Assert.HasCount(1, statusActionInvocations); Assert.AreSame(statusResponse, statusActionInvocations[0]); } @@ -87,7 +87,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 2bdbbdbb..46714373 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 9b95732f..febce225 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests request.Complete(statusResponse); - Assert.AreEqual(1, statusActionInvocations.Count); + Assert.HasCount(1, statusActionInvocations); Assert.AreSame(statusResponse, statusActionInvocations[0]); } @@ -101,7 +101,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 6e1ec406..163f28fe 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests request.Complete(statusResponse); - Assert.AreEqual(1, statusActionInvocations.Count); + Assert.HasCount(1, statusActionInvocations); Assert.AreSame(statusResponse, statusActionInvocations[0]); } @@ -75,7 +75,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 d2afdf8c..6083455f 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests request.Complete(statusResponse); - Assert.AreEqual(1, statusActionInvocations.Count); + Assert.HasCount(1, statusActionInvocations); Assert.AreSame(statusResponse, statusActionInvocations[0]); } @@ -93,7 +93,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 f4739bd2..77f11a81 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 @@ namespace Renci.SshNet.Tests.Classes _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 86817598..6e510b9f 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 @@ namespace Renci.SshNet.Tests.Classes _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 e7badbf3..de213dc1 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 @@ namespace Renci.SshNet.Tests.Classes 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 7496a03a..091430b0 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 @@ namespace Renci.SshNet.Tests.Classes [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 af31b6a5..5e66a164 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 @@ namespace Renci.SshNet.Tests.Classes [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 8d844788..3eef7059 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 @@ namespace Renci.SshNet.Tests.Classes [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 89580f90..eeb0f5dd 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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes { _sessionMock.Raise(p => p.ErrorOccured += null, new ExceptionEventArgs(new Exception())); - Assert.AreEqual(0, _errorOccurredRegister.Count); + Assert.IsEmpty(_errorOccurredRegister); } [TestMethod] @@ -121,7 +121,7 @@ namespace Renci.SshNet.Tests.Classes { _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 a78fd44f..31d3771a 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 @@ namespace Renci.SshNet.Tests.Classes [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 a375e437..63030b98 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 @@ namespace Renci.SshNet.Tests.Classes [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 ddfde8d9..871f7bc6 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 @@ namespace Renci.SshNet.Tests.Classes [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 b25bad65..73c0297d 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 @@ namespace Renci.SshNet.Tests.Classes [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 c6aba3ce..6c56ffd9 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 @@ namespace Renci.SshNet.Tests.Classes [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 5eb881f5..d715484f 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 @@ namespace Renci.SshNet.Tests.Classes [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 17c1c897..14c31749 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 @@ namespace Renci.SshNet.Tests.Classes [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 2629c90f..595ad558 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 @@ namespace Renci.SshNet.Tests.Classes [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 fc4b2960..1d169009 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 @@ namespace Renci.SshNet.Tests.Classes [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 7a81fc59..31517d24 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 @@ namespace Renci.SshNet.Tests.Classes [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 7c042c84..bd19da3e 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 @@ namespace Renci.SshNet.Tests.Classes [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 0f63f193..d9e970b4 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 @@ namespace Renci.SshNet.Tests.Classes [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 5d6fbe46..ed415466 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 @@ namespace Renci.SshNet.Tests.Classes [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 c2416ebc..f24fae94 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 @@ namespace Renci.SshNet.Tests.Classes [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 a1176475..efde0055 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 @@ namespace Renci.SshNet.Tests.Classes [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 d3301c03..b5e8d4ed 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 @@ namespace Renci.SshNet.Tests.Classes [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 eac62bb2..eb19eac1 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 @@ namespace Renci.SshNet.Tests.Classes [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 4fb93ce2..b90d3d2f 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 @@ namespace Renci.SshNet.Tests.Classes [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 3521b22c..ddc635c8 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 @@ namespace Renci.SshNet.Tests.Classes [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 c8db5f63..dbccbb22 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 886e5999..31641efd 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]