From f444111f60bc51ef427185946f45c2ab078364af Mon Sep 17 00:00:00 2001 From: Marius Thesing Date: Thu, 18 Apr 2024 20:28:02 +0200 Subject: [PATCH 1/9] Preparation to enforce formatting and style in CI - enabled IDE0055 to enforce formatting on build - disabled SA1137 and SA1025 because they are already covered by IDE0055 - disabled SA1021 because it conflicts with csharp_space_after_cast --- .editorconfig | 27 +++++++++++++++------------ src/Renci.SshNet/Common/BigInteger.cs | 6 ------ test/Renci.SshNet.Tests/.editorconfig | 4 ---- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/.editorconfig b/.editorconfig index d3d940a89..ebb0e9add 100644 --- a/.editorconfig +++ b/.editorconfig @@ -63,6 +63,12 @@ dotnet_diagnostic.S1125.severity = none # This is a duplicate of MA0026. dotnet_diagnostic.S1135.severity = none + +# SA1137: Elements should have the same indentation +# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1137.md +# duplicate of IDE0055 +dotnet_diagnostic.SA1137.severity = none + # S1168: Empty arrays and collections should be returned instead of null # https://rules.sonarsource.com/csharp/RSPEC-1168 # @@ -339,6 +345,15 @@ dotnet_diagnostic.SA1008.severity = none # var x = (int) z; dotnet_diagnostic.SA1009.severity = none +# SA1021: A negative sign within a C# element is not spaced correctly. +# disabled, because it conflicts with csharp_space_after_cast +dotnet_diagnostic.SA1021.severity = none + +# SA1025: Code should not contain multiple whitespace in a row +# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1025.md +# duplicate of IDE0055 +dotnet_diagnostic.SA1025.severity = none + # SA1101: Prefix local calls with this dotnet_diagnostic.SA1101.severity = none @@ -743,18 +758,6 @@ dotnet_diagnostic.IDE0046.severity = suggestion # Removing "unnecessary" parentheses is not always a clear win for readability. dotnet_diagnostic.IDE0047.severity = suggestion -# IDE0055: Fix formatting -# -# When enabled, diagnostics are reported for indented object initializers. -# For example: -# _content = new Person -# { -# Name = "\u13AAlarm" -# }; -# -# There are no settings to configure this correctly, unless https://github.com/dotnet/roslyn/issues/63256 (or similar) is ever implemented. -dotnet_diagnostic.IDE0055.severity = none - # IDE0130: Namespace does not match folder structure # https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0130 # diff --git a/src/Renci.SshNet/Common/BigInteger.cs b/src/Renci.SshNet/Common/BigInteger.cs index c9c2ea565..53df3d7d6 100644 --- a/src/Renci.SshNet/Common/BigInteger.cs +++ b/src/Renci.SshNet/Common/BigInteger.cs @@ -212,9 +212,7 @@ public BigInteger(int value) else { _sign = -1; -#pragma warning disable SA1021 // Negative signs should be spaced correctly _data = new[] { (uint) -value }; -#pragma warning restore SA1021 // Negative signs should be spaced correctly } } @@ -1330,9 +1328,7 @@ public static explicit operator BigInteger(decimal value) if (left._sign == 0) { -#pragma warning disable SA1021 // Negative signs should be spaced correctly return new BigInteger((short) -right._sign, right._data); -#pragma warning restore SA1021 // Negative signs should be spaced correctly } if (left._sign == right._sign) @@ -1528,9 +1524,7 @@ public static explicit operator BigInteger(decimal value) return value; } -#pragma warning disable SA1021 // Negative signs should be spaced correctly return new BigInteger((short) -value._sign, value._data); -#pragma warning restore SA1021 // Negative signs should be spaced correctly } /// diff --git a/test/Renci.SshNet.Tests/.editorconfig b/test/Renci.SshNet.Tests/.editorconfig index 2e0c27477..496a83213 100644 --- a/test/Renci.SshNet.Tests/.editorconfig +++ b/test/Renci.SshNet.Tests/.editorconfig @@ -143,10 +143,6 @@ dotnet_diagnostic.SA1129.severity = silent # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1133.md dotnet_diagnostic.SA1133.severity = silent -# SA1137: Elements should have the same indentation -# https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1137.md -dotnet_diagnostic.SA1137.severity = silent - # SA1139: Use literals suffix notation instead of casting # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1139.md dotnet_diagnostic.SA1139.severity = silent From b17e9aca642b464638052d97f7724c40d4fdee08 Mon Sep 17 00:00:00 2001 From: Marius Thesing Date: Sat, 20 Apr 2024 10:52:26 +0200 Subject: [PATCH 2/9] Cleanup formatting and style on codebase This commit has no manual changes, it is the result of running "dotnet format whitespace" and "dotnet format style" --- .../Abstractions/CryptoAbstraction.cs | 1 + .../Abstractions/SocketAbstraction.cs | 8 +- .../Abstractions/SocketExtensions.cs | 4 +- .../Channels/ChannelDirectTcpip.cs | 1 + .../Channels/ChannelForwardedTcpip.cs | 1 + src/Renci.SshNet/Channels/ClientChannel.cs | 1 + src/Renci.SshNet/Channels/IChannel.cs | 1 + .../Channels/IChannelDirectTcpip.cs | 1 + .../Channels/IChannelForwardedTcpip.cs | 1 + src/Renci.SshNet/Channels/IChannelSession.cs | 1 + src/Renci.SshNet/CipherInfo.cs | 1 + src/Renci.SshNet/Common/BigInteger.cs | 208 +++--- src/Renci.SshNet/Common/DerData.cs | 10 +- src/Renci.SshNet/Common/Extensions.cs | 1 + src/Renci.SshNet/Common/PacketDump.cs | 2 +- .../Common/SshConnectionException.cs | 1 + src/Renci.SshNet/Common/SshDataStream.cs | 2 +- src/Renci.SshNet/Connection/ProxyConnector.cs | 2 +- .../Connection/Socks4Connector.cs | 2 +- .../Connection/Socks5Connector.cs | 4 +- src/Renci.SshNet/ForwardedPortStatus.cs | 2 +- src/Renci.SshNet/ISubsystemSession.cs | 1 + .../KeyboardInteractiveConnectionInfo.cs | 1 + .../InformationRequestMessage.cs | 1 + .../Messages/Authentication/RequestMessage.cs | 1 + .../PseudoTerminalRequestInfo.cs | 2 +- src/Renci.SshNet/Messages/Message.cs | 2 +- .../Transport/KeyExchangeEcdhInitMessage.cs | 1 + .../Transport/ServiceAcceptMessage.cs | 1 + .../Transport/ServiceRequestMessage.cs | 1 + src/Renci.SshNet/PasswordConnectionInfo.cs | 1 + .../PrivateKeyAuthenticationMethod.cs | 2 +- src/Renci.SshNet/PrivateKeyFile.cs | 8 +- .../Security/Cryptography/BlockCipher.cs | 1 + .../Cryptography/CipherDigitalSignature.cs | 1 + .../Cryptography/Ciphers/AesCipher.CtrImpl.cs | 2 +- .../Cryptography/Ciphers/Arc4Cipher.cs | 2 +- .../Cryptography/Ciphers/BlowfishCipher.cs | 1 + .../Cryptography/Ciphers/CastCipher.cs | 33 +- .../Cryptography/Ciphers/DesCipher.cs | 7 +- .../Ciphers/Modes/CfbCipherMode.cs | 4 +- .../Ciphers/Modes/CtrCipherMode.cs | 2 +- .../Cryptography/Ciphers/RsaCipher.cs | 1 + .../Cryptography/Ciphers/SerpentCipher.cs | 8 +- .../Cryptography/Ciphers/TwofishCipher.cs | 36 +- .../Cryptography/ED25519DigitalSignature.cs | 1 + .../Security/Cryptography/EcdsaKey.cs | 4 +- .../Security/Cryptography/HMACMD5.cs | 1 + .../Security/Cryptography/HMACSHA256.cs | 1 + .../Security/Cryptography/HMACSHA384.cs | 1 + .../Security/Cryptography/HMACSHA512.cs | 1 + .../Security/GroupExchangeHashData.cs | 1 + src/Renci.SshNet/Security/KeyExchange.cs | 22 +- ...changeDiffieHellmanGroupExchangeShaBase.cs | 30 +- src/Renci.SshNet/Security/KeyExchangeEC.cs | 22 +- src/Renci.SshNet/Security/KeyExchangeECDH.cs | 5 +- src/Renci.SshNet/ServiceFactory.cs | 8 +- src/Renci.SshNet/Session.cs | 30 +- .../Sftp/Requests/SftpCloseRequest.cs | 1 + .../Sftp/Requests/SftpExtendedRequest.cs | 1 + .../Sftp/Requests/SftpFSetStatRequest.cs | 1 + .../Sftp/Requests/SftpLStatRequest.cs | 1 + .../Sftp/Requests/SftpMkDirRequest.cs | 1 + .../Sftp/Requests/SftpOpenRequest.cs | 1 + .../Sftp/Requests/SftpRemoveRequest.cs | 1 + .../Sftp/Requests/SftpRenameRequest.cs | 1 + src/Renci.SshNet/Sftp/Requests/SftpRequest.cs | 1 + .../Sftp/Requests/SftpRmDirRequest.cs | 1 + .../Sftp/Requests/SftpSetStatRequest.cs | 1 + .../Sftp/Requests/SftpStatRequest.cs | 1 + .../Sftp/Requests/SftpSymLinkRequest.cs | 1 + .../Sftp/Requests/SftpUnblockRequest.cs | 1 + .../Sftp/Requests/SftpWriteRequest.cs | 1 + .../Sftp/SftpDownloadAsyncResult.cs | 1 + src/Renci.SshNet/Sftp/SftpFile.cs | 1 + src/Renci.SshNet/Sftp/SftpFileReader.cs | 2 +- src/Renci.SshNet/Sftp/SftpFileStream.cs | 10 +- .../Ciphers/AesCipherBenchmarks.cs | 1 + .../ScpClientBenchmark.cs | 1 + .../Common/Socks5Handler.cs | 4 +- .../ConnectivityTests.cs | 4 +- .../HostConfig.cs | 2 +- .../HostKeyFile.cs | 2 +- .../LinuxVMConnectionFactory.cs | 2 +- .../SftpClientTest.ListDirectory.cs | 2 +- .../SftpClientTest.Upload.cs | 18 +- .../ScpClientTests.cs | 2 +- .../Renci.SshNet.IntegrationTests/ScpTests.cs | 16 +- .../SftpClientTests.cs | 2 +- .../SftpTests.cs | 14 +- .../SshConnectionDisruptor.cs | 4 +- .../Renci.SshNet.IntegrationTests/SshTests.cs | 26 +- .../SshdConfig.cs | 2 +- .../Classes/BaseClientTestBase.cs | 1 + ...Test_Connect_OnConnectedThrowsException.cs | 9 +- ...nected_KeepAliveInterval_NotNegativeOne.cs | 3 + ...Connected_KeepAlivesNotSentConcurrently.cs | 9 +- .../BaseClientTest_Disconnected_Connect.cs | 2 + ...nected_KeepAliveInterval_NotNegativeOne.cs | 3 + ...nected_KeepAliveInterval_NotNegativeOne.cs | 3 + ...pose_SessionIsConnectedAndChannelIsOpen.cs | 9 +- .../Channels/ChannelSessionTestBase.cs | 1 + .../ChannelSessionTest_Dispose_Disposed.cs | 16 +- ...hannelEofReceived_DisposeInEventHandler.cs | 5 +- ...Received_SendChannelCloseMessageFailure.cs | 3 + ...Received_SendChannelCloseMessageSuccess.cs | 3 + ...Received_SendChannelCloseMessageFailure.cs | 5 +- ...Received_SendChannelCloseMessageSuccess.cs | 3 + ...Received_SendChannelCloseMessageFailure.cs | 5 +- ...Received_SendChannelCloseMessageSuccess.cs | 3 + ...Open_NoChannelCloseOrChannelEofReceived.cs | 3 + ...ofReceived_SendChannelEofMessageFailure.cs | 5 +- ...sOpen_ChannelCloseAndChannelEofReceived.cs | 5 +- ...edAndChannelIsOpen_ChannelCloseReceived.cs | 5 +- ...Open_NoChannelCloseOrChannelEofReceived.cs | 5 +- ...ived_SessionIsConnectedAndChannelIsOpen.cs | 3 + ...Open_ExceptionWaitingOnOpenConfirmation.cs | 5 +- ...nOpenFailureReceived_NoRetriesAvailable.cs | 13 +- ...n_OnOpenFailureReceived_RetriesAvalable.cs | 3 + .../Classes/Channels/ChannelStub.cs | 3 +- .../Classes/Channels/ChannelTestBase.cs | 1 + ...e_SessionIsConnectedAndChannelIsNotOpen.cs | 5 +- ...onnectedAndChannelIsOpen_EofNotReceived.cs | 5 +- ...nelIsOpen_EofNotReceived_SendEofInvoked.cs | 5 +- ...IsConnectedAndChannelIsOpen_EofReceived.cs | 3 + ...DisconnectWaitingForChannelCloseMessage.cs | 5 +- ...ed_TimeoutWaitingForChannelCloseMessage.cs | 5 +- ...essionIsNotConnectedAndChannelIsNotOpen.cs | 5 +- ...e_SessionIsNotConnectedAndChannelIsOpen.cs | 5 +- ...Open_DisposeChannelInClosedEventHandler.cs | 5 +- ...onnectedAndChannelIsOpen_EofNotReceived.cs | 3 + ...IsConnectedAndChannelIsOpen_EofReceived.cs | 5 +- ...ErrorOccurred_OnErrorOccurred_Exception.cs | 4 +- .../ChannelTest_SendEof_ChannelIsNotOpen.cs | 5 +- .../ChannelTest_SendEof_ChannelIsOpen.cs | 5 +- .../Classes/Channels/ClientChannelStub.cs | 2 +- ...onReceived_OnOpenConfirmation_Exception.cs | 3 + ...FailureReceived_OnOpenFailure_Exception.cs | 7 +- .../Classes/ClientAuthenticationTest.cs | 5 +- .../Classes/ClientAuthenticationTestBase.cs | 2 + ...ticationsHaveReachedPartialSuccessLimit.cs | 17 +- ...e_SingleList_AuthenticationMethodFailed.cs | 3 + ...eList_AuthenticationMethodNotConfigured.cs | 5 +- ...lowedAuthenticationsAfterPartialSuccess.cs | 6 +- ...achedFollowedByFailureInAlternateBranch.cs | 13 +- ...chedFollowedByFailureInAlternateBranch2.cs | 7 +- ...mitReachedFollowedByFailureInSameBranch.cs | 9 +- ...achedFollowedBySuccessInAlternateBranch.cs | 10 +- ...mitReachedFollowedBySuccessInSameBranch.cs | 8 +- ...stponePartialAccessAuthenticationMethod.cs | 2 +- ...lowedAuthenticationsAfterPartialSuccess.cs | 4 +- ...ultiList_SkipFailedAuthenticationMethod.cs | 2 + ...llowedAuthenticationAfterPartialSuccess.cs | 6 +- ...rtialSuccess_PartialSuccessLimitReached.cs | 7 +- .../Classes/CommandAsyncResultTest.cs | 2 + .../Classes/Common/BigIntegerTest.cs | 253 ++++---- .../Common/ChannelDataEventArgsTest.cs | 5 +- .../Classes/Common/ChannelEventArgsTest.cs | 3 +- .../Common/ChannelOpenFailedEventArgsTest.cs | 1 + .../Common/ChannelRequestEventArgsTest.cs | 5 +- .../CountdownEventTest_Dispose_NotSet.cs | 3 +- .../Common/CountdownEventTest_Dispose_Set.cs | 3 +- .../Classes/Common/ExtensionsTest_Concat.cs | 2 + .../ExtensionsTest_IsEqualTo_ByteArray.cs | 6 +- .../Classes/Common/ExtensionsTest_Pad.cs | 2 +- .../Classes/Common/ExtensionsTest_Reverse.cs | 4 +- .../Common/ExtensionsTest_Take_Count.cs | 2 + .../ExtensionsTest_Take_OffsetAndCount.cs | 2 + .../Common/ExtensionsTest_TrimLeadingZeros.cs | 6 +- .../Classes/Common/HostKeyEventArgsTest.cs | 8 +- .../Classes/Common/ObjectIdentifierTest.cs | 1 + .../Classes/Common/PackTest.cs | 225 +++---- .../Classes/Common/PacketDumpTest.cs | 8 +- .../Classes/Common/PipeStreamTest.cs | 4 +- .../Common/PipeStream_Close_BlockingRead.cs | 2 + .../Common/PipeStream_Close_BlockingWrite.cs | 6 +- ...ipeStream_Flush_BytesRemainingAfterRead.cs | 4 +- ...eStream_Flush_NoBytesRemainingAfterRead.cs | 2 + .../Common/PortForwardEventArgsTest.cs | 4 +- ...thTest_CreateAbsoluteOrRelativeFilePath.cs | 6 +- .../Common/PosixPathTest_GetDirectoryName.cs | 2 + .../Common/PosixPathTest_GetFileName.cs | 2 + .../Connection/HttpConnectorTestBase.cs | 3 +- ...orTest_Connect_ConnectionToProxyRefused.cs | 16 +- ...yClosesConnectionBeforeStatusLineIsSent.cs | 19 +- ...pConnectorTest_Connect_ProxyHostInvalid.cs | 5 +- ...nectorTest_Connect_ProxyPasswordIsEmpty.cs | 8 +- ...nnectorTest_Connect_ProxyPasswordIsNull.cs | 17 +- ...oxyResponseDoesNotContainHttpStatusLine.cs | 8 +- ...seStatusIs200_ExtraTextBeforeStatusLine.cs | 8 +- ...xyResponseStatusIs200_HeadersAndContent.cs | 10 +- ...ct_ProxyResponseStatusIs200_OnlyHeaders.cs | 19 +- ...est_Connect_ProxyResponseStatusIsNot200.cs | 6 +- ...nectorTest_Connect_ProxyUserNameIsEmpty.cs | 6 +- ...nnect_ProxyUserNameIsNotNullAndNotEmpty.cs | 6 +- ...nnectorTest_Connect_ProxyUserNameIsNull.cs | 6 +- ...orTest_Connect_TimeoutConnectingToProxy.cs | 6 +- ...rTest_Connect_TimeoutReadingHttpContent.cs | 6 +- ...orTest_Connect_TimeoutReadingStatusLine.cs | 6 +- ...est_ServerResponseContainsNullCharacter.cs | 12 +- ...changeTest_ServerResponseValid_Comments.cs | 11 +- ...angeTest_ServerResponseValid_NoComments.cs | 11 +- .../Connection/Socks4ConnectorTestBase.cs | 2 +- ...orTest_Connect_TimeoutConnectingToProxy.cs | 10 +- ...Test_Connect_TimeoutReadingReplyVersion.cs | 15 +- .../Connection/Socks5ConnectorTestBase.cs | 12 +- ...ct_NoAuthentication_ConnectionSucceeded.cs | 13 +- ...wordAuthentication_AuthenticationFailed.cs | 13 +- ...swordAuthentication_ConnectionSucceeded.cs | 4 +- ...entication_PasswordExceedsMaximumLength.cs | 13 +- .../Connection/SshIdentificationTest.cs | 6 +- .../Classes/ConnectionInfoTest.cs | 15 +- ...ConnectionInfoTest_Authenticate_Failure.cs | 2 + ...ConnectionInfoTest_Authenticate_Success.cs | 2 + .../Classes/ExpectActionTest.cs | 10 +- .../Classes/ForwardedPortDynamicTest.cs | 6 +- ...dedPortDynamicTest_Dispose_PortDisposed.cs | 2 + ...ortDynamicTest_Dispose_PortNeverStarted.cs | 2 +- ...icTest_Dispose_PortStarted_ChannelBound.cs | 9 +- ...est_Dispose_PortStarted_ChannelNotBound.cs | 10 +- ...rdedPortDynamicTest_Dispose_PortStopped.cs | 3 + ...cTest_SessionErrorOccurred_ChannelBound.cs | 19 +- ...ardedPortDynamicTest_Start_PortDisposed.cs | 2 + ...dPortDynamicTest_Start_PortNeverStarted.cs | 5 +- ...wardedPortDynamicTest_Start_PortStarted.cs | 5 +- ...wardedPortDynamicTest_Start_PortStopped.cs | 5 +- ...rtDynamicTest_Start_SessionNotConnected.cs | 5 +- ...wardedPortDynamicTest_Start_SessionNull.cs | 4 +- ...cTest_Started_SocketVersionNotSupported.cs | 2 +- ...wardedPortDynamicTest_Stop_PortDisposed.cs | 4 +- ...edPortDynamicTest_Stop_PortNeverStarted.cs | 4 +- ...namicTest_Stop_PortStarted_ChannelBound.cs | 19 +- ...icTest_Stop_PortStarted_ChannelNotBound.cs | 10 +- ...rwardedPortDynamicTest_Stop_PortStopped.cs | 3 + ...ardedPortLocalTest_Dispose_PortDisposed.cs | 3 + ...lTest_Dispose_PortDisposed_NeverStarted.cs | 2 + ...dPortLocalTest_Dispose_PortNeverStarted.cs | 3 + ...alTest_Dispose_PortStarted_ChannelBound.cs | 13 +- ...est_Dispose_PortStarted_ChannelNotBound.cs | 3 + ...wardedPortLocalTest_Dispose_PortStopped.cs | 5 +- ...rwardedPortLocalTest_Start_PortDisposed.cs | 6 +- ...dedPortLocalTest_Start_PortNeverStarted.cs | 3 + ...orwardedPortLocalTest_Start_PortStarted.cs | 4 +- ...PortLocalTest_Start_SessionNotConnected.cs | 7 +- ...orwardedPortLocalTest_Start_SessionNull.cs | 7 +- ...orwardedPortLocalTest_Stop_PortDisposed.cs | 2 + ...rdedPortLocalTest_Stop_PortNeverStarted.cs | 7 +- ...LocalTest_Stop_PortStarted_ChannelBound.cs | 13 +- ...alTest_Stop_PortStarted_ChannelNotBound.cs | 3 + ...ForwardedPortLocalTest_Stop_PortStopped.cs | 7 +- ...rdedPortRemoteTest_Dispose_PortDisposed.cs | 4 +- ...PortRemoteTest_Dispose_PortNeverStarted.cs | 13 +- ...teTest_Dispose_PortStarted_ChannelBound.cs | 13 +- ...ardedPortRemoteTest_Dispose_PortStopped.cs | 13 +- ...wardedPortRemoteTest_Start_PortDisposed.cs | 4 +- ...edPortRemoteTest_Start_PortNeverStarted.cs | 13 +- ...rwardedPortRemoteTest_Start_PortStarted.cs | 13 +- ...rwardedPortRemoteTest_Start_PortStopped.cs | 13 +- ...ortRemoteTest_Start_SessionNotConnected.cs | 4 +- ...rwardedPortRemoteTest_Start_SessionNull.cs | 2 +- .../ForwardedPortRemoteTest_Started.cs | 27 +- ...rwardedPortRemoteTest_Stop_PortDisposed.cs | 4 +- ...dedPortRemoteTest_Stop_PortNeverStarted.cs | 13 +- ...oardInteractiveAuthenticationMethodTest.cs | 6 +- .../Connection/ChannelDataMessageTest.cs | 12 +- .../ChannelOpen/ChannelOpenMessageTest.cs | 44 +- .../ChannelRequest/PseudoTerminalInfoTest.cs | 2 + .../Connection/GlobalRequestMessageTest.cs | 8 +- .../Messages/Transport/IgnoreMessageTest.cs | 4 +- .../KeyExchangeDhGroupExchangeInitTest.cs | 3 +- .../KeyExchangeDhGroupExchangeReplyBuilder.cs | 3 +- .../KeyExchangeDhGroupExchangeReplyTest.cs | 8 +- .../Transport/KeyExchangeInitMessageTest.cs | 6 +- .../Classes/NetConfClientTest.cs | 22 +- .../Classes/NetConfClientTestBase.cs | 1 + ...st_Connect_NetConfSessionConnectFailure.cs | 2 +- .../NetConfClientTest_Dispose_Connected.cs | 6 +- .../NetConfClientTest_Dispose_Disconnected.cs | 12 +- .../NetConfClientTest_Dispose_Disposed.cs | 12 +- .../NetConfClientTest_Finalize_Connected.cs | 8 +- .../Classes/NoneAuthenticationMethodTest.cs | 6 +- .../PasswordAuthenticationMethodTest.cs | 8 +- .../Classes/PasswordConnectionInfoTest.cs | 10 +- .../Classes/PipeStreamTest_Dispose.cs | 2 + .../PrivateKeyAuthenticationMethodTest.cs | 6 +- .../Classes/PrivateKeyFileTest.cs | 10 +- ...RemotePathDoubleQuoteTransformationTest.cs | 1 + .../RemotePathShellQuoteTransformationTest.cs | 1 + .../Classes/ScpClientTest.cs | 2 +- .../Classes/ScpClientTestBase.cs | 1 + ...rectoryInfo_SendExecRequestReturnsFalse.cs | 3 + ...AndFileInfo_SendExecRequestReturnsFalse.cs | 3 + ...thAndStream_SendExecRequestReturnsFalse.cs | 3 + ...InfoAndPath_SendExecRequestReturnsFalse.cs | 3 + ...InfoAndPath_SendExecRequestReturnsFalse.cs | 3 + ...ientTest_Upload_FileInfoAndPath_Success.cs | 11 +- .../Security/Cryptography/BlockCipherTest.cs | 36 +- .../Cryptography/Ciphers/AesCipherTest.cs | 603 +++++++++--------- .../Cryptography/Ciphers/Arc4CipherTest.cs | 2 + .../Ciphers/BlowfishCipherTest.cs | 7 +- .../Cryptography/Ciphers/CastCipherTest.cs | 7 +- .../Cryptography/Ciphers/DesCipherTest.cs | 10 +- .../Ciphers/Paddings/PKCS5PaddingTest.cs | 5 +- .../Ciphers/Paddings/PKCS7PaddingTest.cs | 1 + .../Classes/Security/KeyAlgorithmTest.cs | 2 +- ...KeyExchangeDiffieHellmanGroup14Sha1Test.cs | 3 +- ...yExchangeDiffieHellmanGroup16Sha512Test.cs | 3 +- .../KeyExchangeDiffieHellmanGroup1Sha1Test.cs | 3 +- .../ServiceFactoryTest_CreateConnector.cs | 7 +- ...tpFileReader_EndLStatThrowsSshException.cs | 5 +- ...izeIsAlmostSixTimesGreaterThanChunkSize.cs | 5 +- ...tpFileReader_FileSizeIsEqualToChunkSize.cs | 9 +- ...eIsExactlyFiveTimesGreaterThanChunkSize.cs | 5 +- ...pFileReader_FileSizeIsLessThanChunkSize.cs | 9 +- ...leMoreThanFiveTimesGreaterThanChunkSize.cs | 9 +- ...IsMoreThanMaxPendingReadsTimesChunkSize.cs | 7 +- ...est_CreateSftpFileReader_FileSizeIsZero.cs | 5 +- ...eShellStream_ChannelOpenThrowsException.cs | 3 + ...m_SendPseudoTerminalRequestReturnsFalse.cs | 3 + ...endPseudoTerminalRequestThrowsException.cs | 3 + ...hellStream_SendShellRequestReturnsFalse.cs | 3 + ...lStream_SendShellRequestThrowsException.cs | 3 + ...ceFactoryTest_CreateShellStream_Success.cs | 3 + .../Renci.SshNet.Tests/Classes/SessionTest.cs | 6 +- .../Classes/SessionTestBase.cs | 1 + .../SessionTest_ConnectToServerFails.cs | 26 +- .../Classes/SessionTest_Connected.cs | 3 + .../Classes/SessionTest_ConnectedBase.cs | 10 +- ...alRequestMessageAfterAuthenticationRace.cs | 2 + ...Connected_ServerAndClientDisconnectRace.cs | 30 +- ...sionTest_Connected_ServerSendsBadPacket.cs | 2 +- ...utsDownSendAfterSendingIncompletePacket.cs | 2 +- ...ionTest_Connected_ServerShutsDownSocket.cs | 2 + .../Classes/SessionTest_NotConnected.cs | 6 +- ...est_SocketConnected_BadPacketAndDispose.cs | 6 +- .../ExtendedRequests/FStatVfsRequestTest.cs | 8 +- .../ExtendedRequests/HardLinkRequestTest.cs | 8 +- .../PosixRenameRequestTest.cs | 10 +- .../ExtendedRequests/StatVfsRequestTest.cs | 8 +- .../Sftp/Requests/SftpBlockRequestTest.cs | 8 +- .../Sftp/Requests/SftpCloseRequestTest.cs | 10 +- .../Sftp/Requests/SftpFSetStatRequestTest.cs | 8 +- .../Sftp/Requests/SftpFStatRequestTest.cs | 8 +- .../Sftp/Requests/SftpInitRequestTest.cs | 3 +- .../Sftp/Requests/SftpLStatRequestTest.cs | 4 +- .../Sftp/Requests/SftpLinkRequestTest.cs | 8 +- .../Sftp/Requests/SftpMkDirRequestTest.cs | 4 +- .../Sftp/Requests/SftpOpenDirRequestTest.cs | 8 +- .../Sftp/Requests/SftpOpenRequestTest.cs | 8 +- .../Sftp/Requests/SftpReadDirRequestTest.cs | 4 +- .../Sftp/Requests/SftpReadLinkRequestTest.cs | 4 +- .../Sftp/Requests/SftpReadRequestTest.cs | 2 + .../Sftp/Requests/SftpRealPathRequestTest.cs | 4 +- .../Sftp/Requests/SftpRemoveRequestTest.cs | 4 +- .../Sftp/Requests/SftpRenameRequestTest.cs | 4 +- .../Sftp/Requests/SftpRmDirRequestTest.cs | 4 +- .../Sftp/Requests/SftpSetStatRequestTest.cs | 8 +- .../Sftp/Requests/SftpStatRequestTest.cs | 6 +- .../Sftp/Requests/SftpSymLinkRequestTest.cs | 4 +- .../Sftp/Requests/SftpUnblockRequestTest.cs | 4 +- .../Sftp/Requests/SftpWriteRequestTest.cs | 2 + .../ExtendedReplies/StatVfsReplyInfoTest.cs | 18 +- .../Sftp/Responses/SftpAttrsResponseTest.cs | 4 +- .../Sftp/Responses/SftpDataResponseTest.cs | 2 + .../SftpExtendedReplyResponseTest.cs | 8 +- .../Sftp/Responses/SftpHandleResponseTest.cs | 4 +- .../Sftp/Responses/SftpNameResponseTest.cs | 3 +- .../Sftp/Responses/SftpStatusResponseTest.cs | 3 +- .../Sftp/Responses/SftpVersionResponseTest.cs | 3 +- .../Classes/Sftp/SftpDataResponseBuilder.cs | 8 +- .../Sftp/SftpDownloadAsyncResultTest.cs | 2 + .../Classes/Sftp/SftpFileReaderTestBase.cs | 11 +- ...ReaderTest_LastChunkBeforeEofIsComplete.cs | 14 +- ...eReaderTest_LastChunkBeforeEofIsPartial.cs | 18 +- ...iousChunkIsIncompleteAndEofIsNotReached.cs | 14 +- ...reviousChunkIsIncompleteAndEofIsReached.cs | 12 +- ...vokeException_DiscardsFurtherReadAheads.cs | 18 +- ...vokeException_PreventsFurtherReadAheads.cs | 2 +- ...Test_Read_ReadAheadExceptionInBeginRead.cs | 16 +- ...dExceptionInWaitOnHandle_ChunkAvailable.cs | 14 +- ...xceptionInWaitOnHandle_NoChunkAvailable.cs | 14 +- .../Sftp/SftpFileStreamAsyncTestBase.cs | 3 + .../Classes/Sftp/SftpFileStreamTestBase.cs | 3 + ...treamTest_CanRead_Closed_FileAccessRead.cs | 3 + ...Test_CanRead_Closed_FileAccessReadWrite.cs | 3 + ...reamTest_CanRead_Closed_FileAccessWrite.cs | 3 + ...eamTest_CanRead_Disposed_FileAccessRead.cs | 3 + ...st_CanRead_Disposed_FileAccessReadWrite.cs | 3 + ...amTest_CanRead_Disposed_FileAccessWrite.cs | 3 + ...reamTest_CanWrite_Closed_FileAccessRead.cs | 3 + ...est_CanWrite_Closed_FileAccessReadWrite.cs | 3 + ...eamTest_CanWrite_Closed_FileAccessWrite.cs | 3 + ...amTest_CanWrite_Disposed_FileAccessRead.cs | 3 + ...t_CanWrite_Disposed_FileAccessReadWrite.cs | 5 +- ...mTest_CanWrite_Disposed_FileAccessWrite.cs | 3 + .../Sftp/SftpFileStreamTest_Close_Closed.cs | 10 +- .../Sftp/SftpFileStreamTest_Close_Disposed.cs | 3 + ...SftpFileStreamTest_Close_SessionNotOpen.cs | 3 + ...tpFileStreamTest_Ctor_FileAccessInvalid.cs | 2 + ...Test_Ctor_FileModeAppend_FileAccessRead.cs | 2 + ...Ctor_FileModeAppend_FileAccessReadWrite.cs | 2 + ...est_Ctor_FileModeAppend_FileAccessWrite.cs | 5 +- ...r_FileModeCreateNew_FileAccessReadWrite.cs | 7 +- ..._Ctor_FileModeCreateNew_FileAccessWrite.cs | 3 + ...Test_Ctor_FileModeCreate_FileAccessRead.cs | 2 +- ...te_FileAccessReadWrite_FileDoesNotExist.cs | 7 +- ...deCreate_FileAccessReadWrite_FileExists.cs | 7 +- ...Create_FileAccessWrite_FileDoesNotExist.cs | 7 +- ...leModeCreate_FileAccessWrite_FileExists.cs | 3 + ...SftpFileStreamTest_Ctor_FileModeInvalid.cs | 2 + ...tor_FileModeOpenOrCreate_FileAccessRead.cs | 3 + ...ileModeOpenOrCreate_FileAccessReadWrite.cs | 7 +- ...or_FileModeOpenOrCreate_FileAccessWrite.cs | 3 + ...amTest_Ctor_FileModeOpen_FileAccessRead.cs | 7 +- ...t_Ctor_FileModeOpen_FileAccessReadWrite.cs | 3 + ...mTest_Ctor_FileModeOpen_FileAccessWrite.cs | 3 + ...st_Ctor_FileModeTruncate_FileAccessRead.cs | 2 + ...t_Ctor_FileModeTruncate_FileAccessWrite.cs | 3 + .../SftpFileStreamTest_Dispose_Disposed.cs | 3 + ...SftpFileStreamTest_Finalize_SessionOpen.cs | 3 + ...ReadMode_DataInBuffer_NotReadFromBuffer.cs | 6 +- ...sh_ReadMode_DataInBuffer_ReadFromBuffer.cs | 15 +- ...treamTest_Flush_ReadMode_NoDataInBuffer.cs | 2 +- ...SftpFileStreamTest_Flush_SessionNotOpen.cs | 9 +- ...StreamTest_Flush_WriteMode_DataInBuffer.cs | 6 +- ...reamTest_Flush_WriteMode_NoDataInBuffer.cs | 13 +- ...eStreamTest_OpenAsync_FileAccessInvalid.cs | 2 + ...OpenAsync_FileModeAppend_FileAccessRead.cs | 2 + ...sync_FileModeAppend_FileAccessReadWrite.cs | 2 + ...penAsync_FileModeAppend_FileAccessWrite.cs | 8 +- ...c_FileModeCreateNew_FileAccessReadWrite.cs | 7 +- ...te_FileAccessReadWrite_FileDoesNotExist.cs | 4 +- ...deCreate_FileAccessReadWrite_FileExists.cs | 7 +- ...Create_FileAccessWrite_FileDoesNotExist.cs | 9 +- ...ileStreamTest_OpenAsync_FileModeInvalid.cs | 2 + ...ync_FileModeOpenOrCreate_FileAccessRead.cs | 5 +- ...ileModeOpenOrCreate_FileAccessReadWrite.cs | 4 +- ...nc_FileModeOpenOrCreate_FileAccessWrite.cs | 3 + ...t_OpenAsync_FileModeOpen_FileAccessRead.cs | 7 +- ..._OpenAsync_FileModeOpen_FileAccessWrite.cs | 3 + ...nc_FileModeTruncate_FileAccessReadWrite.cs | 3 + ...nAsync_FileModeTruncate_FileAccessWrite.cs | 5 +- ...FromServerThanCountAndEqualToBufferSize.cs | 15 +- ...romServerThanCountAndLessThanBufferSize.cs | 13 +- ...fferAndReadMoreBytesFromServerThanCount.cs | 13 +- ...aInWriteBufferAndNoDataInReadBuffer_Eof.cs | 5 +- ...fer_LessDataThanReadBufferSizeAvailable.cs | 5 +- ...FromServerThanCountAndEqualToBufferSize.cs | 13 +- ...romServerThanCountAndLessThanBufferSize.cs | 13 +- ...fferAndReadMoreBytesFromServerThanCount.cs | 9 +- ...ngOfStream_OriginBeginAndOffsetNegative.cs | 11 +- ...ngOfStream_OriginBeginAndOffsetPositive.cs | 11 +- ...inningOfStream_OriginBeginAndOffsetZero.cs | 11 +- ...ningOfStream_OriginEndAndOffsetNegative.cs | 11 +- ...ningOfStream_OriginEndAndOffsetPositive.cs | 11 +- ...eginningOfStream_OriginEndAndOffsetZero.cs | 11 +- ...am_OriginBeginAndOffsetZero_NoBuffering.cs | 7 +- ...eam_OriginBeginAndOffsetZero_ReadBuffer.cs | 3 + .../SftpFileStreamTest_SetLength_Closed.cs | 13 +- ...eadBuffer_NewLengthGreatherThanPosition.cs | 9 +- ...aInReadBuffer_NewLengthLessThanPosition.cs | 21 +- ...iteBuffer_NewLengthGreatherThanPosition.cs | 13 +- ...InWriteBuffer_NewLengthLessThanPosition.cs | 11 +- .../SftpFileStreamTest_SetLength_Disposed.cs | 7 +- ...FileStreamTest_SetLength_SessionNotOpen.cs | 3 + ...st_SetLength_SessionOpen_FileAccessRead.cs | 3 + ...tLength_SessionOpen_FileAccessReadWrite.cs | 7 +- ...t_SetLength_SessionOpen_FileAccessWrite.cs | 7 +- ...tGreatherThanTwoTimesTheWriteBufferSize.cs | 14 +- ...tGreatherThanTwoTimesTheWriteBufferSize.cs | 17 +- .../Classes/Sftp/SftpHandleResponseBuilder.cs | 8 +- .../Classes/Sftp/SftpNameResponseBuilder.cs | 15 +- .../Classes/Sftp/SftpReadRequestBuilder.cs | 5 +- .../Sftp/SftpRealPathRequestBuilder.cs | 7 +- .../SftpSessionTest_Connected_RequestRead.cs | 7 +- ...ftpSessionTest_Connected_RequestStatVfs.cs | 6 +- ...tipleSftpMessagesInSingleSshDataMessage.cs | 13 +- ...essagesSplitOverMultipleSshDataMessages.cs | 13 +- ...eived_SingleSftpMessageInSshDataMessage.cs | 7 +- .../Classes/Sftp/SftpStatVfsRequestBuilder.cs | 10 +- .../Sftp/SftpVersionResponseBuilder.cs | 9 +- .../Classes/SftpClientTest.Connect.cs | 1 + .../Classes/SftpClientTest.ConnectAsync.cs | 1 + .../Classes/SftpClientTest.DeleteDirectory.cs | 1 + .../Classes/SftpClientTest.DeleteFile.cs | 8 +- .../Classes/SftpClientTest.DeleteFileAsync.cs | 10 +- .../Classes/SftpClientTest.ListDirectory.cs | 2 + .../SftpClientTest.ListDirectoryAsync.cs | 2 + .../Classes/SftpClientTest.cs | 24 +- .../Classes/SftpClientTestBase.cs | 1 + ...tTest_Connect_SftpSessionConnectFailure.cs | 2 +- .../SftpClientTest_Dispose_Connected.cs | 6 +- .../SftpClientTest_Dispose_Disconnected.cs | 6 +- .../SftpClientTest_Dispose_Disposed.cs | 6 +- .../SftpClientTest_Finalize_Connected.cs | 6 +- .../Classes/ShellStreamTest.cs | 9 +- ...ferEmptyAndWriteLessBytesThanBufferSize.cs | 3 + ...ferEmptyAndWriteMoreBytesThanBufferSize.cs | 11 +- ...yAndWriteNumberOfBytesEqualToBufferSize.cs | 11 +- ...Write_WriteBufferEmptyAndWriteZeroBytes.cs | 8 +- ...fferFullAndWriteLessBytesThanBufferSize.cs | 11 +- ..._Write_WriteBufferFullAndWriteZeroBytes.cs | 3 + ...tyAndWriteLessBytesThanBufferCanContain.cs | 3 + ...tyAndWriteMoreBytesThanBufferCanContain.cs | 3 + ...te_WriteBufferNotEmptyAndWriteZeroBytes.cs | 11 +- .../Classes/SshClientTest.cs | 11 +- ...AndBufferSizeAndTerminalModes_Connected.cs | 5 +- ...ndWidthAndHeightAndBufferSize_Connected.cs | 8 +- ...entTest_Disconnect_ForwardedPortStarted.cs | 2 + .../SshClientTest_Dispose_Connected.cs | 1 + .../SshClientTest_Dispose_Disconnected.cs | 1 + .../Classes/SshClientTest_Dispose_Disposed.cs | 1 + ...ClientTest_Dispose_ForwardedPortStarted.cs | 4 +- .../Classes/SshCommandTest.cs | 6 +- ...okedOnAsyncResultFromPreviousInvocation.cs | 3 + ...okedOnAsyncResultFromPreviousInvocation.cs | 3 + .../Classes/SshCommandTest_Dispose.cs | 3 + .../Classes/SshCommandTest_EndExecute.cs | 3 + ...ommandTest_EndExecute_AsyncResultIsNull.cs | 3 + .../SshCommandTest_EndExecute_ChannelOpen.cs | 5 +- .../SubsystemSession_Connect_Connected.cs | 3 + .../SubsystemSession_Connect_Disposed.cs | 2 +- ...ssion_Connect_SendSubsystemRequestFails.cs | 3 + ...Session_OnChannelDataReceived_Connected.cs | 7 +- ...mSession_OnChannelDataReceived_Disposed.cs | 7 +- ...elDataReceived_OnDataReceived_Exception.cs | 7 +- ...temSession_OnChannelException_Connected.cs | 3 + ...stemSession_OnChannelException_Disposed.cs | 2 +- ...mSession_OnSessionDisconnected_Disposed.cs | 2 +- ...ession_OnSessionErrorOccurred_Connected.cs | 3 + ...Session_OnSessionErrorOccurred_Disposed.cs | 3 + .../SubsystemSession_SendData_Connected.cs | 5 +- .../SubsystemSession_SendData_Disposed.cs | 3 + ...ubsystemSession_SendData_NeverConnected.cs | 5 +- .../Common/ArgumentExceptionAssert.cs | 3 +- .../Common/AsyncSocketListener.cs | 8 +- .../Common/DictionaryAssert.cs | 5 +- test/Renci.SshNet.Tests/Common/Extensions.cs | 5 +- .../Common/SftpFileAttributesBuilder.cs | 1 + test/Renci.SshNet.Tests/Common/TestBase.cs | 5 +- 540 files changed, 2763 insertions(+), 1786 deletions(-) diff --git a/src/Renci.SshNet/Abstractions/CryptoAbstraction.cs b/src/Renci.SshNet/Abstractions/CryptoAbstraction.cs index bc53905d8..1f98712b0 100644 --- a/src/Renci.SshNet/Abstractions/CryptoAbstraction.cs +++ b/src/Renci.SshNet/Abstractions/CryptoAbstraction.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Security.Cryptography; namespace Renci.SshNet.Abstractions diff --git a/src/Renci.SshNet/Abstractions/SocketAbstraction.cs b/src/Renci.SshNet/Abstractions/SocketAbstraction.cs index e1a12362e..4be67a508 100644 --- a/src/Renci.SshNet/Abstractions/SocketAbstraction.cs +++ b/src/Renci.SshNet/Abstractions/SocketAbstraction.cs @@ -61,10 +61,10 @@ private static void ConnectCore(Socket socket, IPEndPoint remoteEndpoint, TimeSp { var connectCompleted = new ManualResetEvent(initialState: false); var args = new SocketAsyncEventArgs - { - UserToken = connectCompleted, - RemoteEndPoint = remoteEndpoint - }; + { + UserToken = connectCompleted, + RemoteEndPoint = remoteEndpoint + }; args.Completed += ConnectCompleted; if (socket.ConnectAsync(args)) diff --git a/src/Renci.SshNet/Abstractions/SocketExtensions.cs b/src/Renci.SshNet/Abstractions/SocketExtensions.cs index b0946c88b..e51e0bba4 100644 --- a/src/Renci.SshNet/Abstractions/SocketExtensions.cs +++ b/src/Renci.SshNet/Abstractions/SocketExtensions.cs @@ -81,7 +81,7 @@ public void GetResult() if (SocketError != SocketError.Success) { - throw new SocketException((int)SocketError); + throw new SocketException((int) SocketError); } } } @@ -95,7 +95,7 @@ public static async Task ConnectAsync(this Socket socket, IPEndPoint remoteEndpo args.RemoteEndPoint = remoteEndpoint; #if NET || NETSTANDARD2_1_OR_GREATER - await using (cancellationToken.Register(o => ((AwaitableSocketAsyncEventArgs)o).SetCancelled(), args, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) + await using (cancellationToken.Register(o => ((AwaitableSocketAsyncEventArgs) o).SetCancelled(), args, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) #else using (cancellationToken.Register(o => ((AwaitableSocketAsyncEventArgs) o).SetCancelled(), args, useSynchronizationContext: false)) #endif // NET || NETSTANDARD2_1_OR_GREATER diff --git a/src/Renci.SshNet/Channels/ChannelDirectTcpip.cs b/src/Renci.SshNet/Channels/ChannelDirectTcpip.cs index 6c521bce2..d99474542 100644 --- a/src/Renci.SshNet/Channels/ChannelDirectTcpip.cs +++ b/src/Renci.SshNet/Channels/ChannelDirectTcpip.cs @@ -2,6 +2,7 @@ using System.Net; using System.Net.Sockets; using System.Threading; + using Renci.SshNet.Abstractions; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; diff --git a/src/Renci.SshNet/Channels/ChannelForwardedTcpip.cs b/src/Renci.SshNet/Channels/ChannelForwardedTcpip.cs index a8382015a..07271c834 100644 --- a/src/Renci.SshNet/Channels/ChannelForwardedTcpip.cs +++ b/src/Renci.SshNet/Channels/ChannelForwardedTcpip.cs @@ -1,6 +1,7 @@ using System; using System.Net; using System.Net.Sockets; + using Renci.SshNet.Abstractions; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; diff --git a/src/Renci.SshNet/Channels/ClientChannel.cs b/src/Renci.SshNet/Channels/ClientChannel.cs index ea4bfe164..3e746195b 100644 --- a/src/Renci.SshNet/Channels/ClientChannel.cs +++ b/src/Renci.SshNet/Channels/ClientChannel.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; diff --git a/src/Renci.SshNet/Channels/IChannel.cs b/src/Renci.SshNet/Channels/IChannel.cs index 7ec3eb8e2..f89679eb0 100644 --- a/src/Renci.SshNet/Channels/IChannel.cs +++ b/src/Renci.SshNet/Channels/IChannel.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; diff --git a/src/Renci.SshNet/Channels/IChannelDirectTcpip.cs b/src/Renci.SshNet/Channels/IChannelDirectTcpip.cs index eb71bf3df..e68da32ee 100644 --- a/src/Renci.SshNet/Channels/IChannelDirectTcpip.cs +++ b/src/Renci.SshNet/Channels/IChannelDirectTcpip.cs @@ -1,5 +1,6 @@ using System; using System.Net.Sockets; + using Renci.SshNet.Common; namespace Renci.SshNet.Channels diff --git a/src/Renci.SshNet/Channels/IChannelForwardedTcpip.cs b/src/Renci.SshNet/Channels/IChannelForwardedTcpip.cs index 7bc165a8d..ec12cdf22 100644 --- a/src/Renci.SshNet/Channels/IChannelForwardedTcpip.cs +++ b/src/Renci.SshNet/Channels/IChannelForwardedTcpip.cs @@ -1,5 +1,6 @@ using System; using System.Net; + using Renci.SshNet.Common; namespace Renci.SshNet.Channels diff --git a/src/Renci.SshNet/Channels/IChannelSession.cs b/src/Renci.SshNet/Channels/IChannelSession.cs index 13c2e2304..2b18efa63 100644 --- a/src/Renci.SshNet/Channels/IChannelSession.cs +++ b/src/Renci.SshNet/Channels/IChannelSession.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; + using Renci.SshNet.Common; namespace Renci.SshNet.Channels diff --git a/src/Renci.SshNet/CipherInfo.cs b/src/Renci.SshNet/CipherInfo.cs index ed38e3067..0dd37e9f6 100644 --- a/src/Renci.SshNet/CipherInfo.cs +++ b/src/Renci.SshNet/CipherInfo.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Common; using Renci.SshNet.Security.Cryptography; diff --git a/src/Renci.SshNet/Common/BigInteger.cs b/src/Renci.SshNet/Common/BigInteger.cs index 53df3d7d6..fae4e3a71 100644 --- a/src/Renci.SshNet/Common/BigInteger.cs +++ b/src/Renci.SshNet/Common/BigInteger.cs @@ -72,7 +72,7 @@ public struct BigInteger : IComparable, IFormattable, IComparable, I { private const ulong Base = 0x100000000; private const int Bias = 1075; - private const int DecimalSignMask = unchecked((int)0x80000000); + private const int DecimalSignMask = unchecked((int) 0x80000000); private static readonly BigInteger ZeroSingleton = new BigInteger(0); private static readonly BigInteger OneSingleton = new BigInteger(1); @@ -249,8 +249,8 @@ public BigInteger(long value) else if (value > 0) { _sign = 1; - var low = (uint)value; - var high = (uint)(value >> 32); + var low = (uint) value; + var high = (uint) (value >> 32); _data = new uint[high != 0 ? 2 : 1]; _data[0] = low; @@ -263,8 +263,8 @@ public BigInteger(long value) { _sign = -1; value = -value; - var low = (uint)value; - var high = (uint)((ulong)value >> 32); + var low = (uint) value; + var high = (uint) ((ulong) value >> 32); _data = new uint[high != 0 ? 2 : 1]; _data[0] = low; @@ -532,13 +532,13 @@ private static bool Negative(byte[] v) private static ushort Exponent(byte[] v) { - return (ushort)((((ushort)(v[7] & 0x7F)) << (ushort)4) | (((ushort)(v[6] & 0xF0)) >> 4)); + return (ushort) ((((ushort) (v[7] & 0x7F)) << (ushort) 4) | (((ushort) (v[6] & 0xF0)) >> 4)); } private static ulong Mantissa(byte[] v) { - var i1 = (uint)v[0] | ((uint)v[1] << 8) | ((uint)v[2] << 16) | ((uint)v[3] << 24); - var i2 = (uint)v[4] | ((uint)v[5] << 8) | ((uint)(v[6] & 0xF) << 16); + var i1 = (uint) v[0] | ((uint) v[1] << 8) | ((uint) v[2] << 16) | ((uint) v[3] << 24); + var i2 = (uint) v[4] | ((uint) v[5] << 8) | ((uint) (v[6] & 0xF) << 16); return (ulong) i1 | ((ulong) i2 << 32); } @@ -592,7 +592,7 @@ private static int PopulationCount(ulong x) x -= (x >> 1) & 0x5555555555555555UL; x = (x & 0x3333333333333333UL) + ((x >> 2) & 0x3333333333333333UL); x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0fUL; - return (int)((x * 0x0101010101010101UL) >> 56); + return (int) ((x * 0x0101010101010101UL) >> 56); } private static int LeadingZeroCount(uint value) @@ -660,13 +660,13 @@ private static double BuildDouble(int sign, ulong mantissa, int exponent) { unchecked { - var bits = mantissa | ((ulong)exponent << mantissaLength); + var bits = mantissa | ((ulong) exponent << mantissaLength); if (sign < 0) { bits |= negativeMark; } - return BitConverter.Int64BitsToDouble((long)bits); + return BitConverter.Int64BitsToDouble((long) bits); } } @@ -796,7 +796,7 @@ public static explicit operator int(BigInteger value) throw new OverflowException(); } - return (int)data; + return (int) data; } if (value._sign == -1) @@ -806,7 +806,7 @@ public static explicit operator int(BigInteger value) throw new OverflowException(); } - return -(int)data; + return -(int) data; } return 0; @@ -949,7 +949,7 @@ public static explicit operator long(BigInteger value) return (long) low; } - var res = (long)low; + var res = (long) low; return -res; } @@ -962,7 +962,7 @@ public static explicit operator long(BigInteger value) throw new OverflowException(); } - return (((long)high) << 32) | low; + return (((long) high) << 32) | low; } /* @@ -975,7 +975,7 @@ long.MinValue works fine since it's bigint encoding looks like a negative number, but since long.MinValue == -long.MinValue, we're good. */ - var result = -((((long)high) << 32) | (long)low); + var result = -((((long) high) << 32) | (long) low); if (result > 0) { throw new OverflowException(); @@ -1013,7 +1013,7 @@ public static explicit operator ulong(BigInteger value) } var high = value._data[1]; - return (((ulong)high) << 32) | low; + return (((ulong) high) << 32) | low; } /// @@ -1041,7 +1041,7 @@ public static explicit operator double(BigInteger value) default: var index = value._data.Length - 1; var word = value._data[index]; - var mantissa = ((ulong)word << 32) | value._data[index - 1]; + var mantissa = ((ulong) word << 32) | value._data[index - 1]; var missing = LeadingZeroCount(word) - 11; // 11 = bits in exponent if (missing > 0) { @@ -1346,7 +1346,7 @@ public static explicit operator BigInteger(decimal value) return new BigInteger(left._sign, CoreSub(left._data, right._data)); } - return new BigInteger((short)-right._sign, CoreSub(right._data, left._data)); + return new BigInteger((short) -right._sign, CoreSub(right._data, left._data)); } return new BigInteger(left._sign, CoreAdd(left._data, right._data)); @@ -1374,7 +1374,7 @@ public static explicit operator BigInteger(decimal value) return right; } - return new BigInteger((short)-right._sign, right._data); + return new BigInteger((short) -right._sign, right._data); } if (right._data[0] == 1 && right._data.Length == 1) @@ -1384,7 +1384,7 @@ public static explicit operator BigInteger(decimal value) return left; } - return new BigInteger((short)-left._sign, left._data); + return new BigInteger((short) -left._sign, left._data); } var a = left._data; @@ -1401,14 +1401,14 @@ public static explicit operator BigInteger(decimal value) for (var j = 0; j < b.Length; ++j) { carry = carry + (((ulong) ai) * b[j]) + res[k]; - res[k++] = (uint)carry; + res[k++] = (uint) carry; carry >>= 32; } while (carry != 0) { carry += res[k]; - res[k++] = (uint)carry; + res[k++] = (uint) carry; carry >>= 32; } } @@ -1424,7 +1424,7 @@ public static explicit operator BigInteger(decimal value) Array.Resize(ref res, m + 1); } - return new BigInteger((short) (left._sign*right._sign), res); + return new BigInteger((short) (left._sign * right._sign), res); } /// @@ -1466,7 +1466,7 @@ public static explicit operator BigInteger(decimal value) Array.Resize(ref quotient, i + 1); } - return new BigInteger((short)(dividend._sign * divisor._sign), quotient); + return new BigInteger((short) (dividend._sign * divisor._sign), quotient); } /// @@ -1661,8 +1661,8 @@ public static explicit operator BigInteger(decimal value) if (ls == -1) { ac = ~va + ac; - va = (uint)ac; - ac = (uint)(ac >> 32); + va = (uint) ac; + ac = (uint) (ac >> 32); } uint vb = 0; @@ -1674,8 +1674,8 @@ public static explicit operator BigInteger(decimal value) if (rs == -1) { bc = ~vb + bc; - vb = (uint)bc; - bc = (uint)(bc >> 32); + vb = (uint) bc; + bc = (uint) (bc >> 32); } var word = va & vb; @@ -1683,8 +1683,8 @@ public static explicit operator BigInteger(decimal value) if (negRes) { borrow = word - borrow; - word = ~(uint)borrow; - borrow = (uint)(borrow >> 32) & 0x1u; + word = ~(uint) borrow; + borrow = (uint) (borrow >> 32) & 0x1u; } result[i] = word; @@ -1705,7 +1705,7 @@ public static explicit operator BigInteger(decimal value) Array.Resize(ref result, i + 1); } - return new BigInteger(negRes ? (short)-1 : (short)1, result); + return new BigInteger(negRes ? (short) -1 : (short) 1, result); } /// @@ -1753,8 +1753,8 @@ public static explicit operator BigInteger(decimal value) if (ls == -1) { ac = ~va + ac; - va = (uint)ac; - ac = (uint)(ac >> 32); + va = (uint) ac; + ac = (uint) (ac >> 32); } uint vb = 0; @@ -1766,8 +1766,8 @@ public static explicit operator BigInteger(decimal value) if (rs == -1) { bc = ~vb + bc; - vb = (uint)bc; - bc = (uint)(bc >> 32); + vb = (uint) bc; + bc = (uint) (bc >> 32); } var word = va | vb; @@ -1775,8 +1775,8 @@ public static explicit operator BigInteger(decimal value) if (negRes) { borrow = word - borrow; - word = ~(uint)borrow; - borrow = (uint)(borrow >> 32) & 0x1u; + word = ~(uint) borrow; + borrow = (uint) (borrow >> 32) & 0x1u; } result[i] = word; @@ -1797,7 +1797,7 @@ public static explicit operator BigInteger(decimal value) Array.Resize(ref result, i + 1); } - return new BigInteger(negRes ? (short)-1 : (short)1, result); + return new BigInteger(negRes ? (short) -1 : (short) 1, result); } /// @@ -1845,8 +1845,8 @@ public static explicit operator BigInteger(decimal value) if (ls == -1) { ac = ~va + ac; - va = (uint)ac; - ac = (uint)(ac >> 32); + va = (uint) ac; + ac = (uint) (ac >> 32); } uint vb = 0; @@ -1858,8 +1858,8 @@ public static explicit operator BigInteger(decimal value) if (rs == -1) { bc = ~vb + bc; - vb = (uint)bc; - bc = (uint)(bc >> 32); + vb = (uint) bc; + bc = (uint) (bc >> 32); } var word = va ^ vb; @@ -1867,8 +1867,8 @@ public static explicit operator BigInteger(decimal value) if (negRes) { borrow = word - borrow; - word = ~(uint)borrow; - borrow = (uint)(borrow >> 32) & 0x1u; + word = ~(uint) borrow; + borrow = (uint) (borrow >> 32) & 0x1u; } result[i] = word; @@ -1889,7 +1889,7 @@ public static explicit operator BigInteger(decimal value) Array.Resize(ref result, i + 1); } - return new BigInteger(negRes ? (short)-1 : (short)1, result); + return new BigInteger(negRes ? (short) -1 : (short) 1, result); } /// @@ -1924,8 +1924,8 @@ public static explicit operator BigInteger(decimal value) if (sign == -1) { carry = ~word + carry; - word = (uint)carry; - carry = (uint)(carry >> 32); + word = (uint) carry; + carry = (uint) (carry >> 32); } word = ~word; @@ -1933,8 +1933,8 @@ public static explicit operator BigInteger(decimal value) if (negRes) { borrow = word - borrow; - word = ~(uint)borrow; - borrow = (uint)(borrow >> 32) & 0x1u; + word = ~(uint) borrow; + borrow = (uint) (borrow >> 32) & 0x1u; } result[i] = word; @@ -1955,7 +1955,7 @@ public static explicit operator BigInteger(decimal value) Array.Resize(ref result, i + 1); } - return new BigInteger(negRes ? (short)-1 : (short)1, result); + return new BigInteger(negRes ? (short) -1 : (short) 1, result); } /// @@ -2035,7 +2035,7 @@ private static int BitScanBackward(uint word) } } - return new BigInteger((short)sign, res); + return new BigInteger((short) sign, res); } /// @@ -2120,7 +2120,7 @@ private static int BitScanBackward(uint word) { if (data[i] != 0u) { - var tmp = new BigInteger((short)sign, res); + var tmp = new BigInteger((short) sign, res); --tmp; return tmp; } @@ -2128,13 +2128,13 @@ private static int BitScanBackward(uint word) if (bitShift > 0 && (data[idxShift] << carryShift) != 0u) { - var tmp = new BigInteger((short)sign, res); + var tmp = new BigInteger((short) sign, res); --tmp; return tmp; } } - return new BigInteger((short)sign, res); + return new BigInteger((short) sign, res); } /// @@ -3187,7 +3187,7 @@ private static bool Parse(string value, NumberStyles style, IFormatProvider fp, continue; } - number = (number * 10) + (byte)(value[pos++] - '0'); + number = (number * 10) + (byte) (value[pos++] - '0'); } // Post number stuff @@ -3358,7 +3358,7 @@ private static bool CheckStyle(NumberStyles style, bool tryParse, ref Exception return false; } } - else if ((uint)style > (uint)NumberStyles.Any) + else if ((uint) style > (uint) NumberStyles.Any) { if (!tryParse) { @@ -3786,7 +3786,7 @@ public static BigInteger DivRem(BigInteger dividend, BigInteger divisor, out Big Array.Resize(ref quotient, i + 1); } - return new BigInteger((short)(dividend._sign * divisor._sign), quotient); + return new BigInteger((short) (dividend._sign * divisor._sign), quotient); } /// @@ -3934,7 +3934,7 @@ public static BigInteger GreatestCommonDivisor(BigInteger left, BigInteger right */ var yy = x._data[0]; - var xx = (uint)(y % yy); + var xx = (uint) (y % yy); var t = 0; @@ -4024,7 +4024,7 @@ public static double Log(BigInteger value, double baseValue) tempBitlen -= int.MaxValue; } - testBit <<= (int)tempBitlen; + testBit <<= (int) tempBitlen; for (var curbit = bitlen; curbit >= 0; --curbit) { @@ -4283,8 +4283,8 @@ public readonly int CompareTo(ulong other) return 1; } - var high = (uint)(other >> 32); - var low = (uint)other; + var high = (uint) (other >> 32); + var low = (uint) other; return LongCompare(low, high); } @@ -4516,15 +4516,15 @@ public readonly byte[] ToByteArray() { var word = _data[i]; - res[j++] = (byte)word; - res[j++] = (byte)(word >> 8); - res[j++] = (byte)(word >> 16); - res[j++] = (byte)(word >> 24); + res[j++] = (byte) word; + res[j++] = (byte) (word >> 8); + res[j++] = (byte) (word >> 16); + res[j++] = (byte) (word >> 24); } while (extra-- > 0) { - res[j++] = (byte)topWord; + res[j++] = (byte) topWord; topWord >>= 8; } } @@ -4538,19 +4538,19 @@ public readonly byte[] ToByteArray() for (var i = 0; i < end; ++i) { word = _data[i]; - add = (ulong)~word + carry; - word = (uint)add; - carry = (uint)(add >> 32); - - res[j++] = (byte)word; - res[j++] = (byte)(word >> 8); - res[j++] = (byte)(word >> 16); - res[j++] = (byte)(word >> 24); + add = (ulong) ~word + carry; + word = (uint) add; + carry = (uint) (add >> 32); + + res[j++] = (byte) word; + res[j++] = (byte) (word >> 8); + res[j++] = (byte) (word >> 16); + res[j++] = (byte) (word >> 24); } - add = (ulong)~topWord + carry; - word = (uint)add; - carry = (uint)(add >> 32); + add = (ulong) ~topWord + carry; + word = (uint) add; + carry = (uint) (add >> 32); if (carry == 0) { var ex = FirstNonFfByte(word); @@ -4564,7 +4564,7 @@ public readonly byte[] ToByteArray() while (ex-- > 0) { - res[j++] = (byte)word; + res[j++] = (byte) word; word >>= 8; } @@ -4576,10 +4576,10 @@ public readonly byte[] ToByteArray() else { Array.Resize(ref res, bytes + 5); - res[j++] = (byte)word; - res[j++] = (byte)(word >> 8); - res[j++] = (byte)(word >> 16); - res[j++] = (byte)(word >> 24); + res[j++] = (byte) word; + res[j++] = (byte) (word >> 8); + res[j++] = (byte) (word >> 16); + res[j++] = (byte) (word >> 24); res[j++] = 0xFF; } } @@ -4607,21 +4607,21 @@ private static uint[] CoreAdd(uint[] a, uint[] b) for (; i < sl; i++) { sum = sum + a[i] + b[i]; - res[i] = (uint)sum; + res[i] = (uint) sum; sum >>= 32; } for (; i < bl; i++) { sum += a[i]; - res[i] = (uint)sum; + res[i] = (uint) sum; sum >>= 32; } if (sum != 0) { Array.Resize(ref res, bl + 1); - res[i] = (uint)sum; + res[i] = (uint) sum; } return res; @@ -4662,16 +4662,16 @@ private static uint[] CoreSub(uint[] a, uint[] b) int i; for (i = 0; i < sl; ++i) { - borrow = (ulong)a[i] - b[i] - borrow; + borrow = (ulong) a[i] - b[i] - borrow; - res[i] = (uint)borrow; + res[i] = (uint) borrow; borrow = (borrow >> 32) & 0x1; } for (; i < bl; i++) { - borrow = (ulong)a[i] - borrow; - res[i] = (uint)borrow; + borrow = (ulong) a[i] - borrow; + res[i] = (uint) borrow; borrow = (borrow >> 32) & 0x1; } @@ -4698,8 +4698,8 @@ private static uint[] CoreSub(uint[] a, uint b) int i; for (i = 0; i < len; i++) { - borrow = (ulong)a[i] - borrow; - res[i] = (uint)borrow; + borrow = (ulong) a[i] - borrow; + res[i] = (uint) borrow; borrow = (borrow >> 32) & 0x1; } @@ -4867,7 +4867,7 @@ private static void DivModUnsigned(uint[] u, uint[] v, out uint[] q, out uint[] var div = rem / v0; rem -= div * v0; - q[j] = (uint)div; + q[j] = (uint) div; } r[0] = (uint) rem; @@ -4899,7 +4899,7 @@ private static void DivModUnsigned(uint[] u, uint[] v, out uint[] q, out uint[] if ((qq >= Base) || (qq * vn[n - 2] > ((rr * Base) + un[j + n - 2]))) { qq--; - rr += (ulong)vn[n - 1]; + rr += (ulong) vn[n - 1]; if (rr < Base) { continue; @@ -4915,18 +4915,18 @@ private static void DivModUnsigned(uint[] u, uint[] v, out uint[] q, out uint[] for (i = 0; i < n; i++) { var p = vn[i] * qq; - t = (long)un[i + j] - (long)(uint)p - b; - un[i + j] = (uint)t; + t = (long) un[i + j] - (long) (uint) p - b; + un[i + j] = (uint) t; p >>= 32; t >>= 32; - b = (long)p - t; + b = (long) p - t; } - t = (long)un[j + n] - b; - un[j + n] = (uint)t; + t = (long) un[j + n] - b; + un[j + n] = (uint) t; // Store the calculated value - q[j] = (uint)qq; + q[j] = (uint) qq; // Add back vn[0..n] to un[j..j+n] if (t < 0) @@ -4935,13 +4935,13 @@ private static void DivModUnsigned(uint[] u, uint[] v, out uint[] q, out uint[] ulong c = 0; for (i = 0; i < n; i++) { - c = (ulong)vn[i] + un[j + i] + c; - un[j + i] = (uint)c; + c = (ulong) vn[i] + un[j + i] + c; + un[j + i] = (uint) c; c >>= 32; } - c += (ulong)un[j + n]; - un[j + n] = (uint)c; + c += (ulong) un[j + n]; + un[j + n] = (uint) c; } } diff --git a/src/Renci.SshNet/Common/DerData.cs b/src/Renci.SshNet/Common/DerData.cs index ba0a678dd..0359f1a55 100644 --- a/src/Renci.SshNet/Common/DerData.cs +++ b/src/Renci.SshNet/Common/DerData.cs @@ -189,7 +189,7 @@ public void Write(bool data) { _data.Add(Boolean); _data.Add(1); - _data.Add((byte)(data ? 1 : 0)); + _data.Add((byte) (data ? 1 : 0)); } /// @@ -246,7 +246,7 @@ public void Write(ObjectIdentifier identifier) var buffer = new byte[8]; var bufferIndex = buffer.Length - 1; - var current = (byte)(item & 0x7F); + var current = (byte) (item & 0x7F); do { buffer[bufferIndex] = current; @@ -256,7 +256,7 @@ public void Write(ObjectIdentifier identifier) } item >>= 7; - current = (byte)(item & 0x7F); + current = (byte) (item & 0x7F); bufferIndex--; } while (current > 0); @@ -329,11 +329,11 @@ private static byte[] GetLength(int length) } var data = new byte[size]; - data[0] = (byte)(size | 0x80); + data[0] = (byte) (size | 0x80); for (int i = (size - 1) * 8, j = 1; i >= 0; i -= 8, j++) { - data[j] = (byte)(length >> i); + data[j] = (byte) (length >> i); } return data; diff --git a/src/Renci.SshNet/Common/Extensions.cs b/src/Renci.SshNet/Common/Extensions.cs index 80fa8323d..c1dc1d571 100644 --- a/src/Renci.SshNet/Common/Extensions.cs +++ b/src/Renci.SshNet/Common/Extensions.cs @@ -5,6 +5,7 @@ using System.Net; using System.Net.Sockets; using System.Text; + using Renci.SshNet.Abstractions; using Renci.SshNet.Messages; diff --git a/src/Renci.SshNet/Common/PacketDump.cs b/src/Renci.SshNet/Common/PacketDump.cs index 47329f6d0..aabcc8275 100644 --- a/src/Renci.SshNet/Common/PacketDump.cs +++ b/src/Renci.SshNet/Common/PacketDump.cs @@ -30,7 +30,7 @@ public static string Create(byte[] data, int indentLevel) var line = new byte[lineWidth]; var indentChars = new string(' ', indentLevel); - for (var pos = 0; pos < data.Length; ) + for (var pos = 0; pos < data.Length;) { var linePos = 0; diff --git a/src/Renci.SshNet/Common/SshConnectionException.cs b/src/Renci.SshNet/Common/SshConnectionException.cs index d4c46011d..6ab36871a 100644 --- a/src/Renci.SshNet/Common/SshConnectionException.cs +++ b/src/Renci.SshNet/Common/SshConnectionException.cs @@ -1,6 +1,7 @@ using System; #if NETFRAMEWORK using System.Runtime.Serialization; + #endif // NETFRAMEWORK using Renci.SshNet.Messages.Transport; diff --git a/src/Renci.SshNet/Common/SshDataStream.cs b/src/Renci.SshNet/Common/SshDataStream.cs index 5fb40adcf..9083c26b0 100644 --- a/src/Renci.SshNet/Common/SshDataStream.cs +++ b/src/Renci.SshNet/Common/SshDataStream.cs @@ -154,7 +154,7 @@ public byte[] ReadBinary() throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "Data longer than {0} is not supported.", int.MaxValue)); } - return ReadBytes((int)length); + return ReadBytes((int) length); } /// diff --git a/src/Renci.SshNet/Connection/ProxyConnector.cs b/src/Renci.SshNet/Connection/ProxyConnector.cs index d8261e024..68eb5921a 100644 --- a/src/Renci.SshNet/Connection/ProxyConnector.cs +++ b/src/Renci.SshNet/Connection/ProxyConnector.cs @@ -28,7 +28,7 @@ Task HandleProxyConnectAsync(IConnectionInfo connectionInfo, Socket socket, Canc cancellationToken.ThrowIfCancellationRequested(); #if NET || NETSTANDARD2_1_OR_GREATER - await using (cancellationToken.Register(o => ((Socket)o).Dispose(), socket, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) + await using (cancellationToken.Register(o => ((Socket) o).Dispose(), socket, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) #else using (cancellationToken.Register(o => ((Socket) o).Dispose(), socket, useSynchronizationContext: false)) #endif // NET || NETSTANDARD2_1_OR_GREATER diff --git a/src/Renci.SshNet/Connection/Socks4Connector.cs b/src/Renci.SshNet/Connection/Socks4Connector.cs index e3e9800f0..d6a1971c0 100644 --- a/src/Renci.SshNet/Connection/Socks4Connector.cs +++ b/src/Renci.SshNet/Connection/Socks4Connector.cs @@ -28,7 +28,7 @@ public Socks4Connector(ISocketFactory socketFactory) /// The . protected override void HandleProxyConnect(IConnectionInfo connectionInfo, Socket socket) { - var connectionRequest = CreateSocks4ConnectionRequest(connectionInfo.Host, (ushort)connectionInfo.Port, connectionInfo.ProxyUsername); + var connectionRequest = CreateSocks4ConnectionRequest(connectionInfo.Host, (ushort) connectionInfo.Port, connectionInfo.ProxyUsername); SocketAbstraction.Send(socket, connectionRequest); // Read reply version diff --git a/src/Renci.SshNet/Connection/Socks5Connector.cs b/src/Renci.SshNet/Connection/Socks5Connector.cs index ecd286e00..35cb0d718 100644 --- a/src/Renci.SshNet/Connection/Socks5Connector.cs +++ b/src/Renci.SshNet/Connection/Socks5Connector.cs @@ -133,7 +133,7 @@ protected override void HandleProxyConnect(IConnectionInfo connectionInfo, Socke break; case 0x04: var ipv6 = new byte[16]; - _ =SocketRead(socket, ipv6, 0, 16); + _ = SocketRead(socket, ipv6, 0, 16); break; default: throw new ProxyException(string.Format("Address type '{0}' is not supported.", addressType)); @@ -191,7 +191,7 @@ private static byte[] CreateSocks5UserNameAndPasswordAuthenticationRequest(strin authenticationRequest[index++] = (byte) password.Length; // Password - _ =SshData.Ascii.GetBytes(password, 0, password.Length, authenticationRequest, index); + _ = SshData.Ascii.GetBytes(password, 0, password.Length, authenticationRequest, index); return authenticationRequest; } diff --git a/src/Renci.SshNet/ForwardedPortStatus.cs b/src/Renci.SshNet/ForwardedPortStatus.cs index 5695e28c7..8a00b1c56 100644 --- a/src/Renci.SshNet/ForwardedPortStatus.cs +++ b/src/Renci.SshNet/ForwardedPortStatus.cs @@ -50,7 +50,7 @@ public override bool Equals(object obj) public static bool operator !=(ForwardedPortStatus left, ForwardedPortStatus right) { - return !(left==right); + return !(left == right); } public override int GetHashCode() diff --git a/src/Renci.SshNet/ISubsystemSession.cs b/src/Renci.SshNet/ISubsystemSession.cs index f1fe6f914..44e190825 100644 --- a/src/Renci.SshNet/ISubsystemSession.cs +++ b/src/Renci.SshNet/ISubsystemSession.cs @@ -1,5 +1,6 @@ using System; using System.Threading; + using Renci.SshNet.Common; namespace Renci.SshNet diff --git a/src/Renci.SshNet/KeyboardInteractiveConnectionInfo.cs b/src/Renci.SshNet/KeyboardInteractiveConnectionInfo.cs index a2738796a..4828b62b2 100644 --- a/src/Renci.SshNet/KeyboardInteractiveConnectionInfo.cs +++ b/src/Renci.SshNet/KeyboardInteractiveConnectionInfo.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Common; namespace Renci.SshNet diff --git a/src/Renci.SshNet/Messages/Authentication/InformationRequestMessage.cs b/src/Renci.SshNet/Messages/Authentication/InformationRequestMessage.cs index 9a45bcf2b..22914aaf8 100644 --- a/src/Renci.SshNet/Messages/Authentication/InformationRequestMessage.cs +++ b/src/Renci.SshNet/Messages/Authentication/InformationRequestMessage.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Text; + using Renci.SshNet.Common; namespace Renci.SshNet.Messages.Authentication diff --git a/src/Renci.SshNet/Messages/Authentication/RequestMessage.cs b/src/Renci.SshNet/Messages/Authentication/RequestMessage.cs index 58daa10fc..9fdbfaede 100644 --- a/src/Renci.SshNet/Messages/Authentication/RequestMessage.cs +++ b/src/Renci.SshNet/Messages/Authentication/RequestMessage.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Common; namespace Renci.SshNet.Messages.Authentication diff --git a/src/Renci.SshNet/Messages/Connection/ChannelRequest/PseudoTerminalRequestInfo.cs b/src/Renci.SshNet/Messages/Connection/ChannelRequest/PseudoTerminalRequestInfo.cs index 82df2712f..22801a90b 100644 --- a/src/Renci.SshNet/Messages/Connection/ChannelRequest/PseudoTerminalRequestInfo.cs +++ b/src/Renci.SshNet/Messages/Connection/ChannelRequest/PseudoTerminalRequestInfo.cs @@ -141,7 +141,7 @@ protected override void SaveData() // write total length of encoded terminal modes, which is 1 bytes for the opcode / terminal mode // and 4 bytes for the uint argument for each entry; the encoded terminal modes are terminated by // opcode TTY_OP_END (which is 1 byte) - Write(((uint) TerminalModeValues.Count*(1 + 4)) + 1); + Write(((uint) TerminalModeValues.Count * (1 + 4)) + 1); foreach (var item in TerminalModeValues) { diff --git a/src/Renci.SshNet/Messages/Message.cs b/src/Renci.SshNet/Messages/Message.cs index b5c43acaf..eaa5622b3 100644 --- a/src/Renci.SshNet/Messages/Message.cs +++ b/src/Renci.SshNet/Messages/Message.cs @@ -144,7 +144,7 @@ private static uint GetPacketDataLength(int messageLength, byte paddingLength) private static byte GetPaddingLength(byte paddingMultiplier, long packetLength) { - var paddingLength = (byte)((-packetLength) & (paddingMultiplier - 1)); + var paddingLength = (byte) ((-packetLength) & (paddingMultiplier - 1)); if (paddingLength < paddingMultiplier) { diff --git a/src/Renci.SshNet/Messages/Transport/KeyExchangeEcdhInitMessage.cs b/src/Renci.SshNet/Messages/Transport/KeyExchangeEcdhInitMessage.cs index ab5bc1c85..8f3ecee56 100644 --- a/src/Renci.SshNet/Messages/Transport/KeyExchangeEcdhInitMessage.cs +++ b/src/Renci.SshNet/Messages/Transport/KeyExchangeEcdhInitMessage.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Common; namespace Renci.SshNet.Messages.Transport diff --git a/src/Renci.SshNet/Messages/Transport/ServiceAcceptMessage.cs b/src/Renci.SshNet/Messages/Transport/ServiceAcceptMessage.cs index ce16d9fd4..6afa55699 100644 --- a/src/Renci.SshNet/Messages/Transport/ServiceAcceptMessage.cs +++ b/src/Renci.SshNet/Messages/Transport/ServiceAcceptMessage.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Common; namespace Renci.SshNet.Messages.Transport diff --git a/src/Renci.SshNet/Messages/Transport/ServiceRequestMessage.cs b/src/Renci.SshNet/Messages/Transport/ServiceRequestMessage.cs index c7b6a6cbf..aaf451e67 100644 --- a/src/Renci.SshNet/Messages/Transport/ServiceRequestMessage.cs +++ b/src/Renci.SshNet/Messages/Transport/ServiceRequestMessage.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Common; namespace Renci.SshNet.Messages.Transport diff --git a/src/Renci.SshNet/PasswordConnectionInfo.cs b/src/Renci.SshNet/PasswordConnectionInfo.cs index 072b32147..8953a0c29 100644 --- a/src/Renci.SshNet/PasswordConnectionInfo.cs +++ b/src/Renci.SshNet/PasswordConnectionInfo.cs @@ -1,6 +1,7 @@ using System; using System.Net; using System.Text; + using Renci.SshNet.Common; namespace Renci.SshNet diff --git a/src/Renci.SshNet/PrivateKeyAuthenticationMethod.cs b/src/Renci.SshNet/PrivateKeyAuthenticationMethod.cs index dadc7025e..30ed82548 100644 --- a/src/Renci.SshNet/PrivateKeyAuthenticationMethod.cs +++ b/src/Renci.SshNet/PrivateKeyAuthenticationMethod.cs @@ -250,7 +250,7 @@ protected override void SaveData() WriteBinaryString(_message.Username); WriteBinaryString(_serviceName); WriteBinaryString(_authenticationMethod); - Write((byte)1); // TRUE + Write((byte) 1); // TRUE WriteBinaryString(_message.PublicKeyAlgorithmName); WriteBinaryString(_message.PublicKeyData); } diff --git a/src/Renci.SshNet/PrivateKeyFile.cs b/src/Renci.SshNet/PrivateKeyFile.cs index 68408536a..ea192ce7b 100644 --- a/src/Renci.SshNet/PrivateKeyFile.cs +++ b/src/Renci.SshNet/PrivateKeyFile.cs @@ -288,7 +288,7 @@ private void Open(Stream privateKey, string passPhrase) _ = reader.ReadUInt32(); // Read total bytes length including magic number var keyType = reader.ReadString(SshData.Ascii); var ssh2CipherName = reader.ReadString(SshData.Ascii); - var blobSize = (int)reader.ReadUInt32(); + var blobSize = (int) reader.ReadUInt32(); byte[] keyData; if (ssh2CipherName == "none") @@ -468,7 +468,7 @@ private static Key ParseOpenSshV1Key(byte[] keyFileData, string passPhrase) var kdfName = keyReader.ReadString(Encoding.UTF8); // kdf options length: 24 if passphrase, 0 if no passphrase - var kdfOptionsLen = (int)keyReader.ReadUInt32(); + var kdfOptionsLen = (int) keyReader.ReadUInt32(); byte[] salt = null; var rounds = 0; if (kdfOptionsLen > 0) @@ -479,7 +479,7 @@ private static Key ParseOpenSshV1Key(byte[] keyFileData, string passPhrase) } // number of public keys, only supporting 1 for now - var numberOfPublicKeys = (int)keyReader.ReadUInt32(); + var numberOfPublicKeys = (int) keyReader.ReadUInt32(); if (numberOfPublicKeys != 1) { throw new SshException("At this time only one public key in the openssh key is supported."); @@ -715,7 +715,7 @@ public BigInteger ReadBignum() public byte[] ReadBignum2() { - var length = (int)base.ReadUInt32(); + var length = (int) base.ReadUInt32(); return base.ReadBytes(length); } diff --git a/src/Renci.SshNet/Security/Cryptography/BlockCipher.cs b/src/Renci.SshNet/Security/Cryptography/BlockCipher.cs index 3e7e6541a..1fb050072 100644 --- a/src/Renci.SshNet/Security/Cryptography/BlockCipher.cs +++ b/src/Renci.SshNet/Security/Cryptography/BlockCipher.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Security.Cryptography.Ciphers; namespace Renci.SshNet.Security.Cryptography diff --git a/src/Renci.SshNet/Security/Cryptography/CipherDigitalSignature.cs b/src/Renci.SshNet/Security/Cryptography/CipherDigitalSignature.cs index e61b5d655..c2703446f 100644 --- a/src/Renci.SshNet/Security/Cryptography/CipherDigitalSignature.cs +++ b/src/Renci.SshNet/Security/Cryptography/CipherDigitalSignature.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Common; namespace Renci.SshNet.Security.Cryptography diff --git a/src/Renci.SshNet/Security/Cryptography/Ciphers/AesCipher.CtrImpl.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/AesCipher.CtrImpl.cs index dacaf4a79..773736c9a 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/AesCipher.CtrImpl.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/AesCipher.CtrImpl.cs @@ -87,7 +87,7 @@ private byte[] CTREncryptDecrypt(byte[] data, int offset, int length) #if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER - // creates the Counter array filled with incrementing copies of IV + // creates the Counter array filled with incrementing copies of IV private void CTRCreateCounterArray(byte[] buffer) { for (var i = 0; i < buffer.Length; i += 16) diff --git a/src/Renci.SshNet/Security/Cryptography/Ciphers/Arc4Cipher.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/Arc4Cipher.cs index aed9683b8..3c60ad19b 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/Arc4Cipher.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/Arc4Cipher.cs @@ -103,7 +103,7 @@ private int ProcessBytes(byte[] inputBuffer, int inputOffset, int inputCount, by _engineState[_y] = tmp; // xor - outputBuffer[i + outputOffset] = (byte)(inputBuffer[i + inputOffset] ^ _engineState[(_engineState[_x] + _engineState[_y]) & 0xff]); + outputBuffer[i + outputOffset] = (byte) (inputBuffer[i + inputOffset] ^ _engineState[(_engineState[_x] + _engineState[_y]) & 0xff]); } return inputCount; diff --git a/src/Renci.SshNet/Security/Cryptography/Ciphers/BlowfishCipher.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/BlowfishCipher.cs index 6e04c999c..598a8621d 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/BlowfishCipher.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/BlowfishCipher.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Common; namespace Renci.SshNet.Security.Cryptography.Ciphers diff --git a/src/Renci.SshNet/Security/Cryptography/Ciphers/CastCipher.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/CastCipher.cs index d23887856..0fa0c9c58 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/CastCipher.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/CastCipher.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Common; namespace Renci.SshNet.Security.Cryptography.Ciphers @@ -514,10 +515,10 @@ private void SetKey(byte[] key) Bits32ToInts(z8B, z, 0x8); zCf = x47 ^ S5[z[0xA]] ^ S6[z[0x9]] ^ S7[z[0xB]] ^ S8[z[0x8]] ^ S6[x[0xB]]; Bits32ToInts(zCf, z, 0xC); - _kr[1] = (int)((S5[z[0x8]] ^ S6[z[0x9]] ^ S7[z[0x7]] ^ S8[z[0x6]] ^ S5[z[0x2]]) & 0x1f); - _kr[2] = (int)((S5[z[0xA]] ^ S6[z[0xB]] ^ S7[z[0x5]] ^ S8[z[0x4]] ^ S6[z[0x6]]) & 0x1f); - _kr[3] = (int)((S5[z[0xC]] ^ S6[z[0xD]] ^ S7[z[0x3]] ^ S8[z[0x2]] ^ S7[z[0x9]]) & 0x1f); - _kr[4] = (int)((S5[z[0xE]] ^ S6[z[0xF]] ^ S7[z[0x1]] ^ S8[z[0x0]] ^ S8[z[0xC]]) & 0x1f); + _kr[1] = (int) ((S5[z[0x8]] ^ S6[z[0x9]] ^ S7[z[0x7]] ^ S8[z[0x6]] ^ S5[z[0x2]]) & 0x1f); + _kr[2] = (int) ((S5[z[0xA]] ^ S6[z[0xB]] ^ S7[z[0x5]] ^ S8[z[0x4]] ^ S6[z[0x6]]) & 0x1f); + _kr[3] = (int) ((S5[z[0xC]] ^ S6[z[0xD]] ^ S7[z[0x3]] ^ S8[z[0x2]] ^ S7[z[0x9]]) & 0x1f); + _kr[4] = (int) ((S5[z[0xE]] ^ S6[z[0xF]] ^ S7[z[0x1]] ^ S8[z[0x0]] ^ S8[z[0xC]]) & 0x1f); z03 = IntsTo32Bits(z, 0x0); z47 = IntsTo32Bits(z, 0x4); @@ -531,10 +532,10 @@ private void SetKey(byte[] key) Bits32ToInts(x8B, x, 0x8); xCf = zCf ^ S5[x[0xA]] ^ S6[x[0x9]] ^ S7[x[0xB]] ^ S8[x[0x8]] ^ S6[z[0x3]]; Bits32ToInts(xCf, x, 0xC); - _kr[5] = (int)((S5[x[0x3]] ^ S6[x[0x2]] ^ S7[x[0xC]] ^ S8[x[0xD]] ^ S5[x[0x8]]) & 0x1f); - _kr[6] = (int)((S5[x[0x1]] ^ S6[x[0x0]] ^ S7[x[0xE]] ^ S8[x[0xF]] ^ S6[x[0xD]]) & 0x1f); - _kr[7] = (int)((S5[x[0x7]] ^ S6[x[0x6]] ^ S7[x[0x8]] ^ S8[x[0x9]] ^ S7[x[0x3]]) & 0x1f); - _kr[8] = (int)((S5[x[0x5]] ^ S6[x[0x4]] ^ S7[x[0xA]] ^ S8[x[0xB]] ^ S8[x[0x7]]) & 0x1f); + _kr[5] = (int) ((S5[x[0x3]] ^ S6[x[0x2]] ^ S7[x[0xC]] ^ S8[x[0xD]] ^ S5[x[0x8]]) & 0x1f); + _kr[6] = (int) ((S5[x[0x1]] ^ S6[x[0x0]] ^ S7[x[0xE]] ^ S8[x[0xF]] ^ S6[x[0xD]]) & 0x1f); + _kr[7] = (int) ((S5[x[0x7]] ^ S6[x[0x6]] ^ S7[x[0x8]] ^ S8[x[0x9]] ^ S7[x[0x3]]) & 0x1f); + _kr[8] = (int) ((S5[x[0x5]] ^ S6[x[0x4]] ^ S7[x[0xA]] ^ S8[x[0xB]] ^ S8[x[0x7]]) & 0x1f); x03 = IntsTo32Bits(x, 0x0); x47 = IntsTo32Bits(x, 0x4); @@ -548,10 +549,10 @@ private void SetKey(byte[] key) Bits32ToInts(z8B, z, 0x8); zCf = x47 ^ S5[z[0xA]] ^ S6[z[0x9]] ^ S7[z[0xB]] ^ S8[z[0x8]] ^ S6[x[0xB]]; Bits32ToInts(zCf, z, 0xC); - _kr[9] = (int)((S5[z[0x3]] ^ S6[z[0x2]] ^ S7[z[0xC]] ^ S8[z[0xD]] ^ S5[z[0x9]]) & 0x1f); - _kr[10] = (int)((S5[z[0x1]] ^ S6[z[0x0]] ^ S7[z[0xE]] ^ S8[z[0xF]] ^ S6[z[0xc]]) & 0x1f); - _kr[11] = (int)((S5[z[0x7]] ^ S6[z[0x6]] ^ S7[z[0x8]] ^ S8[z[0x9]] ^ S7[z[0x2]]) & 0x1f); - _kr[12] = (int)((S5[z[0x5]] ^ S6[z[0x4]] ^ S7[z[0xA]] ^ S8[z[0xB]] ^ S8[z[0x6]]) & 0x1f); + _kr[9] = (int) ((S5[z[0x3]] ^ S6[z[0x2]] ^ S7[z[0xC]] ^ S8[z[0xD]] ^ S5[z[0x9]]) & 0x1f); + _kr[10] = (int) ((S5[z[0x1]] ^ S6[z[0x0]] ^ S7[z[0xE]] ^ S8[z[0xF]] ^ S6[z[0xc]]) & 0x1f); + _kr[11] = (int) ((S5[z[0x7]] ^ S6[z[0x6]] ^ S7[z[0x8]] ^ S8[z[0x9]] ^ S7[z[0x2]]) & 0x1f); + _kr[12] = (int) ((S5[z[0x5]] ^ S6[z[0x4]] ^ S7[z[0xA]] ^ S8[z[0xB]] ^ S8[z[0x6]]) & 0x1f); z03 = IntsTo32Bits(z, 0x0); z47 = IntsTo32Bits(z, 0x4); @@ -565,10 +566,10 @@ private void SetKey(byte[] key) Bits32ToInts(x8B, x, 0x8); xCf = zCf ^ S5[x[0xA]] ^ S6[x[0x9]] ^ S7[x[0xB]] ^ S8[x[0x8]] ^ S6[z[0x3]]; Bits32ToInts(xCf, x, 0xC); - _kr[13] = (int)((S5[x[0x8]] ^ S6[x[0x9]] ^ S7[x[0x7]] ^ S8[x[0x6]] ^ S5[x[0x3]]) & 0x1f); - _kr[14] = (int)((S5[x[0xA]] ^ S6[x[0xB]] ^ S7[x[0x5]] ^ S8[x[0x4]] ^ S6[x[0x7]]) & 0x1f); - _kr[15] = (int)((S5[x[0xC]] ^ S6[x[0xD]] ^ S7[x[0x3]] ^ S8[x[0x2]] ^ S7[x[0x8]]) & 0x1f); - _kr[16] = (int)((S5[x[0xE]] ^ S6[x[0xF]] ^ S7[x[0x1]] ^ S8[x[0x0]] ^ S8[x[0xD]]) & 0x1f); + _kr[13] = (int) ((S5[x[0x8]] ^ S6[x[0x9]] ^ S7[x[0x7]] ^ S8[x[0x6]] ^ S5[x[0x3]]) & 0x1f); + _kr[14] = (int) ((S5[x[0xA]] ^ S6[x[0xB]] ^ S7[x[0x5]] ^ S8[x[0x4]] ^ S6[x[0x7]]) & 0x1f); + _kr[15] = (int) ((S5[x[0xC]] ^ S6[x[0xD]] ^ S7[x[0x3]] ^ S8[x[0x2]] ^ S7[x[0x8]]) & 0x1f); + _kr[16] = (int) ((S5[x[0xE]] ^ S6[x[0xF]] ^ S7[x[0x1]] ^ S8[x[0x0]] ^ S8[x[0xD]]) & 0x1f); } /// diff --git a/src/Renci.SshNet/Security/Cryptography/Ciphers/DesCipher.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/DesCipher.cs index f2d2e4035..9679b8397 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/DesCipher.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/DesCipher.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Common; namespace Renci.SshNet.Security.Cryptography.Ciphers @@ -429,7 +430,7 @@ protected static void DesFunc(int[] wKey, byte[] input, int inOff, byte[] outByt for (var round = 0; round < 8; round++) { work = (right << 28) | (right >> 4); - work ^= (uint)wKey[(round * 4) + 0]; + work ^= (uint) wKey[(round * 4) + 0]; var fval = Sp7[work & 0x3f]; fval |= Sp5[(work >> 8) & 0x3f]; fval |= Sp3[(work >> 16) & 0x3f]; @@ -441,12 +442,12 @@ protected static void DesFunc(int[] wKey, byte[] input, int inOff, byte[] outByt fval |= Sp2[(work >> 24) & 0x3f]; left ^= fval; work = (left << 28) | (left >> 4); - work ^= (uint)wKey[(round * 4) + 2]; + work ^= (uint) wKey[(round * 4) + 2]; fval = Sp7[work & 0x3f]; fval |= Sp5[(work >> 8) & 0x3f]; fval |= Sp3[(work >> 16) & 0x3f]; fval |= Sp1[(work >> 24) & 0x3f]; - work = left ^ (uint)wKey[(round * 4) + 3]; + work = left ^ (uint) wKey[(round * 4) + 3]; fval |= Sp8[work & 0x3f]; fval |= Sp6[(work >> 8) & 0x3f]; fval |= Sp4[(work >> 16) & 0x3f]; diff --git a/src/Renci.SshNet/Security/Cryptography/Ciphers/Modes/CfbCipherMode.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/Modes/CfbCipherMode.cs index 23a4bb2f7..fcc352123 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/Modes/CfbCipherMode.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/Modes/CfbCipherMode.cs @@ -52,7 +52,7 @@ public override int EncryptBlock(byte[] inputBuffer, int inputOffset, int inputC for (var i = 0; i < _blockSize; i++) { - outputBuffer[outputOffset + i] = (byte)(_ivOutput[i] ^ inputBuffer[inputOffset + i]); + outputBuffer[outputOffset + i] = (byte) (_ivOutput[i] ^ inputBuffer[inputOffset + i]); } Buffer.BlockCopy(IV, _blockSize, IV, 0, IV.Length - _blockSize); @@ -96,7 +96,7 @@ public override int DecryptBlock(byte[] inputBuffer, int inputOffset, int inputC for (var i = 0; i < _blockSize; i++) { - outputBuffer[outputOffset + i] = (byte)(_ivOutput[i] ^ inputBuffer[inputOffset + i]); + outputBuffer[outputOffset + i] = (byte) (_ivOutput[i] ^ inputBuffer[inputOffset + i]); } return _blockSize; diff --git a/src/Renci.SshNet/Security/Cryptography/Ciphers/Modes/CtrCipherMode.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/Modes/CtrCipherMode.cs index a0ae5010b..fe06b55a0 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/Modes/CtrCipherMode.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/Modes/CtrCipherMode.cs @@ -52,7 +52,7 @@ public override int EncryptBlock(byte[] inputBuffer, int inputOffset, int inputC for (var i = 0; i < _blockSize; i++) { - outputBuffer[outputOffset + i] = (byte)(_ivOutput[i] ^ inputBuffer[inputOffset + i]); + outputBuffer[outputOffset + i] = (byte) (_ivOutput[i] ^ inputBuffer[inputOffset + i]); } var j = IV.Length; diff --git a/src/Renci.SshNet/Security/Cryptography/Ciphers/RsaCipher.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/RsaCipher.cs index acfb3fc9a..c51f56898 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/RsaCipher.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/RsaCipher.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Common; namespace Renci.SshNet.Security.Cryptography.Ciphers diff --git a/src/Renci.SshNet/Security/Cryptography/Ciphers/SerpentCipher.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/SerpentCipher.cs index 6f19e176d..396ec5dbd 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/SerpentCipher.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/SerpentCipher.cs @@ -8,7 +8,7 @@ namespace Renci.SshNet.Security.Cryptography.Ciphers public sealed class SerpentCipher : BlockCipher { private const int Rounds = 32; - private const int Phi = unchecked((int)0x9E3779B9); // (Sqrt(5) - 1) * 2**31 + private const int Phi = unchecked((int) 0x9E3779B9); // (Sqrt(5) - 1) * 2**31 private readonly int[] _workingKey; @@ -686,9 +686,9 @@ private static int BytesToWord(byte[] src, int srcOff) private static void WordToBytes(int word, byte[] dst, int dstOff) { dst[dstOff + 3] = (byte) word; - dst[dstOff + 2] = (byte) ((uint)word >> 8); - dst[dstOff + 1] = (byte) ((uint)word >> 16); - dst[dstOff] = (byte) ((uint)word >> 24); + dst[dstOff + 2] = (byte) ((uint) word >> 8); + dst[dstOff + 1] = (byte) ((uint) word >> 16); + dst[dstOff] = (byte) ((uint) word >> 24); } /* diff --git a/src/Renci.SshNet/Security/Cryptography/Ciphers/TwofishCipher.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/TwofishCipher.cs index 7ef039cc3..067016156 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/TwofishCipher.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/TwofishCipher.cs @@ -145,14 +145,14 @@ public override int EncryptBlock(byte[] inputBuffer, int inputOffset, int inputC var t0 = Fe32_0(_gSBox, x0); var t1 = Fe32_3(_gSBox, x1); x2 ^= t0 + t1 + _gSubKeys[k++]; - x2 = (int)((uint)x2 >> 1) | x2 << 31; - x3 = (x3 << 1 | (int)((uint)x3 >> 31)) ^ (t0 + (2 * t1) + _gSubKeys[k++]); + x2 = (int) ((uint) x2 >> 1) | x2 << 31; + x3 = (x3 << 1 | (int) ((uint) x3 >> 31)) ^ (t0 + (2 * t1) + _gSubKeys[k++]); t0 = Fe32_0(_gSBox, x2); t1 = Fe32_3(_gSBox, x3); x0 ^= t0 + t1 + _gSubKeys[k++]; - x0 = (int)((uint)x0 >> 1) | x0 << 31; - x1 = (x1 << 1 | (int)((uint)x1 >> 31)) ^ (t0 + (2 * t1) + _gSubKeys[k++]); + x0 = (int) ((uint) x0 >> 1) | x0 << 31; + x1 = (x1 << 1 | (int) ((uint) x1 >> 31)) ^ (t0 + (2 * t1) + _gSubKeys[k++]); } Bits32ToBytes(x2 ^ _gSubKeys[OUTPUT_WHITEN], outputBuffer, outputOffset); @@ -283,11 +283,11 @@ private void SetKey(byte[] key) var q = i * SK_STEP; var a = F32(q, k32e); var b = F32(q + SK_BUMP, k32o); - b = b << 8 | (int)((uint)b >> 24); + b = b << 8 | (int) ((uint) b >> 24); a += b; _gSubKeys[i * 2] = a; a += b; - _gSubKeys[(i * 2) + 1] = a << SK_ROTL | (int)((uint)a >> (32 - SK_ROTL)); + _gSubKeys[(i * 2) + 1] = a << SK_ROTL | (int) ((uint) a >> (32 - SK_ROTL)); } /* @@ -467,37 +467,37 @@ private static int M_b0(int x) private static int M_b1(int x) #pragma warning restore IDE1006 // Naming Styles { - return (int)((uint)x >> 8) & 0xff; + return (int) ((uint) x >> 8) & 0xff; } #pragma warning disable IDE1006 // Naming Styles private static int M_b2(int x) #pragma warning restore IDE1006 // Naming Styles { - return (int)((uint)x >> 16) & 0xff; + return (int) ((uint) x >> 16) & 0xff; } #pragma warning disable IDE1006 // Naming Styles private static int M_b3(int x) #pragma warning restore IDE1006 // Naming Styles { - return (int)((uint)x >> 24) & 0xff; + return (int) ((uint) x >> 24) & 0xff; } private static int Fe32_0(int[] gSBox1, int x) { return gSBox1[0x000 + (2 * (x & 0xff))] ^ - gSBox1[0x001 + (2 * ((int)((uint)x >> 8) & 0xff))] ^ - gSBox1[0x200 + (2 * ((int)((uint)x >> 16) & 0xff))] ^ - gSBox1[0x201 + (2 * ((int)((uint)x >> 24) & 0xff))]; + gSBox1[0x001 + (2 * ((int) ((uint) x >> 8) & 0xff))] ^ + gSBox1[0x200 + (2 * ((int) ((uint) x >> 16) & 0xff))] ^ + gSBox1[0x201 + (2 * ((int) ((uint) x >> 24) & 0xff))]; } private static int Fe32_3(int[] gSBox1, int x) { return gSBox1[0x000 + (2 * ((int) ((uint) x >> 24) & 0xff))] ^ gSBox1[0x001 + (2 * (x & 0xff))] ^ - gSBox1[0x200 + (2 * ((int)((uint)x >> 8) & 0xff))] ^ - gSBox1[0x201 + (2 * ((int)((uint)x >> 16) & 0xff))]; + gSBox1[0x200 + (2 * ((int) ((uint) x >> 8) & 0xff))] ^ + gSBox1[0x201 + (2 * ((int) ((uint) x >> 16) & 0xff))]; } private static int BytesTo32Bits(byte[] b, int p) @@ -510,10 +510,10 @@ private static int BytesTo32Bits(byte[] b, int p) private static void Bits32ToBytes(int inData, byte[] b, int offset) { - b[offset] = (byte)inData; - b[offset + 1] = (byte)(inData >> 8); - b[offset + 2] = (byte)(inData >> 16); - b[offset + 3] = (byte)(inData >> 24); + b[offset] = (byte) inData; + b[offset + 1] = (byte) (inData >> 8); + b[offset + 2] = (byte) (inData >> 16); + b[offset + 3] = (byte) (inData >> 24); } } } diff --git a/src/Renci.SshNet/Security/Cryptography/ED25519DigitalSignature.cs b/src/Renci.SshNet/Security/Cryptography/ED25519DigitalSignature.cs index 2d3cdb956..5b39b09ff 100644 --- a/src/Renci.SshNet/Security/Cryptography/ED25519DigitalSignature.cs +++ b/src/Renci.SshNet/Security/Cryptography/ED25519DigitalSignature.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Common; using Renci.SshNet.Security.Chaos.NaCl; diff --git a/src/Renci.SshNet/Security/Cryptography/EcdsaKey.cs b/src/Renci.SshNet/Security/Cryptography/EcdsaKey.cs index 6bf244bc4..19db7d810 100644 --- a/src/Renci.SshNet/Security/Cryptography/EcdsaKey.cs +++ b/src/Renci.SshNet/Security/Cryptography/EcdsaKey.cs @@ -159,7 +159,7 @@ public override BigInteger[] Public KeyBlobMagicNumber magic; using (var br = new BinaryReader(new MemoryStream(blob))) { - magic = (KeyBlobMagicNumber)br.ReadInt32(); + magic = (KeyBlobMagicNumber) br.ReadInt32(); var cbKey = br.ReadInt32(); qx = br.ReadBytes(cbKey); qy = br.ReadBytes(cbKey); @@ -388,7 +388,7 @@ private void Import(string curve_oid, byte[] publickey, byte[] privatekey) var blob = new byte[blobSize]; using (var bw = new BinaryWriter(new MemoryStream(blob))) { - bw.Write((int)curve_magic); + bw.Write((int) curve_magic); bw.Write(cord_size); bw.Write(qx); // q.x bw.Write(qy); // q.y diff --git a/src/Renci.SshNet/Security/Cryptography/HMACMD5.cs b/src/Renci.SshNet/Security/Cryptography/HMACMD5.cs index 83bb31f34..b0c1e1431 100644 --- a/src/Renci.SshNet/Security/Cryptography/HMACMD5.cs +++ b/src/Renci.SshNet/Security/Cryptography/HMACMD5.cs @@ -1,4 +1,5 @@ using System.Security.Cryptography; + using Renci.SshNet.Common; namespace Renci.SshNet.Security.Cryptography diff --git a/src/Renci.SshNet/Security/Cryptography/HMACSHA256.cs b/src/Renci.SshNet/Security/Cryptography/HMACSHA256.cs index 20f752a86..e0f230a1a 100644 --- a/src/Renci.SshNet/Security/Cryptography/HMACSHA256.cs +++ b/src/Renci.SshNet/Security/Cryptography/HMACSHA256.cs @@ -1,4 +1,5 @@ using System.Security.Cryptography; + using Renci.SshNet.Common; namespace Renci.SshNet.Security.Cryptography diff --git a/src/Renci.SshNet/Security/Cryptography/HMACSHA384.cs b/src/Renci.SshNet/Security/Cryptography/HMACSHA384.cs index e13d720c8..cbdcdf73c 100644 --- a/src/Renci.SshNet/Security/Cryptography/HMACSHA384.cs +++ b/src/Renci.SshNet/Security/Cryptography/HMACSHA384.cs @@ -1,4 +1,5 @@ using System.Security.Cryptography; + using Renci.SshNet.Common; namespace Renci.SshNet.Security.Cryptography diff --git a/src/Renci.SshNet/Security/Cryptography/HMACSHA512.cs b/src/Renci.SshNet/Security/Cryptography/HMACSHA512.cs index 8d756efef..45cca6a11 100644 --- a/src/Renci.SshNet/Security/Cryptography/HMACSHA512.cs +++ b/src/Renci.SshNet/Security/Cryptography/HMACSHA512.cs @@ -1,4 +1,5 @@ using System.Security.Cryptography; + using Renci.SshNet.Common; namespace Renci.SshNet.Security.Cryptography diff --git a/src/Renci.SshNet/Security/GroupExchangeHashData.cs b/src/Renci.SshNet/Security/GroupExchangeHashData.cs index 921841094..57fe2e83c 100644 --- a/src/Renci.SshNet/Security/GroupExchangeHashData.cs +++ b/src/Renci.SshNet/Security/GroupExchangeHashData.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Common; namespace Renci.SshNet.Security diff --git a/src/Renci.SshNet/Security/KeyExchange.cs b/src/Renci.SshNet/Security/KeyExchange.cs index 4ce988339..4c798d078 100644 --- a/src/Renci.SshNet/Security/KeyExchange.cs +++ b/src/Renci.SshNet/Security/KeyExchange.cs @@ -427,11 +427,11 @@ private byte[] GenerateSessionKey(byte[] sharedKey, byte[] exchangeHash, byte[] while (size > result.Count) { var sessionKeyAdjustment = new SessionKeyAdjustment - { - SharedKey = sharedKey, - ExchangeHash = exchangeHash, - Key = key, - }; + { + SharedKey = sharedKey, + ExchangeHash = exchangeHash, + Key = key, + }; result.AddRange(Hash(sessionKeyAdjustment.GetBytes())); } @@ -452,12 +452,12 @@ private byte[] GenerateSessionKey(byte[] sharedKey, byte[] exchangeHash, byte[] private static byte[] GenerateSessionKey(byte[] sharedKey, byte[] exchangeHash, char p, byte[] sessionId) { var sessionKeyGeneration = new SessionKeyGeneration - { - SharedKey = sharedKey, - ExchangeHash = exchangeHash, - Char = p, - SessionId = sessionId - }; + { + SharedKey = sharedKey, + ExchangeHash = exchangeHash, + Char = p, + SessionId = sessionId + }; return sessionKeyGeneration.GetBytes(); } diff --git a/src/Renci.SshNet/Security/KeyExchangeDiffieHellmanGroupExchangeShaBase.cs b/src/Renci.SshNet/Security/KeyExchangeDiffieHellmanGroupExchangeShaBase.cs index 5774f2c34..d35983887 100644 --- a/src/Renci.SshNet/Security/KeyExchangeDiffieHellmanGroupExchangeShaBase.cs +++ b/src/Renci.SshNet/Security/KeyExchangeDiffieHellmanGroupExchangeShaBase.cs @@ -20,21 +20,21 @@ internal abstract class KeyExchangeDiffieHellmanGroupExchangeShaBase : KeyExchan protected override byte[] CalculateHash() { var groupExchangeHashData = new GroupExchangeHashData - { - ClientVersion = Session.ClientVersion, - ServerVersion = Session.ServerVersion, - ClientPayload = _clientPayload, - ServerPayload = _serverPayload, - HostKey = _hostKey, - MinimumGroupSize = MinimumGroupSize, - PreferredGroupSize = PreferredGroupSize, - MaximumGroupSize = MaximumProupSize, - Prime = _prime, - SubGroup = _group, - ClientExchangeValue = _clientExchangeValue, - ServerExchangeValue = _serverExchangeValue, - SharedKey = SharedKey, - }; + { + ClientVersion = Session.ClientVersion, + ServerVersion = Session.ServerVersion, + ClientPayload = _clientPayload, + ServerPayload = _serverPayload, + HostKey = _hostKey, + MinimumGroupSize = MinimumGroupSize, + PreferredGroupSize = PreferredGroupSize, + MaximumGroupSize = MaximumProupSize, + Prime = _prime, + SubGroup = _group, + ClientExchangeValue = _clientExchangeValue, + ServerExchangeValue = _serverExchangeValue, + SharedKey = SharedKey, + }; return Hash(groupExchangeHashData.GetBytes()); } diff --git a/src/Renci.SshNet/Security/KeyExchangeEC.cs b/src/Renci.SshNet/Security/KeyExchangeEC.cs index 8bc61e7fc..a0b41538e 100644 --- a/src/Renci.SshNet/Security/KeyExchangeEC.cs +++ b/src/Renci.SshNet/Security/KeyExchangeEC.cs @@ -53,16 +53,16 @@ internal abstract class KeyExchangeEC : KeyExchange protected override byte[] CalculateHash() { var hashData = new KeyExchangeHashData - { - ClientVersion = Session.ClientVersion, - ServerVersion = Session.ServerVersion, - ClientPayload = _clientPayload, - ServerPayload = _serverPayload, - HostKey = _hostKey, - ClientExchangeValue = _clientExchangeValue, - ServerExchangeValue = _serverExchangeValue, - SharedKey = SharedKey, - }; + { + ClientVersion = Session.ClientVersion, + ServerVersion = Session.ServerVersion, + ClientPayload = _clientPayload, + ServerPayload = _serverPayload, + HostKey = _hostKey, + ClientExchangeValue = _clientExchangeValue, + ServerExchangeValue = _serverExchangeValue, + SharedKey = SharedKey, + }; return Hash(hashData.GetBytes()); } @@ -86,5 +86,5 @@ public override void Start(Session session, KeyExchangeInitMessage message, bool _serverPayload = message.GetBytes(); _clientPayload = Session.ClientInitMessage.GetBytes(); } - } + } } diff --git a/src/Renci.SshNet/Security/KeyExchangeECDH.cs b/src/Renci.SshNet/Security/KeyExchangeECDH.cs index c756fb6cb..442a15d6f 100644 --- a/src/Renci.SshNet/Security/KeyExchangeECDH.cs +++ b/src/Renci.SshNet/Security/KeyExchangeECDH.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Common; using Renci.SshNet.Messages.Transport; @@ -45,7 +46,7 @@ public override void Start(Session session, KeyExchangeInitMessage message, bool var aKeyPair = g.GenerateKeyPair(); _keyAgreement = new ECDHCBasicAgreement(); _keyAgreement.Init(aKeyPair.Private); - _clientExchangeValue = ((ECPublicKeyParameters)aKeyPair.Public).Q.GetEncoded(); + _clientExchangeValue = ((ECPublicKeyParameters) aKeyPair.Public).Q.GetEncoded(); SendMessage(new KeyExchangeEcdhInitMessage(_clientExchangeValue)); } @@ -91,7 +92,7 @@ private void HandleServerEcdhReply(byte[] hostKey, byte[] serverExchangeValue, b var y = new byte[cordSize]; Buffer.BlockCopy(serverExchangeValue, cordSize + 1, y, 0, y.Length); - var c = (FpCurve)_domainParameters.Curve; + var c = (FpCurve) _domainParameters.Curve; var q = c.CreatePoint(new Org.BouncyCastle.Math.BigInteger(1, x), new Org.BouncyCastle.Math.BigInteger(1, y)); var publicKey = new ECPublicKeyParameters("ECDH", q, _domainParameters); diff --git a/src/Renci.SshNet/ServiceFactory.cs b/src/Renci.SshNet/ServiceFactory.cs index 0e279873a..775e9422b 100644 --- a/src/Renci.SshNet/ServiceFactory.cs +++ b/src/Renci.SshNet/ServiceFactory.cs @@ -94,9 +94,9 @@ public IKeyExchange CreateKeyExchange(IDictionary> cl // find an algorithm that is supported by both client and server var keyExchangeAlgorithmFactory = (from c in clientAlgorithms - from s in serverAlgorithms - where s == c.Key - select c.Value).FirstOrDefault(); + from s in serverAlgorithms + where s == c.Key + select c.Value).FirstOrDefault(); if (keyExchangeAlgorithmFactory is null) { @@ -152,7 +152,7 @@ public ISftpFileReader CreateSftpFileReader(string fileName, ISftpSession sftpSe { var fileAttributes = sftpSession.EndLStat(statAsyncResult); fileSize = fileAttributes.Size; - maxPendingReads = Math.Min(100, (int)Math.Ceiling((double)fileAttributes.Size / chunkSize) + 1); + maxPendingReads = Math.Min(100, (int) Math.Ceiling((double) fileAttributes.Size / chunkSize) + 1); } catch (SshException ex) { diff --git a/src/Renci.SshNet/Session.cs b/src/Renci.SshNet/Session.cs index f2fe7f2ae..43e3db11b 100644 --- a/src/Renci.SshNet/Session.cs +++ b/src/Renci.SshNet/Session.cs @@ -225,7 +225,7 @@ private uint NextChannelNumber { get { - return (uint)Interlocked.Increment(ref _nextChannelNumber); + return (uint) Interlocked.Increment(ref _nextChannelNumber); } } @@ -292,20 +292,20 @@ public Message ClientInitMessage get { _clientInitMessage ??= new KeyExchangeInitMessage - { - KeyExchangeAlgorithms = ConnectionInfo.KeyExchangeAlgorithms.Keys.ToArray(), - ServerHostKeyAlgorithms = ConnectionInfo.HostKeyAlgorithms.Keys.ToArray(), - EncryptionAlgorithmsClientToServer = ConnectionInfo.Encryptions.Keys.ToArray(), - EncryptionAlgorithmsServerToClient = ConnectionInfo.Encryptions.Keys.ToArray(), - MacAlgorithmsClientToServer = ConnectionInfo.HmacAlgorithms.Keys.ToArray(), - MacAlgorithmsServerToClient = ConnectionInfo.HmacAlgorithms.Keys.ToArray(), - CompressionAlgorithmsClientToServer = ConnectionInfo.CompressionAlgorithms.Keys.ToArray(), - CompressionAlgorithmsServerToClient = ConnectionInfo.CompressionAlgorithms.Keys.ToArray(), - LanguagesClientToServer = new[] { string.Empty }, - LanguagesServerToClient = new[] { string.Empty }, - FirstKexPacketFollows = false, - Reserved = 0 - }; + { + KeyExchangeAlgorithms = ConnectionInfo.KeyExchangeAlgorithms.Keys.ToArray(), + ServerHostKeyAlgorithms = ConnectionInfo.HostKeyAlgorithms.Keys.ToArray(), + EncryptionAlgorithmsClientToServer = ConnectionInfo.Encryptions.Keys.ToArray(), + EncryptionAlgorithmsServerToClient = ConnectionInfo.Encryptions.Keys.ToArray(), + MacAlgorithmsClientToServer = ConnectionInfo.HmacAlgorithms.Keys.ToArray(), + MacAlgorithmsServerToClient = ConnectionInfo.HmacAlgorithms.Keys.ToArray(), + CompressionAlgorithmsClientToServer = ConnectionInfo.CompressionAlgorithms.Keys.ToArray(), + CompressionAlgorithmsServerToClient = ConnectionInfo.CompressionAlgorithms.Keys.ToArray(), + LanguagesClientToServer = new[] { string.Empty }, + LanguagesServerToClient = new[] { string.Empty }, + FirstKexPacketFollows = false, + Reserved = 0 + }; return _clientInitMessage; } diff --git a/src/Renci.SshNet/Sftp/Requests/SftpCloseRequest.cs b/src/Renci.SshNet/Sftp/Requests/SftpCloseRequest.cs index f17673f95..b91c31eeb 100644 --- a/src/Renci.SshNet/Sftp/Requests/SftpCloseRequest.cs +++ b/src/Renci.SshNet/Sftp/Requests/SftpCloseRequest.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Sftp.Responses; namespace Renci.SshNet.Sftp.Requests diff --git a/src/Renci.SshNet/Sftp/Requests/SftpExtendedRequest.cs b/src/Renci.SshNet/Sftp/Requests/SftpExtendedRequest.cs index 59da98af5..84a81bb98 100644 --- a/src/Renci.SshNet/Sftp/Requests/SftpExtendedRequest.cs +++ b/src/Renci.SshNet/Sftp/Requests/SftpExtendedRequest.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Sftp.Responses; namespace Renci.SshNet.Sftp.Requests diff --git a/src/Renci.SshNet/Sftp/Requests/SftpFSetStatRequest.cs b/src/Renci.SshNet/Sftp/Requests/SftpFSetStatRequest.cs index d24f757b8..3063c1299 100644 --- a/src/Renci.SshNet/Sftp/Requests/SftpFSetStatRequest.cs +++ b/src/Renci.SshNet/Sftp/Requests/SftpFSetStatRequest.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Sftp.Responses; namespace Renci.SshNet.Sftp.Requests diff --git a/src/Renci.SshNet/Sftp/Requests/SftpLStatRequest.cs b/src/Renci.SshNet/Sftp/Requests/SftpLStatRequest.cs index 950ef8f43..fa8c2c14f 100644 --- a/src/Renci.SshNet/Sftp/Requests/SftpLStatRequest.cs +++ b/src/Renci.SshNet/Sftp/Requests/SftpLStatRequest.cs @@ -1,5 +1,6 @@ using System; using System.Text; + using Renci.SshNet.Sftp.Responses; namespace Renci.SshNet.Sftp.Requests diff --git a/src/Renci.SshNet/Sftp/Requests/SftpMkDirRequest.cs b/src/Renci.SshNet/Sftp/Requests/SftpMkDirRequest.cs index 126925b95..fafd481f8 100644 --- a/src/Renci.SshNet/Sftp/Requests/SftpMkDirRequest.cs +++ b/src/Renci.SshNet/Sftp/Requests/SftpMkDirRequest.cs @@ -1,5 +1,6 @@ using System; using System.Text; + using Renci.SshNet.Sftp.Responses; namespace Renci.SshNet.Sftp.Requests diff --git a/src/Renci.SshNet/Sftp/Requests/SftpOpenRequest.cs b/src/Renci.SshNet/Sftp/Requests/SftpOpenRequest.cs index 780552fbc..a356768a3 100644 --- a/src/Renci.SshNet/Sftp/Requests/SftpOpenRequest.cs +++ b/src/Renci.SshNet/Sftp/Requests/SftpOpenRequest.cs @@ -1,5 +1,6 @@ using System; using System.Text; + using Renci.SshNet.Sftp.Responses; namespace Renci.SshNet.Sftp.Requests diff --git a/src/Renci.SshNet/Sftp/Requests/SftpRemoveRequest.cs b/src/Renci.SshNet/Sftp/Requests/SftpRemoveRequest.cs index 99d072f50..a1b3ed780 100644 --- a/src/Renci.SshNet/Sftp/Requests/SftpRemoveRequest.cs +++ b/src/Renci.SshNet/Sftp/Requests/SftpRemoveRequest.cs @@ -1,5 +1,6 @@ using System; using System.Text; + using Renci.SshNet.Sftp.Responses; namespace Renci.SshNet.Sftp.Requests diff --git a/src/Renci.SshNet/Sftp/Requests/SftpRenameRequest.cs b/src/Renci.SshNet/Sftp/Requests/SftpRenameRequest.cs index 8d7fc91a2..71dc83025 100644 --- a/src/Renci.SshNet/Sftp/Requests/SftpRenameRequest.cs +++ b/src/Renci.SshNet/Sftp/Requests/SftpRenameRequest.cs @@ -1,5 +1,6 @@ using System; using System.Text; + using Renci.SshNet.Sftp.Responses; namespace Renci.SshNet.Sftp.Requests diff --git a/src/Renci.SshNet/Sftp/Requests/SftpRequest.cs b/src/Renci.SshNet/Sftp/Requests/SftpRequest.cs index a3e4d0595..e099d1c2a 100644 --- a/src/Renci.SshNet/Sftp/Requests/SftpRequest.cs +++ b/src/Renci.SshNet/Sftp/Requests/SftpRequest.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Sftp.Responses; namespace Renci.SshNet.Sftp.Requests diff --git a/src/Renci.SshNet/Sftp/Requests/SftpRmDirRequest.cs b/src/Renci.SshNet/Sftp/Requests/SftpRmDirRequest.cs index 003198afc..dd19c669a 100644 --- a/src/Renci.SshNet/Sftp/Requests/SftpRmDirRequest.cs +++ b/src/Renci.SshNet/Sftp/Requests/SftpRmDirRequest.cs @@ -1,5 +1,6 @@ using System; using System.Text; + using Renci.SshNet.Sftp.Responses; namespace Renci.SshNet.Sftp.Requests diff --git a/src/Renci.SshNet/Sftp/Requests/SftpSetStatRequest.cs b/src/Renci.SshNet/Sftp/Requests/SftpSetStatRequest.cs index 8731b9fc6..e517acef3 100644 --- a/src/Renci.SshNet/Sftp/Requests/SftpSetStatRequest.cs +++ b/src/Renci.SshNet/Sftp/Requests/SftpSetStatRequest.cs @@ -1,5 +1,6 @@ using System; using System.Text; + using Renci.SshNet.Sftp.Responses; namespace Renci.SshNet.Sftp.Requests diff --git a/src/Renci.SshNet/Sftp/Requests/SftpStatRequest.cs b/src/Renci.SshNet/Sftp/Requests/SftpStatRequest.cs index 09657bff6..fe7030658 100644 --- a/src/Renci.SshNet/Sftp/Requests/SftpStatRequest.cs +++ b/src/Renci.SshNet/Sftp/Requests/SftpStatRequest.cs @@ -1,5 +1,6 @@ using System; using System.Text; + using Renci.SshNet.Sftp.Responses; namespace Renci.SshNet.Sftp.Requests diff --git a/src/Renci.SshNet/Sftp/Requests/SftpSymLinkRequest.cs b/src/Renci.SshNet/Sftp/Requests/SftpSymLinkRequest.cs index 63127cdd5..1b1ec3e86 100644 --- a/src/Renci.SshNet/Sftp/Requests/SftpSymLinkRequest.cs +++ b/src/Renci.SshNet/Sftp/Requests/SftpSymLinkRequest.cs @@ -1,5 +1,6 @@ using System; using System.Text; + using Renci.SshNet.Sftp.Responses; namespace Renci.SshNet.Sftp.Requests diff --git a/src/Renci.SshNet/Sftp/Requests/SftpUnblockRequest.cs b/src/Renci.SshNet/Sftp/Requests/SftpUnblockRequest.cs index 6dff38360..e456f98cf 100644 --- a/src/Renci.SshNet/Sftp/Requests/SftpUnblockRequest.cs +++ b/src/Renci.SshNet/Sftp/Requests/SftpUnblockRequest.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Sftp.Responses; namespace Renci.SshNet.Sftp.Requests diff --git a/src/Renci.SshNet/Sftp/Requests/SftpWriteRequest.cs b/src/Renci.SshNet/Sftp/Requests/SftpWriteRequest.cs index be7f6da91..6627513ae 100644 --- a/src/Renci.SshNet/Sftp/Requests/SftpWriteRequest.cs +++ b/src/Renci.SshNet/Sftp/Requests/SftpWriteRequest.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Sftp.Responses; namespace Renci.SshNet.Sftp.Requests diff --git a/src/Renci.SshNet/Sftp/SftpDownloadAsyncResult.cs b/src/Renci.SshNet/Sftp/SftpDownloadAsyncResult.cs index 9e706d9e0..cdb46cf73 100644 --- a/src/Renci.SshNet/Sftp/SftpDownloadAsyncResult.cs +++ b/src/Renci.SshNet/Sftp/SftpDownloadAsyncResult.cs @@ -1,4 +1,5 @@ using System; + using Renci.SshNet.Common; namespace Renci.SshNet.Sftp diff --git a/src/Renci.SshNet/Sftp/SftpFile.cs b/src/Renci.SshNet/Sftp/SftpFile.cs index 2122220be..f8b770e1d 100644 --- a/src/Renci.SshNet/Sftp/SftpFile.cs +++ b/src/Renci.SshNet/Sftp/SftpFile.cs @@ -1,5 +1,6 @@ using System; using System.Globalization; + using Renci.SshNet.Common; namespace Renci.SshNet.Sftp diff --git a/src/Renci.SshNet/Sftp/SftpFileReader.cs b/src/Renci.SshNet/Sftp/SftpFileReader.cs index 8d3ef211f..10f819f8c 100644 --- a/src/Renci.SshNet/Sftp/SftpFileReader.cs +++ b/src/Renci.SshNet/Sftp/SftpFileReader.cs @@ -101,7 +101,7 @@ public byte[] Read() // instance is already disposed while (!_queue.TryGetValue(_nextChunkIndex, out nextChunk) && _exception is null) { - _ =Monitor.Wait(_readLock); + _ = Monitor.Wait(_readLock); } // throw when exception occured in read-ahead, or the current instance is already disposed diff --git a/src/Renci.SshNet/Sftp/SftpFileStream.cs b/src/Renci.SshNet/Sftp/SftpFileStream.cs index f0086c7d0..270ed1d1d 100644 --- a/src/Renci.SshNet/Sftp/SftpFileStream.cs +++ b/src/Renci.SshNet/Sftp/SftpFileStream.cs @@ -708,7 +708,7 @@ public override async Task ReadAsync(byte[] buffer, int offset, int count, var bytesAvailableInBuffer = _bufferLen - _bufferPosition; if (bytesAvailableInBuffer <= 0) { - var data = await _session.RequestReadAsync(_handle, (ulong)_position, (uint)_readBufferSize, cancellationToken).ConfigureAwait(false); + var data = await _session.RequestReadAsync(_handle, (ulong) _position, (uint) _readBufferSize, cancellationToken).ConfigureAwait(false); if (data.Length == 0) { @@ -900,7 +900,7 @@ public override long Seek(long offset, SeekOrigin origin) newPosn = _position - _bufferPosition; if (offset >= newPosn && offset < (newPosn + _bufferLen)) { - _bufferPosition = (int)(offset - newPosn); + _bufferPosition = (int) (offset - newPosn); _position = offset; return _position; } @@ -1180,7 +1180,7 @@ public override async Task WriteAsync(byte[] buffer, int offset, int count, Canc // Can we short-cut the internal buffer? if (_bufferPosition == 0 && tempLen == _writeBufferSize) { - await _session.RequestWriteAsync(_handle, (ulong)_position, buffer, offset, tempLen, cancellationToken).ConfigureAwait(false); + await _session.RequestWriteAsync(_handle, (ulong) _position, buffer, offset, tempLen, cancellationToken).ConfigureAwait(false); } else { @@ -1199,7 +1199,7 @@ public override async Task WriteAsync(byte[] buffer, int offset, int count, Canc // rather than waiting for the next call to this method. if (_bufferPosition >= _writeBufferSize) { - await _session.RequestWriteAsync(_handle, (ulong)(_position - _bufferPosition), GetOrCreateWriteBuffer(), 0, _bufferPosition, cancellationToken).ConfigureAwait(false); + await _session.RequestWriteAsync(_handle, (ulong) (_position - _bufferPosition), GetOrCreateWriteBuffer(), 0, _bufferPosition, cancellationToken).ConfigureAwait(false); _bufferPosition = 0; } } @@ -1323,7 +1323,7 @@ private async Task FlushWriteBufferAsync(CancellationToken cancellationToken) { if (_bufferPosition > 0) { - await _session.RequestWriteAsync(_handle, (ulong)(_position - _bufferPosition), _writeBuffer, 0, _bufferPosition, cancellationToken).ConfigureAwait(false); + await _session.RequestWriteAsync(_handle, (ulong) (_position - _bufferPosition), _writeBuffer, 0, _bufferPosition, cancellationToken).ConfigureAwait(false); _bufferPosition = 0; } } diff --git a/test/Renci.SshNet.Benchmarks/Security/Cryptography/Ciphers/AesCipherBenchmarks.cs b/test/Renci.SshNet.Benchmarks/Security/Cryptography/Ciphers/AesCipherBenchmarks.cs index f24559c5b..9cecc0855 100644 --- a/test/Renci.SshNet.Benchmarks/Security/Cryptography/Ciphers/AesCipherBenchmarks.cs +++ b/test/Renci.SshNet.Benchmarks/Security/Cryptography/Ciphers/AesCipherBenchmarks.cs @@ -1,4 +1,5 @@ using BenchmarkDotNet.Attributes; + using Renci.SshNet.Security.Cryptography.Ciphers; namespace Renci.SshNet.Benchmarks.Security.Cryptography.Ciphers diff --git a/test/Renci.SshNet.IntegrationBenchmarks/ScpClientBenchmark.cs b/test/Renci.SshNet.IntegrationBenchmarks/ScpClientBenchmark.cs index 1e7b9368b..f73643a9c 100644 --- a/test/Renci.SshNet.IntegrationBenchmarks/ScpClientBenchmark.cs +++ b/test/Renci.SshNet.IntegrationBenchmarks/ScpClientBenchmark.cs @@ -1,4 +1,5 @@ using System.Text; + using BenchmarkDotNet.Attributes; using Renci.SshNet.IntegrationTests.TestsFixtures; diff --git a/test/Renci.SshNet.IntegrationTests/Common/Socks5Handler.cs b/test/Renci.SshNet.IntegrationTests/Common/Socks5Handler.cs index e50858c33..3e910d4b9 100644 --- a/test/Renci.SshNet.IntegrationTests/Common/Socks5Handler.cs +++ b/test/Renci.SshNet.IntegrationTests/Common/Socks5Handler.cs @@ -138,8 +138,8 @@ private Socket Connect(byte[] addressBytes, int port) SocketAbstraction.Send(socket, addressBytes); // Send port - SocketWriteByte(socket, (byte)(port / 0xFF)); - SocketWriteByte(socket, (byte)(port % 0xFF)); + SocketWriteByte(socket, (byte) (port / 0xFF)); + SocketWriteByte(socket, (byte) (port % 0xFF)); // Read Server SOCKS5 version if (SocketReadByte(socket) != 5) diff --git a/test/Renci.SshNet.IntegrationTests/ConnectivityTests.cs b/test/Renci.SshNet.IntegrationTests/ConnectivityTests.cs index a6ff3465c..2510f83b8 100644 --- a/test/Renci.SshNet.IntegrationTests/ConnectivityTests.cs +++ b/test/Renci.SshNet.IntegrationTests/ConnectivityTests.cs @@ -76,7 +76,7 @@ public void Common_DisposeAfterLossOfNetworkConnectivity() hostNetworkConnectionDisabled = true; WaitForConnectionInterruption(client); } - + Assert.IsNotNull(errorOccurred); Assert.AreEqual(typeof(SshConnectionException), errorOccurred.GetType()); @@ -104,7 +104,7 @@ public void Common_DetectLossOfNetworkConnectivityThroughKeepAlive() int count = 0; client.ErrorOccurred += (sender, args) => { - Console.WriteLine("Exception "+ count++); + Console.WriteLine("Exception " + count++); Console.WriteLine(args.Exception); errorOccurred = args.Exception; }; diff --git a/test/Renci.SshNet.IntegrationTests/HostConfig.cs b/test/Renci.SshNet.IntegrationTests/HostConfig.cs index fd3c3f133..19d78e705 100644 --- a/test/Renci.SshNet.IntegrationTests/HostConfig.cs +++ b/test/Renci.SshNet.IntegrationTests/HostConfig.cs @@ -73,7 +73,7 @@ public void Write(ScpClient scpClient, string path) { // Use linux line ending sw.NewLine = "\n"; - + foreach (var hostEntry in Entries) { sw.Write(hostEntry.IPAddress); diff --git a/test/Renci.SshNet.IntegrationTests/HostKeyFile.cs b/test/Renci.SshNet.IntegrationTests/HostKeyFile.cs index 66d09fd29..10dfb294f 100644 --- a/test/Renci.SshNet.IntegrationTests/HostKeyFile.cs +++ b/test/Renci.SshNet.IntegrationTests/HostKeyFile.cs @@ -14,7 +14,7 @@ private HostKeyFile(string keyName, string filePath, byte[] fingerPrint) FingerPrint = fingerPrint; } - public string KeyName {get; } + public string KeyName { get; } public string FilePath { get; } public byte[] FingerPrint { get; } } diff --git a/test/Renci.SshNet.IntegrationTests/LinuxVMConnectionFactory.cs b/test/Renci.SshNet.IntegrationTests/LinuxVMConnectionFactory.cs index f2f04dbfc..fe24ceac3 100644 --- a/test/Renci.SshNet.IntegrationTests/LinuxVMConnectionFactory.cs +++ b/test/Renci.SshNet.IntegrationTests/LinuxVMConnectionFactory.cs @@ -2,7 +2,7 @@ { public class LinuxVMConnectionFactory : IConnectionInfoFactory { - + private const string ProxyHost = "127.0.0.1"; private const int ProxyPort = 1234; diff --git a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.ListDirectory.cs b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.ListDirectory.cs index e37e937f9..86e02b2ca 100644 --- a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.ListDirectory.cs +++ b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.ListDirectory.cs @@ -79,7 +79,7 @@ public async Task Test_Sftp_ListDirectoryAsync_Current() var cts = new CancellationTokenSource(); cts.CancelAfter(TimeSpan.FromMinutes(1)); var count = 0; - await foreach(var file in sftp.ListDirectoryAsync(".", cts.Token)) + await foreach (var file in sftp.ListDirectoryAsync(".", cts.Token)) { count++; Debug.WriteLine(file.FullName); diff --git a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.Upload.cs b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.Upload.cs index 91c248bd3..ab6f9da22 100644 --- a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.Upload.cs +++ b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.Upload.cs @@ -93,11 +93,11 @@ public void Test_Sftp_Multiple_Async_Upload_And_Download_10Files_5MB_Each() for (var i = 0; i < maxFiles; i++) { var testInfo = new TestInfo - { - UploadedFileName = Path.GetTempFileName(), - DownloadedFileName = Path.GetTempFileName(), - RemoteFileName = Path.GetRandomFileName() - }; + { + UploadedFileName = Path.GetTempFileName(), + DownloadedFileName = Path.GetTempFileName(), + RemoteFileName = Path.GetRandomFileName() + }; CreateTestFile(testInfo.UploadedFileName, maxSize); @@ -201,7 +201,7 @@ public void Test_Sftp_Multiple_Async_Upload_And_Download_10Files_5MB_Each() testInfo.DownloadedHash = CalculateMD5(testInfo.DownloadedFileName); Console.WriteLine(remoteFile); - Console.WriteLine("UploadedBytes: "+ testInfo.UploadResult.UploadedBytes); + Console.WriteLine("UploadedBytes: " + testInfo.UploadResult.UploadedBytes); Console.WriteLine("DownloadedBytes: " + testInfo.DownloadResult.DownloadedBytes); Console.WriteLine("UploadedHash: " + testInfo.UploadedHash); Console.WriteLine("DownloadedHash: " + testInfo.DownloadedHash); @@ -261,7 +261,7 @@ public void Test_Sftp_Ensure_Async_Delegates_Called_For_BeginFileUpload_BeginFil { asyncResult = sftp.BeginUploadFile(fileStream, remoteFileName, - delegate(IAsyncResult ar) + delegate (IAsyncResult ar) { sftp.EndUploadFile(ar); uploadDelegateCalled = true; @@ -285,7 +285,7 @@ public void Test_Sftp_Ensure_Async_Delegates_Called_For_BeginFileUpload_BeginFil { asyncResult = sftp.BeginDownloadFile(remoteFileName, fileStream, - delegate(IAsyncResult ar) + delegate (IAsyncResult ar) { sftp.EndDownloadFile(ar); downloadDelegateCalled = true; @@ -306,7 +306,7 @@ public void Test_Sftp_Ensure_Async_Delegates_Called_For_BeginFileUpload_BeginFil asyncResult = null; asyncResult = sftp.BeginListDirectory(sftp.WorkingDirectory, - delegate(IAsyncResult ar) + delegate (IAsyncResult ar) { _ = sftp.EndListDirectory(ar); listDirectoryDelegateCalled = true; diff --git a/test/Renci.SshNet.IntegrationTests/ScpClientTests.cs b/test/Renci.SshNet.IntegrationTests/ScpClientTests.cs index fc90554a5..ba424a247 100644 --- a/test/Renci.SshNet.IntegrationTests/ScpClientTests.cs +++ b/test/Renci.SshNet.IntegrationTests/ScpClientTests.cs @@ -20,7 +20,7 @@ public void Upload_And_Download_FileStream() { var file = $"/tmp/{Guid.NewGuid()}.txt"; var fileContent = "File content !@#$%^&*()_+{}:,./<>[];'\\|"; - + using var uploadStream = new MemoryStream(Encoding.UTF8.GetBytes(fileContent)); _scpClient.Upload(uploadStream, file); diff --git a/test/Renci.SshNet.IntegrationTests/ScpTests.cs b/test/Renci.SshNet.IntegrationTests/ScpTests.cs index c244b86a8..5a131865f 100644 --- a/test/Renci.SshNet.IntegrationTests/ScpTests.cs +++ b/test/Renci.SshNet.IntegrationTests/ScpTests.cs @@ -1368,10 +1368,10 @@ public void Scp_Upload_FileInfo_ExistingFile(IRemotePathTransformation remotePat } var fileInfo = new FileInfo(file) - { - LastAccessTimeUtc = new DateTime(1973, 8, 13, 20, 15, 33, DateTimeKind.Utc), - LastWriteTimeUtc = new DateTime(1974, 1, 24, 3, 55, 12, DateTimeKind.Utc) - }; + { + LastAccessTimeUtc = new DateTime(1973, 8, 13, 20, 15, 33, DateTimeKind.Utc), + LastWriteTimeUtc = new DateTime(1974, 1, 24, 3, 55, 12, DateTimeKind.Utc) + }; using (var client = new ScpClient(_connectionInfoFactory.Create())) { @@ -1463,10 +1463,10 @@ public void Scp_Upload_FileInfo_FileDoesNotExist(IRemotePathTransformation remot } var fileInfo = new FileInfo(file) - { - LastAccessTimeUtc = new DateTime(1973, 8, 13, 20, 15, 33, DateTimeKind.Utc), - LastWriteTimeUtc = new DateTime(1974, 1, 24, 3, 55, 12, DateTimeKind.Utc) - }; + { + LastAccessTimeUtc = new DateTime(1973, 8, 13, 20, 15, 33, DateTimeKind.Utc), + LastWriteTimeUtc = new DateTime(1974, 1, 24, 3, 55, 12, DateTimeKind.Utc) + }; using (var client = new ScpClient(_connectionInfoFactory.Create())) { diff --git a/test/Renci.SshNet.IntegrationTests/SftpClientTests.cs b/test/Renci.SshNet.IntegrationTests/SftpClientTests.cs index 535b07bce..a1276e801 100644 --- a/test/Renci.SshNet.IntegrationTests/SftpClientTests.cs +++ b/test/Renci.SshNet.IntegrationTests/SftpClientTests.cs @@ -20,7 +20,7 @@ public SftpClientTests() public void Create_directory_with_contents_and_list_it() { var testDirectory = "/home/sshnet/sshnet-test"; - var testFileName = "test-file.txt"; + var testFileName = "test-file.txt"; var testFilePath = $"{testDirectory}/{testFileName}"; var testContent = "file content"; diff --git a/test/Renci.SshNet.IntegrationTests/SftpTests.cs b/test/Renci.SshNet.IntegrationTests/SftpTests.cs index 87b59c7a8..ff5acf024 100644 --- a/test/Renci.SshNet.IntegrationTests/SftpTests.cs +++ b/test/Renci.SshNet.IntegrationTests/SftpTests.cs @@ -1389,8 +1389,8 @@ public void Sftp_CreateText_Encoding_FileDoesNotExist() finally { if (client.Exists(remoteFile)) - { - client.DeleteFile(remoteFile); + { + client.DeleteFile(remoteFile); } } } @@ -1464,8 +1464,8 @@ public void Sftp_ReadAllBytes_ExistingFile() finally { if (client.Exists(remoteFile)) - { - client.DeleteFile(remoteFile); + { + client.DeleteFile(remoteFile); } } } @@ -4880,7 +4880,7 @@ public void Sftp_SftpFileStream_Seek_NegativeOffSet_SeekOriginEnd() // Remaining bytes should not have been touched readBuffer = new byte[((int) client.BufferSize * 2) - 4]; Assert.AreEqual(readBuffer.Length, fs.Read(readBuffer, offset: 0, readBuffer.Length)); - Assert.IsTrue(readBuffer.SequenceEqual(writeBuffer.Skip(((int)client.BufferSize * 2) + 4).Take(readBuffer.Length))); + Assert.IsTrue(readBuffer.SequenceEqual(writeBuffer.Skip(((int) client.BufferSize * 2) + 4).Take(readBuffer.Length))); // Ensure we've reached end of the stream Assert.AreEqual(-1, fs.ReadByte()); @@ -6186,7 +6186,7 @@ public void Sftp_SetLastAccessTimeUtc() } finally { - client.DeleteFile(testFilePath); + client.DeleteFile(testFilePath); } } @@ -6230,7 +6230,7 @@ public void Sftp_SetLastWriteTimeUtc() client.Connect(); using var fileStream = new MemoryStream(Encoding.UTF8.GetBytes(testContent)); - + client.UploadFile(fileStream, testFilePath); try { diff --git a/test/Renci.SshNet.IntegrationTests/SshConnectionDisruptor.cs b/test/Renci.SshNet.IntegrationTests/SshConnectionDisruptor.cs index 741134114..4116daad7 100644 --- a/test/Renci.SshNet.IntegrationTests/SshConnectionDisruptor.cs +++ b/test/Renci.SshNet.IntegrationTests/SshConnectionDisruptor.cs @@ -12,11 +12,11 @@ public SshConnectionDisruptor(IConnectionInfoFactory connectionInfoFactory) public SshConnectionRestorer BreakConnections() { var client = new SshClient(_connectionInfoFactory.Create()); - + client.Connect(); PauseSshd(client); - + return new SshConnectionRestorer(client); } diff --git a/test/Renci.SshNet.IntegrationTests/SshTests.cs b/test/Renci.SshNet.IntegrationTests/SshTests.cs index fe05e3482..b7af4f652 100644 --- a/test/Renci.SshNet.IntegrationTests/SshTests.cs +++ b/test/Renci.SshNet.IntegrationTests/SshTests.cs @@ -86,12 +86,12 @@ public void Ssh_ShellStream_IntermittendOutput() const string remoteFile = "/home/sshnet/test.sh"; List expectedLines = ["renci-ssh-tests-server:~$ Line 1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", - "Line 2 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", - "Line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", - "Line 4 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", - "Line 5 ", - "Line 6", - "renci-ssh-tests-server:~$ "]; // No idea how stable this is. + "Line 2 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "Line 3 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "Line 4 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", + "Line 5 ", + "Line 6", + "renci-ssh-tests-server:~$ "]; // No idea how stable this is. var scriptBuilder = new StringBuilder(); scriptBuilder.Append("#!/bin/sh\n"); @@ -483,7 +483,7 @@ public void Ssh_LocalPortForwardingCloseChannels() for (var i = 0; i < (connectionInfo.MaxSessions + 1); i++) { var forwardedPort = new ForwardedPortLocal(localEndPoint.Address.ToString(), - (uint)localEndPoint.Port, + (uint) localEndPoint.Port, hostNameAlias, 80); client.AddForwardedPort(forwardedPort); @@ -498,7 +498,7 @@ public void Ssh_LocalPortForwardingCloseChannels() try { - using (var httpResponse = (HttpWebResponse)httpRequest.GetResponse()) + using (var httpResponse = (HttpWebResponse) httpRequest.GetResponse()) { Assert.AreEqual(HttpStatusCode.MovedPermanently, httpResponse.StatusCode); } @@ -550,7 +550,7 @@ public void Ssh_LocalPortForwarding() var localEndPoint = new IPEndPoint(IPAddress.Loopback, 1225); var forwardedPort = new ForwardedPortLocal(localEndPoint.Address.ToString(), - (uint)localEndPoint.Port, + (uint) localEndPoint.Port, hostNameAlias, 80); forwardedPort.Exception += @@ -568,7 +568,7 @@ public void Ssh_LocalPortForwarding() try { - using (var httpResponse = (HttpWebResponse)httpRequest.GetResponse()) + using (var httpResponse = (HttpWebResponse) httpRequest.GetResponse()) { Assert.AreEqual(HttpStatusCode.MovedPermanently, httpResponse.StatusCode); } @@ -627,7 +627,7 @@ public void Ssh_RemotePortForwarding() var forwardedPort1 = new ForwardedPortRemote(IPAddress.Loopback, 10002, endpoint1.Address, - (uint)endpoint1.Port); + (uint) endpoint1.Port); forwardedPort1.Exception += (sender, args) => Console.WriteLine(@"forwardedPort1 exception: " + args.Exception); client.AddForwardedPort(forwardedPort1); forwardedPort1.Start(); @@ -635,7 +635,7 @@ public void Ssh_RemotePortForwarding() var forwardedPort2 = new ForwardedPortRemote(IPAddress.Loopback, 10003, endpoint2.Address, - (uint)endpoint2.Port); + (uint) endpoint2.Port); forwardedPort2.Exception += (sender, args) => Console.WriteLine(@"forwardedPort2 exception: " + args.Exception); client.AddForwardedPort(forwardedPort2); forwardedPort2.Start(); @@ -940,7 +940,7 @@ private static void CreateShellScript(IConnectionInfoFactory connectionInfoFacto using (var sftpClient = new SftpClient(connectionInfoFactory.Create())) { sftpClient.Connect(); - + using (var sw = sftpClient.CreateText(remoteFile, new UTF8Encoding(false))) { sw.Write(script); diff --git a/test/Renci.SshNet.TestTools.OpenSSH/SshdConfig.cs b/test/Renci.SshNet.TestTools.OpenSSH/SshdConfig.cs index e5609be7b..a5bae901a 100644 --- a/test/Renci.SshNet.TestTools.OpenSSH/SshdConfig.cs +++ b/test/Renci.SshNet.TestTools.OpenSSH/SshdConfig.cs @@ -329,7 +329,7 @@ private static void ProcessGlobalOption(SshdConfig sshdConfig, string line) sshdConfig.KeyboardInteractiveAuthentication = ToBool(value); break; case "LogLevel": - sshdConfig.LogLevel = (LogLevel)Enum.Parse(typeof(LogLevel), value, ignoreCase: true); + sshdConfig.LogLevel = (LogLevel) Enum.Parse(typeof(LogLevel), value, ignoreCase: true); break; case "Subsystem": sshdConfig.Subsystems.Add(Subsystem.FromConfig(value)); diff --git a/test/Renci.SshNet.Tests/Classes/BaseClientTestBase.cs b/test/Renci.SshNet.Tests/Classes/BaseClientTestBase.cs index 7c6c58388..d22bfd17d 100644 --- a/test/Renci.SshNet.Tests/Classes/BaseClientTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/BaseClientTestBase.cs @@ -1,4 +1,5 @@ using Moq; + using Renci.SshNet.Connection; using Renci.SshNet.Tests.Common; diff --git a/test/Renci.SshNet.Tests/Classes/BaseClientTest_Connect_OnConnectedThrowsException.cs b/test/Renci.SshNet.Tests/Classes/BaseClientTest_Connect_OnConnectedThrowsException.cs index 543a5089c..6450a72c1 100644 --- a/test/Renci.SshNet.Tests/Classes/BaseClientTest_Connect_OnConnectedThrowsException.cs +++ b/test/Renci.SshNet.Tests/Classes/BaseClientTest_Connect_OnConnectedThrowsException.cs @@ -1,8 +1,11 @@ using System; using System.Linq; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Security; using Renci.SshNet.Tests.Common; @@ -48,9 +51,9 @@ protected override void Arrange() base.Arrange(); _client = new MyClient(_connectionInfo, false, ServiceFactoryMock.Object) - { - OnConnectedException = _onConnectException - }; + { + OnConnectedException = _onConnectException + }; } protected override void Act() diff --git a/test/Renci.SshNet.Tests/Classes/BaseClientTest_Connected_KeepAliveInterval_NotNegativeOne.cs b/test/Renci.SshNet.Tests/Classes/BaseClientTest_Connected_KeepAliveInterval_NotNegativeOne.cs index f3650976a..cbc740b01 100644 --- a/test/Renci.SshNet.Tests/Classes/BaseClientTest_Connected_KeepAliveInterval_NotNegativeOne.cs +++ b/test/Renci.SshNet.Tests/Classes/BaseClientTest_Connected_KeepAliveInterval_NotNegativeOne.cs @@ -1,7 +1,10 @@ using System; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Messages.Transport; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/BaseClientTest_Connected_KeepAlivesNotSentConcurrently.cs b/test/Renci.SshNet.Tests/Classes/BaseClientTest_Connected_KeepAlivesNotSentConcurrently.cs index c03251026..1fd6766d3 100644 --- a/test/Renci.SshNet.Tests/Classes/BaseClientTest_Connected_KeepAlivesNotSentConcurrently.cs +++ b/test/Renci.SshNet.Tests/Classes/BaseClientTest_Connected_KeepAlivesNotSentConcurrently.cs @@ -1,7 +1,10 @@ using System; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Messages.Transport; namespace Renci.SshNet.Tests.Classes @@ -47,9 +50,9 @@ protected override void Arrange() base.Arrange(); _client = new MyClient(_connectionInfo, false, ServiceFactoryMock.Object) - { - KeepAliveInterval = TimeSpan.FromMilliseconds(50d) - }; + { + KeepAliveInterval = TimeSpan.FromMilliseconds(50d) + }; _client.Connect(); } diff --git a/test/Renci.SshNet.Tests/Classes/BaseClientTest_Disconnected_Connect.cs b/test/Renci.SshNet.Tests/Classes/BaseClientTest_Disconnected_Connect.cs index ebde0c20c..db2cac1c6 100644 --- a/test/Renci.SshNet.Tests/Classes/BaseClientTest_Disconnected_Connect.cs +++ b/test/Renci.SshNet.Tests/Classes/BaseClientTest_Disconnected_Connect.cs @@ -1,5 +1,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Connection; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/BaseClientTest_Disconnected_KeepAliveInterval_NotNegativeOne.cs b/test/Renci.SshNet.Tests/Classes/BaseClientTest_Disconnected_KeepAliveInterval_NotNegativeOne.cs index e026d09b8..c94dcb1a3 100644 --- a/test/Renci.SshNet.Tests/Classes/BaseClientTest_Disconnected_KeepAliveInterval_NotNegativeOne.cs +++ b/test/Renci.SshNet.Tests/Classes/BaseClientTest_Disconnected_KeepAliveInterval_NotNegativeOne.cs @@ -1,7 +1,10 @@ using System; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Messages.Transport; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/BaseClientTest_NotConnected_KeepAliveInterval_NotNegativeOne.cs b/test/Renci.SshNet.Tests/Classes/BaseClientTest_NotConnected_KeepAliveInterval_NotNegativeOne.cs index e0720e422..b6276479d 100644 --- a/test/Renci.SshNet.Tests/Classes/BaseClientTest_NotConnected_KeepAliveInterval_NotNegativeOne.cs +++ b/test/Renci.SshNet.Tests/Classes/BaseClientTest_NotConnected_KeepAliveInterval_NotNegativeOne.cs @@ -1,7 +1,10 @@ using System; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Messages.Transport; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs index cf6d17bb0..94487075b 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs @@ -3,8 +3,11 @@ using System.Net; using System.Net.Sockets; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Messages.Connection; using Renci.SshNet.Tests.Common; @@ -70,9 +73,9 @@ private void Arrange() _clientReceivedFinishedWaitHandle = new ManualResetEvent(false); _channelException = null; - _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); - _remoteWindowSize = (uint)random.Next(0, int.MaxValue); - _remotePacketSize = (uint)random.Next(100, 200); + _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); + _remoteWindowSize = (uint) random.Next(0, int.MaxValue); + _remotePacketSize = (uint) random.Next(100, 200); _sessionMock = new Mock(MockBehavior.Strict); _connectionInfoMock = new Mock(MockBehavior.Strict); diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTestBase.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTestBase.cs index 52dfabb94..302f5d39f 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTestBase.cs @@ -1,4 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; namespace Renci.SshNet.Tests.Classes.Channels 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 da5ce0d12..5b0ac256b 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_Disposed.cs @@ -31,12 +31,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint)random.Next(0, int.MaxValue); - _localWindowSize = (uint)random.Next(2000, 3000); - _localPacketSize = (uint)random.Next(1000, 2000); - _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); - _remoteWindowSize = (uint)random.Next(0, int.MaxValue); - _remotePacketSize = (uint)random.Next(100, 200); + _localChannelNumber = (uint) random.Next(0, int.MaxValue); + _localWindowSize = (uint) random.Next(2000, 3000); + _localPacketSize = (uint) random.Next(1000, 2000); + _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); + _remoteWindowSize = (uint) random.Next(0, int.MaxValue); + _remotePacketSize = (uint) random.Next(100, 200); _channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20)); _sessionSemaphore = new SemaphoreSlim(1); _channelClosedRegister = new List(); @@ -72,8 +72,8 @@ protected override void SetupMocks() _remoteWindowSize, _remotePacketSize, _remoteChannelNumber))); - w.WaitOne(); - }); + w.WaitOne(); + }); SessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true); SessionMock.InSequence(sequence) .Setup(p => p.TrySendMessage(It.Is(m => m.LocalChannelNumber == _remoteChannelNumber))).Returns(true); 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 626a6519a..5b868e37a 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 @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -136,4 +139,4 @@ public void IsOpenShouldReturnFalse() Assert.IsFalse(_channel.IsOpen); } } -} \ No newline at end of file +} 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 dca9c0ecf..e8b8f5357 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 @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; 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 7a68ff177..5d16d83fd 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 @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; 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 6948fded2..26224f8b9 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 @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -123,4 +126,4 @@ public void IsOpenShouldReturnFalse() Assert.IsFalse(_channel.IsOpen); } } -} \ No newline at end of file +} 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 b07bf3d20..c020e52aa 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 @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; 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 d8294bf1f..c6a2eccb1 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 @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -121,4 +124,4 @@ public void IsOpenShouldReturnFalse() Assert.IsFalse(_channel.IsOpen); } } -} \ No newline at end of file +} 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 3b340bd42..ef6859501 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 @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; 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 ce2bc0969..f73825e7e 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 @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; 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 b547af778..bbc15bc5b 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 @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -141,4 +144,4 @@ public void IsOpenShouldReturnFalse() Assert.IsFalse(_channel.IsOpen); } } -} \ No newline at end of file +} 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 e2ded5942..15d743d1c 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 @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -122,4 +125,4 @@ public void IsOpenShouldReturnFalse() Assert.IsFalse(_channel.IsOpen); } } -} \ No newline at end of file +} 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 62f5ab4ac..aeaccfb8b 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 @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -119,4 +122,4 @@ public void IsOpenShouldReturnFalse() Assert.IsFalse(_channel.IsOpen); } } -} \ No newline at end of file +} 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 08f00b905..b417543e9 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 @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -113,4 +116,4 @@ public void IsOpenShouldReturnFalse() Assert.IsFalse(_channel.IsOpen); } } -} \ No newline at end of file +} 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 5771f4e10..e8b03cbfb 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; 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 44b9800a2..d6972517d 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_ExceptionWaitingOnOpenConfirmation.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_ExceptionWaitingOnOpenConfirmation.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -110,4 +113,4 @@ public void IsOpenShouldReturnFalse() Assert.IsFalse(_channel.IsOpen); } } -} \ No newline at end of file +} 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 37cf3ac06..9f986ca8b 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 @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Globalization; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -39,7 +42,7 @@ protected override void SetupData() _channelExceptionRegister = new List(); _actualException = null; - _failureReasonCode = (uint)random.Next(0, int.MaxValue); + _failureReasonCode = (uint) random.Next(0, int.MaxValue); _failureDescription = random.Next().ToString(CultureInfo.InvariantCulture); _failureLanguage = random.Next().ToString(CultureInfo.InvariantCulture); } @@ -74,8 +77,8 @@ protected override void SetupMocks() _failureReasonCode, _failureLanguage ))); - w.WaitOne(); - }); + w.WaitOne(); + }); SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object); ConnectionInfoMock.InSequence(sequence).Setup(p => p.RetryAttempts).Returns(1); } @@ -105,7 +108,7 @@ protected override void Act() public void OpenShouldHaveThrownSshException() { Assert.IsNotNull(_actualException); - Assert.AreEqual(typeof (SshException), _actualException.GetType()); + Assert.AreEqual(typeof(SshException), _actualException.GetType()); Assert.IsNull(_actualException.InnerException); Assert.AreEqual("Failed to open a channel after 1 attempts.", _actualException.Message); } @@ -134,4 +137,4 @@ public void IsOpenShouldReturnFalse() Assert.IsFalse(_channel.IsOpen); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_OnOpenFailureReceived_RetriesAvalable.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_OnOpenFailureReceived_RetriesAvalable.cs index 9934c0715..ce3f324bf 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_OnOpenFailureReceived_RetriesAvalable.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_OnOpenFailureReceived_RetriesAvalable.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Globalization; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelStub.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelStub.cs index 6476ec919..d89ec98c0 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelStub.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelStub.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; + using Renci.SshNet.Channels; using Renci.SshNet.Messages.Connection; @@ -33,7 +34,7 @@ public override ChannelTypes ChannelType public Exception OnDisconnectedException { get; set; } - public Exception OnEofException{ get; set; } + public Exception OnEofException { get; set; } public Exception OnErrorOccurredException { get; set; } diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTestBase.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTestBase.cs index f92810cca..e8f1aba2b 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTestBase.cs @@ -1,4 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; namespace Renci.SshNet.Tests.Classes.Channels 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 8847ff7a0..6263e3056 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsNotOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsNotOpen.cs @@ -1,7 +1,10 @@ using System; using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages; @@ -72,4 +75,4 @@ public void ExceptionShouldNeverHaveFired() Assert.AreEqual(0, _channelExceptionRegister.Count); } } -} \ No newline at end of file +} 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 679e1b8a2..b6454c68d 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 @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Diagnostics; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -152,4 +155,4 @@ public void ExceptionShouldNeverHaveFired() Assert.AreEqual(0, _channelExceptionRegister.Count); } } -} \ No newline at end of file +} 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 e59e95df8..031618699 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 @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Diagnostics; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -158,4 +161,4 @@ public void ExceptionShouldNeverHaveFired() Assert.AreEqual(0, _channelExceptionRegister.Count); } } -} \ No newline at end of file +} 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 23a00ca83..b394d0a63 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 @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; 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 7519c5dbc..8b41f5532 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 @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -118,4 +121,4 @@ public void ExceptionShouldNeverHaveFired() Assert.AreEqual(0, _channelExceptionRegister.Count); } } -} \ No newline at end of file +} 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 a5131338c..d4333a5d1 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 @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -118,4 +121,4 @@ public void ExceptionShouldNeverHaveFired() Assert.AreEqual(0, _channelExceptionRegister.Count); } } -} \ No newline at end of file +} 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 d7709464e..e073a6dd0 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsNotConnectedAndChannelIsNotOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsNotConnectedAndChannelIsNotOpen.cs @@ -1,7 +1,10 @@ using System; using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages; @@ -72,4 +75,4 @@ public void ExceptionShouldNeverHaveFired() Assert.AreEqual(0, _channelExceptionRegister.Count); } } -} \ No newline at end of file +} 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 d837c7341..bc8542b0e 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsNotConnectedAndChannelIsOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsNotConnectedAndChannelIsOpen.cs @@ -1,7 +1,10 @@ using System; using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Messages; @@ -72,4 +75,4 @@ public void ExceptionShouldNeverHaveFired() Assert.AreEqual(0, _channelExceptionRegister.Count); } } -} \ No newline at end of file +} 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 e8aa97529..05963363a 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 @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -140,4 +143,4 @@ public void ChannelCloseReceivedShouldBlockUntilClosedEventHandlerHasCompleted() Assert.IsTrue(_channelClosedEventHandlerCompleted.WaitOne(0)); } } -} \ No newline at end of file +} 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 b1d633b5e..443bf4684 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 @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; using Renci.SshNet.Tests.Common; 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 9f37a40a2..c64a07da6 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 @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; using Renci.SshNet.Tests.Common; @@ -126,4 +129,4 @@ public void ChannelCloseReceivedShouldBlockUntilClosedEventHandlerHasCompleted() Assert.IsTrue(_channelClosedEventHandlerCompleted.WaitOne(0)); } } -} \ No newline at end of file +} 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 ddbae080f..b47127ab3 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 @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes.Channels @@ -60,4 +62,4 @@ public void OnErrorOccuredShouldBeInvokedOnce() Assert.AreSame(_errorOccurredException, _channel.OnErrorOccurredInvocations[0]); } } -} \ No newline at end of file +} 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 83d4ac3f3..0bdb0d378 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_SendEof_ChannelIsNotOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_SendEof_ChannelIsNotOpen.cs @@ -1,7 +1,10 @@ using System; using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Messages; @@ -88,4 +91,4 @@ public void ExceptionShouldNeverHaveFired() Assert.AreEqual(0, _channelExceptionRegister.Count); } } -} \ No newline at end of file +} 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 ff843491b..06c3ca374 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_SendEof_ChannelIsOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_SendEof_ChannelIsOpen.cs @@ -1,7 +1,10 @@ using System; using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -81,4 +84,4 @@ public void ExceptionShouldNeverHaveFired() Assert.AreEqual(0, _channelExceptionRegister.Count); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ClientChannelStub.cs b/test/Renci.SshNet.Tests/Classes/Channels/ClientChannelStub.cs index 05c52f2ac..66113f60b 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ClientChannelStub.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ClientChannelStub.cs @@ -34,7 +34,7 @@ public override ChannelTypes ChannelType public Exception OnDisconnectedException { get; set; } - public Exception OnEofException{ get; set; } + public Exception OnEofException { get; set; } public Exception OnErrorOccurredException { get; set; } 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 4f0b3cfa8..413501ac5 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 @@ -1,7 +1,10 @@ using System; using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; 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 a7ccde35c..ebe10428e 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 @@ -1,7 +1,10 @@ using System; using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -28,8 +31,8 @@ public void Initialize() private void Arrange() { var random = new Random(); - _localChannelNumber = (uint)random.Next(0, int.MaxValue); - _localWindowSize = (uint)random.Next(1000, int.MaxValue); + _localChannelNumber = (uint) random.Next(0, int.MaxValue); + _localWindowSize = (uint) random.Next(1000, int.MaxValue); _localPacketSize = _localWindowSize - 1; _onOpenFailureException = new SystemException(); _channelExceptionRegister = new List(); diff --git a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest.cs b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest.cs index e2bb4d8c2..1bf0b8d83 100644 --- a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest.cs +++ b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest.cs @@ -1,6 +1,9 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes @@ -74,7 +77,7 @@ public void Ctor_PartialSuccessLimit_MaxValue() [TestMethod] public void AuthenticateShouldThrowArgumentNullExceptionWhenConnectionInfoIsNull() { - const IConnectionInfoInternal connectionInfo = null; + const IConnectionInfoInternal connectionInfo = null; var session = new Mock(MockBehavior.Strict).Object; try diff --git a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTestBase.cs b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTestBase.cs index 853114af8..9a4707b13 100644 --- a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTestBase.cs @@ -1,5 +1,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Failure_MultiList_AllAllowedAuthenticationsHaveReachedPartialSuccessLimit.cs b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Failure_MultiList_AllAllowedAuthenticationsHaveReachedPartialSuccessLimit.cs index bcf93a91f..e538dcca3 100644 --- a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Failure_MultiList_AllAllowedAuthenticationsHaveReachedPartialSuccessLimit.cs +++ b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Failure_MultiList_AllAllowedAuthenticationsHaveReachedPartialSuccessLimit.cs @@ -1,6 +1,9 @@ using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes @@ -67,7 +70,7 @@ protected override void SetupMocks() }); NoneAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password", "publickey", "keyboard-interactive"}); + .Returns(new[] { "password", "publickey", "keyboard-interactive" }); /* Enumerate supported authentication methods */ @@ -81,7 +84,7 @@ protected override void SetupMocks() .Returns(AuthenticationResult.PartialSuccess); PublicKeyAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -95,7 +98,7 @@ protected override void SetupMocks() .Returns(AuthenticationResult.PartialSuccess); PasswordAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -109,7 +112,7 @@ protected override void SetupMocks() .Returns(AuthenticationResult.PartialSuccess); PasswordAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"publickey"}); + .Returns(new[] { "publickey" }); /* Enumerate supported authentication methods */ @@ -123,7 +126,7 @@ protected override void SetupMocks() .Returns(AuthenticationResult.PartialSuccess); PublicKeyAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"publickey"}); + .Returns(new[] { "publickey" }); /* Enumerate supported authentication methods */ @@ -141,7 +144,7 @@ protected override void SetupMocks() PasswordAuthenticationMethodMock.InSequence(seq) .Setup(p => p.Name) .Returns("password-partial1"); - + SessionMock.InSequence(seq).Setup(p => p.UnRegisterMessage("SSH_MSG_USERAUTH_FAILURE")); SessionMock.InSequence(seq).Setup(p => p.UnRegisterMessage("SSH_MSG_USERAUTH_SUCCESS")); SessionMock.InSequence(seq).Setup(p => p.UnRegisterMessage("SSH_MSG_USERAUTH_BANNER")); @@ -187,4 +190,4 @@ public void AuthenticateShouldThrowSshAuthenticationException() Assert.AreEqual("Reached authentication attempt limit for method (password-partial1).", _actualException.Message); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Failure_SingleList_AuthenticationMethodFailed.cs b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Failure_SingleList_AuthenticationMethodFailed.cs index 66e931f84..8b8f38245 100644 --- a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Failure_SingleList_AuthenticationMethodFailed.cs +++ b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Failure_SingleList_AuthenticationMethodFailed.cs @@ -1,6 +1,9 @@ using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Failure_SingleList_AuthenticationMethodNotConfigured.cs b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Failure_SingleList_AuthenticationMethodNotConfigured.cs index 72a9da49a..eb94ca008 100644 --- a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Failure_SingleList_AuthenticationMethodNotConfigured.cs +++ b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Failure_SingleList_AuthenticationMethodNotConfigured.cs @@ -1,6 +1,9 @@ using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes @@ -38,7 +41,7 @@ protected override void SetupMocks() }); NoneAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); PublicKeyAuthenticationMethodMock.InSequence(seq).Setup(p => p.Name).Returns("publickey"); diff --git a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_DifferentAllowedAuthenticationsAfterPartialSuccess.cs b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_DifferentAllowedAuthenticationsAfterPartialSuccess.cs index 0f21f0bf5..b69121f09 100644 --- a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_DifferentAllowedAuthenticationsAfterPartialSuccess.cs +++ b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_DifferentAllowedAuthenticationsAfterPartialSuccess.cs @@ -1,5 +1,7 @@ using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; namespace Renci.SshNet.Tests.Classes @@ -58,7 +60,7 @@ protected override void SetupMocks() }); NoneAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"publickey", "password"}); + .Returns(new[] { "publickey", "password" }); /* Enumerate supported authentication methods */ @@ -71,7 +73,7 @@ protected override void SetupMocks() PasswordAuthenticationMethodMock.InSequence(seq).Setup(p => p.Authenticate(SessionMock.Object)) .Returns(AuthenticationResult.PartialSuccess); PasswordAuthenticationMethodMock.InSequence(seq).Setup(p => p.AllowedAuthentications) - .Returns(new[] {"keyboard-interactive", "publickey"}); + .Returns(new[] { "keyboard-interactive", "publickey" }); /* Enumerate supported authentication methods */ diff --git a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PartialSuccessLimitReachedFollowedByFailureInAlternateBranch.cs b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PartialSuccessLimitReachedFollowedByFailureInAlternateBranch.cs index f4c49023e..6d59884f5 100644 --- a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PartialSuccessLimitReachedFollowedByFailureInAlternateBranch.cs +++ b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PartialSuccessLimitReachedFollowedByFailureInAlternateBranch.cs @@ -1,6 +1,9 @@ using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes @@ -67,7 +70,7 @@ protected override void SetupMocks() }); NoneAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"publickey", "keyboard-interactive"}); + .Returns(new[] { "publickey", "keyboard-interactive" }); /* Enumerate supported authentication methods */ @@ -82,7 +85,7 @@ protected override void SetupMocks() .Returns(AuthenticationResult.PartialSuccess); PublicKeyAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -97,7 +100,7 @@ protected override void SetupMocks() .Returns(AuthenticationResult.PartialSuccess); PasswordAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -112,7 +115,7 @@ protected override void SetupMocks() .Returns(AuthenticationResult.PartialSuccess); PasswordAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -172,4 +175,4 @@ public void AuthenticateShouldThrowSshAuthenticationException() Assert.AreEqual("Permission denied (keyboard-interactive-failure).", _actualException.Message); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PartialSuccessLimitReachedFollowedByFailureInAlternateBranch2.cs b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PartialSuccessLimitReachedFollowedByFailureInAlternateBranch2.cs index e8c0e4745..775b8b73a 100644 --- a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PartialSuccessLimitReachedFollowedByFailureInAlternateBranch2.cs +++ b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PartialSuccessLimitReachedFollowedByFailureInAlternateBranch2.cs @@ -1,6 +1,9 @@ using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes @@ -133,7 +136,7 @@ protected override void SetupMocks() .Returns(AuthenticationResult.PartialSuccess); KeyboardInteractiveAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password", "publickey"}); + .Returns(new[] { "password", "publickey" }); /* Enumerate supported authentication methods */ @@ -199,4 +202,4 @@ public void AuthenticateShouldThrowSshAuthenticationException() Assert.AreEqual("Permission denied (publickey).", _actualException.Message); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PartialSuccessLimitReachedFollowedByFailureInSameBranch.cs b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PartialSuccessLimitReachedFollowedByFailureInSameBranch.cs index be985a702..b2500e8be 100644 --- a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PartialSuccessLimitReachedFollowedByFailureInSameBranch.cs +++ b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PartialSuccessLimitReachedFollowedByFailureInSameBranch.cs @@ -1,6 +1,9 @@ using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes @@ -63,7 +66,7 @@ protected override void SetupMocks() }); NoneAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -78,7 +81,7 @@ protected override void SetupMocks() .Returns(AuthenticationResult.PartialSuccess); PasswordAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password", "publickey"}); + .Returns(new[] { "password", "publickey" }); /* Enumerate supported authentication methods */ @@ -102,7 +105,7 @@ protected override void SetupMocks() .Returns(AuthenticationResult.PartialSuccess); PasswordAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"keyboard-interactive"}); + .Returns(new[] { "keyboard-interactive" }); /* Enumerate supported authentication methods */ diff --git a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PartialSuccessLimitReachedFollowedBySuccessInAlternateBranch.cs b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PartialSuccessLimitReachedFollowedBySuccessInAlternateBranch.cs index 877874145..88d0d75e1 100644 --- a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PartialSuccessLimitReachedFollowedBySuccessInAlternateBranch.cs +++ b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PartialSuccessLimitReachedFollowedBySuccessInAlternateBranch.cs @@ -67,7 +67,7 @@ protected override void SetupMocks() }); NoneAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"publickey", "keyboard-interactive"}); + .Returns(new[] { "publickey", "keyboard-interactive" }); /* Enumerate supported authentication methods */ @@ -82,7 +82,7 @@ protected override void SetupMocks() .Returns(AuthenticationResult.PartialSuccess); PublicKeyAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -97,7 +97,7 @@ protected override void SetupMocks() .Returns(AuthenticationResult.PartialSuccess); PasswordAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -112,7 +112,7 @@ protected override void SetupMocks() .Returns(AuthenticationResult.PartialSuccess); PasswordAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -133,7 +133,7 @@ protected override void SetupMocks() .Returns(AuthenticationResult.PartialSuccess); KeyboardInteractiveAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password", "publickey"}); + .Returns(new[] { "password", "publickey" }); /* Enumerate supported authentication methods */ diff --git a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PartialSuccessLimitReachedFollowedBySuccessInSameBranch.cs b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PartialSuccessLimitReachedFollowedBySuccessInSameBranch.cs index 228ad23f5..4d095c078 100644 --- a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PartialSuccessLimitReachedFollowedBySuccessInSameBranch.cs +++ b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PartialSuccessLimitReachedFollowedBySuccessInSameBranch.cs @@ -1,5 +1,7 @@ using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; namespace Renci.SshNet.Tests.Classes @@ -61,7 +63,7 @@ protected override void SetupMocks() }); NoneAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -76,7 +78,7 @@ protected override void SetupMocks() .Returns(AuthenticationResult.PartialSuccess); PasswordAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password", "publickey"}); + .Returns(new[] { "password", "publickey" }); /* Enumerate supported authentication methods */ @@ -100,7 +102,7 @@ protected override void SetupMocks() .Returns(AuthenticationResult.PartialSuccess); PasswordAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"keyboard-interactive"}); + .Returns(new[] { "keyboard-interactive" }); /* Enumerate supported authentication methods */ diff --git a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PostponePartialAccessAuthenticationMethod.cs b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PostponePartialAccessAuthenticationMethod.cs index 4a0d5fc24..2a481e31f 100644 --- a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PostponePartialAccessAuthenticationMethod.cs +++ b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_PostponePartialAccessAuthenticationMethod.cs @@ -58,7 +58,7 @@ protected override void SetupMocks() .Returns(AuthenticationResult.PartialSuccess); _ = PasswordAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password", "publickey"}); + .Returns(new[] { "password", "publickey" }); _ = KeyboardInteractiveAuthenticationMethodMock.InSequence(seq) .Setup(p => p.Name) .Returns("keyboard-interactive"); diff --git a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_SameAllowedAuthenticationsAfterPartialSuccess.cs b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_SameAllowedAuthenticationsAfterPartialSuccess.cs index 7cfd76ee1..2a5314361 100644 --- a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_SameAllowedAuthenticationsAfterPartialSuccess.cs +++ b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_SameAllowedAuthenticationsAfterPartialSuccess.cs @@ -1,5 +1,7 @@ using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; namespace Renci.SshNet.Tests.Classes @@ -41,7 +43,7 @@ protected override void SetupMocks() PasswordAuthenticationMethodMock.InSequence(seq).Setup(p => p.Authenticate(SessionMock.Object)) .Returns(AuthenticationResult.PartialSuccess); PasswordAuthenticationMethodMock.InSequence(seq).Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password", "publickey"}); + .Returns(new[] { "password", "publickey" }); PasswordAuthenticationMethodMock.InSequence(seq).Setup(p => p.Name).Returns("password"); PublicKeyAuthenticationMethodMock.InSequence(seq).Setup(p => p.Name).Returns("publickey"); KeyboardInteractiveAuthenticationMethodMock.InSequence(seq).Setup(p => p.Name).Returns("keyboard-interactive"); diff --git a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_SkipFailedAuthenticationMethod.cs b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_SkipFailedAuthenticationMethod.cs index 4ca447d60..3a9578f0a 100644 --- a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_SkipFailedAuthenticationMethod.cs +++ b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_MultiList_SkipFailedAuthenticationMethod.cs @@ -1,5 +1,7 @@ using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_SingleList_SameAllowedAuthenticationAfterPartialSuccess.cs b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_SingleList_SameAllowedAuthenticationAfterPartialSuccess.cs index e3f8ff3fb..be87fc9fe 100644 --- a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_SingleList_SameAllowedAuthenticationAfterPartialSuccess.cs +++ b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_SingleList_SameAllowedAuthenticationAfterPartialSuccess.cs @@ -1,5 +1,7 @@ using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; namespace Renci.SshNet.Tests.Classes @@ -55,7 +57,7 @@ protected override void SetupMocks() }); NoneAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -69,7 +71,7 @@ protected override void SetupMocks() .Returns(AuthenticationResult.PartialSuccess); PasswordAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ diff --git a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_SingleList_SameAllowedAuthenticationAfterPartialSuccess_PartialSuccessLimitReached.cs b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_SingleList_SameAllowedAuthenticationAfterPartialSuccess_PartialSuccessLimitReached.cs index 74261dc10..e98de6ecf 100644 --- a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_SingleList_SameAllowedAuthenticationAfterPartialSuccess_PartialSuccessLimitReached.cs +++ b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest_Success_SingleList_SameAllowedAuthenticationAfterPartialSuccess_PartialSuccessLimitReached.cs @@ -1,6 +1,9 @@ using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes @@ -75,7 +78,7 @@ protected override void SetupMocks() .Returns(AuthenticationResult.PartialSuccess); PasswordAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -144,7 +147,7 @@ public void AuthenticateShouldThrowSshAuthenticationException() { Assert.IsNotNull(_actualException); Assert.IsNull(_actualException.InnerException); - Assert.AreEqual("Reached authentication attempt limit for method (x_password_x).",_actualException.Message); + Assert.AreEqual("Reached authentication attempt limit for method (x_password_x).", _actualException.Message); } } } diff --git a/test/Renci.SshNet.Tests/Classes/CommandAsyncResultTest.cs b/test/Renci.SshNet.Tests/Classes/CommandAsyncResultTest.cs index c340f40f4..f8066bd03 100644 --- a/test/Renci.SshNet.Tests/Classes/CommandAsyncResultTest.cs +++ b/test/Renci.SshNet.Tests/Classes/CommandAsyncResultTest.cs @@ -1,5 +1,7 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/Common/BigIntegerTest.cs b/test/Renci.SshNet.Tests/Classes/Common/BigIntegerTest.cs index af5613e87..6a5e5ed18 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/BigIntegerTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/BigIntegerTest.cs @@ -13,8 +13,11 @@ using System; using System.Globalization; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; + #if FEATURE_NUMERICS_BIGINTEGER using BigInteger = System.Numerics.BigInteger; #else @@ -78,7 +81,7 @@ public class BigIntegerTest 0x57, 0x40, 0x51, 0xB6, 0x5D, 0xC, 0x17, 0xD1, 0x86, 0xE9, 0xA4, 0x20 }; - private static readonly byte[] Huge_div = {0x0}; + private static readonly byte[] Huge_div = { 0x0 }; private static readonly byte[] Huge_rem = { @@ -98,23 +101,23 @@ public class BigIntegerTest public void SetUpFixture() { _nfiUser = new NumberFormatInfo - { - CurrencyDecimalDigits = 3, - CurrencyDecimalSeparator = ":", - CurrencyGroupSeparator = "/", - CurrencyGroupSizes = new[] { 2, 1, 0 }, - CurrencyNegativePattern = 10, // n $- - CurrencyPositivePattern = 3, // n $ - CurrencySymbol = "XYZ", - PercentDecimalDigits = 1, - PercentDecimalSeparator = ";", - PercentGroupSeparator = "~", - PercentGroupSizes = new[] { 1 }, - PercentNegativePattern = 2, - PercentPositivePattern = 2, - PercentSymbol = "%%%", - NumberDecimalSeparator = "." - }; + { + CurrencyDecimalDigits = 3, + CurrencyDecimalSeparator = ":", + CurrencyGroupSeparator = "/", + CurrencyGroupSizes = new[] { 2, 1, 0 }, + CurrencyNegativePattern = 10, // n $- + CurrencyPositivePattern = 3, // n $ + CurrencySymbol = "XYZ", + PercentDecimalDigits = 1, + PercentDecimalSeparator = ";", + PercentGroupSeparator = "~", + PercentGroupSizes = new[] { 1 }, + PercentNegativePattern = 2, + PercentPositivePattern = 2, + PercentSymbol = "%%%", + NumberDecimalSeparator = "." + }; } [TestMethod] @@ -129,7 +132,7 @@ public void Mul() var a = new BigInteger(values[i]); var b = new BigInteger(values[j]); var c = a * b; - Assert.AreEqual(values[i] * values[j], (long)c, "#_" + i + "_" + j); + Assert.AreEqual(values[i] * values[j], (long) c, "#_" + i + "_" + j); } } } @@ -161,8 +164,8 @@ public void DivRem() var b = new BigInteger(values[j]); var c = BigInteger.DivRem(a, b, out var d); - Assert.AreEqual(values[i] / values[j], (long)c, "#a_" + i + "_" + j); - Assert.AreEqual(values[i] % values[j], (long)d, "#b_" + i + "_" + j); + Assert.AreEqual(values[i] / values[j], (long) c, "#a_" + i + "_" + j); + Assert.AreEqual(values[i] % values[j], (long) d, "#b_" + i + "_" + j); } } } @@ -188,11 +191,11 @@ public void Pow() } catch (ArgumentOutOfRangeException) { } - Assert.AreEqual(1, (int)BigInteger.Pow(99999, 0), "#2"); - Assert.AreEqual(99999, (int)BigInteger.Pow(99999, 1), "#5"); - Assert.AreEqual(59049, (int)BigInteger.Pow(3, 10), "#4"); - Assert.AreEqual(177147, (int)BigInteger.Pow(3, 11), "#5"); - Assert.AreEqual(-177147, (int)BigInteger.Pow(-3, 11), "#6"); + Assert.AreEqual(1, (int) BigInteger.Pow(99999, 0), "#2"); + Assert.AreEqual(99999, (int) BigInteger.Pow(99999, 1), "#5"); + Assert.AreEqual(59049, (int) BigInteger.Pow(3, 10), "#4"); + Assert.AreEqual(177147, (int) BigInteger.Pow(3, 11), "#5"); + Assert.AreEqual(-177147, (int) BigInteger.Pow(-3, 11), "#6"); } [TestMethod] @@ -212,36 +215,36 @@ public void ModPow() } catch (DivideByZeroException) { } - Assert.AreEqual(4L, (long)BigInteger.ModPow(3, 2, 5), "#2"); - Assert.AreEqual(20L, (long)BigInteger.ModPow(555, 10, 71), "#3"); - Assert.AreEqual(20L, (long)BigInteger.ModPow(-555, 10, 71), "#3"); - Assert.AreEqual(-24L, (long)BigInteger.ModPow(-555, 11, 71), "#3"); + Assert.AreEqual(4L, (long) BigInteger.ModPow(3, 2, 5), "#2"); + Assert.AreEqual(20L, (long) BigInteger.ModPow(555, 10, 71), "#3"); + Assert.AreEqual(20L, (long) BigInteger.ModPow(-555, 10, 71), "#3"); + Assert.AreEqual(-24L, (long) BigInteger.ModPow(-555, 11, 71), "#3"); } [TestMethod] public void GreatestCommonDivisor() { - Assert.AreEqual(999999, (int)BigInteger.GreatestCommonDivisor(999999, 0), "#1"); - Assert.AreEqual(999999, (int)BigInteger.GreatestCommonDivisor(0, 999999), "#2"); - Assert.AreEqual(1, (int)BigInteger.GreatestCommonDivisor(999999, 1), "#3"); - Assert.AreEqual(1, (int)BigInteger.GreatestCommonDivisor(1, 999999), "#4"); - Assert.AreEqual(1, (int)BigInteger.GreatestCommonDivisor(1, 0), "#5"); - Assert.AreEqual(1, (int)BigInteger.GreatestCommonDivisor(0, 1), "#6"); + Assert.AreEqual(999999, (int) BigInteger.GreatestCommonDivisor(999999, 0), "#1"); + Assert.AreEqual(999999, (int) BigInteger.GreatestCommonDivisor(0, 999999), "#2"); + Assert.AreEqual(1, (int) BigInteger.GreatestCommonDivisor(999999, 1), "#3"); + Assert.AreEqual(1, (int) BigInteger.GreatestCommonDivisor(1, 999999), "#4"); + Assert.AreEqual(1, (int) BigInteger.GreatestCommonDivisor(1, 0), "#5"); + Assert.AreEqual(1, (int) BigInteger.GreatestCommonDivisor(0, 1), "#6"); - Assert.AreEqual(1, (int)BigInteger.GreatestCommonDivisor(999999, -1), "#7"); - Assert.AreEqual(1, (int)BigInteger.GreatestCommonDivisor(-1, 999999), "#8"); - Assert.AreEqual(1, (int)BigInteger.GreatestCommonDivisor(-1, 0), "#9"); - Assert.AreEqual(1, (int)BigInteger.GreatestCommonDivisor(0, -1), "#10"); + Assert.AreEqual(1, (int) BigInteger.GreatestCommonDivisor(999999, -1), "#7"); + Assert.AreEqual(1, (int) BigInteger.GreatestCommonDivisor(-1, 999999), "#8"); + Assert.AreEqual(1, (int) BigInteger.GreatestCommonDivisor(-1, 0), "#9"); + Assert.AreEqual(1, (int) BigInteger.GreatestCommonDivisor(0, -1), "#10"); - Assert.AreEqual(2, (int)BigInteger.GreatestCommonDivisor(12345678, 8765432), "#11"); - Assert.AreEqual(2, (int)BigInteger.GreatestCommonDivisor(-12345678, 8765432), "#12"); - Assert.AreEqual(2, (int)BigInteger.GreatestCommonDivisor(12345678, -8765432), "#13"); - Assert.AreEqual(2, (int)BigInteger.GreatestCommonDivisor(-12345678, -8765432), "#14"); + Assert.AreEqual(2, (int) BigInteger.GreatestCommonDivisor(12345678, 8765432), "#11"); + Assert.AreEqual(2, (int) BigInteger.GreatestCommonDivisor(-12345678, 8765432), "#12"); + Assert.AreEqual(2, (int) BigInteger.GreatestCommonDivisor(12345678, -8765432), "#13"); + Assert.AreEqual(2, (int) BigInteger.GreatestCommonDivisor(-12345678, -8765432), "#14"); - Assert.AreEqual(40, (int)BigInteger.GreatestCommonDivisor(5581 * 40, 6671 * 40), "#15"); + Assert.AreEqual(40, (int) BigInteger.GreatestCommonDivisor(5581 * 40, 6671 * 40), "#15"); - Assert.AreEqual(5, (int)BigInteger.GreatestCommonDivisor(-5, 0), "#16"); - Assert.AreEqual(5, (int)BigInteger.GreatestCommonDivisor(0, -5), "#17"); + Assert.AreEqual(5, (int) BigInteger.GreatestCommonDivisor(-5, 0), "#16"); + Assert.AreEqual(5, (int) BigInteger.GreatestCommonDivisor(0, -5), "#17"); } [TestMethod] @@ -319,7 +322,7 @@ public void TestAdd2() var a = new BigInteger(values[i]); var b = new BigInteger(values[j]); var c = a + b; - Assert.AreEqual(values[i] + values[j], (long)c, "#_" + i + "_" + j); + Assert.AreEqual(values[i] + values[j], (long) c, "#_" + i + "_" + j); } } } @@ -348,8 +351,8 @@ public void TestSub() var c = a - b; var d = BigInteger.Subtract(a, b); - Assert.AreEqual(values[i] - values[j], (long)c, "#_" + i + "_" + j); - Assert.AreEqual(values[i] - values[j], (long)d, "#_" + i + "_" + j); + Assert.AreEqual(values[i] - values[j], (long) c, "#_" + i + "_" + j); + Assert.AreEqual(values[i] - values[j], (long) d, "#_" + i + "_" + j); } } } @@ -430,7 +433,7 @@ public void TestInc() var a = new BigInteger(values[i]); var b = ++a; - Assert.AreEqual(++values[i], (long)b, "#_" + i); + Assert.AreEqual(++values[i], (long) b, "#_" + i); } } @@ -651,8 +654,8 @@ public void IntCtorRoundTrip() var a = new BigInteger(val); var b = new BigInteger(a.ToByteArray()); - Assert.AreEqual(val, (int)a, "#a_" + val); - Assert.AreEqual(val, (int)b, "#b_" + val); + Assert.AreEqual(val, (int) a, "#a_" + val); + Assert.AreEqual(val, (int) b, "#b_" + val); } } @@ -786,10 +789,10 @@ public void TestToStringFmt() public void TestToStringFmtProvider() { var info = new NumberFormatInfo - { - NegativeSign = ">", - PositiveSign = "%" - }; + { + NegativeSign = ">", + PositiveSign = "%" + }; Assert.AreEqual("10", new BigInteger(10).ToString(info), "#1"); Assert.AreEqual(">10", new BigInteger(-10).ToString(info), "#2"); @@ -803,9 +806,9 @@ public void TestToStringFmtProvider() Assert.AreEqual(">10", new BigInteger(-10).ToString("R", info), "#10"); info = new NumberFormatInfo - { - NegativeSign = "#$%" - }; + { + NegativeSign = "#$%" + }; Assert.AreEqual("#$%10", new BigInteger(-10).ToString(info), "#2"); Assert.AreEqual("#$%10", new BigInteger(-10).ToString(null, info), "#2"); @@ -840,8 +843,8 @@ public void TestToIntOperator() } catch (OverflowException) { } - Assert.AreEqual(int.MaxValue, (int)new BigInteger(int.MaxValue), "#4"); - Assert.AreEqual(int.MinValue, (int)new BigInteger(int.MinValue), "#5"); + Assert.AreEqual(int.MaxValue, (int) new BigInteger(int.MaxValue), "#4"); + Assert.AreEqual(int.MinValue, (int) new BigInteger(int.MinValue), "#5"); } @@ -871,8 +874,8 @@ public void TestToLongOperator() } catch (OverflowException) { } - Assert.AreEqual(long.MaxValue, (long)new BigInteger(long.MaxValue), "#4"); - Assert.AreEqual(long.MinValue, (long)new BigInteger(long.MinValue), "#5"); + Assert.AreEqual(long.MaxValue, (long) new BigInteger(long.MaxValue), "#4"); + Assert.AreEqual(long.MinValue, (long) new BigInteger(long.MinValue), "#5"); } [TestMethod] @@ -931,8 +934,8 @@ public void CompareTo() [TestMethod] public void ShortOperators() { - Assert.AreEqual(22, (int)new BigInteger(22), "#1"); - Assert.AreEqual(-22, (int)new BigInteger(-22), "#2"); + Assert.AreEqual(22, (int) new BigInteger(22), "#1"); + Assert.AreEqual(-22, (int) new BigInteger(-22), "#2"); try { @@ -991,59 +994,59 @@ public void Ctor_Double_PositiveInfinity() [TestMethod] public void Ctor_Double() { - Assert.AreEqual(10000, (int)new BigInteger(10000.2)); - Assert.AreEqual(10000, (int)new BigInteger(10000.9)); - Assert.AreEqual(10000, (int)new BigInteger(10000.2)); - Assert.AreEqual(0, (int)new BigInteger(0.9)); - Assert.AreEqual(12345678999L, (long)new BigInteger(12345678999.33)); + Assert.AreEqual(10000, (int) new BigInteger(10000.2)); + Assert.AreEqual(10000, (int) new BigInteger(10000.9)); + Assert.AreEqual(10000, (int) new BigInteger(10000.2)); + Assert.AreEqual(0, (int) new BigInteger(0.9)); + Assert.AreEqual(12345678999L, (long) new BigInteger(12345678999.33)); } [TestMethod] public void DoubleConversion() { - Assert.AreEqual(999d, (double)new BigInteger(999), "#1"); - Assert.AreEqual(double.PositiveInfinity, (double)BigInteger.Pow(2, 1024), "#2"); - Assert.AreEqual(double.NegativeInfinity, (double)BigInteger.Pow(-2, 1025), "#3"); + Assert.AreEqual(999d, (double) new BigInteger(999), "#1"); + Assert.AreEqual(double.PositiveInfinity, (double) BigInteger.Pow(2, 1024), "#2"); + Assert.AreEqual(double.NegativeInfinity, (double) BigInteger.Pow(-2, 1025), "#3"); - Assert.AreEqual(0d, (double)BigInteger.Zero, "#4"); - Assert.AreEqual(1d, (double)BigInteger.One, "#5"); - Assert.AreEqual(-1d, (double)BigInteger.MinusOne, "#6"); + Assert.AreEqual(0d, (double) BigInteger.Zero, "#4"); + Assert.AreEqual(1d, (double) BigInteger.One, "#5"); + Assert.AreEqual(-1d, (double) BigInteger.MinusOne, "#6"); var result1 = BitConverter.Int64BitsToDouble(-4337852273739220173); - Assert.AreEqual(result1, (double)new BigInteger(new byte[] { 53, 152, 137, 177, 240, 81, 75, 198 }), "#7"); + Assert.AreEqual(result1, (double) new BigInteger(new byte[] { 53, 152, 137, 177, 240, 81, 75, 198 }), "#7"); var result2 = BitConverter.Int64BitsToDouble(4893382453283402035); - Assert.AreEqual(result2, (double)new BigInteger(new byte[] { 53, 152, 137, 177, 240, 81, 75, 198, 0 }), "#8"); + Assert.AreEqual(result2, (double) new BigInteger(new byte[] { 53, 152, 137, 177, 240, 81, 75, 198, 0 }), "#8"); var result3 = BitConverter.Int64BitsToDouble(5010775143622804480); var result4 = BitConverter.Int64BitsToDouble(5010775143622804481); var result5 = BitConverter.Int64BitsToDouble(5010775143622804482); - Assert.AreEqual(result3, (double)new BigInteger(new byte[] { 0, 0, 0, 0, 16, 128, 208, 159, 60, 46, 59, 3 }), "#9"); - Assert.AreEqual(result3, (double)new BigInteger(new byte[] { 0, 0, 0, 0, 17, 128, 208, 159, 60, 46, 59, 3 }), "#10"); - Assert.AreEqual(result3, (double)new BigInteger(new byte[] { 0, 0, 0, 0, 24, 128, 208, 159, 60, 46, 59, 3 }), "#11"); - Assert.AreEqual(result4, (double)new BigInteger(new byte[] { 0, 0, 0, 0, 32, 128, 208, 159, 60, 46, 59, 3 }), "#12"); - Assert.AreEqual(result4, (double)new BigInteger(new byte[] { 0, 0, 0, 0, 48, 128, 208, 159, 60, 46, 59, 3 }), "#13"); - Assert.AreEqual(result5, (double)new BigInteger(new byte[] { 0, 0, 0, 0, 64, 128, 208, 159, 60, 46, 59, 3 }), "#14"); + Assert.AreEqual(result3, (double) new BigInteger(new byte[] { 0, 0, 0, 0, 16, 128, 208, 159, 60, 46, 59, 3 }), "#9"); + Assert.AreEqual(result3, (double) new BigInteger(new byte[] { 0, 0, 0, 0, 17, 128, 208, 159, 60, 46, 59, 3 }), "#10"); + Assert.AreEqual(result3, (double) new BigInteger(new byte[] { 0, 0, 0, 0, 24, 128, 208, 159, 60, 46, 59, 3 }), "#11"); + Assert.AreEqual(result4, (double) new BigInteger(new byte[] { 0, 0, 0, 0, 32, 128, 208, 159, 60, 46, 59, 3 }), "#12"); + Assert.AreEqual(result4, (double) new BigInteger(new byte[] { 0, 0, 0, 0, 48, 128, 208, 159, 60, 46, 59, 3 }), "#13"); + Assert.AreEqual(result5, (double) new BigInteger(new byte[] { 0, 0, 0, 0, 64, 128, 208, 159, 60, 46, 59, 3 }), "#14"); - Assert.AreEqual(BitConverter.Int64BitsToDouble(-2748107935317889142), (double)new BigInteger(Huge_a), "#15"); - Assert.AreEqual(BitConverter.Int64BitsToDouble(-2354774254443231289), (double)new BigInteger(Huge_b), "#16"); - Assert.AreEqual(BitConverter.Int64BitsToDouble(8737073938546854790), (double)new BigInteger(Huge_mul), "#17"); + Assert.AreEqual(BitConverter.Int64BitsToDouble(-2748107935317889142), (double) new BigInteger(Huge_a), "#15"); + Assert.AreEqual(BitConverter.Int64BitsToDouble(-2354774254443231289), (double) new BigInteger(Huge_b), "#16"); + Assert.AreEqual(BitConverter.Int64BitsToDouble(8737073938546854790), (double) new BigInteger(Huge_mul), "#17"); - Assert.AreEqual(BitConverter.Int64BitsToDouble(6912920136897069886), (double)(2278888483353476799 * BigInteger.Pow(2, 451)), "#18"); - Assert.AreEqual(double.PositiveInfinity, (double)(843942696292817306 * BigInteger.Pow(2, 965)), "#19"); + Assert.AreEqual(BitConverter.Int64BitsToDouble(6912920136897069886), (double) (2278888483353476799 * BigInteger.Pow(2, 451)), "#18"); + Assert.AreEqual(double.PositiveInfinity, (double) (843942696292817306 * BigInteger.Pow(2, 965)), "#19"); } [TestMethod] public void DecimalCtor() { - Assert.AreEqual(999, (int)new BigInteger(999.99m), "#1"); - Assert.AreEqual(-10000, (int)new BigInteger(-10000m), "#2"); - Assert.AreEqual(0, (int)new BigInteger(0m), "#3"); + Assert.AreEqual(999, (int) new BigInteger(999.99m), "#1"); + Assert.AreEqual(-10000, (int) new BigInteger(-10000m), "#2"); + Assert.AreEqual(0, (int) new BigInteger(0m), "#3"); } [TestMethod] public void DecimalConversion() { - Assert.AreEqual(999m, (decimal)new BigInteger(999), "#1"); + Assert.AreEqual(999m, (decimal) new BigInteger(999), "#1"); try { @@ -1063,11 +1066,11 @@ public void DecimalConversion() { } - Assert.AreEqual(0m, (decimal)new BigInteger(0), "#4"); - Assert.AreEqual(1m, (decimal)new BigInteger(1), "#5"); - Assert.AreEqual(-1m, (decimal)new BigInteger(-1), "#6"); - Assert.AreEqual(9999999999999999999999999999m, (decimal)new BigInteger(9999999999999999999999999999m), "#7"); - Assert.AreEqual(0m, (decimal)new BigInteger(), "#8"); + Assert.AreEqual(0m, (decimal) new BigInteger(0), "#4"); + Assert.AreEqual(1m, (decimal) new BigInteger(1), "#5"); + Assert.AreEqual(-1m, (decimal) new BigInteger(-1), "#6"); + Assert.AreEqual(9999999999999999999999999999m, (decimal) new BigInteger(9999999999999999999999999999m), "#7"); + Assert.AreEqual(0m, (decimal) new BigInteger(), "#8"); } [TestMethod] @@ -1116,26 +1119,26 @@ public void Parse() } catch (FormatException) { } - Assert.AreEqual(10, (int)BigInteger.Parse("+10"), "#7"); - Assert.AreEqual(10, (int)BigInteger.Parse("10 "), "#8"); - Assert.AreEqual(-10, (int)BigInteger.Parse("-10 "), "#9"); - Assert.AreEqual(10, (int)BigInteger.Parse(" 10 "), "#10"); - Assert.AreEqual(-10, (int)BigInteger.Parse(" -10 "), "#11"); + Assert.AreEqual(10, (int) BigInteger.Parse("+10"), "#7"); + Assert.AreEqual(10, (int) BigInteger.Parse("10 "), "#8"); + Assert.AreEqual(-10, (int) BigInteger.Parse("-10 "), "#9"); + Assert.AreEqual(10, (int) BigInteger.Parse(" 10 "), "#10"); + Assert.AreEqual(-10, (int) BigInteger.Parse(" -10 "), "#11"); - Assert.AreEqual(-1, (int)BigInteger.Parse("F", NumberStyles.AllowHexSpecifier), "#12"); - Assert.AreEqual(-8, (int)BigInteger.Parse("8", NumberStyles.AllowHexSpecifier), "#13"); - Assert.AreEqual(8, (int)BigInteger.Parse("08", NumberStyles.AllowHexSpecifier), "#14"); - Assert.AreEqual(15, (int)BigInteger.Parse("0F", NumberStyles.AllowHexSpecifier), "#15"); - Assert.AreEqual(-1, (int)BigInteger.Parse("FF", NumberStyles.AllowHexSpecifier), "#16"); - Assert.AreEqual(255, (int)BigInteger.Parse("0FF", NumberStyles.AllowHexSpecifier), "#17"); + Assert.AreEqual(-1, (int) BigInteger.Parse("F", NumberStyles.AllowHexSpecifier), "#12"); + Assert.AreEqual(-8, (int) BigInteger.Parse("8", NumberStyles.AllowHexSpecifier), "#13"); + Assert.AreEqual(8, (int) BigInteger.Parse("08", NumberStyles.AllowHexSpecifier), "#14"); + Assert.AreEqual(15, (int) BigInteger.Parse("0F", NumberStyles.AllowHexSpecifier), "#15"); + Assert.AreEqual(-1, (int) BigInteger.Parse("FF", NumberStyles.AllowHexSpecifier), "#16"); + Assert.AreEqual(255, (int) BigInteger.Parse("0FF", NumberStyles.AllowHexSpecifier), "#17"); - Assert.AreEqual(-17, (int)BigInteger.Parse(" (17) ", NumberStyles.AllowParentheses | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite), "#18"); - Assert.AreEqual(-23, (int)BigInteger.Parse(" -23 ", NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite), "#19"); + Assert.AreEqual(-17, (int) BigInteger.Parse(" (17) ", NumberStyles.AllowParentheses | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite), "#18"); + Assert.AreEqual(-23, (int) BigInteger.Parse(" -23 ", NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite), "#19"); - Assert.AreEqual(300000, (int)BigInteger.Parse("3E5", NumberStyles.AllowExponent), "#20"); + Assert.AreEqual(300000, (int) BigInteger.Parse("3E5", NumberStyles.AllowExponent), "#20"); var dsep = NumberFormatInfo.CurrentInfo.NumberDecimalSeparator; - Assert.AreEqual(250, (int)BigInteger.Parse("2" + dsep + "5E2", NumberStyles.AllowExponent | NumberStyles.AllowDecimalPoint), "#21");//2.5E2 = 250 - Assert.AreEqual(25, (int)BigInteger.Parse("2500E-2", NumberStyles.AllowExponent), "#22"); + Assert.AreEqual(250, (int) BigInteger.Parse("2" + dsep + "5E2", NumberStyles.AllowExponent | NumberStyles.AllowDecimalPoint), "#21");//2.5E2 = 250 + Assert.AreEqual(25, (int) BigInteger.Parse("2500E-2", NumberStyles.AllowExponent), "#22"); Assert.AreEqual("136236974127783066520110477975349088954559032721408", BigInteger.Parse("136236974127783066520110477975349088954559032721408", NumberStyles.None).ToString(), "#23"); Assert.AreEqual("136236974127783066520110477975349088954559032721408", BigInteger.Parse("136236974127783066520110477975349088954559032721408").ToString(), "#24"); @@ -1273,19 +1276,19 @@ public void TestUserCurrency() Assert.AreEqual("1234/5/67:000 XYZ", s, "Currency value type 2 is not what we want to try to parse"); v = BigInteger.Parse(s, NumberStyles.Currency, _nfiUser); - Assert.AreEqual(val2, (int)v); + Assert.AreEqual(val2, (int) v); } [TestMethod] public void TryParseWeirdCulture() { var old = Thread.CurrentThread.CurrentCulture; - var cur = (CultureInfo)old.Clone(); + var cur = (CultureInfo) old.Clone(); cur.NumberFormat = new NumberFormatInfo - { - NegativeSign = ">", - PositiveSign = "%" - }; + { + NegativeSign = ">", + PositiveSign = "%" + }; Thread.CurrentThread.CurrentCulture = cur; @@ -1517,13 +1520,13 @@ public void DefaultCtorWorks() Assert.AreEqual(true, a.IsEven, "#8"); a = new BigInteger(); - Assert.AreEqual(0, (int)a, "#9"); + Assert.AreEqual(0, (int) a, "#9"); a = new BigInteger(); - Assert.AreEqual((uint) 0, (uint)a, "#10"); + Assert.AreEqual((uint) 0, (uint) a, "#10"); a = new BigInteger(); - Assert.AreEqual((ulong) 0, (ulong)a, "#11"); + Assert.AreEqual((ulong) 0, (ulong) a, "#11"); a = new BigInteger(); Assert.AreEqual(true, a.Equals(a), "#12"); @@ -1550,7 +1553,7 @@ public void Bug16526() Assert.AreEqual("-9223372036854775809", x.ToString(), "#1"); try { - x = (long)x; + x = (long) x; Assert.Fail("#2 Must OVF: " + x); } catch (OverflowException) diff --git a/test/Renci.SshNet.Tests/Classes/Common/ChannelDataEventArgsTest.cs b/test/Renci.SshNet.Tests/Classes/Common/ChannelDataEventArgsTest.cs index 3c68163fb..cc7e54889 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/ChannelDataEventArgsTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/ChannelDataEventArgsTest.cs @@ -1,13 +1,14 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes.Common { /// - /// Provides data for event and events. + /// Provides data for event and events. /// [TestClass] public class ChannelDataEventArgsTest : TestBase { } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Common/ChannelEventArgsTest.cs b/test/Renci.SshNet.Tests/Classes/Common/ChannelEventArgsTest.cs index 4e411de94..b741c897e 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/ChannelEventArgsTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/ChannelEventArgsTest.cs @@ -1,4 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes.Common @@ -10,4 +11,4 @@ namespace Renci.SshNet.Tests.Classes.Common public class ChannelEventArgsTest : TestBase { } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Common/ChannelOpenFailedEventArgsTest.cs b/test/Renci.SshNet.Tests/Classes/Common/ChannelOpenFailedEventArgsTest.cs index 2265a5f79..2d42c5705 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/ChannelOpenFailedEventArgsTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/ChannelOpenFailedEventArgsTest.cs @@ -1,4 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes.Common diff --git a/test/Renci.SshNet.Tests/Classes/Common/ChannelRequestEventArgsTest.cs b/test/Renci.SshNet.Tests/Classes/Common/ChannelRequestEventArgsTest.cs index 093a59c91..6b5eeca91 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/ChannelRequestEventArgsTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/ChannelRequestEventArgsTest.cs @@ -1,13 +1,14 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes.Common { /// - /// Provides data for event. + /// Provides data for event. /// [TestClass] public class ChannelRequestEventArgsTest : TestBase { } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Common/CountdownEventTest_Dispose_NotSet.cs b/test/Renci.SshNet.Tests/Classes/Common/CountdownEventTest_Dispose_NotSet.cs index a2badf97e..c85115f65 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/CountdownEventTest_Dispose_NotSet.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/CountdownEventTest_Dispose_NotSet.cs @@ -1,7 +1,8 @@ using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Threading; +using Microsoft.VisualStudio.TestTools.UnitTesting; + namespace Renci.SshNet.Tests.Classes.Common { [TestClass] diff --git a/test/Renci.SshNet.Tests/Classes/Common/CountdownEventTest_Dispose_Set.cs b/test/Renci.SshNet.Tests/Classes/Common/CountdownEventTest_Dispose_Set.cs index df5f5b979..511ace48d 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/CountdownEventTest_Dispose_Set.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/CountdownEventTest_Dispose_Set.cs @@ -1,7 +1,8 @@ using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System.Threading; +using Microsoft.VisualStudio.TestTools.UnitTesting; + namespace Renci.SshNet.Tests.Classes.Common { [TestClass] diff --git a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Concat.cs b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Concat.cs index 13b1d8eef..bbae3afac 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Concat.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Concat.cs @@ -1,5 +1,7 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes.Common diff --git a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_IsEqualTo_ByteArray.cs b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_IsEqualTo_ByteArray.cs index 2513aebfb..3a780b259 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_IsEqualTo_ByteArray.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_IsEqualTo_ByteArray.cs @@ -1,5 +1,7 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes.Common @@ -72,8 +74,8 @@ public void ShouldThrowArgumentNullExceptionWhenLeftAndRightAreNull() [TestMethod] public void ShouldReturnFalseWhenLeftIsNotEqualToRight() { - Assert.IsFalse(Extensions.IsEqualTo(new byte[] {0x0a}, new byte[] {0x0a, 0x0d})); - Assert.IsFalse(Extensions.IsEqualTo(new byte[] {0x0a, 0x0d}, new byte[] {0x0a})); + Assert.IsFalse(Extensions.IsEqualTo(new byte[] { 0x0a }, new byte[] { 0x0a, 0x0d })); + Assert.IsFalse(Extensions.IsEqualTo(new byte[] { 0x0a, 0x0d }, new byte[] { 0x0a })); Assert.IsFalse(Extensions.IsEqualTo(new byte[0], new byte[] { 0x0a })); Assert.IsFalse(Extensions.IsEqualTo(new byte[] { 0x0a, 0x0d }, new byte[0])); } diff --git a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Pad.cs b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Pad.cs index 1b933af0c..3a7bb32f8 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Pad.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Pad.cs @@ -10,7 +10,7 @@ public class ExtensionsTest_Pad [TestMethod] public void ShouldReturnNotPadded() { - byte[] value = {0x0a, 0x0d}; + byte[] value = { 0x0a, 0x0d }; var padded = value.Pad(2); Assert.AreEqual(value, padded); Assert.AreEqual(value.Length, padded.Length); diff --git a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Reverse.cs b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Reverse.cs index 019924a1a..585df1aa9 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Reverse.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Reverse.cs @@ -1,5 +1,7 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes.Common @@ -38,7 +40,7 @@ public void Null() [TestMethod] public void Small() { - var value = new[] {0, 1, 4, 3, 7, 9}; + var value = new[] { 0, 1, 4, 3, 7, 9 }; var actual = Extensions.Reverse(value); 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 ea43330d9..0f30c0aea 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Take_Count.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Take_Count.cs @@ -1,5 +1,7 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes.Common 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 16527bf1c..f455915d2 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Take_OffsetAndCount.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_Take_OffsetAndCount.cs @@ -1,5 +1,7 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes.Common diff --git a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_TrimLeadingZeros.cs b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_TrimLeadingZeros.cs index 814f80397..dee706b0f 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_TrimLeadingZeros.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/ExtensionsTest_TrimLeadingZeros.cs @@ -1,5 +1,7 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes.Common @@ -27,7 +29,7 @@ public void ShouldThrowArgumentNullExceptionWhenValueIsNull() [TestMethod] public void ShouldRemoveAllLeadingZeros() { - byte[] value = {0x00, 0x00, 0x0a, 0x0d}; + byte[] value = { 0x00, 0x00, 0x0a, 0x0d }; var actual = Extensions.TrimLeadingZeros(value); @@ -69,7 +71,7 @@ public void ShouldReturnOriginalEmptyByteArrayWhenValueHasNoLeadingZeros() [TestMethod] public void ShouldReturnEmptyByteArrayWhenValueIsEmpty() { - byte[] value = {}; + byte[] value = { }; var actual = Extensions.TrimLeadingZeros(value); diff --git a/test/Renci.SshNet.Tests/Classes/Common/HostKeyEventArgsTest.cs b/test/Renci.SshNet.Tests/Classes/Common/HostKeyEventArgsTest.cs index 84d899f8c..b298c8d85 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/HostKeyEventArgsTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/HostKeyEventArgsTest.cs @@ -1,8 +1,10 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Linq; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Security; using Renci.SshNet.Tests.Common; -using System.Linq; namespace Renci.SshNet.Tests.Classes.Common { @@ -88,7 +90,7 @@ private static KeyHostAlgorithm GetKeyHostAlgorithm() using (var s = GetData("Key.RSA.txt")) { var privateKey = new PrivateKeyFile(s); - return (KeyHostAlgorithm)privateKey.HostKeyAlgorithms.Single(x => x.Name == "rsa-sha2-512"); + return (KeyHostAlgorithm) privateKey.HostKeyAlgorithms.Single(x => x.Name == "rsa-sha2-512"); } } diff --git a/test/Renci.SshNet.Tests/Classes/Common/ObjectIdentifierTest.cs b/test/Renci.SshNet.Tests/Classes/Common/ObjectIdentifierTest.cs index 608159424..c0b74098b 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/ObjectIdentifierTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/ObjectIdentifierTest.cs @@ -1,6 +1,7 @@ using System; using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Tests.Common; diff --git a/test/Renci.SshNet.Tests/Classes/Common/PackTest.cs b/test/Renci.SshNet.Tests/Classes/Common/PackTest.cs index a5ff500f0..13696757a 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/PackTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/PackTest.cs @@ -1,4 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes.Common @@ -9,173 +10,173 @@ public class PackTest [TestMethod] public void BigEndianToUInt16() { - Assert.AreEqual(0, Pack.BigEndianToUInt16(new byte[] {0, 0})); - Assert.AreEqual(1, Pack.BigEndianToUInt16(new byte[] {0, 1})); - Assert.AreEqual(256, Pack.BigEndianToUInt16(new byte[] {1, 0})); - Assert.AreEqual(257, Pack.BigEndianToUInt16(new byte[] {1, 1})); - Assert.AreEqual(1025, Pack.BigEndianToUInt16(new byte[] {4, 1})); - Assert.AreEqual(ushort.MaxValue, Pack.BigEndianToUInt16(new byte[] {255, 255})); + Assert.AreEqual(0, Pack.BigEndianToUInt16(new byte[] { 0, 0 })); + Assert.AreEqual(1, Pack.BigEndianToUInt16(new byte[] { 0, 1 })); + Assert.AreEqual(256, Pack.BigEndianToUInt16(new byte[] { 1, 0 })); + Assert.AreEqual(257, Pack.BigEndianToUInt16(new byte[] { 1, 1 })); + Assert.AreEqual(1025, Pack.BigEndianToUInt16(new byte[] { 4, 1 })); + Assert.AreEqual(ushort.MaxValue, Pack.BigEndianToUInt16(new byte[] { 255, 255 })); } [TestMethod] public void BigEndianToUInt32() { - Assert.AreEqual(0U, Pack.BigEndianToUInt32(new byte[] {0, 0, 0, 0})); - Assert.AreEqual(1U, Pack.BigEndianToUInt32(new byte[] {0, 0, 0, 1})); - Assert.AreEqual(256U, Pack.BigEndianToUInt32(new byte[] {0, 0, 1, 0})); - Assert.AreEqual(257U, Pack.BigEndianToUInt32(new byte[] {0, 0, 1, 1})); - Assert.AreEqual(1025U, Pack.BigEndianToUInt32(new byte[] {0, 0, 4, 1})); - Assert.AreEqual(65536U, Pack.BigEndianToUInt32(new byte[] {0, 1, 0, 0})); - Assert.AreEqual(133124U, Pack.BigEndianToUInt32(new byte[] {0, 2, 8, 4})); - Assert.AreEqual(16777216U, Pack.BigEndianToUInt32(new byte[] {1, 0, 0, 0})); - Assert.AreEqual(uint.MaxValue, Pack.BigEndianToUInt32(new byte[] {255, 255, 255, 255})); + Assert.AreEqual(0U, Pack.BigEndianToUInt32(new byte[] { 0, 0, 0, 0 })); + Assert.AreEqual(1U, Pack.BigEndianToUInt32(new byte[] { 0, 0, 0, 1 })); + Assert.AreEqual(256U, Pack.BigEndianToUInt32(new byte[] { 0, 0, 1, 0 })); + Assert.AreEqual(257U, Pack.BigEndianToUInt32(new byte[] { 0, 0, 1, 1 })); + Assert.AreEqual(1025U, Pack.BigEndianToUInt32(new byte[] { 0, 0, 4, 1 })); + Assert.AreEqual(65536U, Pack.BigEndianToUInt32(new byte[] { 0, 1, 0, 0 })); + Assert.AreEqual(133124U, Pack.BigEndianToUInt32(new byte[] { 0, 2, 8, 4 })); + Assert.AreEqual(16777216U, Pack.BigEndianToUInt32(new byte[] { 1, 0, 0, 0 })); + Assert.AreEqual(uint.MaxValue, Pack.BigEndianToUInt32(new byte[] { 255, 255, 255, 255 })); } [TestMethod] public void BigEndianToUInt64() { - Assert.AreEqual(0UL, Pack.BigEndianToUInt64(new byte[] {0, 0, 0, 0, 0, 0, 0, 0})); - Assert.AreEqual(1UL, Pack.BigEndianToUInt64(new byte[] {0, 0, 0, 0, 0, 0, 0, 1})); - Assert.AreEqual(256UL, Pack.BigEndianToUInt64(new byte[] {0, 0, 0, 0, 0, 0, 1, 0})); - Assert.AreEqual(257UL, Pack.BigEndianToUInt64(new byte[] {0, 0, 0, 0, 0, 0, 1, 1})); - Assert.AreEqual(65536UL, Pack.BigEndianToUInt64(new byte[] {0, 0, 0, 0, 0, 1, 0, 0})); - Assert.AreEqual(133124UL, Pack.BigEndianToUInt64(new byte[] {0, 0, 0, 0, 0, 2, 8, 4})); - Assert.AreEqual(16777216UL, Pack.BigEndianToUInt64(new byte[] {0, 0, 0, 0, 1, 0, 0, 0})); - Assert.AreEqual(4294967296UL, Pack.BigEndianToUInt64(new byte[] {0, 0, 0, 1, 0, 0, 0, 0})); - Assert.AreEqual(1099511627776UL, Pack.BigEndianToUInt64(new byte[] {0, 0, 1, 0, 0, 0, 0, 0})); - Assert.AreEqual(1099511892096UL, Pack.BigEndianToUInt64(new byte[] {0, 0, 1, 0, 0, 4, 8, 128})); - Assert.AreEqual(1099511627776UL * 256, Pack.BigEndianToUInt64(new byte[] {0, 1, 0, 0, 0, 0, 0, 0})); - Assert.AreEqual(1099511627776UL * 256 * 256, Pack.BigEndianToUInt64(new byte[] {1, 0, 0, 0, 0, 0, 0, 0})); - Assert.AreEqual(ulong.MaxValue, Pack.BigEndianToUInt64(new byte[] {255, 255, 255, 255, 255, 255, 255, 255})); + Assert.AreEqual(0UL, Pack.BigEndianToUInt64(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 })); + Assert.AreEqual(1UL, Pack.BigEndianToUInt64(new byte[] { 0, 0, 0, 0, 0, 0, 0, 1 })); + Assert.AreEqual(256UL, Pack.BigEndianToUInt64(new byte[] { 0, 0, 0, 0, 0, 0, 1, 0 })); + Assert.AreEqual(257UL, Pack.BigEndianToUInt64(new byte[] { 0, 0, 0, 0, 0, 0, 1, 1 })); + Assert.AreEqual(65536UL, Pack.BigEndianToUInt64(new byte[] { 0, 0, 0, 0, 0, 1, 0, 0 })); + Assert.AreEqual(133124UL, Pack.BigEndianToUInt64(new byte[] { 0, 0, 0, 0, 0, 2, 8, 4 })); + Assert.AreEqual(16777216UL, Pack.BigEndianToUInt64(new byte[] { 0, 0, 0, 0, 1, 0, 0, 0 })); + Assert.AreEqual(4294967296UL, Pack.BigEndianToUInt64(new byte[] { 0, 0, 0, 1, 0, 0, 0, 0 })); + Assert.AreEqual(1099511627776UL, Pack.BigEndianToUInt64(new byte[] { 0, 0, 1, 0, 0, 0, 0, 0 })); + Assert.AreEqual(1099511892096UL, Pack.BigEndianToUInt64(new byte[] { 0, 0, 1, 0, 0, 4, 8, 128 })); + Assert.AreEqual(1099511627776UL * 256, Pack.BigEndianToUInt64(new byte[] { 0, 1, 0, 0, 0, 0, 0, 0 })); + Assert.AreEqual(1099511627776UL * 256 * 256, Pack.BigEndianToUInt64(new byte[] { 1, 0, 0, 0, 0, 0, 0, 0 })); + Assert.AreEqual(ulong.MaxValue, Pack.BigEndianToUInt64(new byte[] { 255, 255, 255, 255, 255, 255, 255, 255 })); } [TestMethod] public void LittleEndianToUInt16() { - Assert.AreEqual((ushort) 0, Pack.LittleEndianToUInt16(new byte[] {0, 0})); - Assert.AreEqual((ushort) 1, Pack.LittleEndianToUInt16(new byte[] {1, 0})); - Assert.AreEqual((ushort) 256, Pack.LittleEndianToUInt16(new byte[] {0, 1})); - Assert.AreEqual((ushort) 257, Pack.LittleEndianToUInt16(new byte[] {1, 1})); - Assert.AreEqual((ushort) 1025, Pack.LittleEndianToUInt16(new byte[] {1, 4})); - Assert.AreEqual(ushort.MaxValue, Pack.LittleEndianToUInt16(new byte[] {255, 255})); + Assert.AreEqual((ushort) 0, Pack.LittleEndianToUInt16(new byte[] { 0, 0 })); + Assert.AreEqual((ushort) 1, Pack.LittleEndianToUInt16(new byte[] { 1, 0 })); + Assert.AreEqual((ushort) 256, Pack.LittleEndianToUInt16(new byte[] { 0, 1 })); + Assert.AreEqual((ushort) 257, Pack.LittleEndianToUInt16(new byte[] { 1, 1 })); + Assert.AreEqual((ushort) 1025, Pack.LittleEndianToUInt16(new byte[] { 1, 4 })); + Assert.AreEqual(ushort.MaxValue, Pack.LittleEndianToUInt16(new byte[] { 255, 255 })); } [TestMethod] public void LittleEndianToUInt32() { - Assert.AreEqual(0U, Pack.LittleEndianToUInt32(new byte[] {0, 0, 0, 0})); - Assert.AreEqual(1U, Pack.LittleEndianToUInt32(new byte[] {1, 0, 0, 0})); - Assert.AreEqual(256U, Pack.LittleEndianToUInt32(new byte[] {0, 1, 0, 0})); - Assert.AreEqual(257U, Pack.LittleEndianToUInt32(new byte[] {1, 1, 0, 0})); - Assert.AreEqual(1025U, Pack.LittleEndianToUInt32(new byte[] {1, 4, 0, 0})); - Assert.AreEqual(65536U, Pack.LittleEndianToUInt32(new byte[] {0, 0, 1, 0})); - Assert.AreEqual(133124U, Pack.LittleEndianToUInt32(new byte[] {4, 8, 2, 0})); - Assert.AreEqual(16777216U, Pack.LittleEndianToUInt32(new byte[] {0, 0, 0, 1})); - Assert.AreEqual(uint.MaxValue, Pack.LittleEndianToUInt32(new byte[] {255, 255, 255, 255})); + Assert.AreEqual(0U, Pack.LittleEndianToUInt32(new byte[] { 0, 0, 0, 0 })); + Assert.AreEqual(1U, Pack.LittleEndianToUInt32(new byte[] { 1, 0, 0, 0 })); + Assert.AreEqual(256U, Pack.LittleEndianToUInt32(new byte[] { 0, 1, 0, 0 })); + Assert.AreEqual(257U, Pack.LittleEndianToUInt32(new byte[] { 1, 1, 0, 0 })); + Assert.AreEqual(1025U, Pack.LittleEndianToUInt32(new byte[] { 1, 4, 0, 0 })); + Assert.AreEqual(65536U, Pack.LittleEndianToUInt32(new byte[] { 0, 0, 1, 0 })); + Assert.AreEqual(133124U, Pack.LittleEndianToUInt32(new byte[] { 4, 8, 2, 0 })); + Assert.AreEqual(16777216U, Pack.LittleEndianToUInt32(new byte[] { 0, 0, 0, 1 })); + Assert.AreEqual(uint.MaxValue, Pack.LittleEndianToUInt32(new byte[] { 255, 255, 255, 255 })); } [TestMethod] public void LittleEndianToUInt64() { - Assert.AreEqual(0UL, Pack.LittleEndianToUInt64(new byte[] {0, 0, 0, 0, 0, 0, 0, 0})); - Assert.AreEqual(1UL, Pack.LittleEndianToUInt64(new byte[] {1, 0, 0, 0, 0, 0, 0, 0})); - Assert.AreEqual(256UL, Pack.LittleEndianToUInt64(new byte[] {0, 1, 0, 0, 0, 0, 0, 0})); - Assert.AreEqual(257UL, Pack.LittleEndianToUInt64(new byte[] {1, 1, 0, 0, 0, 0, 0, 0})); - Assert.AreEqual(65536UL, Pack.LittleEndianToUInt64(new byte[] {0, 0, 1, 0, 0, 0, 0, 0})); - Assert.AreEqual(133124UL, Pack.LittleEndianToUInt64(new byte[] {4, 8, 2, 0, 0, 0, 0, 0})); - Assert.AreEqual(16777216UL, Pack.LittleEndianToUInt64(new byte[] {0, 0, 0, 1, 0, 0, 0, 0})); - Assert.AreEqual(4294967296UL, Pack.LittleEndianToUInt64(new byte[] {0, 0, 0, 0, 1, 0, 0, 0})); - Assert.AreEqual(1099511627776UL, Pack.LittleEndianToUInt64(new byte[] {0, 0, 0, 0, 0, 1, 0, 0})); - Assert.AreEqual(1099511892096UL, Pack.LittleEndianToUInt64(new byte[] {128, 8, 4, 0, 0, 1, 0, 0})); - Assert.AreEqual(1099511627776UL * 256, Pack.LittleEndianToUInt64(new byte[] {0, 0, 0, 0, 0, 0, 1, 0})); - Assert.AreEqual(1099511627776UL * 256 * 256, Pack.LittleEndianToUInt64(new byte[] {0, 0, 0, 0, 0, 0, 0, 1})); - Assert.AreEqual(ulong.MaxValue, Pack.LittleEndianToUInt64(new byte[] {255, 255, 255, 255, 255, 255, 255, 255})); + Assert.AreEqual(0UL, Pack.LittleEndianToUInt64(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 })); + Assert.AreEqual(1UL, Pack.LittleEndianToUInt64(new byte[] { 1, 0, 0, 0, 0, 0, 0, 0 })); + Assert.AreEqual(256UL, Pack.LittleEndianToUInt64(new byte[] { 0, 1, 0, 0, 0, 0, 0, 0 })); + Assert.AreEqual(257UL, Pack.LittleEndianToUInt64(new byte[] { 1, 1, 0, 0, 0, 0, 0, 0 })); + Assert.AreEqual(65536UL, Pack.LittleEndianToUInt64(new byte[] { 0, 0, 1, 0, 0, 0, 0, 0 })); + Assert.AreEqual(133124UL, Pack.LittleEndianToUInt64(new byte[] { 4, 8, 2, 0, 0, 0, 0, 0 })); + Assert.AreEqual(16777216UL, Pack.LittleEndianToUInt64(new byte[] { 0, 0, 0, 1, 0, 0, 0, 0 })); + Assert.AreEqual(4294967296UL, Pack.LittleEndianToUInt64(new byte[] { 0, 0, 0, 0, 1, 0, 0, 0 })); + Assert.AreEqual(1099511627776UL, Pack.LittleEndianToUInt64(new byte[] { 0, 0, 0, 0, 0, 1, 0, 0 })); + Assert.AreEqual(1099511892096UL, Pack.LittleEndianToUInt64(new byte[] { 128, 8, 4, 0, 0, 1, 0, 0 })); + Assert.AreEqual(1099511627776UL * 256, Pack.LittleEndianToUInt64(new byte[] { 0, 0, 0, 0, 0, 0, 1, 0 })); + Assert.AreEqual(1099511627776UL * 256 * 256, Pack.LittleEndianToUInt64(new byte[] { 0, 0, 0, 0, 0, 0, 0, 1 })); + Assert.AreEqual(ulong.MaxValue, Pack.LittleEndianToUInt64(new byte[] { 255, 255, 255, 255, 255, 255, 255, 255 })); } [TestMethod] public void UInt16ToLittleEndian() { - AssertEqual(new byte[] {0, 0}, Pack.UInt16ToLittleEndian(0)); - AssertEqual(new byte[] {1, 0}, Pack.UInt16ToLittleEndian(1)); - AssertEqual(new byte[] {0, 1}, Pack.UInt16ToLittleEndian(256)); - AssertEqual(new byte[] {1, 1}, Pack.UInt16ToLittleEndian(257)); - AssertEqual(new byte[] {1, 4}, Pack.UInt16ToLittleEndian(1025)); - AssertEqual(new byte[] {255, 255}, Pack.UInt16ToLittleEndian(ushort.MaxValue)); + AssertEqual(new byte[] { 0, 0 }, Pack.UInt16ToLittleEndian(0)); + AssertEqual(new byte[] { 1, 0 }, Pack.UInt16ToLittleEndian(1)); + AssertEqual(new byte[] { 0, 1 }, Pack.UInt16ToLittleEndian(256)); + AssertEqual(new byte[] { 1, 1 }, Pack.UInt16ToLittleEndian(257)); + AssertEqual(new byte[] { 1, 4 }, Pack.UInt16ToLittleEndian(1025)); + AssertEqual(new byte[] { 255, 255 }, Pack.UInt16ToLittleEndian(ushort.MaxValue)); } [TestMethod] public void UInt32ToLittleEndian() { - AssertEqual(new byte[] {0, 0, 0, 0}, Pack.UInt32ToLittleEndian(0)); - AssertEqual(new byte[] {1, 0, 0, 0}, Pack.UInt32ToLittleEndian(1)); - AssertEqual(new byte[] {0, 1, 0, 0}, Pack.UInt32ToLittleEndian(256)); - AssertEqual(new byte[] {1, 1, 0, 0}, Pack.UInt32ToLittleEndian(257)); - AssertEqual(new byte[] {1, 4, 0, 0}, Pack.UInt32ToLittleEndian(1025)); - AssertEqual(new byte[] {0, 0, 1, 0}, Pack.UInt32ToLittleEndian(65536)); - AssertEqual(new byte[] {4, 8, 2, 0}, Pack.UInt32ToLittleEndian(133124)); - AssertEqual(new byte[] {0, 0, 0, 1}, Pack.UInt32ToLittleEndian(16777216)); - AssertEqual(new byte[] {255, 255, 255, 255}, Pack.UInt32ToLittleEndian(uint.MaxValue)); + AssertEqual(new byte[] { 0, 0, 0, 0 }, Pack.UInt32ToLittleEndian(0)); + AssertEqual(new byte[] { 1, 0, 0, 0 }, Pack.UInt32ToLittleEndian(1)); + AssertEqual(new byte[] { 0, 1, 0, 0 }, Pack.UInt32ToLittleEndian(256)); + AssertEqual(new byte[] { 1, 1, 0, 0 }, Pack.UInt32ToLittleEndian(257)); + AssertEqual(new byte[] { 1, 4, 0, 0 }, Pack.UInt32ToLittleEndian(1025)); + AssertEqual(new byte[] { 0, 0, 1, 0 }, Pack.UInt32ToLittleEndian(65536)); + AssertEqual(new byte[] { 4, 8, 2, 0 }, Pack.UInt32ToLittleEndian(133124)); + AssertEqual(new byte[] { 0, 0, 0, 1 }, Pack.UInt32ToLittleEndian(16777216)); + AssertEqual(new byte[] { 255, 255, 255, 255 }, Pack.UInt32ToLittleEndian(uint.MaxValue)); } [TestMethod] public void UInt64ToLittleEndian() { - AssertEqual(new byte[] {0, 0, 0, 0, 0, 0, 0, 0}, Pack.UInt64ToLittleEndian(0UL)); - AssertEqual(new byte[] {1, 0, 0, 0, 0, 0, 0, 0}, Pack.UInt64ToLittleEndian(1UL)); - AssertEqual(new byte[] {0, 1, 0, 0, 0, 0, 0, 0}, Pack.UInt64ToLittleEndian(256UL)); - AssertEqual(new byte[] {1, 1, 0, 0, 0, 0, 0, 0}, Pack.UInt64ToLittleEndian(257UL)); - AssertEqual(new byte[] {0, 0, 1, 0, 0, 0, 0, 0}, Pack.UInt64ToLittleEndian(65536UL)); - AssertEqual(new byte[] {4, 8, 2, 0, 0, 0, 0, 0}, Pack.UInt64ToLittleEndian(133124UL)); - AssertEqual(new byte[] {0, 0, 0, 1, 0, 0, 0, 0}, Pack.UInt64ToLittleEndian(16777216UL)); - AssertEqual(new byte[] {0, 0, 0, 0, 1, 0, 0, 0}, Pack.UInt64ToLittleEndian(4294967296UL)); - AssertEqual(new byte[] {0, 0, 0, 0, 0, 1, 0, 0}, Pack.UInt64ToLittleEndian(1099511627776UL)); - AssertEqual(new byte[] {128, 8, 4, 0, 0, 1, 0, 0}, Pack.UInt64ToLittleEndian(1099511892096UL)); - AssertEqual(new byte[] {0, 0, 0, 0, 0, 0, 1, 0}, Pack.UInt64ToLittleEndian(1099511627776UL * 256)); - AssertEqual(new byte[] {0, 0, 0, 0, 0, 0, 0, 1}, Pack.UInt64ToLittleEndian(1099511627776UL * 256 * 256)); - AssertEqual(new byte[] {255, 255, 255, 255, 255, 255, 255, 255}, Pack.UInt64ToLittleEndian(ulong.MaxValue)); + AssertEqual(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 }, Pack.UInt64ToLittleEndian(0UL)); + AssertEqual(new byte[] { 1, 0, 0, 0, 0, 0, 0, 0 }, Pack.UInt64ToLittleEndian(1UL)); + AssertEqual(new byte[] { 0, 1, 0, 0, 0, 0, 0, 0 }, Pack.UInt64ToLittleEndian(256UL)); + AssertEqual(new byte[] { 1, 1, 0, 0, 0, 0, 0, 0 }, Pack.UInt64ToLittleEndian(257UL)); + AssertEqual(new byte[] { 0, 0, 1, 0, 0, 0, 0, 0 }, Pack.UInt64ToLittleEndian(65536UL)); + AssertEqual(new byte[] { 4, 8, 2, 0, 0, 0, 0, 0 }, Pack.UInt64ToLittleEndian(133124UL)); + AssertEqual(new byte[] { 0, 0, 0, 1, 0, 0, 0, 0 }, Pack.UInt64ToLittleEndian(16777216UL)); + AssertEqual(new byte[] { 0, 0, 0, 0, 1, 0, 0, 0 }, Pack.UInt64ToLittleEndian(4294967296UL)); + AssertEqual(new byte[] { 0, 0, 0, 0, 0, 1, 0, 0 }, Pack.UInt64ToLittleEndian(1099511627776UL)); + AssertEqual(new byte[] { 128, 8, 4, 0, 0, 1, 0, 0 }, Pack.UInt64ToLittleEndian(1099511892096UL)); + AssertEqual(new byte[] { 0, 0, 0, 0, 0, 0, 1, 0 }, Pack.UInt64ToLittleEndian(1099511627776UL * 256)); + AssertEqual(new byte[] { 0, 0, 0, 0, 0, 0, 0, 1 }, Pack.UInt64ToLittleEndian(1099511627776UL * 256 * 256)); + AssertEqual(new byte[] { 255, 255, 255, 255, 255, 255, 255, 255 }, Pack.UInt64ToLittleEndian(ulong.MaxValue)); } [TestMethod] public void UInt16ToBigEndian() { - AssertEqual(new byte[] {0, 0}, Pack.UInt16ToBigEndian(0)); - AssertEqual(new byte[] {0, 1}, Pack.UInt16ToBigEndian(1)); - AssertEqual(new byte[] {1, 0}, Pack.UInt16ToBigEndian(256)); - AssertEqual(new byte[] {1, 1}, Pack.UInt16ToBigEndian(257)); - AssertEqual(new byte[] {4, 1}, Pack.UInt16ToBigEndian(1025)); - AssertEqual(new byte[] {255, 255}, Pack.UInt16ToBigEndian(ushort.MaxValue)); + AssertEqual(new byte[] { 0, 0 }, Pack.UInt16ToBigEndian(0)); + AssertEqual(new byte[] { 0, 1 }, Pack.UInt16ToBigEndian(1)); + AssertEqual(new byte[] { 1, 0 }, Pack.UInt16ToBigEndian(256)); + AssertEqual(new byte[] { 1, 1 }, Pack.UInt16ToBigEndian(257)); + AssertEqual(new byte[] { 4, 1 }, Pack.UInt16ToBigEndian(1025)); + AssertEqual(new byte[] { 255, 255 }, Pack.UInt16ToBigEndian(ushort.MaxValue)); } [TestMethod] public void UInt32ToBigEndian() { - AssertEqual(new byte[] {0, 0, 0, 0}, Pack.UInt32ToBigEndian(0)); - AssertEqual(new byte[] {0, 0, 0, 1}, Pack.UInt32ToBigEndian(1)); - AssertEqual(new byte[] {0, 0, 1, 0}, Pack.UInt32ToBigEndian(256)); - AssertEqual(new byte[] {0, 0, 1, 1}, Pack.UInt32ToBigEndian(257)); - AssertEqual(new byte[] {0, 0, 4, 1}, Pack.UInt32ToBigEndian(1025)); - AssertEqual(new byte[] {0, 1, 0, 0}, Pack.UInt32ToBigEndian(65536)); - AssertEqual(new byte[] {0, 2, 8, 4}, Pack.UInt32ToBigEndian(133124)); - AssertEqual(new byte[] {1, 0, 0, 0}, Pack.UInt32ToBigEndian(16777216)); - AssertEqual(new byte[] {255, 255, 255, 255}, Pack.UInt32ToBigEndian(uint.MaxValue)); + AssertEqual(new byte[] { 0, 0, 0, 0 }, Pack.UInt32ToBigEndian(0)); + AssertEqual(new byte[] { 0, 0, 0, 1 }, Pack.UInt32ToBigEndian(1)); + AssertEqual(new byte[] { 0, 0, 1, 0 }, Pack.UInt32ToBigEndian(256)); + AssertEqual(new byte[] { 0, 0, 1, 1 }, Pack.UInt32ToBigEndian(257)); + AssertEqual(new byte[] { 0, 0, 4, 1 }, Pack.UInt32ToBigEndian(1025)); + AssertEqual(new byte[] { 0, 1, 0, 0 }, Pack.UInt32ToBigEndian(65536)); + AssertEqual(new byte[] { 0, 2, 8, 4 }, Pack.UInt32ToBigEndian(133124)); + AssertEqual(new byte[] { 1, 0, 0, 0 }, Pack.UInt32ToBigEndian(16777216)); + AssertEqual(new byte[] { 255, 255, 255, 255 }, Pack.UInt32ToBigEndian(uint.MaxValue)); } [TestMethod] public void UInt64ToBigEndian() { - AssertEqual(new byte[] {0, 0, 0, 0, 0, 0, 0, 0}, Pack.UInt64ToBigEndian(0UL)); - AssertEqual(new byte[] {0, 0, 0, 0, 0, 0, 0, 1}, Pack.UInt64ToBigEndian(1UL)); - AssertEqual(new byte[] {0, 0, 0, 0, 0, 0, 1, 0}, Pack.UInt64ToBigEndian(256UL)); - AssertEqual(new byte[] {0, 0, 0, 0, 0, 0, 1, 1}, Pack.UInt64ToBigEndian(257UL)); - AssertEqual(new byte[] {0, 0, 0, 0, 0, 1, 0, 0}, Pack.UInt64ToBigEndian(65536UL)); - AssertEqual(new byte[] {0, 0, 0, 0, 0, 2, 8, 4}, Pack.UInt64ToBigEndian(133124UL)); - AssertEqual(new byte[] {0, 0, 0, 0, 1, 0, 0, 0}, Pack.UInt64ToBigEndian(16777216UL)); - AssertEqual(new byte[] {0, 0, 0, 1, 0, 0, 0, 0}, Pack.UInt64ToBigEndian(4294967296UL)); - AssertEqual(new byte[] {0, 0, 1, 0, 0, 0, 0, 0}, Pack.UInt64ToBigEndian(1099511627776UL)); - AssertEqual(new byte[] {0, 0, 1, 0, 0, 4, 8, 128}, Pack.UInt64ToBigEndian(1099511892096UL)); - AssertEqual(new byte[] {0, 1, 0, 0, 0, 0, 0, 0}, Pack.UInt64ToBigEndian(1099511627776UL * 256)); - AssertEqual(new byte[] {1, 0, 0, 0, 0, 0, 0, 0}, Pack.UInt64ToBigEndian(1099511627776UL * 256 * 256)); - AssertEqual(new byte[] {255, 255, 255, 255, 255, 255, 255, 255}, Pack.UInt64ToBigEndian(ulong.MaxValue)); + AssertEqual(new byte[] { 0, 0, 0, 0, 0, 0, 0, 0 }, Pack.UInt64ToBigEndian(0UL)); + AssertEqual(new byte[] { 0, 0, 0, 0, 0, 0, 0, 1 }, Pack.UInt64ToBigEndian(1UL)); + AssertEqual(new byte[] { 0, 0, 0, 0, 0, 0, 1, 0 }, Pack.UInt64ToBigEndian(256UL)); + AssertEqual(new byte[] { 0, 0, 0, 0, 0, 0, 1, 1 }, Pack.UInt64ToBigEndian(257UL)); + AssertEqual(new byte[] { 0, 0, 0, 0, 0, 1, 0, 0 }, Pack.UInt64ToBigEndian(65536UL)); + AssertEqual(new byte[] { 0, 0, 0, 0, 0, 2, 8, 4 }, Pack.UInt64ToBigEndian(133124UL)); + AssertEqual(new byte[] { 0, 0, 0, 0, 1, 0, 0, 0 }, Pack.UInt64ToBigEndian(16777216UL)); + AssertEqual(new byte[] { 0, 0, 0, 1, 0, 0, 0, 0 }, Pack.UInt64ToBigEndian(4294967296UL)); + AssertEqual(new byte[] { 0, 0, 1, 0, 0, 0, 0, 0 }, Pack.UInt64ToBigEndian(1099511627776UL)); + AssertEqual(new byte[] { 0, 0, 1, 0, 0, 4, 8, 128 }, Pack.UInt64ToBigEndian(1099511892096UL)); + AssertEqual(new byte[] { 0, 1, 0, 0, 0, 0, 0, 0 }, Pack.UInt64ToBigEndian(1099511627776UL * 256)); + AssertEqual(new byte[] { 1, 0, 0, 0, 0, 0, 0, 0 }, Pack.UInt64ToBigEndian(1099511627776UL * 256 * 256)); + AssertEqual(new byte[] { 255, 255, 255, 255, 255, 255, 255, 255 }, Pack.UInt64ToBigEndian(ulong.MaxValue)); } private static void AssertEqual(byte[] expected, byte[] actual) diff --git a/test/Renci.SshNet.Tests/Classes/Common/PacketDumpTest.cs b/test/Renci.SshNet.Tests/Classes/Common/PacketDumpTest.cs index 13c649bde..be6ad48e8 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/PacketDumpTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/PacketDumpTest.cs @@ -1,6 +1,8 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; -using System; using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes.Common @@ -32,7 +34,7 @@ public void Create_ByteArrayAndIndentLevel_IndentLevelLessThanZero() try { - _ =PacketDump.Create(data, -1); + _ = PacketDump.Create(data, -1); Assert.Fail(); } catch (ArgumentOutOfRangeException ex) diff --git a/test/Renci.SshNet.Tests/Classes/Common/PipeStreamTest.cs b/test/Renci.SshNet.Tests/Classes/Common/PipeStreamTest.cs index 6d56807fd..56738dff6 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/PipeStreamTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/PipeStreamTest.cs @@ -73,7 +73,7 @@ public void Read() () => { Thread.Sleep(sleepTime); - var writeBuffer = new byte[] {0x05, 0x03}; + var writeBuffer = new byte[] { 0x05, 0x03 }; target.Write(writeBuffer, 0, writeBuffer.Length); }); writeToStreamThread.Start(); @@ -123,7 +123,7 @@ public void WriteTest() { var target = new PipeStream(); - var writeBuffer = new byte[] {0x0a, 0x05, 0x0d}; + var writeBuffer = new byte[] { 0x0a, 0x05, 0x0d }; target.Write(writeBuffer, 0, 2); writeBuffer = new byte[] { 0x02, 0x04, 0x03, 0x06, 0x09 }; diff --git a/test/Renci.SshNet.Tests/Classes/Common/PipeStream_Close_BlockingRead.cs b/test/Renci.SshNet.Tests/Classes/Common/PipeStream_Close_BlockingRead.cs index ed25b260a..41a5f07b8 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/PipeStream_Close_BlockingRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/PipeStream_Close_BlockingRead.cs @@ -1,5 +1,7 @@ using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Tests.Common; diff --git a/test/Renci.SshNet.Tests/Classes/Common/PipeStream_Close_BlockingWrite.cs b/test/Renci.SshNet.Tests/Classes/Common/PipeStream_Close_BlockingWrite.cs index eb314d4d7..b0e3c3c2e 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/PipeStream_Close_BlockingWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/PipeStream_Close_BlockingWrite.cs @@ -1,6 +1,8 @@ using System; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Tests.Common; @@ -15,7 +17,7 @@ public class PipeStream_Close_BlockingWrite : TripleATestBase protected override void Arrange() { - _pipeStream = new PipeStream {MaxBufferLength = 3}; + _pipeStream = new PipeStream { MaxBufferLength = 3 }; _writehread = new Thread(() => { @@ -58,7 +60,7 @@ public void BlockingWriteShouldHaveBeenInterrupted() public void WriteShouldHaveThrownObjectDisposedException() { Assert.IsNotNull(_writeException); - Assert.AreEqual(typeof (ObjectDisposedException), _writeException.GetType()); + Assert.AreEqual(typeof(ObjectDisposedException), _writeException.GetType()); } } } diff --git a/test/Renci.SshNet.Tests/Classes/Common/PipeStream_Flush_BytesRemainingAfterRead.cs b/test/Renci.SshNet.Tests/Classes/Common/PipeStream_Flush_BytesRemainingAfterRead.cs index 415466af2..d765e2fca 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/PipeStream_Flush_BytesRemainingAfterRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/PipeStream_Flush_BytesRemainingAfterRead.cs @@ -1,5 +1,7 @@ using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Tests.Common; @@ -107,7 +109,7 @@ public void WriteCausesSubsequentReadToBlockUntilRequestedNumberOfBytesAreAvaila // Thread Abort method is obsolete: https://learn.microsoft.com/en-us/dotnet/core/compatibility/core-libraries/5.0/thread-abort-obsolete readThread.Abort(); - + Assert.AreEqual(int.MaxValue, bytesRead); Assert.AreEqual(0, buffer[0]); diff --git a/test/Renci.SshNet.Tests/Classes/Common/PipeStream_Flush_NoBytesRemainingAfterRead.cs b/test/Renci.SshNet.Tests/Classes/Common/PipeStream_Flush_NoBytesRemainingAfterRead.cs index f306edf1d..0926f2e69 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/PipeStream_Flush_NoBytesRemainingAfterRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/PipeStream_Flush_NoBytesRemainingAfterRead.cs @@ -1,5 +1,7 @@ using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Tests.Common; diff --git a/test/Renci.SshNet.Tests/Classes/Common/PortForwardEventArgsTest.cs b/test/Renci.SshNet.Tests/Classes/Common/PortForwardEventArgsTest.cs index c1f41dd70..16f3f2c57 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/PortForwardEventArgsTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/PortForwardEventArgsTest.cs @@ -1,6 +1,8 @@ using System; using System.Net; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Tests.Common; using Renci.SshNet.Tests.Properties; @@ -8,7 +10,7 @@ namespace Renci.SshNet.Tests.Classes.Common { /// - /// Provides data for event. + /// Provides data for event. /// [TestClass] public class PortForwardEventArgsTest : TestBase diff --git a/test/Renci.SshNet.Tests/Classes/Common/PosixPathTest_CreateAbsoluteOrRelativeFilePath.cs b/test/Renci.SshNet.Tests/Classes/Common/PosixPathTest_CreateAbsoluteOrRelativeFilePath.cs index 519c95434..d04dbb43c 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/PosixPathTest_CreateAbsoluteOrRelativeFilePath.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/PosixPathTest_CreateAbsoluteOrRelativeFilePath.cs @@ -1,6 +1,8 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; -using System; using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes.Common diff --git a/test/Renci.SshNet.Tests/Classes/Common/PosixPathTest_GetDirectoryName.cs b/test/Renci.SshNet.Tests/Classes/Common/PosixPathTest_GetDirectoryName.cs index 0767c11e7..e4b168dce 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/PosixPathTest_GetDirectoryName.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/PosixPathTest_GetDirectoryName.cs @@ -1,5 +1,7 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes.Common diff --git a/test/Renci.SshNet.Tests/Classes/Common/PosixPathTest_GetFileName.cs b/test/Renci.SshNet.Tests/Classes/Common/PosixPathTest_GetFileName.cs index d81a13d2d..3997dca29 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/PosixPathTest_GetFileName.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/PosixPathTest_GetFileName.cs @@ -1,5 +1,7 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes.Common diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTestBase.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTestBase.cs index 1ed56ecd5..7023901fa 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTestBase.cs @@ -1,4 +1,5 @@ using Moq; + using Renci.SshNet.Connection; using Renci.SshNet.Tests.Common; @@ -24,7 +25,7 @@ protected virtual void SetupData() protected virtual void SetupMocks() { } - + protected sealed override void Arrange() { CreateMocks(); 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 518303329..5cc4e8d23 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ConnectionToProxyRefused.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ConnectionToProxyRefused.cs @@ -1,12 +1,12 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; - -using Moq; - -using System; +using System; using System.Diagnostics; using System.Net; using System.Net.Sockets; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Moq; + namespace Renci.SshNet.Tests.Classes.Connection { [TestClass] @@ -30,9 +30,9 @@ protected override void SetupData() "proxyUser", "proxyPwd", new KeyboardInteractiveAuthenticationMethod("user")) - { - Timeout = TimeSpan.FromMilliseconds(5000) - }; + { + Timeout = TimeSpan.FromMilliseconds(5000) + }; _stopWatch = new Stopwatch(); _actualException = null; diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyClosesConnectionBeforeStatusLineIsSent.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyClosesConnectionBeforeStatusLineIsSent.cs index ece0aa9e1..c6b7939b7 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyClosesConnectionBeforeStatusLineIsSent.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyClosesConnectionBeforeStatusLineIsSent.cs @@ -1,12 +1,15 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Moq; -using Renci.SshNet.Common; -using Renci.SshNet.Tests.Common; -using System; +using System; using System.Net; using System.Net.Sockets; using System.Threading; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Moq; + +using Renci.SshNet.Common; +using Renci.SshNet.Tests.Common; + namespace Renci.SshNet.Tests.Classes.Connection { [TestClass] @@ -31,9 +34,9 @@ protected override void SetupData() "proxyUser", "proxyPwd", new KeyboardInteractiveAuthenticationMethod("user")) - { - Timeout = TimeSpan.FromMilliseconds(100) - }; + { + Timeout = TimeSpan.FromMilliseconds(100) + }; _actualException = null; _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyHostInvalid.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyHostInvalid.cs index 7a87e9d6f..8384e4d98 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyHostInvalid.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyHostInvalid.cs @@ -1,5 +1,6 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Net.Sockets; +using System.Net.Sockets; + +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Renci.SshNet.Tests.Classes.Connection { diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyPasswordIsEmpty.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyPasswordIsEmpty.cs index 9a7e876a5..e8bf537b8 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyPasswordIsEmpty.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyPasswordIsEmpty.cs @@ -38,9 +38,9 @@ protected override void SetupData() "proxyUser", string.Empty, new KeyboardInteractiveAuthenticationMethod("user")) - { - Timeout = TimeSpan.FromMilliseconds(20) - }; + { + Timeout = TimeSpan.FromMilliseconds(20) + }; _expectedHttpRequest = string.Format("CONNECT {0}:{1} HTTP/1.0{2}" + "Proxy-Authorization: Basic cHJveHlVc2VyOg=={2}{2}", _connectionInfo.Host, @@ -92,7 +92,7 @@ protected override void TearDown() protected override void Act() { _actual = Connector.Connect(_connectionInfo); - + // Give some time to process all messages Thread.Sleep(200); } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyPasswordIsNull.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyPasswordIsNull.cs index ccbf2b751..850082049 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyPasswordIsNull.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyPasswordIsNull.cs @@ -1,7 +1,4 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Moq; -using Renci.SshNet.Tests.Common; -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.Net; @@ -9,6 +6,12 @@ using System.Text; using System.Threading; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Moq; + +using Renci.SshNet.Tests.Common; + namespace Renci.SshNet.Tests.Classes.Connection { [TestClass] @@ -35,9 +38,9 @@ protected override void SetupData() "proxyUser", null, new KeyboardInteractiveAuthenticationMethod("user")) - { - Timeout = TimeSpan.FromMilliseconds(20) - }; + { + Timeout = TimeSpan.FromMilliseconds(20) + }; _expectedHttpRequest = string.Format("CONNECT {0}:{1} HTTP/1.0{2}" + "Proxy-Authorization: Basic cHJveHlVc2VyOg=={2}{2}", _connectionInfo.Host, diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseDoesNotContainHttpStatusLine.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseDoesNotContainHttpStatusLine.cs index eebb70faf..cca8544a9 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseDoesNotContainHttpStatusLine.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseDoesNotContainHttpStatusLine.cs @@ -37,9 +37,9 @@ protected override void SetupData() "proxyUser", "proxyPwd", new KeyboardInteractiveAuthenticationMethod("user")) - { - Timeout = TimeSpan.FromMilliseconds(100) - }; + { + Timeout = TimeSpan.FromMilliseconds(100) + }; _bytesReceivedByProxy = new List(); _actualException = null; @@ -85,7 +85,7 @@ protected override void Act() { _actualException = ex; } - + // Give some time to process all messages Thread.Sleep(200); } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_ExtraTextBeforeStatusLine.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_ExtraTextBeforeStatusLine.cs index f2287807a..f729c6166 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_ExtraTextBeforeStatusLine.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_ExtraTextBeforeStatusLine.cs @@ -38,9 +38,9 @@ protected override void SetupData() "proxyUser", "proxyPwd", new KeyboardInteractiveAuthenticationMethod("user")) - { - Timeout = TimeSpan.FromMilliseconds(20) - }; + { + Timeout = TimeSpan.FromMilliseconds(20) + }; _expectedHttpRequest = string.Format("CONNECT {0}:{1} HTTP/1.0{2}" + "Proxy-Authorization: Basic cHJveHlVc2VyOnByb3h5UHdk{2}{2}", _connectionInfo.Host, @@ -96,7 +96,7 @@ protected override void TearDown() protected override void Act() { _actual = Connector.Connect(_connectionInfo); - + // Give some time to process all messages Thread.Sleep(200); } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_HeadersAndContent.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_HeadersAndContent.cs index 765e7f81a..955e701a3 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_HeadersAndContent.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_HeadersAndContent.cs @@ -38,9 +38,9 @@ protected override void SetupData() "proxyUser", "proxyPwd", new KeyboardInteractiveAuthenticationMethod("user")) - { - Timeout = TimeSpan.FromMilliseconds(20) - }; + { + Timeout = TimeSpan.FromMilliseconds(20) + }; _expectedHttpRequest = string.Format("CONNECT {0}:{1} HTTP/1.0{2}" + "Proxy-Authorization: Basic cHJveHlVc2VyOnByb3h5UHdk{2}{2}", _connectionInfo.Host, @@ -67,7 +67,7 @@ protected override void SetupData() _ = socket.Send(Encoding.ASCII.GetBytes("\r\n")); _ = socket.Send(Encoding.ASCII.GetBytes("TEEN_BYTES")); _ = socket.Send(Encoding.ASCII.GetBytes("!666!")); - + socket.Shutdown(SocketShutdown.Send); } }; @@ -96,7 +96,7 @@ protected override void TearDown() protected override void Act() { _actual = Connector.Connect(_connectionInfo); - + // Give some time to process all messages Thread.Sleep(200); } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_OnlyHeaders.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_OnlyHeaders.cs index 17da268c6..7a41263c4 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_OnlyHeaders.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIs200_OnlyHeaders.cs @@ -1,7 +1,4 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Moq; -using Renci.SshNet.Tests.Common; -using System; +using System; using System.Collections.Generic; using System.Globalization; using System.Net; @@ -9,6 +6,12 @@ using System.Text; using System.Threading; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Moq; + +using Renci.SshNet.Tests.Common; + namespace Renci.SshNet.Tests.Classes.Connection { [TestClass] @@ -35,9 +38,9 @@ protected override void SetupData() "proxyUser", "proxyPwd", new KeyboardInteractiveAuthenticationMethod("user")) - { - Timeout = TimeSpan.FromMilliseconds(20) - }; + { + Timeout = TimeSpan.FromMilliseconds(20) + }; _expectedHttpRequest = string.Format("CONNECT {0}:{1} HTTP/1.0{2}" + "Proxy-Authorization: Basic cHJveHlVc2VyOnByb3h5UHdk{2}{2}", _connectionInfo.Host, @@ -91,7 +94,7 @@ protected override void TearDown() protected override void Act() { _actual = Connector.Connect(_connectionInfo); - + // Give some time to process all messages Thread.Sleep(200); } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIsNot200.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIsNot200.cs index b2cdc5fd3..fb7f7f9d4 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIsNot200.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyResponseStatusIsNot200.cs @@ -37,9 +37,9 @@ protected override void SetupData() "proxyUser", "proxyPwd", new KeyboardInteractiveAuthenticationMethod("user")) - { - Timeout = TimeSpan.FromMilliseconds(100) - }; + { + Timeout = TimeSpan.FromMilliseconds(100) + }; _bytesReceivedByProxy = new List(); _actualException = null; diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsEmpty.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsEmpty.cs index 455a41a9f..453a3f71d 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsEmpty.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsEmpty.cs @@ -38,9 +38,9 @@ protected override void SetupData() string.Empty, "proxyPwd", new KeyboardInteractiveAuthenticationMethod("user")) - { - Timeout = TimeSpan.FromMilliseconds(20) - }; + { + Timeout = TimeSpan.FromMilliseconds(20) + }; _expectedHttpRequest = string.Format("CONNECT {0}:{1} HTTP/1.0{2}{2}", _connectionInfo.Host, _connectionInfo.Port.ToString(CultureInfo.InvariantCulture), diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsNotNullAndNotEmpty.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsNotNullAndNotEmpty.cs index b49d1b12a..de78270fd 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsNotNullAndNotEmpty.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsNotNullAndNotEmpty.cs @@ -38,9 +38,9 @@ protected override void SetupData() "user", "pwd", new KeyboardInteractiveAuthenticationMethod("user")) - { - Timeout = TimeSpan.FromMilliseconds(20) - }; + { + Timeout = TimeSpan.FromMilliseconds(20) + }; _expectedHttpRequest = string.Format("CONNECT {0}:{1} HTTP/1.0{2}" + "Proxy-Authorization: Basic dXNlcjpwd2Q={2}{2}", _connectionInfo.Host, diff --git a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsNull.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsNull.cs index 59a022bc8..4d9b02679 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsNull.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_ProxyUserNameIsNull.cs @@ -38,9 +38,9 @@ protected override void SetupData() null, "proxyPwd", new KeyboardInteractiveAuthenticationMethod("user")) - { - Timeout = TimeSpan.FromMilliseconds(20) - }; + { + Timeout = TimeSpan.FromMilliseconds(20) + }; _expectedHttpRequest = string.Format("CONNECT {0}:{1} HTTP/1.0{2}{2}", _connectionInfo.Host, _connectionInfo.Port.ToString(CultureInfo.InvariantCulture), 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 de3332908..fbdfeb2c7 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutConnectingToProxy.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutConnectingToProxy.cs @@ -37,9 +37,9 @@ protected override void SetupData() "proxyUser", "proxyPwd", new KeyboardInteractiveAuthenticationMethod("user")) - { - Timeout = TimeSpan.FromMilliseconds(random.Next(50, 200)) - }; + { + Timeout = TimeSpan.FromMilliseconds(random.Next(50, 200)) + }; _stopWatch = new Stopwatch(); _actualException = null; 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 6808bfb50..c2c56eede 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingHttpContent.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingHttpContent.cs @@ -44,9 +44,9 @@ protected override void SetupData() "proxyUser", "proxyPwd", new KeyboardInteractiveAuthenticationMethod("user")) - { - Timeout = TimeSpan.FromMilliseconds(random.Next(50, 200)) - }; + { + Timeout = TimeSpan.FromMilliseconds(random.Next(50, 200)) + }; _expectedHttpRequest = string.Format("CONNECT {0}:{1} HTTP/1.0{2}" + "Proxy-Authorization: Basic cHJveHlVc2VyOnByb3h5UHdk{2}{2}", _connectionInfo.Host, 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 38f65634c..1cd27be56 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingStatusLine.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTest_Connect_TimeoutReadingStatusLine.cs @@ -40,9 +40,9 @@ protected override void SetupData() "proxyUser", "proxyPwd", new KeyboardInteractiveAuthenticationMethod("user")) - { - Timeout = TimeSpan.FromMilliseconds(random.Next(50, 200)) - }; + { + Timeout = TimeSpan.FromMilliseconds(random.Next(50, 200)) + }; _stopWatch = new Stopwatch(); _actualException = null; diff --git a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseContainsNullCharacter.cs b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseContainsNullCharacter.cs index 2b3245eef..164cb6a70 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseContainsNullCharacter.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseContainsNullCharacter.cs @@ -1,8 +1,4 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Renci.SshNet.Common; -using Renci.SshNet.Connection; -using Renci.SshNet.Tests.Common; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Net; @@ -10,6 +6,12 @@ using System.Text; using System.Threading; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Renci.SshNet.Common; +using Renci.SshNet.Connection; +using Renci.SshNet.Tests.Common; + namespace Renci.SshNet.Tests.Classes.Connection { [TestClass] 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 4108c7c09..2af8062b6 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseValid_Comments.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseValid_Comments.cs @@ -1,8 +1,4 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; - -using Renci.SshNet.Connection; -using Renci.SshNet.Tests.Common; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Net; @@ -10,6 +6,11 @@ using System.Text; using System.Threading; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Renci.SshNet.Connection; +using Renci.SshNet.Tests.Common; + namespace Renci.SshNet.Tests.Classes.Connection { [TestClass] 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 f3ce9ccf8..365967209 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseValid_NoComments.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/ProtocolVersionExchangeTest_ServerResponseValid_NoComments.cs @@ -1,8 +1,4 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; - -using Renci.SshNet.Connection; -using Renci.SshNet.Tests.Common; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Net; @@ -10,6 +6,11 @@ using System.Text; using System.Threading; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Renci.SshNet.Connection; +using Renci.SshNet.Tests.Common; + namespace Renci.SshNet.Tests.Classes.Connection { [TestClass] diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTestBase.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTestBase.cs index 91891252b..ced3e1551 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTestBase.cs @@ -34,7 +34,7 @@ protected sealed override void Arrange() SetupData(); SetupMocks(); } - + protected ConnectionInfo CreateConnectionInfo(string proxyUser, string proxyPassword) { return new ConnectionInfo(IPAddress.Loopback.ToString(), 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 f8793bd68..64976c7df 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutConnectingToProxy.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutConnectingToProxy.cs @@ -1,12 +1,14 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Moq; -using Renci.SshNet.Common; -using System; +using System; using System.Diagnostics; using System.Globalization; using System.Net.Sockets; using System.Runtime.InteropServices; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Moq; + +using Renci.SshNet.Common; using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes.Connection 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 4ca6e0c58..c6d4c65d8 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyVersion.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTest_Connect_TimeoutReadingReplyVersion.cs @@ -1,14 +1,17 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Moq; -using Renci.SshNet.Common; -using Renci.SshNet.Tests.Common; -using System; +using System; using System.Diagnostics; using System.Globalization; using System.Net; using System.Net.Sockets; using System.Threading; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Moq; + +using Renci.SshNet.Common; +using Renci.SshNet.Tests.Common; + namespace Renci.SshNet.Tests.Classes.Connection { [TestClass] @@ -74,7 +77,7 @@ protected override void Act() { _stopWatch.Stop(); } - + // Give some time to process all messages Thread.Sleep(200); } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTestBase.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTestBase.cs index 8ce9537cf..bbac79c7e 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTestBase.cs @@ -1,12 +1,12 @@ -using Moq; +using System; +using System.Net; +using System.Text; + +using Moq; using Renci.SshNet.Connection; using Renci.SshNet.Tests.Common; -using System; -using System.Net; -using System.Text; - namespace Renci.SshNet.Tests.Classes.Connection { public abstract class Socks5ConnectorTestBase : TripleATestBase @@ -50,7 +50,7 @@ protected ConnectionInfo CreateConnectionInfo(string proxyUser, string proxyPass new KeyboardInteractiveAuthenticationMethod("user")); } - protected static string GenerateRandomString(int minLength, int maxLength) + protected static string GenerateRandomString(int minLength, int maxLength) { var random = new Random(); var length = random.Next(minLength, maxLength); diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_NoAuthentication_ConnectionSucceeded.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_NoAuthentication_ConnectionSucceeded.cs index 65ec1a20b..58bfa2bb6 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_NoAuthentication_ConnectionSucceeded.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_NoAuthentication_ConnectionSucceeded.cs @@ -1,14 +1,17 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Moq; -using Renci.SshNet.Common; -using Renci.SshNet.Tests.Common; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Sockets; using System.Threading; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Moq; + +using Renci.SshNet.Common; +using Renci.SshNet.Tests.Common; + namespace Renci.SshNet.Tests.Classes.Connection { [TestClass] diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_AuthenticationFailed.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_AuthenticationFailed.cs index e6bcf5abe..ca2c51af8 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_AuthenticationFailed.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_AuthenticationFailed.cs @@ -1,8 +1,4 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Moq; -using Renci.SshNet.Common; -using Renci.SshNet.Tests.Common; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Net; @@ -10,6 +6,13 @@ using System.Text; using System.Threading; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Moq; + +using Renci.SshNet.Common; +using Renci.SshNet.Tests.Common; + namespace Renci.SshNet.Tests.Classes.Connection { [TestClass] diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_ConnectionSucceeded.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_ConnectionSucceeded.cs index 3c69ac5c4..9941ad786 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_ConnectionSucceeded.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_ConnectionSucceeded.cs @@ -167,11 +167,11 @@ public void ProxyShouldHaveReceivedExpectedSocksRequest() // Version of the negotiation expectedSocksRequest.Add(0x01); // Length of the username - expectedSocksRequest.Add((byte)_connectionInfo.ProxyUsername.Length); + expectedSocksRequest.Add((byte) _connectionInfo.ProxyUsername.Length); // Username expectedSocksRequest.AddRange(Encoding.ASCII.GetBytes(_connectionInfo.ProxyUsername)); // Length of the password - expectedSocksRequest.Add((byte)_connectionInfo.ProxyPassword.Length); + expectedSocksRequest.Add((byte) _connectionInfo.ProxyPassword.Length); // Password expectedSocksRequest.AddRange(Encoding.ASCII.GetBytes(_connectionInfo.ProxyPassword)); diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_PasswordExceedsMaximumLength.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_PasswordExceedsMaximumLength.cs index b36a7eff9..bb300489d 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_PasswordExceedsMaximumLength.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_PasswordExceedsMaximumLength.cs @@ -1,14 +1,17 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Moq; -using Renci.SshNet.Common; -using Renci.SshNet.Tests.Common; -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Sockets; using System.Threading; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Moq; + +using Renci.SshNet.Common; +using Renci.SshNet.Tests.Common; + namespace Renci.SshNet.Tests.Classes.Connection { [TestClass] diff --git a/test/Renci.SshNet.Tests/Classes/Connection/SshIdentificationTest.cs b/test/Renci.SshNet.Tests/Classes/Connection/SshIdentificationTest.cs index 3d18cfa53..c5a9fffec 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/SshIdentificationTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/SshIdentificationTest.cs @@ -1,6 +1,8 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Connection; -using System; namespace Renci.SshNet.Tests.Classes.Connection { diff --git a/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest.cs b/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest.cs index 130b4b534..82b580cc5 100644 --- a/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest.cs +++ b/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest.cs @@ -1,10 +1,13 @@ -using System.Globalization; +using System; +using System.Globalization; using System.Net; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Tests.Common; using Renci.SshNet.Tests.Properties; -using System; namespace Renci.SshNet.Tests.Classes { @@ -303,7 +306,7 @@ public void Test_ConnectionInfo_Timeout_Valid() try { - connectionInfo.Timeout = TimeSpan.FromMilliseconds((double)int.MaxValue + 1); + connectionInfo.Timeout = TimeSpan.FromMilliseconds((double) int.MaxValue + 1); } catch (ArgumentOutOfRangeException ex) { @@ -342,7 +345,7 @@ public void Test_ConnectionInfo_ChannelCloseTimeout_Valid() try { - connectionInfo.ChannelCloseTimeout = TimeSpan.FromMilliseconds((double)int.MaxValue + 1); + connectionInfo.ChannelCloseTimeout = TimeSpan.FromMilliseconds((double) int.MaxValue + 1); } catch (ArgumentOutOfRangeException ex) { @@ -427,7 +430,7 @@ public void ConstructorShouldThrowArgumentExceptionhenUsernameContainsOnlyWhites } catch (ArgumentException ex) { - Assert.AreEqual(typeof (ArgumentException), ex.GetType()); + Assert.AreEqual(typeof(ArgumentException), ex.GetType()); Assert.IsNull(ex.InnerException); Assert.AreEqual("username", ex.ParamName); } @@ -509,5 +512,5 @@ public void AuthenticateShouldThrowArgumentNullExceptionWhenServiceFactoryIsNull Assert.AreEqual("serviceFactory", ex.ParamName); } } - } + } } diff --git a/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest_Authenticate_Failure.cs b/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest_Authenticate_Failure.cs index 597b400ff..a06350f72 100644 --- a/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest_Authenticate_Failure.cs +++ b/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest_Authenticate_Failure.cs @@ -1,5 +1,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Tests.Properties; diff --git a/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest_Authenticate_Success.cs b/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest_Authenticate_Success.cs index 7b6ce1c2a..f2309785d 100644 --- a/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest_Authenticate_Success.cs +++ b/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest_Authenticate_Success.cs @@ -1,5 +1,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Tests.Properties; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/ExpectActionTest.cs b/test/Renci.SshNet.Tests/Classes/ExpectActionTest.cs index 777875f05..c87ac2f16 100644 --- a/test/Renci.SshNet.Tests/Classes/ExpectActionTest.cs +++ b/test/Renci.SshNet.Tests/Classes/ExpectActionTest.cs @@ -1,8 +1,10 @@ -using System.Globalization; +using System; +using System.Globalization; +using System.Text.RegularExpressions; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Tests.Common; -using System; -using System.Text.RegularExpressions; namespace Renci.SshNet.Tests.Classes { @@ -34,4 +36,4 @@ public void Constructor_RegexAndAction() Assert.AreSame(action, target.Action); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest.cs index a836cebd7..873f61268 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest.cs @@ -1,6 +1,8 @@ using System; using System.Globalization; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes @@ -23,7 +25,7 @@ public void Constructor_HostAndPort() [TestMethod()] public void Constructor_Port() { - var port = (uint)new Random().Next(0, int.MaxValue); + var port = (uint) new Random().Next(0, int.MaxValue); var target = new ForwardedPortDynamic(port); @@ -31,4 +33,4 @@ public void Constructor_Port() Assert.AreEqual(port, target.BoundPort); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortDisposed.cs index 36fc91dd2..d39a91fab 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortDisposed.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortDisposed.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortNeverStarted.cs index dfd07a273..ae38206de 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortNeverStarted.cs @@ -51,7 +51,7 @@ protected void Arrange() _sessionMock.Setup(p => p.IsConnected).Returns(true); _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; 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 441250a0a..e76b4b0dd 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelBound.cs @@ -6,8 +6,11 @@ using System.Net.Sockets; using System.Text; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Abstractions; using Renci.SshNet.Channels; using Renci.SshNet.Common; @@ -84,7 +87,7 @@ private void SetupData() _channelBindStarted = new ManualResetEvent(false); _channelBindCompleted = new ManualResetEvent(false); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; @@ -103,7 +106,7 @@ private void SetupMocks() _sessionMock.Setup(p => p.IsConnected).Returns(true); _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); _sessionMock.Setup(p => p.CreateChannelDirectTcpip()).Returns(_channelMock.Object); - _channelMock.Setup(p => p.Open(_remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port, _forwardedPort, It.IsAny())); + _channelMock.Setup(p => p.Open(_remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port, _forwardedPort, It.IsAny())); _channelMock.Setup(p => p.IsOpen).Returns(true); _channelMock.Setup(p => p.Bind()).Callback(() => { @@ -218,7 +221,7 @@ private void EstablishSocks4Connection(Socket client) { var userNameBytes = Encoding.ASCII.GetBytes(_userName); var addressBytes = _remoteEndpoint.Address.GetAddressBytes(); - var portBytes = BitConverter.GetBytes((ushort)_remoteEndpoint.Port).Reverse().ToArray(); + var portBytes = BitConverter.GetBytes((ushort) _remoteEndpoint.Port).Reverse().ToArray(); _client.Connect(_endpoint); 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 b3e325535..a41c6b3a0 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelNotBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelNotBound.cs @@ -72,11 +72,11 @@ protected void Arrange() _forwardedPort.Start(); _client = new Socket(_endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp) - { - ReceiveTimeout = 500, - SendTimeout = 500, - SendBufferSize = 0 - }; + { + ReceiveTimeout = 500, + SendTimeout = 500, + SendBufferSize = 0 + }; _client.Connect(_endpoint); // allow for client socket to establish connection diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStopped.cs index 9eeca0de6..27b6741f1 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStopped.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStopped.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Net; using System.Net.Sockets; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_SessionErrorOccurred_ChannelBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_SessionErrorOccurred_ChannelBound.cs index db778a089..1fc785b34 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_SessionErrorOccurred_ChannelBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_SessionErrorOccurred_ChannelBound.cs @@ -6,8 +6,11 @@ using System.Net.Sockets; using System.Text; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Abstractions; using Renci.SshNet.Channels; using Renci.SshNet.Common; @@ -92,11 +95,11 @@ private void SetupData() _forwardedPort.Session = _sessionMock.Object; _client = new Socket(_endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp) - { - ReceiveTimeout = 100, - SendTimeout = 100, - SendBufferSize = 0 - }; + { + ReceiveTimeout = 100, + SendTimeout = 100, + SendBufferSize = 0 + }; } private void SetupMocks() @@ -105,7 +108,7 @@ private void SetupMocks() _sessionMock.Setup(p => p.IsConnected).Returns(true); _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); _sessionMock.Setup(p => p.CreateChannelDirectTcpip()).Returns(_channelMock.Object); - _channelMock.Setup(p => p.Open(_remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port, _forwardedPort, It.IsAny())); + _channelMock.Setup(p => p.Open(_remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port, _forwardedPort, It.IsAny())); _channelMock.Setup(p => p.IsOpen).Returns(true); _channelMock.Setup(p => p.Bind()).Callback(() => { @@ -205,7 +208,7 @@ public void OpenOnChannelShouldBeInvokedOnce() { _channelMock.Verify( p => - p.Open(_remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port, _forwardedPort, + p.Open(_remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port, _forwardedPort, It.IsAny()), Times.Once); } @@ -225,7 +228,7 @@ private void EstablishSocks4Connection(Socket client) { var userNameBytes = Encoding.ASCII.GetBytes(_userName); var addressBytes = _remoteEndpoint.Address.GetAddressBytes(); - var portBytes = BitConverter.GetBytes((ushort)_remoteEndpoint.Port).Reverse().ToArray(); + var portBytes = BitConverter.GetBytes((ushort) _remoteEndpoint.Port).Reverse().ToArray(); _client.Connect(_endpoint); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortDisposed.cs index ba758f79f..2ceac31e4 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortDisposed.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortDisposed.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortNeverStarted.cs index cb97c1ec6..24c623e55 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortNeverStarted.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Net; using System.Net.Sockets; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; @@ -52,7 +55,7 @@ protected void Arrange() _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); _sessionMock.Setup(p => p.CreateChannelDirectTcpip()).Returns(_channelMock.Object); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStarted.cs index 4978ea79c..54c5fae9d 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStarted.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Net; using System.Net.Sockets; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; @@ -53,7 +56,7 @@ protected void Arrange() _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); _sessionMock.Setup(p => p.CreateChannelDirectTcpip()).Returns(_channelMock.Object); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStopped.cs index 3c5eb998d..9b500a79f 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStopped.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStopped.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Net; using System.Net.Sockets; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; @@ -52,7 +55,7 @@ protected void Arrange() _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); _sessionMock.Setup(p => p.CreateChannelDirectTcpip()).Returns(_channelMock.Object); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNotConnected.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNotConnected.cs index f35a6582a..cca1cc9c8 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNotConnected.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNotConnected.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Net; using System.Net.Sockets; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes @@ -49,7 +52,7 @@ protected void Arrange() _sessionMock.Setup(p => p.IsConnected).Returns(false); _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNull.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNull.cs index a3b717e5b..f571b2731 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNull.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNull.cs @@ -2,7 +2,9 @@ using System.Collections.Generic; using System.Net; using System.Net.Sockets; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes @@ -39,7 +41,7 @@ protected void Arrange() _exceptionRegister = new List(); _endpoint = new IPEndPoint(IPAddress.Loopback, 8122); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketVersionNotSupported.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketVersionNotSupported.cs index e3dc264b5..9c15f0798 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketVersionNotSupported.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketVersionNotSupported.cs @@ -107,7 +107,7 @@ private void Arrange() private void Act() { - var buffer = new byte[] {0x07}; + var buffer = new byte[] { 0x07 }; _client.Send(buffer, 0, buffer.Length, SocketFlags.None); // wait for Exception event to be fired as a way to ensure that SOCKS diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortDisposed.cs index f84657b7a..db03e78e7 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortDisposed.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortDisposed.cs @@ -2,7 +2,9 @@ using System.Collections.Generic; using System.Net; using System.Net.Sockets; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes @@ -38,7 +40,7 @@ protected void Arrange() _exceptionRegister = new List(); _endpoint = new IPEndPoint(IPAddress.Loopback, 8122); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Dispose(); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortNeverStarted.cs index 92999ab70..b32536d7e 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortNeverStarted.cs @@ -2,7 +2,9 @@ using System.Collections.Generic; using System.Net; using System.Net.Sockets; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes @@ -38,7 +40,7 @@ protected void Arrange() _exceptionRegister = new List(); _endpoint = new IPEndPoint(IPAddress.Loopback, 8122); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); } 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 80f7877e3..67efbff15 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelBound.cs @@ -6,8 +6,11 @@ using System.Net.Sockets; using System.Text; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Abstractions; using Renci.SshNet.Channels; using Renci.SshNet.Common; @@ -83,17 +86,17 @@ private void SetupData() _channelBindStarted = new ManualResetEvent(false); _channelBindCompleted = new ManualResetEvent(false); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; _client = new Socket(_endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp) - { - ReceiveTimeout = 100, - SendTimeout = 100, - SendBufferSize = 0 - }; + { + ReceiveTimeout = 100, + SendTimeout = 100, + SendBufferSize = 0 + }; } private void SetupMocks() @@ -102,7 +105,7 @@ private void SetupMocks() _sessionMock.Setup(p => p.IsConnected).Returns(true); _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); _sessionMock.Setup(p => p.CreateChannelDirectTcpip()).Returns(_channelMock.Object); - _channelMock.Setup(p => p.Open(_remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port, _forwardedPort, It.IsAny())); + _channelMock.Setup(p => p.Open(_remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port, _forwardedPort, It.IsAny())); _channelMock.Setup(p => p.IsOpen).Returns(true); _channelMock.Setup(p => p.Bind()).Callback(() => { @@ -205,7 +208,7 @@ private void EstablishSocks4Connection(Socket client) { var userNameBytes = Encoding.ASCII.GetBytes(_userName); var addressBytes = _remoteEndpoint.Address.GetAddressBytes(); - var portBytes = BitConverter.GetBytes((ushort)_remoteEndpoint.Port).Reverse().ToArray(); + var portBytes = BitConverter.GetBytes((ushort) _remoteEndpoint.Port).Reverse().ToArray(); _client.Connect(_endpoint); 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 b0059f453..e9bae905c 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelNotBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelNotBound.cs @@ -76,11 +76,11 @@ protected void Arrange() _forwardedPort.Start(); _client = new Socket(_endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp) - { - ReceiveTimeout = 500, - SendTimeout = 500, - SendBufferSize = 0 - }; + { + ReceiveTimeout = 500, + SendTimeout = 500, + SendBufferSize = 0 + }; _client.Connect(_endpoint); // allow for client socket to establish connection diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStopped.cs index 3fc619176..d61349903 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStopped.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStopped.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Net; using System.Net.Sockets; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortDisposed.cs index 2ca34f410..8b4a837d1 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortDisposed.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortDisposed.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Net; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes 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 dd4e73f9d..fb74e217d 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortDisposed_NeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortDisposed_NeverStarted.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortNeverStarted.cs index 6ba24a873..7a92472df 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortNeverStarted.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Net; using System.Net.Sockets; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes 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 9677734a2..42872742e 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelBound.cs @@ -3,8 +3,11 @@ using System.Net; using System.Net.Sockets; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; @@ -93,11 +96,11 @@ protected void Arrange() _forwardedPort.Start(); _client = new Socket(_localEndpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp) - { - ReceiveTimeout = 100, - SendTimeout = 500, - SendBufferSize = 0 - }; + { + ReceiveTimeout = 100, + SendTimeout = 500, + SendBufferSize = 0 + }; _client.Connect(_localEndpoint); 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 f7dadf629..4a754843f 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelNotBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelNotBound.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Net; using System.Net.Sockets; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStopped.cs index 3e8e63218..087b48ba9 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStopped.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStopped.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Net; using System.Net.Sockets; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes @@ -53,7 +56,7 @@ protected void Arrange() _sessionMock.Setup(p => p.IsConnected).Returns(true); _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); - _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint)_localEndpoint.Port, _remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port); + _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint) _localEndpoint.Port, _remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortDisposed.cs index 78d5ba525..be89d8fef 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortDisposed.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortDisposed.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using System.Net; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes @@ -42,8 +44,8 @@ protected void Arrange() _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); - _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint)_localEndpoint.Port, - _remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port); + _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint) _localEndpoint.Port, + _remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Dispose(); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortNeverStarted.cs index c286bd88f..6cc47cabf 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortNeverStarted.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Net; using System.Net.Sockets; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStarted.cs index e9e07e393..08eef568b 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStarted.cs @@ -61,8 +61,8 @@ protected void Arrange() _ = _sessionMock.Setup(p => p.ConnectionInfo) .Returns(_connectionInfoMock.Object); - _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint)_localEndpoint.Port, - _remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port); + _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint) _localEndpoint.Port, + _remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNotConnected.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNotConnected.cs index fda16ba81..c6c980af1 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNotConnected.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNotConnected.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Net; using System.Net.Sockets; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes @@ -53,8 +56,8 @@ protected void Arrange() _sessionMock.Setup(p => p.IsConnected).Returns(false); - _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint)_localEndpoint.Port, - _remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port); + _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint) _localEndpoint.Port, + _remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNull.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNull.cs index 01caca5b0..45c62e04e 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNull.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNull.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Net; using System.Net.Sockets; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes @@ -53,8 +56,8 @@ protected void Arrange() _sessionMock.Setup(p => p.IsConnected).Returns(false); _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); - _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint)_localEndpoint.Port, - _remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port); + _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint) _localEndpoint.Port, + _remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortDisposed.cs index b84a9339c..2806ec540 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortDisposed.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortDisposed.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortNeverStarted.cs index a6c1ef5fb..2508eefb4 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortNeverStarted.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Net; using System.Net.Sockets; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes @@ -50,8 +53,8 @@ protected void Arrange() _sessionMock = new Mock(MockBehavior.Strict); _connectionInfoMock = new Mock(MockBehavior.Strict); - _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint)_localEndpoint.Port, - _remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port); + _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint) _localEndpoint.Port, + _remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; 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 b07bb9331..2aba926b6 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelBound.cs @@ -3,8 +3,11 @@ using System.Net; using System.Net.Sockets; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; @@ -83,11 +86,11 @@ private void SetupData() _forwardedPort.Session = _sessionMock.Object; _client = new Socket(_localEndpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp) - { - ReceiveTimeout = 100, - SendTimeout = 100, - SendBufferSize = 0 - }; + { + ReceiveTimeout = 100, + SendTimeout = 100, + SendBufferSize = 0 + }; } private void SetupMocks() 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 d43ee28fc..49b959954 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelNotBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelNotBound.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Net; using System.Net.Sockets; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStopped.cs index ff55acb38..7f4ec5ce2 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStopped.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStopped.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Net; using System.Net.Sockets; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes @@ -52,8 +55,8 @@ protected void Arrange() _sessionMock.Setup(p => p.IsConnected).Returns(true); _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); - _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint)_localEndpoint.Port, - _remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port); + _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint) _localEndpoint.Port, + _remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortDisposed.cs index 03d14da60..1e55dcd61 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortDisposed.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortDisposed.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using System.Net; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes @@ -38,7 +40,7 @@ protected void Arrange() _closingRegister = new List(); _exceptionRegister = new List(); _bindEndpoint = new IPEndPoint(IPAddress.Any, random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); - _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); + _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortNeverStarted.cs index 1454ce2a6..62e454506 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortNeverStarted.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Globalization; using System.Net; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -54,7 +57,7 @@ protected void Arrange() _sessionMock.Setup(p => p.IsConnected).Returns(true); _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); - _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); + _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; @@ -74,11 +77,11 @@ public void IsStartedShouldReturnFalse() [TestMethod] public void ForwardedPortShouldIgnoreChannelOpenMessagesWhenDisposed() { - var channelNumberDisposed = (uint)new Random().Next(1001, int.MaxValue); - var initialWindowSizeDisposed = (uint)new Random().Next(0, int.MaxValue); - var maximumPacketSizeDisposed = (uint)new Random().Next(0, int.MaxValue); + var channelNumberDisposed = (uint) new Random().Next(1001, int.MaxValue); + var initialWindowSizeDisposed = (uint) new Random().Next(0, int.MaxValue); + var maximumPacketSizeDisposed = (uint) new Random().Next(0, int.MaxValue); var originatorAddressDisposed = new Random().Next().ToString(CultureInfo.InvariantCulture); - var originatorPortDisposed = (uint)new Random().Next(0, int.MaxValue); + var originatorPortDisposed = (uint) new Random().Next(0, int.MaxValue); var channelMock = new Mock(MockBehavior.Strict); _sessionMock.Setup( 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 69787c826..7ffd2aafd 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStarted_ChannelBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStarted_ChannelBound.cs @@ -3,8 +3,11 @@ using System.Globalization; using System.Net; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -91,7 +94,7 @@ private void SetUpData() _channelBindStarted = new ManualResetEvent(false); _channelBindCompleted = new ManualResetEvent(false); - ForwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); + ForwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); ForwardedPort.Closing += (sender, args) => { _closingRegister.Add(args); @@ -190,11 +193,11 @@ public void ForwardedPortShouldRejectChannelOpenMessagesThatAreReceivedWhileTheS [TestMethod] public void ForwardedPortShouldIgnoreChannelOpenMessagesWhenDisposed() { - var channelNumberDisposed = (uint)new Random().Next(1001, int.MaxValue); - var initialWindowSizeDisposed = (uint)new Random().Next(0, int.MaxValue); - var maximumPacketSizeDisposed = (uint)new Random().Next(0, int.MaxValue); + var channelNumberDisposed = (uint) new Random().Next(1001, int.MaxValue); + var initialWindowSizeDisposed = (uint) new Random().Next(0, int.MaxValue); + var maximumPacketSizeDisposed = (uint) new Random().Next(0, int.MaxValue); var originatorAddressDisposed = new Random().Next().ToString(CultureInfo.InvariantCulture); - var originatorPortDisposed = (uint)new Random().Next(0, int.MaxValue); + var originatorPortDisposed = (uint) new Random().Next(0, int.MaxValue); var channelMock = new Mock(MockBehavior.Strict); _sessionMock.Setup( diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStopped.cs index 0c1de603b..4539254a5 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStopped.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStopped.cs @@ -3,8 +3,11 @@ using System.Globalization; using System.Net; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -47,7 +50,7 @@ protected void Arrange() _exceptionRegister = new List(); _bindEndpoint = new IPEndPoint(IPAddress.Any, random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); - ForwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); + ForwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); @@ -104,11 +107,11 @@ public void IsStartedShouldReturnFalse() [TestMethod] public void ForwardedPortShouldIgnoreChannelOpenMessagesWhenDisposed() { - var channelNumberDisposed = (uint)new Random().Next(1001, int.MaxValue); - var initialWindowSizeDisposed = (uint)new Random().Next(0, int.MaxValue); - var maximumPacketSizeDisposed = (uint)new Random().Next(0, int.MaxValue); + var channelNumberDisposed = (uint) new Random().Next(1001, int.MaxValue); + var initialWindowSizeDisposed = (uint) new Random().Next(0, int.MaxValue); + var maximumPacketSizeDisposed = (uint) new Random().Next(0, int.MaxValue); var originatorAddressDisposed = new Random().Next().ToString(CultureInfo.InvariantCulture); - var originatorPortDisposed = (uint)new Random().Next(0, int.MaxValue); + var originatorPortDisposed = (uint) new Random().Next(0, int.MaxValue); var channelMock = new Mock(MockBehavior.Strict); _sessionMock.Setup( diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortDisposed.cs index bb33584b8..9bf5596db 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortDisposed.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortDisposed.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using System.Net; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes @@ -40,7 +42,7 @@ protected void Arrange() _exceptionRegister = new List(); _bindEndpoint = new IPEndPoint(IPAddress.Any, random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); - _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); + _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs index a090f289b..9babccc17 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs @@ -3,8 +3,11 @@ using System.Globalization; using System.Net; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -54,7 +57,7 @@ protected void Arrange() _exceptionRegister = new List(); _bindEndpoint = new IPEndPoint(IPAddress.Any, random.Next(IPEndPoint.MinPort, 1000)); _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); - _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); + _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); @@ -98,11 +101,11 @@ public void IsStartedShouldReturnTrue() [TestMethod] public void ForwardedPortShouldAcceptNewConnections() { - var channelNumber = (uint)new Random().Next(1001, int.MaxValue); - var initialWindowSize = (uint)new Random().Next(0, int.MaxValue); - var maximumPacketSize = (uint)new Random().Next(0, int.MaxValue); + var channelNumber = (uint) new Random().Next(1001, int.MaxValue); + var initialWindowSize = (uint) new Random().Next(0, int.MaxValue); + var maximumPacketSize = (uint) new Random().Next(0, int.MaxValue); var originatorAddress = new Random().Next().ToString(CultureInfo.InvariantCulture); - var originatorPort = (uint)new Random().Next(0, int.MaxValue); + var originatorPort = (uint) new Random().Next(0, int.MaxValue); var channelMock = new Mock(MockBehavior.Strict); _sessionMock.Setup( diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStarted.cs index 0cd8a6ad7..cf8a64990 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStarted.cs @@ -3,8 +3,11 @@ using System.Globalization; using System.Net; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -55,7 +58,7 @@ protected void Arrange() _exceptionRegister = new List(); _bindEndpoint = new IPEndPoint(IPAddress.Any, random.Next(IPEndPoint.MinPort, 1000)); _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); - _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); + _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); @@ -115,11 +118,11 @@ public void IsStartedShouldReturnTrue() [TestMethod] public void ForwardedPortShouldAcceptNewConnections() { - var channelNumber = (uint)new Random().Next(1001, int.MaxValue); - var initialWindowSize = (uint)new Random().Next(0, int.MaxValue); - var maximumPacketSize = (uint)new Random().Next(0, int.MaxValue); + var channelNumber = (uint) new Random().Next(1001, int.MaxValue); + var initialWindowSize = (uint) new Random().Next(0, int.MaxValue); + var maximumPacketSize = (uint) new Random().Next(0, int.MaxValue); var originatorAddress = new Random().Next().ToString(CultureInfo.InvariantCulture); - var originatorPort = (uint)new Random().Next(0, int.MaxValue); + var originatorPort = (uint) new Random().Next(0, int.MaxValue); var channelMock = new Mock(MockBehavior.Strict); _sessionMock.Setup( diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStopped.cs index 92caa7ac8..c568af8b4 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStopped.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStopped.cs @@ -3,8 +3,11 @@ using System.Globalization; using System.Net; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -54,7 +57,7 @@ protected void Arrange() _exceptionRegister = new List(); _bindEndpoint = new IPEndPoint(IPAddress.Any, random.Next(IPEndPoint.MinPort, 1000)); _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); - _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); + _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); @@ -114,11 +117,11 @@ public void IsStartedShouldReturnTrue() [TestMethod] public void ForwardedPortShouldAcceptNewConnections() { - var channelNumber = (uint)new Random().Next(1001, int.MaxValue); - var initialWindowSize = (uint)new Random().Next(0, int.MaxValue); - var maximumPacketSize = (uint)new Random().Next(0, int.MaxValue); + var channelNumber = (uint) new Random().Next(1001, int.MaxValue); + var initialWindowSize = (uint) new Random().Next(0, int.MaxValue); + var maximumPacketSize = (uint) new Random().Next(0, int.MaxValue); var originatorAddress = new Random().Next().ToString(CultureInfo.InvariantCulture); - var originatorPort = (uint)new Random().Next(0, int.MaxValue); + var originatorPort = (uint) new Random().Next(0, int.MaxValue); var channelMock = new Mock(MockBehavior.Strict); var channelDisposed = new ManualResetEvent(false); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNotConnected.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNotConnected.cs index af38f057a..abb85676b 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNotConnected.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNotConnected.cs @@ -61,7 +61,7 @@ protected void Arrange() _ = _sessionMock.Setup(p => p.IsConnected) .Returns(false); - _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); + _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; @@ -104,7 +104,7 @@ public void ForwardedPortShouldIgnoreReceivedSignalForNewConnection() var channelMock = new Mock(MockBehavior.Strict); _ = _sessionMock.Setup(p => p.CreateChannelForwardedTcpip(channelNumber, initialWindowSize, maximumPacketSize)).Returns(channelMock.Object); - + _sessionMock.Raise(p => p.ChannelOpenReceived += null, new MessageEventArgs(new ChannelOpenMessage(channelNumber, initialWindowSize, maximumPacketSize, diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNull.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNull.cs index 9cd3a3046..2e3acb115 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNull.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNull.cs @@ -43,7 +43,7 @@ protected void Arrange() _bindEndpoint = new IPEndPoint(IPAddress.Any, random.Next(IPEndPoint.MinPort, 1000)); _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); - _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); + _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Started.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Started.cs index dd7537a3b..6c1445388 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Started.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Started.cs @@ -3,8 +3,11 @@ using System.Globalization; using System.Net; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -52,7 +55,7 @@ protected void Arrange() _exceptionRegister = new List(); _bindEndpoint = new IPEndPoint(IPAddress.Any, random.Next(IPEndPoint.MinPort, 1000)); _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); - _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); + _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); @@ -129,11 +132,11 @@ public void ForwardedPortShouldAcceptChannelOpenMessageForBoundAddressAndBoundPo [TestMethod] public void ForwardedPortShouldIgnoreChannelOpenMessageForBoundHostAndOtherPort() { - var channelNumber = (uint)new Random().Next(1001, int.MaxValue); - var initialWindowSize = (uint)new Random().Next(0, int.MaxValue); - var maximumPacketSize = (uint)new Random().Next(0, int.MaxValue); + var channelNumber = (uint) new Random().Next(1001, int.MaxValue); + var initialWindowSize = (uint) new Random().Next(0, int.MaxValue); + var maximumPacketSize = (uint) new Random().Next(0, int.MaxValue); var originatorAddress = new Random().Next().ToString(CultureInfo.InvariantCulture); - var originatorPort = (uint)new Random().Next(0, int.MaxValue); + var originatorPort = (uint) new Random().Next(0, int.MaxValue); var channelMock = new Mock(MockBehavior.Strict); _sessionMock.Setup( @@ -155,11 +158,11 @@ public void ForwardedPortShouldIgnoreChannelOpenMessageForBoundHostAndOtherPort( [TestMethod] public void ForwardedPortShouldIgnoreChannelOpenMessageForOtherHostAndBoundPort() { - var channelNumber = (uint)new Random().Next(1001, int.MaxValue); - var initialWindowSize = (uint)new Random().Next(0, int.MaxValue); - var maximumPacketSize = (uint)new Random().Next(0, int.MaxValue); + var channelNumber = (uint) new Random().Next(1001, int.MaxValue); + var initialWindowSize = (uint) new Random().Next(0, int.MaxValue); + var maximumPacketSize = (uint) new Random().Next(0, int.MaxValue); var originatorAddress = new Random().Next().ToString(CultureInfo.InvariantCulture); - var originatorPort = (uint)new Random().Next(0, int.MaxValue); + var originatorPort = (uint) new Random().Next(0, int.MaxValue); var channelMock = new Mock(MockBehavior.Strict); _sessionMock.Setup( @@ -181,9 +184,9 @@ public void ForwardedPortShouldIgnoreChannelOpenMessageForOtherHostAndBoundPort( [TestMethod] public void ForwardedPortShouldIgnoreChannelOpenMessageWhenChannelOpenInfoIsNotForwardedTcpipChannelInfo() { - var channelNumber = (uint)new Random().Next(1001, int.MaxValue); - var initialWindowSize = (uint)new Random().Next(0, int.MaxValue); - var maximumPacketSize = (uint)new Random().Next(0, int.MaxValue); + var channelNumber = (uint) new Random().Next(1001, int.MaxValue); + var initialWindowSize = (uint) new Random().Next(0, int.MaxValue); + var maximumPacketSize = (uint) new Random().Next(0, int.MaxValue); var channelMock = new Mock(MockBehavior.Strict); _sessionMock.Setup( diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortDisposed.cs index 5c905c3d7..62fc59e19 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortDisposed.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortDisposed.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using System.Net; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes @@ -39,7 +41,7 @@ protected void Arrange() _exceptionRegister = new List(); _bindEndpoint = new IPEndPoint(IPAddress.Any, random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); - _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); + _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortNeverStarted.cs index d3fce85fc..532cc86e9 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortNeverStarted.cs @@ -3,8 +3,11 @@ using System.Globalization; using System.Net; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -54,7 +57,7 @@ protected void Arrange() _exceptionRegister = new List(); _bindEndpoint = new IPEndPoint(IPAddress.Any, random.Next(IPEndPoint.MinPort, 1000)); _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); - _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); + _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); @@ -98,11 +101,11 @@ public void IsStartedShouldReturnFalse() [TestMethod] public void ForwardedPortShouldIgnoreNewConnections() { - var channelNumberDisposed = (uint)new Random().Next(1001, int.MaxValue); - var initialWindowSizeDisposed = (uint)new Random().Next(0, int.MaxValue); - var maximumPacketSizeDisposed = (uint)new Random().Next(0, int.MaxValue); + var channelNumberDisposed = (uint) new Random().Next(1001, int.MaxValue); + var initialWindowSizeDisposed = (uint) new Random().Next(0, int.MaxValue); + var maximumPacketSizeDisposed = (uint) new Random().Next(0, int.MaxValue); var originatorAddressDisposed = new Random().Next().ToString(CultureInfo.InvariantCulture); - var originatorPortDisposed = (uint)new Random().Next(0, int.MaxValue); + var originatorPortDisposed = (uint) new Random().Next(0, int.MaxValue); var channelMock = new Mock(MockBehavior.Strict); _sessionMock.Setup( diff --git a/test/Renci.SshNet.Tests/Classes/KeyboardInteractiveAuthenticationMethodTest.cs b/test/Renci.SshNet.Tests/Classes/KeyboardInteractiveAuthenticationMethodTest.cs index 2940388d1..e96bcae4c 100644 --- a/test/Renci.SshNet.Tests/Classes/KeyboardInteractiveAuthenticationMethodTest.cs +++ b/test/Renci.SshNet.Tests/Classes/KeyboardInteractiveAuthenticationMethodTest.cs @@ -1,6 +1,8 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Tests.Common; -using System; namespace Renci.SshNet.Tests.Classes { diff --git a/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelDataMessageTest.cs b/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelDataMessageTest.cs index 31002433b..fb2470593 100644 --- a/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelDataMessageTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelDataMessageTest.cs @@ -1,9 +1,11 @@ -using System.Linq; -using Renci.SshNet.Common; -using Renci.SshNet.Messages.Connection; +using System; +using System.Linq; + using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; + using Renci.SshNet.Abstractions; +using Renci.SshNet.Common; +using Renci.SshNet.Messages.Connection; using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes.Messages.Connection @@ -30,7 +32,7 @@ public void Constructor_LocalChannelNumberAndData() { var random = new Random(); - var localChannelNumber = (uint)random.Next(0, int.MaxValue); + var localChannelNumber = (uint) random.Next(0, int.MaxValue); var data = new byte[3]; var target = new ChannelDataMessage(localChannelNumber, data); 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 d53568a83..e67e7e8f6 100644 --- a/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelOpen/ChannelOpenMessageTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelOpen/ChannelOpenMessageTest.cs @@ -1,10 +1,12 @@ -using System.Globalization; +using System; +using System.Globalization; using System.Linq; using System.Text; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; namespace Renci.SshNet.Tests.Classes.Messages.Connection { @@ -73,9 +75,9 @@ public void Constructor_LocalChannelNumberAndInitialWindowSizeAndMaximumPacketSi [TestMethod] public void GetBytes() { - var localChannelNumber = (uint)_random.Next(0, int.MaxValue); - var initialWindowSize = (uint)_random.Next(0, int.MaxValue); - var maximumPacketSize = (uint)_random.Next(0, int.MaxValue); + var localChannelNumber = (uint) _random.Next(0, int.MaxValue); + var initialWindowSize = (uint) _random.Next(0, int.MaxValue); + var maximumPacketSize = (uint) _random.Next(0, int.MaxValue); var info = new DirectTcpipChannelInfo("host", 22, "originator", 25); var infoBytes = info.GetBytes(); var target = new ChannelOpenMessage(localChannelNumber, initialWindowSize, maximumPacketSize, info); @@ -117,9 +119,9 @@ public void GetBytes() [TestMethod] public void Load_DirectTcpipChannelInfo() { - var localChannelNumber = (uint)_random.Next(0, int.MaxValue); - var initialWindowSize = (uint)_random.Next(0, int.MaxValue); - var maximumPacketSize = (uint)_random.Next(0, int.MaxValue); + var localChannelNumber = (uint) _random.Next(0, int.MaxValue); + var initialWindowSize = (uint) _random.Next(0, int.MaxValue); + var maximumPacketSize = (uint) _random.Next(0, int.MaxValue); var info = new DirectTcpipChannelInfo("host", 22, "originator", 25); var target = new ChannelOpenMessage(localChannelNumber, initialWindowSize, maximumPacketSize, info); var bytes = target.GetBytes(); @@ -144,9 +146,9 @@ public void Load_DirectTcpipChannelInfo() [TestMethod] public void Load_ForwardedTcpipChannelInfo() { - var localChannelNumber = (uint)_random.Next(0, int.MaxValue); - var initialWindowSize = (uint)_random.Next(0, int.MaxValue); - var maximumPacketSize = (uint)_random.Next(0, int.MaxValue); + var localChannelNumber = (uint) _random.Next(0, int.MaxValue); + var initialWindowSize = (uint) _random.Next(0, int.MaxValue); + var maximumPacketSize = (uint) _random.Next(0, int.MaxValue); var info = new ForwardedTcpipChannelInfo("connected", 25, "originator", 21); var target = new ChannelOpenMessage(localChannelNumber, initialWindowSize, maximumPacketSize, info); var bytes = target.GetBytes(); @@ -171,9 +173,9 @@ public void Load_ForwardedTcpipChannelInfo() [TestMethod] public void Load_SessionChannelOpenInfo() { - var localChannelNumber = (uint)_random.Next(0, int.MaxValue); - var initialWindowSize = (uint)_random.Next(0, int.MaxValue); - var maximumPacketSize = (uint)_random.Next(0, int.MaxValue); + var localChannelNumber = (uint) _random.Next(0, int.MaxValue); + var initialWindowSize = (uint) _random.Next(0, int.MaxValue); + var maximumPacketSize = (uint) _random.Next(0, int.MaxValue); var info = new SessionChannelOpenInfo(); var target = new ChannelOpenMessage(localChannelNumber, initialWindowSize, maximumPacketSize, info); var bytes = target.GetBytes(); @@ -195,9 +197,9 @@ public void Load_SessionChannelOpenInfo() [TestMethod] public void Load_X11ChannelOpenInfo() { - var localChannelNumber = (uint)_random.Next(0, int.MaxValue); - var initialWindowSize = (uint)_random.Next(0, int.MaxValue); - var maximumPacketSize = (uint)_random.Next(0, int.MaxValue); + var localChannelNumber = (uint) _random.Next(0, int.MaxValue); + var initialWindowSize = (uint) _random.Next(0, int.MaxValue); + var maximumPacketSize = (uint) _random.Next(0, int.MaxValue); var info = new X11ChannelOpenInfo("address", 26); var target = new ChannelOpenMessage(localChannelNumber, initialWindowSize, maximumPacketSize, info); var bytes = target.GetBytes(); @@ -220,9 +222,9 @@ public void Load_X11ChannelOpenInfo() [TestMethod] public void Load_ShouldThrowNotSupportedExceptionWhenChannelTypeIsNotSupported() { - var localChannelNumber = (uint)_random.Next(0, int.MaxValue); - var initialWindowSize = (uint)_random.Next(0, int.MaxValue); - var maximumPacketSize = (uint)_random.Next(0, int.MaxValue); + var localChannelNumber = (uint) _random.Next(0, int.MaxValue); + var initialWindowSize = (uint) _random.Next(0, int.MaxValue); + var maximumPacketSize = (uint) _random.Next(0, int.MaxValue); var channelName = "dunno_" + _random.Next().ToString(CultureInfo.InvariantCulture); var channelType = _ascii.GetBytes(channelName); var target = new ChannelOpenMessage(); 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 fedbdb7fc..0d855b266 100644 --- a/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelRequest/PseudoTerminalInfoTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelRequest/PseudoTerminalInfoTest.cs @@ -2,7 +2,9 @@ using System.Collections.Generic; using System.Globalization; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; diff --git a/test/Renci.SshNet.Tests/Classes/Messages/Connection/GlobalRequestMessageTest.cs b/test/Renci.SshNet.Tests/Classes/Messages/Connection/GlobalRequestMessageTest.cs index 156a17d9b..3da4d105e 100644 --- a/test/Renci.SshNet.Tests/Classes/Messages/Connection/GlobalRequestMessageTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Messages/Connection/GlobalRequestMessageTest.cs @@ -1,8 +1,10 @@ -using Renci.SshNet.Messages.Connection; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; +using System; using System.Globalization; using System.Text; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Renci.SshNet.Messages.Connection; using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes.Messages.Connection diff --git a/test/Renci.SshNet.Tests/Classes/Messages/Transport/IgnoreMessageTest.cs b/test/Renci.SshNet.Tests/Classes/Messages/Transport/IgnoreMessageTest.cs index ff8fd86dc..1da1cebd3 100644 --- a/test/Renci.SshNet.Tests/Classes/Messages/Transport/IgnoreMessageTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Messages/Transport/IgnoreMessageTest.cs @@ -1,8 +1,10 @@ using System; using System.Linq; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Messages.Transport; -using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Renci.SshNet.Tests.Classes.Messages.Transport { diff --git a/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeInitTest.cs b/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeInitTest.cs index 0cd39a0e2..0ffc4ba0d 100644 --- a/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeInitTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeInitTest.cs @@ -1,4 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes.Messages.Transport @@ -10,4 +11,4 @@ namespace Renci.SshNet.Tests.Classes.Messages.Transport public class KeyExchangeDhGroupExchangeInitTest : TestBase { } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeReplyBuilder.cs b/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeReplyBuilder.cs index f257e6de3..659ee1a29 100644 --- a/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeReplyBuilder.cs +++ b/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeReplyBuilder.cs @@ -1,4 +1,5 @@ using System.Text; + using Renci.SshNet.Common; using Renci.SshNet.Messages.Transport; @@ -43,7 +44,7 @@ public byte[] Build() var sshDataStream = new SshDataStream(0); var target = new KeyExchangeDhGroupExchangeReply(); sshDataStream.WriteByte(target.MessageNumber); - sshDataStream.Write((uint)(4 + _hostKeyAlgorithm.Length + _hostKeys.Length)); + sshDataStream.Write((uint) (4 + _hostKeyAlgorithm.Length + _hostKeys.Length)); sshDataStream.Write((uint) _hostKeyAlgorithm.Length); sshDataStream.Write(_hostKeyAlgorithm, 0, _hostKeyAlgorithm.Length); sshDataStream.Write(_hostKeys, 0, _hostKeys.Length); diff --git a/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeReplyTest.cs b/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeReplyTest.cs index 2e424b50f..6d0650afa 100644 --- a/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeReplyTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeReplyTest.cs @@ -1,7 +1,9 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Linq; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Messages.Transport; using Renci.SshNet.Tests.Common; -using System.Linq; namespace Renci.SshNet.Tests.Classes.Messages.Transport { @@ -26,4 +28,4 @@ public void Test_KeyExchangeDhGroupExchangeReply_Load() Assert.IsTrue(m.F.SequenceEqual(new byte[] { 0x00, 0xc6, 0x58, 0xb9, 0xa8, 0x11, 0xfd, 0xb6, 0xd6, 0xe9, 0x0c, 0x51, 0x45, 0xac, 0x51, 0x8a, 0x25, 0x6e, 0x1d, 0x9e, 0xbb, 0x7f, 0x98, 0xe3, 0x94, 0xd5, 0xac, 0x97, 0xd6, 0x35, 0x2e, 0xcc, 0x34, 0x85, 0xe2, 0x29, 0x2c, 0xba, 0x45, 0x6b, 0x39, 0xce, 0xd2, 0xae, 0x2e, 0x9a, 0x30, 0x43, 0x45, 0x09, 0xd2, 0xeb, 0x21, 0x46, 0x95, 0xa8, 0xb9, 0xbc, 0xb4, 0x21, 0xcd, 0x65, 0xeb, 0x0f, 0x48, 0x3c, 0x82, 0xdb, 0x52, 0x0e, 0xa5, 0xa8, 0xca, 0x29, 0x2d, 0xf8, 0x54, 0x38, 0xe4, 0x8f, 0x2c, 0x2d, 0x45, 0x2d, 0x2c, 0xf7, 0x1a, 0x41, 0xef, 0xd4, 0xec, 0x0f, 0xa5, 0xa8, 0xa7, 0x64, 0xb3, 0xe8, 0x7b, 0xa1, 0x40, 0x41, 0x69, 0x70, 0x4d, 0x95, 0x91, 0x8b, 0x5f, 0x28, 0xa2, 0xfc, 0xa7, 0x12, 0x2b, 0x94, 0xf0, 0x0a, 0x82, 0x92, 0x65, 0xdf, 0x8a, 0x35, 0xfb, 0xcc, 0xbe, 0xbd, 0x2d })); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeInitMessageTest.cs b/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeInitMessageTest.cs index e7116dc85..e60d56b09 100644 --- a/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeInitMessageTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeInitMessageTest.cs @@ -1,7 +1,9 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Linq; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Messages.Transport; using Renci.SshNet.Tests.Common; -using System.Linq; namespace Renci.SshNet.Tests.Classes.Messages.Transport { diff --git a/test/Renci.SshNet.Tests/Classes/NetConfClientTest.cs b/test/Renci.SshNet.Tests/Classes/NetConfClientTest.cs index b67644585..4917442a6 100644 --- a/test/Renci.SshNet.Tests/Classes/NetConfClientTest.cs +++ b/test/Renci.SshNet.Tests/Classes/NetConfClientTest.cs @@ -1,6 +1,8 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Tests.Common; -using System; namespace Renci.SshNet.Tests.Classes { @@ -32,9 +34,9 @@ public void OperationTimeout_InsideLimits() var operationTimeout = TimeSpan.FromMilliseconds(_random.Next(0, int.MaxValue - 1)); var connectionInfo = new PasswordConnectionInfo("host", 22, "admin", "pwd"); var target = new NetConfClient(connectionInfo) - { - OperationTimeout = operationTimeout - }; + { + OperationTimeout = operationTimeout + }; var actual = target.OperationTimeout; @@ -47,8 +49,8 @@ public void OperationTimeout_LowerLimit() var operationTimeout = TimeSpan.FromMilliseconds(-1); var connectionInfo = new PasswordConnectionInfo("host", 22, "admin", "pwd"); var target = new NetConfClient(connectionInfo) - { - OperationTimeout = operationTimeout + { + OperationTimeout = operationTimeout }; var actual = target.OperationTimeout; @@ -62,9 +64,9 @@ public void OperationTimeout_UpperLimit() var operationTimeout = TimeSpan.FromMilliseconds(int.MaxValue); var connectionInfo = new PasswordConnectionInfo("host", 22, "admin", "pwd"); var target = new NetConfClient(connectionInfo) - { - OperationTimeout = operationTimeout - }; + { + OperationTimeout = operationTimeout + }; var actual = target.OperationTimeout; diff --git a/test/Renci.SshNet.Tests/Classes/NetConfClientTestBase.cs b/test/Renci.SshNet.Tests/Classes/NetConfClientTestBase.cs index 4c6cbe7f0..66e3c25ad 100644 --- a/test/Renci.SshNet.Tests/Classes/NetConfClientTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/NetConfClientTestBase.cs @@ -1,4 +1,5 @@ using Moq; + using Renci.SshNet.NetConf; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Connect_NetConfSessionConnectFailure.cs b/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Connect_NetConfSessionConnectFailure.cs index 1585d8734..c1e659aaf 100644 --- a/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Connect_NetConfSessionConnectFailure.cs +++ b/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Connect_NetConfSessionConnectFailure.cs @@ -112,7 +112,7 @@ private static KeyHostAlgorithm GetKeyHostAlgorithm() using (var s = TestBase.GetData("Key.RSA.txt")) { var privateKey = new PrivateKeyFile(s); - return (KeyHostAlgorithm)privateKey.HostKeyAlgorithms.First(); + return (KeyHostAlgorithm) privateKey.HostKeyAlgorithms.First(); } } } diff --git a/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Dispose_Connected.cs b/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Dispose_Connected.cs index ed0103837..d67b43af9 100644 --- a/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Dispose_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Dispose_Connected.cs @@ -18,9 +18,9 @@ protected override void SetupData() _connectionInfo = new ConnectionInfo("host", "user", new NoneAuthenticationMethod("userauth")); _operationTimeout = new Random().Next(1000, 10000); _netConfClient = new NetConfClient(_connectionInfo, false, ServiceFactoryMock.Object) - { - OperationTimeout = TimeSpan.FromMilliseconds(_operationTimeout) - }; + { + OperationTimeout = TimeSpan.FromMilliseconds(_operationTimeout) + }; } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Dispose_Disconnected.cs b/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Dispose_Disconnected.cs index efbfe7ff2..e3f15628f 100644 --- a/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Dispose_Disconnected.cs +++ b/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Dispose_Disconnected.cs @@ -1,8 +1,8 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; -using Moq; +using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; +using Moq; namespace Renci.SshNet.Tests.Classes { @@ -25,9 +25,9 @@ protected override void SetupData() _connectionInfo = new ConnectionInfo("host", "user", new NoneAuthenticationMethod("userauth")); _operationTimeout = new Random().Next(1000, 10000); _netConfClient = new NetConfClient(_connectionInfo, false, ServiceFactoryMock.Object) - { - OperationTimeout = TimeSpan.FromMilliseconds(_operationTimeout) - }; + { + OperationTimeout = TimeSpan.FromMilliseconds(_operationTimeout) + }; } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Dispose_Disposed.cs b/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Dispose_Disposed.cs index cc5f704f4..7294033a0 100644 --- a/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Dispose_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Dispose_Disposed.cs @@ -1,8 +1,8 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; -using Moq; +using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; +using Moq; namespace Renci.SshNet.Tests.Classes { @@ -18,9 +18,9 @@ protected override void SetupData() _connectionInfo = new ConnectionInfo("host", "user", new NoneAuthenticationMethod("userauth")); _operationTimeout = new Random().Next(1000, 10000); _netConfClient = new NetConfClient(_connectionInfo, false, ServiceFactoryMock.Object) - { - OperationTimeout = TimeSpan.FromMilliseconds(_operationTimeout) - }; + { + OperationTimeout = TimeSpan.FromMilliseconds(_operationTimeout) + }; } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Finalize_Connected.cs b/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Finalize_Connected.cs index ec827b1e6..0d826643f 100644 --- a/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Finalize_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Finalize_Connected.cs @@ -1,5 +1,7 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; namespace Renci.SshNet.Tests.Classes @@ -17,9 +19,9 @@ protected override void SetupData() _connectionInfo = new ConnectionInfo("host", "user", new NoneAuthenticationMethod("userauth")); _operationTimeout = new Random().Next(1000, 10000); _netConfClient = new NetConfClient(_connectionInfo, false, ServiceFactoryMock.Object) - { - OperationTimeout = TimeSpan.FromMilliseconds(_operationTimeout) - }; + { + OperationTimeout = TimeSpan.FromMilliseconds(_operationTimeout) + }; _netConfClientWeakRefence = new WeakReference(_netConfClient); } diff --git a/test/Renci.SshNet.Tests/Classes/NoneAuthenticationMethodTest.cs b/test/Renci.SshNet.Tests/Classes/NoneAuthenticationMethodTest.cs index 377ff89a5..81b74c0ee 100644 --- a/test/Renci.SshNet.Tests/Classes/NoneAuthenticationMethodTest.cs +++ b/test/Renci.SshNet.Tests/Classes/NoneAuthenticationMethodTest.cs @@ -1,7 +1,9 @@ -using System.Globalization; +using System; +using System.Globalization; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Tests.Common; -using System; namespace Renci.SshNet.Tests.Classes { diff --git a/test/Renci.SshNet.Tests/Classes/PasswordAuthenticationMethodTest.cs b/test/Renci.SshNet.Tests/Classes/PasswordAuthenticationMethodTest.cs index 7ad141adf..76ef793f8 100644 --- a/test/Renci.SshNet.Tests/Classes/PasswordAuthenticationMethodTest.cs +++ b/test/Renci.SshNet.Tests/Classes/PasswordAuthenticationMethodTest.cs @@ -1,6 +1,8 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Tests.Common; -using System; namespace Renci.SshNet.Tests.Classes { @@ -27,7 +29,7 @@ public void Password_Test_Pass_Null_Username() [ExpectedException(typeof(ArgumentNullException))] public void Password_Test_Pass_Null_Password() { - new PasswordAuthenticationMethod("valid", (string)null); + new PasswordAuthenticationMethod("valid", (string) null); } [TestMethod] diff --git a/test/Renci.SshNet.Tests/Classes/PasswordConnectionInfoTest.cs b/test/Renci.SshNet.Tests/Classes/PasswordConnectionInfoTest.cs index dbaa340f8..8929e53f9 100644 --- a/test/Renci.SshNet.Tests/Classes/PasswordConnectionInfoTest.cs +++ b/test/Renci.SshNet.Tests/Classes/PasswordConnectionInfoTest.cs @@ -1,8 +1,10 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Net; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Tests.Common; using Renci.SshNet.Tests.Properties; -using System; -using System.Net; namespace Renci.SshNet.Tests.Classes { @@ -42,7 +44,7 @@ public void Test_ConnectionInfo_Username_Is_Null() [ExpectedException(typeof(ArgumentNullException))] public void Test_ConnectionInfo_Password_Is_Null() { - _ = new PasswordConnectionInfo(Resources.HOST, Resources.USERNAME, (string)null); + _ = new PasswordConnectionInfo(Resources.HOST, Resources.USERNAME, (string) null); } [TestMethod] diff --git a/test/Renci.SshNet.Tests/Classes/PipeStreamTest_Dispose.cs b/test/Renci.SshNet.Tests/Classes/PipeStreamTest_Dispose.cs index 6ce5e73ff..8ccf52d09 100644 --- a/test/Renci.SshNet.Tests/Classes/PipeStreamTest_Dispose.cs +++ b/test/Renci.SshNet.Tests/Classes/PipeStreamTest_Dispose.cs @@ -1,6 +1,8 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Tests.Common; diff --git a/test/Renci.SshNet.Tests/Classes/PrivateKeyAuthenticationMethodTest.cs b/test/Renci.SshNet.Tests/Classes/PrivateKeyAuthenticationMethodTest.cs index aa713dc96..e28a505fb 100644 --- a/test/Renci.SshNet.Tests/Classes/PrivateKeyAuthenticationMethodTest.cs +++ b/test/Renci.SshNet.Tests/Classes/PrivateKeyAuthenticationMethodTest.cs @@ -1,6 +1,8 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Tests.Common; -using System; namespace Renci.SshNet.Tests.Classes { diff --git a/test/Renci.SshNet.Tests/Classes/PrivateKeyFileTest.cs b/test/Renci.SshNet.Tests/Classes/PrivateKeyFileTest.cs index bcf0d4788..d07c3867c 100644 --- a/test/Renci.SshNet.Tests/Classes/PrivateKeyFileTest.cs +++ b/test/Renci.SshNet.Tests/Classes/PrivateKeyFileTest.cs @@ -1,10 +1,12 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Renci.SshNet.Common; -using Renci.SshNet.Tests.Common; -using System; +using System; using System.IO; using System.Linq; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Renci.SshNet.Common; +using Renci.SshNet.Tests.Common; + namespace Renci.SshNet.Tests.Classes { /// diff --git a/test/Renci.SshNet.Tests/Classes/RemotePathDoubleQuoteTransformationTest.cs b/test/Renci.SshNet.Tests/Classes/RemotePathDoubleQuoteTransformationTest.cs index dd7c3a328..f5f4925f1 100644 --- a/test/Renci.SshNet.Tests/Classes/RemotePathDoubleQuoteTransformationTest.cs +++ b/test/Renci.SshNet.Tests/Classes/RemotePathDoubleQuoteTransformationTest.cs @@ -1,4 +1,5 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/RemotePathShellQuoteTransformationTest.cs b/test/Renci.SshNet.Tests/Classes/RemotePathShellQuoteTransformationTest.cs index a20fc5186..b15ba890c 100644 --- a/test/Renci.SshNet.Tests/Classes/RemotePathShellQuoteTransformationTest.cs +++ b/test/Renci.SshNet.Tests/Classes/RemotePathShellQuoteTransformationTest.cs @@ -1,4 +1,5 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/ScpClientTest.cs b/test/Renci.SshNet.Tests/Classes/ScpClientTest.cs index 786e408d4..d44afb78c 100644 --- a/test/Renci.SshNet.Tests/Classes/ScpClientTest.cs +++ b/test/Renci.SshNet.Tests/Classes/ScpClientTest.cs @@ -121,7 +121,7 @@ public void Ctor_HostAndPortAndUsernameAndPrivateKeys() var host = _random.Next().ToString(); var port = _random.Next(1, 100); var userName = _random.Next().ToString(); - var privateKeys = new[] {GetRsaKey(), GetDsaKey()}; + var privateKeys = new[] { GetRsaKey(), GetDsaKey() }; var client = new ScpClient(host, port, userName, privateKeys); Assert.AreEqual(16 * 1024U, client.BufferSize); diff --git a/test/Renci.SshNet.Tests/Classes/ScpClientTestBase.cs b/test/Renci.SshNet.Tests/Classes/ScpClientTestBase.cs index 26aa22e30..fdbe123c1 100644 --- a/test/Renci.SshNet.Tests/Classes/ScpClientTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/ScpClientTestBase.cs @@ -1,4 +1,5 @@ using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; 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 f64e039ee..c3aba4b25 100644 --- a/test/Renci.SshNet.Tests/Classes/ScpClientTest_Download_PathAndDirectoryInfo_SendExecRequestReturnsFalse.cs +++ b/test/Renci.SshNet.Tests/Classes/ScpClientTest_Download_PathAndDirectoryInfo_SendExecRequestReturnsFalse.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Globalization; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes 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 08eba4ff8..0d8815fb2 100644 --- a/test/Renci.SshNet.Tests/Classes/ScpClientTest_Download_PathAndFileInfo_SendExecRequestReturnsFalse.cs +++ b/test/Renci.SshNet.Tests/Classes/ScpClientTest_Download_PathAndFileInfo_SendExecRequestReturnsFalse.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Globalization; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes 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 143938c38..0be4c9623 100644 --- a/test/Renci.SshNet.Tests/Classes/ScpClientTest_Download_PathAndStream_SendExecRequestReturnsFalse.cs +++ b/test/Renci.SshNet.Tests/Classes/ScpClientTest_Download_PathAndStream_SendExecRequestReturnsFalse.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Globalization; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes 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 71c1c0cd8..75b1071c4 100644 --- a/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_DirectoryInfoAndPath_SendExecRequestReturnsFalse.cs +++ b/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_DirectoryInfoAndPath_SendExecRequestReturnsFalse.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes 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 288790d22..9fda30566 100644 --- a/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_FileInfoAndPath_SendExecRequestReturnsFalse.cs +++ b/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_FileInfoAndPath_SendExecRequestReturnsFalse.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes 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 1df8d6ac2..cdc88c5ed 100644 --- a/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_FileInfoAndPath_Success.cs +++ b/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_FileInfoAndPath_Success.cs @@ -3,8 +3,11 @@ using System.IO; using System.Linq; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; namespace Renci.SshNet.Tests.Classes @@ -89,7 +92,7 @@ protected override void SetupMocks() _ = _channelSessionMock.InSequence(sequence) .Setup(p => p.SendData(It.Is(b => b.Take(0, _fileContent.Length - _bufferSize).SequenceEqual(_fileContent.Take(_bufferSize, _fileContent.Length - _bufferSize))), 0, _fileContent.Length - _bufferSize)); _ = _channelSessionMock.InSequence(sequence) - .Setup(p => p.SendData(It.Is(b => b.SequenceEqual(new byte[] {0})))); + .Setup(p => p.SendData(It.Is(b => b.SequenceEqual(new byte[] { 0 })))); _ = _pipeStreamMock.InSequence(sequence) .Setup(p => p.ReadByte()) .Returns(0); @@ -104,9 +107,9 @@ protected override void Arrange() base.Arrange(); _scpClient = new ScpClient(_connectionInfo, false, ServiceFactoryMock.Object) - { - BufferSize = (uint) _bufferSize - }; + { + BufferSize = (uint) _bufferSize + }; _scpClient.Uploading += (sender, args) => _uploadingRegister.Add(args); _scpClient.Connect(); } diff --git a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/BlockCipherTest.cs b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/BlockCipherTest.cs index 49546d61f..39250ae27 100644 --- a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/BlockCipherTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/BlockCipherTest.cs @@ -1,6 +1,8 @@ using System; using System.Linq; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Security.Cryptography; using Renci.SshNet.Security.Cryptography.Ciphers; using Renci.SshNet.Security.Cryptography.Ciphers.Paddings; @@ -9,7 +11,7 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography { [TestClass] - public class BlockCipherTest : TestBase + public class BlockCipherTest : TestBase { [TestMethod] public void EncryptShouldTakeIntoAccountPaddingForLengthOfOutputBufferPassedToEncryptBlock() @@ -18,14 +20,14 @@ public void EncryptShouldTakeIntoAccountPaddingForLengthOfOutputBufferPassedToEn var output = new byte[] { 0x0a, 0x00, 0x03, 0x02, 0x06, 0x08, 0x07, 0x05 }; var key = new byte[] { 0x17, 0x78, 0x56, 0xe1, 0x3e, 0xbd, 0x3e, 0x50, 0x1d, 0x79, 0x3f, 0x0f, 0x55, 0x37, 0x45, 0x54 }; var blockCipher = new BlockCipherStub(key, 8, null, new PKCS5Padding()) - { - EncryptBlockDelegate = (inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset) => - { - Assert.AreEqual(8, outputBuffer.Length); - Buffer.BlockCopy(output, 0, outputBuffer, 0, output.Length); - return inputBuffer.Length; - } - }; + { + EncryptBlockDelegate = (inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset) => + { + Assert.AreEqual(8, outputBuffer.Length); + Buffer.BlockCopy(output, 0, outputBuffer, 0, output.Length); + return inputBuffer.Length; + } + }; var actual = blockCipher.Encrypt(input); @@ -39,14 +41,14 @@ public void DecryptShouldTakeIntoAccountPaddingForLengthOfOutputBufferPassedToDe var output = new byte[] { 0x0a, 0x00, 0x03, 0x02, 0x06, 0x08, 0x07, 0x05 }; var key = new byte[] { 0x17, 0x78, 0x56, 0xe1, 0x3e, 0xbd, 0x3e, 0x50, 0x1d, 0x79, 0x3f, 0x0f, 0x55, 0x37, 0x45, 0x54 }; var blockCipher = new BlockCipherStub(key, 8, null, new PKCS5Padding()) - { - DecryptBlockDelegate = (inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset) => - { - Assert.AreEqual(8, outputBuffer.Length); - Buffer.BlockCopy(output, 0, outputBuffer, 0, output.Length); - return inputBuffer.Length; - } - }; + { + DecryptBlockDelegate = (inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset) => + { + Assert.AreEqual(8, outputBuffer.Length); + Buffer.BlockCopy(output, 0, outputBuffer, 0, output.Length); + return inputBuffer.Length; + } + }; var actual = blockCipher.Decrypt(input); diff --git a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/AesCipherTest.cs b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/AesCipherTest.cs index e1a0e9744..e11ab1248 100644 --- a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/AesCipherTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/AesCipherTest.cs @@ -1,6 +1,7 @@ using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Security.Cryptography.Ciphers; using Renci.SshNet.Tests.Common; @@ -132,7 +133,7 @@ public void Encrypt_InputAndOffsetAndLength_128_CBC() var key = new byte[] { 0xe4, 0x94, 0xf9, 0xb1, 0x00, 0x4f, 0x16, 0x2a, 0x80, 0x11, 0xea, 0x73, 0x0d, 0xb9, 0xbf, 0x64 }; var iv = new byte[] { 0x74, 0x8b, 0x4f, 0xe6, 0xc1, 0x29, 0xb3, 0x54, 0xec, 0x77, 0x92, 0xf3, 0x15, 0xa0, 0x41, 0xa8 }; var expected = new byte[] { 0x19, 0x7f, 0x80, 0xd8, 0xc9, 0x89, 0xc4, 0xa7, 0xc6, 0xc6, 0x3f, 0x9f, 0x1e, 0x00, 0x1f, 0x72, 0xa7, 0x5e, 0xde, 0x40, 0x88, 0xa2, 0x72, 0xf2, 0xed, 0x3f, 0x81, 0x45, 0xb6, 0xbd, 0x45, 0x87, 0x15, 0xa5, 0x10, 0x92, 0x4a, 0x37, 0x9e, 0xa9, 0x80, 0x1c, 0x14, 0x83, 0xa3, 0x39, 0x45, 0x28 }; - var testCipher = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false); + var testCipher = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false); var actual = testCipher.Encrypt(input, 2, input.Length - 5); @@ -146,7 +147,7 @@ public void Encrypt_Input_128_CTR() var key = new byte[] { 0x17, 0x78, 0x56, 0xe1, 0x3e, 0xbd, 0x3e, 0x50, 0x1d, 0x79, 0x3f, 0x0f, 0x55, 0x37, 0x45, 0x54 }; var iv = new byte[] { 0xe6, 0x65, 0x36, 0x0d, 0xdd, 0xd7, 0x50, 0xc3, 0x48, 0xdb, 0x48, 0x07, 0xa1, 0x30, 0xd2, 0x38 }; var expected = new byte[] { 0xca, 0xfb, 0x1c, 0x49, 0xbf, 0x82, 0x2a, 0xbb, 0x1c, 0x52, 0xc7, 0x86, 0x22, 0x8a, 0xe5, 0xa4, 0xf3, 0xda, 0x4e, 0x1c, 0x3a, 0x87, 0x41, 0x1c, 0xd2, 0x6e, 0x76, 0xdc, 0xc2, 0xe9, 0xc2, 0x0e, 0xf5, 0xc7, 0xbd, 0x12, 0x85, 0xfa, 0x0e, 0xda, 0xee, 0x50, 0xd7, 0xfd, 0x81, 0x34, 0x25, 0x6d }; - var testCipher = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false); + var testCipher = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false); var actual = testCipher.Encrypt(input); @@ -160,7 +161,7 @@ public void Decrypt_Input_128_CTR() var iv = new byte[] { 0xe6, 0x65, 0x36, 0x0d, 0xdd, 0xd7, 0x50, 0xc3, 0x48, 0xdb, 0x48, 0x07, 0xa1, 0x30, 0xd2, 0x38 }; var input = new byte[] { 0xca, 0xfb, 0x1c, 0x49, 0xbf, 0x82, 0x2a, 0xbb, 0x1c, 0x52, 0xc7, 0x86, 0x22, 0x8a, 0xe5, 0xa4, 0xf3, 0xda, 0x4e, 0x1c, 0x3a, 0x87, 0x41, 0x1c, 0xd2, 0x6e, 0x76, 0xdc, 0xc2, 0xe9, 0xc2, 0x0e, 0xf5, 0xc7, 0xbd, 0x12, 0x85, 0xfa, 0x0e, 0xda, 0xee, 0x50, 0xd7, 0xfd, 0x81, 0x34, 0x25, 0x6d }; var expected = new byte[] { 0x00, 0x00, 0x00, 0x2c, 0x1a, 0x05, 0x00, 0x00, 0x00, 0x0c, 0x73, 0x73, 0x68, 0x2d, 0x75, 0x73, 0x65, 0x72, 0x61, 0x75, 0x74, 0x68, 0xb0, 0x74, 0x21, 0x87, 0x16, 0xb9, 0x69, 0x48, 0x33, 0xce, 0xb3, 0xe7, 0xdc, 0x3f, 0x50, 0xdc, 0xcc, 0xd5, 0x27, 0xb7, 0xfe, 0x7a, 0x78, 0x22, 0xae, 0xc8 }; - var testCipher = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false); + var testCipher = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false); var actual = testCipher.Decrypt(input); @@ -174,7 +175,7 @@ public void Decrypt_InputAndOffsetAndLength_128_CTR() var iv = new byte[] { 0xe6, 0x65, 0x36, 0x0d, 0xdd, 0xd7, 0x50, 0xc3, 0x48, 0xdb, 0x48, 0x07, 0xa1, 0x30, 0xd2, 0x38 }; var input = new byte[] { 0x0a, 0xca, 0xfb, 0x1c, 0x49, 0xbf, 0x82, 0x2a, 0xbb, 0x1c, 0x52, 0xc7, 0x86, 0x22, 0x8a, 0xe5, 0xa4, 0xf3, 0xda, 0x4e, 0x1c, 0x3a, 0x87, 0x41, 0x1c, 0xd2, 0x6e, 0x76, 0xdc, 0xc2, 0xe9, 0xc2, 0x0e, 0xf5, 0xc7, 0xbd, 0x12, 0x85, 0xfa, 0x0e, 0xda, 0xee, 0x50, 0xd7, 0xfd, 0x81, 0x34, 0x25, 0x6d, 0x0a, 0x05 }; var expected = new byte[] { 0x00, 0x00, 0x00, 0x2c, 0x1a, 0x05, 0x00, 0x00, 0x00, 0x0c, 0x73, 0x73, 0x68, 0x2d, 0x75, 0x73, 0x65, 0x72, 0x61, 0x75, 0x74, 0x68, 0xb0, 0x74, 0x21, 0x87, 0x16, 0xb9, 0x69, 0x48, 0x33, 0xce, 0xb3, 0xe7, 0xdc, 0x3f, 0x50, 0xdc, 0xcc, 0xd5, 0x27, 0xb7, 0xfe, 0x7a, 0x78, 0x22, 0xae, 0xc8 }; - var testCipher = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false); + var testCipher = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false); var actual = testCipher.Decrypt(input, 1, input.Length - 3); @@ -194,19 +195,19 @@ public void AES_ECB_128_Length16() { 0x96, 0x39, 0xec, 0x0d, 0xfc, 0x2d, 0xb2, 0x7c, 0xe9, 0x74, 0x8e, 0x5f, 0xb9, 0xf3, 0x99, 0xce, }; - + // echo -n -e '\x03\xe1\xe1\xaa\xa5\xbc\xa1\x9f\xba\x8c\x42\x05\x8b\x4a\xbf\x28' | openssl enc -e -aes-128-ecb -K 9639EC0DFC2DB27CE9748E5FB9F399CE -nopad | hd var expected = new byte[] { 0x9d, 0x55, 0x05, 0x4e, 0xe9, 0x50, 0xb5, 0x93, 0x50, 0x93, 0x69, 0x96, 0xa6, 0xdd, 0x1e, 0x15, }; - + var actual = new AesCipher(key, iv: null, AesCipherMode.ECB, pkcs7Padding: false).Encrypt(input); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, iv: null, AesCipherMode.ECB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -222,20 +223,20 @@ public void AES_ECB_128_Length32() { 0x67, 0x02, 0x45, 0xc8, 0xb8, 0x64, 0x42, 0x17, 0xda, 0x85, 0x21, 0x3e, 0x5c, 0xa6, 0xee, 0xd4, }; - + // echo -n -e '\x1a\xf1\x3a\x35\x8c\xca\x3f\xd6\x2f\x65\xc1\x31\x2d\x41\xe5\xc7\xf3\x74\x23\x71\xed\x6d\x84\x79\x61\xd0\xf8\x6f\x7f\x0c\xcc\x86' | openssl enc -e -aes-128-ecb -K 670245C8B8644217DA85213E5CA6EED4 -nopad | hd var expected = new byte[] { 0x73, 0x67, 0xcc, 0x04, 0x46, 0xf5, 0x31, 0x9b, 0x64, 0x26, 0x32, 0xba, 0xa4, 0x18, 0x0d, 0x8a, 0xe3, 0x1c, 0x95, 0x44, 0x49, 0x9e, 0x4a, 0x17, 0x0e, 0x64, 0xd3, 0xe8, 0x5c, 0xe6, 0x9f, 0x83, }; - + var actual = new AesCipher(key, iv: null, AesCipherMode.ECB, pkcs7Padding: false).Encrypt(input); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, iv: null, AesCipherMode.ECB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -253,7 +254,7 @@ public void AES_ECB_128_Length64() { 0xc7, 0x8d, 0x3a, 0x4c, 0xa2, 0xfb, 0xde, 0x1e, 0x49, 0x3e, 0xc1, 0x34, 0x86, 0x14, 0xc6, 0x2d, }; - + // echo -n -e '\x99\x3a\xc9\x2b\xfb\x1d\x0e\x8e\x31\x0c\x96\x68\x4c\x46\x1d\xbb\xe1\x23\xc8\x99\x59\x90\x47\xcb\x63\x99\x5b\xf7\x91\x87\x44\x09\x2e\xff\xa4\x21\xdc\xc3\xd9\x89\xd7\x24\x0a\x32\x05\x36\x60\x25\xa4\x17\xda\xaf\x08\xbe\xc9\x08\xf3\xfe\xc7\x61\xc2\x17\xfd\xaa' | openssl enc -e -aes-128-ecb -K C78D3A4CA2FBDE1E493EC1348614C62D -nopad | hd var expected = new byte[] { @@ -262,13 +263,13 @@ public void AES_ECB_128_Length64() 0xee, 0x64, 0xf2, 0xf4, 0xa3, 0x20, 0x54, 0x84, 0x7f, 0x8d, 0xe1, 0x6b, 0xf3, 0xd9, 0x7e, 0x34, 0x10, 0xe3, 0xe0, 0x30, 0xd3, 0x0e, 0xe3, 0x94, 0xd8, 0xf5, 0xb1, 0x44, 0xf8, 0x36, 0xfd, 0x0b, }; - + var actual = new AesCipher(key, iv: null, AesCipherMode.ECB, pkcs7Padding: false).Encrypt(input); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, iv: null, AesCipherMode.ECB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -284,19 +285,19 @@ public void AES_ECB_192_Length16() 0x38, 0x99, 0x28, 0x8c, 0xc4, 0x84, 0xfd, 0x32, 0x8c, 0xca, 0x16, 0x06, 0xcc, 0x00, 0x22, 0xd2, 0x76, 0x00, 0x0d, 0x25, 0xa9, 0x4e, 0x31, 0x25, }; - + // echo -n -e '\x27\x60\x6b\x78\xfc\x13\x83\xa8\x38\xbb\x65\xca\xfd\x94\x82\xde' | openssl enc -e -aes-192-ecb -K 3899288CC484FD328CCA1606CC0022D276000D25A94E3125 -nopad | hd var expected = new byte[] { 0x1c, 0xd3, 0x91, 0xd8, 0xc3, 0xe0, 0x4d, 0x8e, 0x9e, 0x5c, 0xaf, 0xcc, 0x55, 0x65, 0x54, 0xb7, }; - + var actual = new AesCipher(key, iv: null, AesCipherMode.ECB, pkcs7Padding: false).Encrypt(input); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, iv: null, AesCipherMode.ECB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -313,20 +314,20 @@ public void AES_ECB_192_Length32() 0x05, 0x6a, 0xc2, 0x70, 0x62, 0xff, 0x28, 0x34, 0xce, 0x08, 0x58, 0x9c, 0xe3, 0x76, 0x1b, 0xbb, 0x1a, 0xbc, 0xf9, 0x4c, 0x60, 0xe1, 0x5f, 0x57, }; - + // echo -n -e '\x63\x38\xec\x32\xfd\x7d\xdb\x38\x99\x93\x53\xfc\x86\x5d\x35\xe9\x68\x02\xda\x1a\x43\x0b\x02\x55\x57\x74\xed\x7d\x5a\xbf\x82\x3b' | openssl enc -e -aes-192-ecb -K 056AC27062FF2834CE08589CE3761BBB1ABCF94C60E15F57 -nopad | hd var expected = new byte[] { 0x02, 0x7c, 0x02, 0x3d, 0x80, 0x78, 0xbe, 0x53, 0x10, 0xb9, 0x1b, 0xbf, 0xb4, 0x2c, 0x16, 0xe7, 0x87, 0xe2, 0x91, 0x40, 0x31, 0x26, 0x67, 0xf6, 0xf7, 0x86, 0x73, 0x89, 0x0d, 0x35, 0x22, 0x6c, }; - + var actual = new AesCipher(key, iv: null, AesCipherMode.ECB, pkcs7Padding: false).Encrypt(input); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, iv: null, AesCipherMode.ECB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -345,7 +346,7 @@ public void AES_ECB_192_Length64() 0x10, 0x0c, 0x69, 0x35, 0xc3, 0x1f, 0x8d, 0xe7, 0xc7, 0x6b, 0xa5, 0x2a, 0x6f, 0x46, 0x73, 0xe9, 0x6b, 0xb1, 0x8e, 0xac, 0xef, 0xf1, 0xcc, 0x78, }; - + // echo -n -e '\xda\xa5\x4b\x3b\xb3\x66\x71\xe0\x58\x31\x62\x9d\xc6\x36\xda\x23\x0b\x6b\x3b\xcb\x24\x9f\xa4\x6f\x29\x7e\x8b\xcb\x7f\xff\x21\x56\x34\x90\x72\xba\x95\x23\xa3\xcf\x25\xfa\x30\x5e\xfc\x40\x13\xda\x3d\xd3\x10\x2f\x89\xbc\x44\x3a\x01\xdb\x11\x34\xda\xa5\x60\x58' | openssl enc -e -aes-192-ecb -K 100C6935C31F8DE7C76BA52A6F4673E96BB18EACEFF1CC78 -nopad | hd var expected = new byte[] { @@ -354,13 +355,13 @@ public void AES_ECB_192_Length64() 0xc1, 0xe2, 0xf0, 0xbc, 0x01, 0xad, 0xb1, 0x15, 0xaf, 0x42, 0x6c, 0x08, 0xc8, 0xb3, 0x98, 0xf3, 0xcd, 0x20, 0xab, 0xbc, 0x59, 0xb2, 0xa5, 0x80, 0xf5, 0x8e, 0x53, 0xda, 0xb1, 0x39, 0x8f, 0xbc, }; - + var actual = new AesCipher(key, iv: null, AesCipherMode.ECB, pkcs7Padding: false).Encrypt(input); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, iv: null, AesCipherMode.ECB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -376,19 +377,19 @@ public void AES_ECB_256_Length16() 0x3f, 0xf1, 0xe9, 0x8b, 0x65, 0xd3, 0xd5, 0x58, 0x77, 0x26, 0x91, 0x97, 0xf9, 0x84, 0x12, 0x8e, 0x9b, 0x71, 0x66, 0xc6, 0x8a, 0xaf, 0x61, 0x31, 0x6c, 0xff, 0x52, 0xea, 0xa5, 0xcb, 0x68, 0xe4, }; - + // echo -n -e '\x45\x29\x67\x1d\x16\x1a\xcb\xba\x67\x28\xc9\x28\x17\xb4\x69\x1e' | openssl enc -e -aes-256-ecb -K 3FF1E98B65D3D55877269197F984128E9B7166C68AAF61316CFF52EAA5CB68E4 -nopad | hd var expected = new byte[] { 0x6a, 0xd2, 0x73, 0x2b, 0x05, 0x2e, 0xdd, 0x74, 0x0c, 0x37, 0xf2, 0xcf, 0x8a, 0xef, 0x57, 0x8a, }; - + var actual = new AesCipher(key, iv: null, AesCipherMode.ECB, pkcs7Padding: false).Encrypt(input); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, iv: null, AesCipherMode.ECB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -405,20 +406,20 @@ public void AES_ECB_256_Length32() 0x3e, 0x6e, 0xd3, 0x69, 0x3e, 0xc2, 0x96, 0xca, 0x9a, 0x20, 0x56, 0x3a, 0x6b, 0x50, 0xf0, 0x68, 0x5b, 0xfa, 0x32, 0xdc, 0x0a, 0xf6, 0x10, 0xea, 0xa0, 0x7c, 0xec, 0x58, 0x30, 0x19, 0x86, 0x1f, }; - + // echo -n -e '\x16\x3b\x8d\xa6\x4d\xa3\x94\x8f\x8f\xb8\x1f\x66\x81\xeb\xb3\xab\xbe\xac\x29\xca\xd3\x2b\x9a\x10\xba\xf4\x72\x7b\x09\x70\xa8\x38' | openssl enc -e -aes-256-ecb -K 3E6ED3693EC296CA9A20563A6B50F0685BFA32DC0AF610EAA07CEC583019861F -nopad | hd var expected = new byte[] { 0xb3, 0x37, 0x5d, 0x78, 0xf5, 0x99, 0x69, 0xad, 0x7e, 0xf9, 0x0f, 0xb7, 0x00, 0x8b, 0x99, 0x0f, 0x59, 0x0b, 0x9c, 0x7a, 0xf2, 0xb6, 0x34, 0x0d, 0xc9, 0xdd, 0x15, 0x6e, 0x75, 0xe7, 0xc6, 0x82, }; - + var actual = new AesCipher(key, iv: null, AesCipherMode.ECB, pkcs7Padding: false).Encrypt(input); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, iv: null, AesCipherMode.ECB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -437,7 +438,7 @@ public void AES_ECB_256_Length64() 0xd4, 0x87, 0xea, 0x53, 0xe8, 0x73, 0x87, 0x22, 0x56, 0xe6, 0xcd, 0x47, 0x29, 0x23, 0x91, 0xe3, 0x0f, 0xee, 0xe7, 0x16, 0x43, 0x76, 0x0c, 0xb7, 0x41, 0x2f, 0x6e, 0xeb, 0xf6, 0xd8, 0x3e, 0x35, }; - + // echo -n -e '\x03\x09\x1f\x0e\x3e\xcb\x2e\x47\x5e\xe9\xc8\xc2\xd5\x3e\x9a\x80\x9a\x37\x2a\x85\x28\xdd\x51\x11\x8d\x36\xc6\xab\xc6\x5c\x14\x41\xd7\x82\x55\x26\xf9\x77\xe0\x44\xb7\xe0\xb4\x2d\x80\xaa\x26\xd7\xc4\xaf\x19\x9e\x34\x20\x41\x25\xb8\x0d\x81\x08\x05\x82\x81\x01' | openssl enc -e -aes-256-ecb -K D487EA53E873872256E6CD47292391E30FEEE71643760CB7412F6EEBF6D83E35 -nopad | hd var expected = new byte[] { @@ -446,13 +447,13 @@ public void AES_ECB_256_Length64() 0x06, 0x36, 0x7b, 0x61, 0x48, 0x62, 0x76, 0xfb, 0x58, 0x3e, 0x08, 0x51, 0xf6, 0xf8, 0xfa, 0xd2, 0x63, 0xd2, 0x7d, 0x7a, 0xfc, 0xdb, 0x11, 0x08, 0x70, 0x73, 0x61, 0xe0, 0xfb, 0x93, 0xa6, 0xf9, }; - + var actual = new AesCipher(key, iv: null, AesCipherMode.ECB, pkcs7Padding: false).Encrypt(input); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, iv: null, AesCipherMode.ECB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -471,19 +472,19 @@ public void AES_CBC_128_Length16() { 0x32, 0xda, 0x6f, 0x58, 0xe0, 0x28, 0x99, 0xf5, 0xf5, 0xfa, 0x7e, 0x8c, 0xc1, 0x35, 0x4c, 0x8d, }; - + // echo -n -e '\x7c\x9e\xf8\x16\x9b\x6a\xbe\x5e\x7a\x33\x11\xb9\x04\x9b\x2c\x7d' | openssl enc -e -aes-128-cbc -K A798E775CA98233C0096ED4C2DBE6447 -iv 32DA6F58E02899F5F5FA7E8CC1354C8D -nopad | hd var expected = new byte[] { 0x49, 0x0e, 0xa9, 0x6f, 0x55, 0xb3, 0x57, 0xdf, 0x7c, 0x18, 0x77, 0x0c, 0xca, 0x46, 0x0d, 0x83, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -503,20 +504,20 @@ public void AES_CBC_128_Length32() { 0xca, 0xc2, 0xbd, 0xf7, 0xae, 0x21, 0x62, 0xf5, 0x2e, 0x28, 0xbb, 0x1f, 0x06, 0xfa, 0xca, 0xe4, }; - + // echo -n -e '\xca\xcb\xa6\xb9\x12\x87\xca\xe3\x7a\xbb\x16\x04\x7c\x71\x30\xbc\xce\xc9\x86\x2a\x2b\xd4\x9c\x7e\xfe\xf2\x80\xcf\x19\x96\x7b\xca' | openssl enc -e -aes-128-cbc -K 4A60826217AA35AB108BDD2512957883 -iv CAC2BDF7AE2162F52E28BB1F06FACAE4 -nopad | hd var expected = new byte[] { 0x55, 0xf4, 0x06, 0x4c, 0xdf, 0x4e, 0xf0, 0x12, 0xce, 0x45, 0x53, 0xdd, 0x9e, 0x12, 0x62, 0x61, 0x2d, 0x87, 0x42, 0x20, 0xf1, 0x0b, 0x78, 0x96, 0xd5, 0x7c, 0xeb, 0xa2, 0x7f, 0x4b, 0x5a, 0xff, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -538,7 +539,7 @@ public void AES_CBC_128_Length64() { 0x8e, 0x7d, 0x33, 0x9e, 0x6f, 0x9b, 0x21, 0x4f, 0xee, 0x2a, 0x96, 0x4a, 0x3e, 0x32, 0x63, 0x68, }; - + // echo -n -e '\x3f\x4b\xb9\x1c\xef\xcd\xa4\x23\x94\xdb\x1a\x9f\xf7\x77\x6c\x69\x79\xfc\x05\x57\xd9\x84\x1c\x29\xfe\x8c\x34\xef\xef\x15\xa4\x15\xc1\xf9\xe5\xc6\xdb\x5c\x94\xfc\x1d\x99\x63\xd3\x06\xc2\xfe\xb7\xbb\x51\xa6\x09\xf4\x72\x0a\xbb\x2f\x90\x1e\x62\x99\xb5\x34\x7e' | openssl enc -e -aes-128-cbc -K 3604DEFD91A68D1D680839402148223C -iv 8E7D339E6F9B214FEE2A964A3E326368 -nopad | hd var expected = new byte[] { @@ -547,13 +548,13 @@ public void AES_CBC_128_Length64() 0x64, 0xd5, 0x0e, 0xc2, 0x47, 0xce, 0x2a, 0x40, 0x47, 0x12, 0x05, 0xde, 0x19, 0xbd, 0x23, 0x76, 0x3d, 0x61, 0x9e, 0x0d, 0x54, 0x7f, 0xe1, 0xc4, 0x78, 0xf2, 0x04, 0x00, 0x68, 0xa9, 0x9b, 0x32, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -573,19 +574,19 @@ public void AES_CBC_192_Length16() { 0x57, 0x1e, 0xda, 0xe6, 0xf9, 0x35, 0x16, 0x23, 0x91, 0xaf, 0xdb, 0x5c, 0x5e, 0x47, 0xe7, 0xcf, }; - + // echo -n -e '\x65\xe4\x9c\x01\xe4\x00\x26\x15\xc3\x88\xa1\xeb\x38\xca\x99\xe6' | openssl enc -e -aes-192-cbc -K 6EE2D41C81960F9BE38E0F660F43DF36A5D1DA3CAC20578D -iv 571EDAE6F935162391AFDB5C5E47E7CF -nopad | hd var expected = new byte[] { 0xe1, 0x2f, 0x71, 0xad, 0x59, 0xae, 0xa7, 0xe3, 0xd3, 0x23, 0x43, 0x81, 0x31, 0xc2, 0xe5, 0xd9, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -606,20 +607,20 @@ public void AES_CBC_192_Length32() { 0x5f, 0x6f, 0xdc, 0x06, 0xea, 0xa5, 0x18, 0x27, 0x92, 0xe8, 0x7e, 0xe4, 0xf4, 0x8e, 0x4c, 0x87, }; - + // echo -n -e '\xd5\x00\x1e\x55\xf1\xbf\x05\x80\xa9\x6a\x46\x67\xef\x5c\x3a\x4e\x8a\x46\xc5\x63\xbb\x28\xa1\xae\x78\xeb\xd4\x5f\x67\x82\xd8\x5e' | openssl enc -e -aes-192-cbc -K E90B67AB02029B9718593C8EEEAE3334758DD217828413AC -iv 5F6FDC06EAA5182792E87EE4F48E4C87 -nopad | hd var expected = new byte[] { 0x21, 0x2c, 0x43, 0x64, 0x48, 0x20, 0xe9, 0xfd, 0xe9, 0x15, 0x27, 0x4d, 0x35, 0x8f, 0xf8, 0x42, 0x07, 0xf2, 0x98, 0x41, 0xbb, 0x58, 0x3d, 0xe5, 0xcf, 0x56, 0xf5, 0x4b, 0x33, 0xf7, 0xa0, 0x9a, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -642,7 +643,7 @@ public void AES_CBC_192_Length64() { 0xe9, 0x55, 0xd3, 0x62, 0x90, 0xea, 0x36, 0xf4, 0x77, 0xe6, 0xea, 0xb7, 0xa4, 0x10, 0x7c, 0x85, }; - + // echo -n -e '\xab\x2d\x4a\x61\xeb\x12\xc0\xca\xb7\xa0\xea\xda\xb0\xc0\xdb\x65\xf8\xbb\x4c\x92\x26\x95\xac\x72\x41\x15\xfc\x06\x30\x4f\x3f\xe6\x40\x4a\x6b\x54\x39\xb1\xc0\x4c\xaf\x11\x4e\x4a\xbb\x3e\x76\xd2\x0c\x18\xeb\x39\x42\xb9\x61\x15\x81\xd7\x20\xd6\x16\xba\x9a\x67' | openssl enc -e -aes-192-cbc -K 60049A6655872C46FAFFE3144762B7039F29F9186306A386 -iv E955D36290EA36F477E6EAB7A4107C85 -nopad | hd var expected = new byte[] { @@ -651,13 +652,13 @@ public void AES_CBC_192_Length64() 0x7f, 0x91, 0x8f, 0xed, 0xa9, 0x88, 0x72, 0x0c, 0x9c, 0x55, 0x13, 0x87, 0x34, 0x17, 0x51, 0xd3, 0xda, 0xba, 0xde, 0xb2, 0x7d, 0xbc, 0x71, 0xf8, 0x9b, 0xaa, 0x93, 0x52, 0xf4, 0x26, 0x3c, 0x6f, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -677,19 +678,19 @@ public void AES_CBC_256_Length16() { 0xe2, 0x90, 0x56, 0x90, 0x93, 0x7d, 0xd2, 0x22, 0xef, 0x2d, 0x7a, 0xe7, 0xb0, 0x6e, 0xa7, 0x1f, }; - + // echo -n -e '\xec\xa5\x3e\x43\xd6\x4d\xce\x1f\x1f\x1d\x37\xec\xc0\x82\x03\x5a' | openssl enc -e -aes-256-cbc -K 60137CFFB3C9B510C9EE9C6077005F8EAC732BBEC760B09C87B44273B34934F5 -iv E2905690937DD222EF2D7AE7B06EA71F -nopad | hd var expected = new byte[] { 0xe7, 0xa5, 0x53, 0xd7, 0x28, 0x4c, 0x16, 0x4e, 0xfc, 0xa2, 0xa8, 0x86, 0xfc, 0xcb, 0x71, 0x61, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -710,20 +711,20 @@ public void AES_CBC_256_Length32() { 0xf4, 0x5f, 0xf1, 0x64, 0x8d, 0x52, 0x75, 0xd3, 0x08, 0xe0, 0xea, 0x54, 0xa1, 0x48, 0x29, 0xcd, }; - + // echo -n -e '\xbe\xa8\x3f\x4d\x56\x45\x92\x00\x63\xe0\x78\xfe\x87\x42\x5d\x7f\xba\xa7\x7d\xe7\xaa\xce\xfb\x2f\xa1\x09\xcf\x99\xe5\xc8\xec\x18' | openssl enc -e -aes-256-cbc -K 0D22B40A09E69E9DFD552DB205D39AADD0FA2D08F0BF75F0AC10AB4C76F81A9B -iv F45FF1648D5275D308E0EA54A14829CD -nopad | hd var expected = new byte[] { 0x4f, 0x29, 0xa7, 0xd7, 0xbc, 0x51, 0x95, 0xc5, 0x4c, 0x79, 0x1c, 0xde, 0xad, 0xc8, 0xe0, 0xfd, 0x6a, 0xfb, 0x4a, 0x8b, 0xc8, 0x25, 0x87, 0x5c, 0x9b, 0x47, 0xf5, 0x3f, 0x42, 0xf5, 0xc6, 0x08, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -746,7 +747,7 @@ public void AES_CBC_256_Length64() { 0x2a, 0x2b, 0x52, 0xf9, 0x69, 0x3c, 0x42, 0xe7, 0x0f, 0x0c, 0x7f, 0xde, 0x12, 0xad, 0xb9, 0xab, }; - + // echo -n -e '\x6e\x21\xc9\xeb\x9a\xe3\x28\x4e\xad\xc4\x5e\xf9\x3a\x52\x26\x04\x3b\x91\xbd\xa6\xe2\x36\x1f\x7d\x85\x59\xff\x0f\xd5\x21\x4e\x63\xe7\xde\xdd\x54\x2f\x2f\x00\x11\x36\xa3\xb7\xc8\xf4\x7c\x98\xb6\xb9\xe5\x18\x0f\x8b\x82\xeb\x38\x02\x4b\x65\x40\xe3\x19\x78\x8b' | openssl enc -e -aes-256-cbc -K 76FA125C74D2D50C90AC703E7E578809C14855F0083FD864F2A452E3C9C02D1D -iv 2A2B52F9693C42E70F0C7FDE12ADB9AB -nopad | hd var expected = new byte[] { @@ -755,13 +756,13 @@ public void AES_CBC_256_Length64() 0x54, 0x3e, 0xb6, 0x23, 0x0a, 0x82, 0x7d, 0x3f, 0xbf, 0x88, 0xd1, 0x05, 0x0d, 0x10, 0x10, 0x59, 0x08, 0x19, 0x66, 0x47, 0xe7, 0xd9, 0x1d, 0x1c, 0x42, 0xdc, 0x97, 0x9c, 0xf0, 0x9a, 0x14, 0x34, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -780,19 +781,19 @@ public void AES_CFB_128_Length16() { 0xea, 0xa7, 0x20, 0x6c, 0x40, 0x92, 0x59, 0xa2, 0xa8, 0x1b, 0xd7, 0xbc, 0xd1, 0x72, 0x67, 0x1d, }; - + // echo -n -e '\xc2\x5c\x7f\x9b\xc3\x88\x83\x37\x22\xad\x6a\xcf\x7f\xf1\x42\xd0' | openssl enc -e -aes-128-cfb -K 7F531353048F9F84066EE0FCBFFA5144 -iv EAA7206C409259A2A81BD7BCD172671D -nopad | hd var expected = new byte[] { 0x76, 0xd2, 0x2b, 0x69, 0xa6, 0xdf, 0x3b, 0x4d, 0x4a, 0x52, 0x8a, 0x7a, 0x54, 0x9d, 0xbe, 0x55, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -812,20 +813,20 @@ public void AES_CFB_128_Length32() { 0xa4, 0xaf, 0x60, 0xab, 0x8d, 0x8e, 0x4c, 0xf3, 0x1f, 0x71, 0xc6, 0x27, 0xbb, 0xbe, 0x7c, 0xda, }; - + // echo -n -e '\xc9\xae\x5e\xbf\x99\x66\xa6\x33\xbd\xfa\x94\x55\xa8\x87\x77\x28\x5b\x25\xe4\xd8\xd1\xd6\x8f\xed\xf9\x71\xab\xe8\xb7\xe2\xb3\x94' | openssl enc -e -aes-128-cfb -K 06C232119B92AB8400ECAE46FE04F921 -iv A4AF60AB8D8E4CF31F71C627BBBE7CDA -nopad | hd var expected = new byte[] { 0x62, 0x67, 0x2b, 0xa7, 0x0b, 0xd1, 0xbc, 0x2f, 0x55, 0xaa, 0x71, 0x53, 0x7a, 0x68, 0xe5, 0x46, 0x18, 0xc5, 0xf7, 0x41, 0x78, 0x5f, 0x38, 0x6b, 0x4d, 0x04, 0x00, 0x3b, 0x61, 0x8c, 0xaf, 0xe7, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -847,7 +848,7 @@ public void AES_CFB_128_Length64() { 0x73, 0x1b, 0xa7, 0xfa, 0xd4, 0x97, 0xc8, 0xfb, 0x7b, 0xbf, 0x05, 0xe0, 0xa4, 0xb6, 0xca, 0xbf, }; - + // echo -n -e '\x47\xff\x4e\xe5\x54\x65\x8d\xc9\x7a\x60\xd7\xe4\x27\x49\xef\xf4\x78\x89\x44\x07\x82\x07\x06\x77\x76\x3e\xf1\x29\xcc\x84\xc8\x42\x70\xd3\xff\xfe\xb6\x13\xcc\x3e\x22\x96\x31\x2d\xb6\x67\xcb\xd6\x82\xd1\xaf\x31\x79\x74\x58\x3f\xf9\xd6\x6f\x16\x73\x63\xfc\xf6' | openssl enc -e -aes-128-cfb -K 979573544AF03D64BD05E5EBD5D8C00E -iv 731BA7FAD497C8FB7BBF05E0A4B6CABF -nopad | hd var expected = new byte[] { @@ -856,13 +857,13 @@ public void AES_CFB_128_Length64() 0x44, 0xe6, 0xce, 0x49, 0xe6, 0x8f, 0x35, 0x27, 0x26, 0x21, 0x04, 0xee, 0x52, 0x44, 0x40, 0x80, 0xf7, 0x49, 0xbc, 0xbf, 0xcb, 0x5c, 0xfa, 0x12, 0xcb, 0xcc, 0x38, 0x71, 0x68, 0xd6, 0xe9, 0x64, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -882,19 +883,19 @@ public void AES_CFB_192_Length16() { 0x90, 0x15, 0x66, 0x89, 0x23, 0x54, 0x6c, 0x0f, 0x55, 0xe4, 0xca, 0x43, 0x12, 0x72, 0x02, 0x98, }; - + // echo -n -e '\x9a\x3b\x96\x21\xf3\x77\x8b\x91\x94\x4a\x73\x74\x8f\x6c\x6a\x20' | openssl enc -e -aes-192-cfb -K 1561A357BC022100CC78D98AEB5DC0073A26519A429F1AFB -iv 9015668923546C0F55E4CA4312720298 -nopad | hd var expected = new byte[] { 0x4f, 0x9b, 0xdf, 0x72, 0x2d, 0x10, 0x1b, 0xb9, 0xa1, 0xe1, 0x06, 0xba, 0xbc, 0xc5, 0xfe, 0x13, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -915,20 +916,20 @@ public void AES_CFB_192_Length32() { 0xb9, 0xdc, 0x70, 0xd4, 0xcb, 0x9f, 0xa3, 0x0d, 0x77, 0x72, 0x45, 0x61, 0x50, 0x31, 0x2c, 0xa8, }; - + // echo -n -e '\x1a\x96\x54\x7b\x9e\x01\xa6\x36\x8a\x6c\x3a\x69\x1a\xcf\xdd\x76\x46\xa7\xc7\xa7\x9b\x97\xdc\x78\x0b\xca\x35\x06\x93\x7c\xf4\xc7' | openssl enc -e -aes-192-cfb -K 23B97FAC4A9E5D8E6F2FFFB61903F4850753FC6BAB5BFC83 -iv B9DC70D4CB9FA30D7772456150312CA8 -nopad | hd var expected = new byte[] { 0xc0, 0xdf, 0x63, 0xb5, 0x17, 0x40, 0xd4, 0xa7, 0x73, 0x40, 0xc5, 0x21, 0xa5, 0xea, 0x63, 0xdf, 0x72, 0xcf, 0x57, 0x7f, 0xf9, 0x5d, 0xfe, 0xb1, 0x36, 0x9a, 0x1d, 0x02, 0x0d, 0x4b, 0x8f, 0x35, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -951,7 +952,7 @@ public void AES_CFB_192_Length64() { 0xd9, 0x60, 0xfc, 0xbb, 0xb1, 0x44, 0xab, 0xc6, 0x1e, 0xbb, 0xa0, 0x77, 0x4b, 0x5f, 0x87, 0xac, }; - + // echo -n -e '\x4a\x38\x37\x6b\x98\x26\x5e\x08\xd5\xb0\xff\x3f\x80\x88\x1c\xc8\xbc\xfc\xf3\x6d\x2d\x89\xc3\xcf\x8c\xf1\x3e\xa7\xbe\x93\x34\xd6\x27\x53\x21\x72\x23\x90\xeb\x93\x7d\x68\xfe\x1b\xa0\x63\x8d\xee\x56\x7c\xa4\x54\x3d\xbe\x7a\xc0\x75\x68\xdf\xa6\xe7\xb7\x49\x42' | openssl enc -e -aes-192-cfb -K 7B28182D67AAA52C1160F0C58AA72F28644F5041EEE09868 -iv D960FCBBB144ABC61EBBA0774B5F87AC -nopad | hd var expected = new byte[] { @@ -960,13 +961,13 @@ public void AES_CFB_192_Length64() 0xec, 0x58, 0x90, 0x0d, 0xe0, 0x32, 0xb6, 0xa4, 0xfd, 0x6f, 0xac, 0xdb, 0x40, 0x63, 0xe9, 0x28, 0x69, 0x90, 0x2a, 0xf9, 0xf4, 0xe8, 0xcc, 0xa5, 0x2b, 0xdd, 0x9c, 0xbc, 0x44, 0xcd, 0x1e, 0x5b, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -986,19 +987,19 @@ public void AES_CFB_256_Length16() { 0x67, 0x06, 0xe7, 0x9c, 0x0b, 0x80, 0xfe, 0xed, 0xfd, 0x75, 0x28, 0xa4, 0x0d, 0x67, 0xc6, 0x80, }; - + // echo -n -e '\xd7\x78\x42\xdd\xce\xb5\x36\xcd\x38\xb7\x42\x97\x66\x08\x53\x9a' | openssl enc -e -aes-256-cfb -K 90AF5406ADE97ACCB429A7CE07B7DC04C8A469769EBB9A242A2E82FA01145F16 -iv 6706E79C0B80FEEDFD7528A40D67C680 -nopad | hd var expected = new byte[] { 0xf0, 0xfa, 0x95, 0x5c, 0xfc, 0x3f, 0xbe, 0xe5, 0x4b, 0x55, 0x57, 0xad, 0x93, 0x63, 0x36, 0x07, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -1019,20 +1020,20 @@ public void AES_CFB_256_Length32() { 0x1a, 0x1a, 0x16, 0x65, 0x60, 0x07, 0x5a, 0x2e, 0x19, 0xdc, 0xf7, 0xbe, 0xb9, 0x1d, 0xa4, 0x26, }; - + // echo -n -e '\xda\x3e\xcf\xc2\x9e\xdd\xfc\xd4\x15\x30\xdc\x7f\x67\x80\xcb\xa0\xca\x91\x66\x01\xd0\x40\xf8\x47\xa5\x7b\x78\x28\x93\xf5\x16\xc2' | openssl enc -e -aes-256-cfb -K 680120C3459C778A091286DBA37F867DAA88D97C01C4B09945871C2365D3411F -iv 1A1A166560075A2E19DCF7BEB91DA426 -nopad | hd var expected = new byte[] { 0x94, 0x65, 0xf5, 0x19, 0xe9, 0xc8, 0xc6, 0xd0, 0x0d, 0x81, 0x4e, 0x13, 0xb8, 0x37, 0x2b, 0x92, 0xc2, 0xc1, 0x54, 0x9c, 0xfd, 0xf9, 0x43, 0xd0, 0xdc, 0xa7, 0x20, 0x68, 0x3e, 0xc3, 0x8f, 0x3c, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -1055,7 +1056,7 @@ public void AES_CFB_256_Length64() { 0x9a, 0xb4, 0x33, 0x33, 0xc2, 0x25, 0x9f, 0xfd, 0xe2, 0x52, 0xee, 0x1c, 0xeb, 0xc6, 0xc7, 0x99, }; - + // echo -n -e '\xf5\xfa\x7d\x0a\x1c\x99\xc0\xa4\x51\x86\x7e\xbe\x7f\x54\x24\x35\xd1\x67\xc1\x89\x68\x20\x1d\xa2\x2d\xab\x63\x25\xcc\xf1\xe0\x27\xe3\xf6\x2d\x6a\x56\x36\x03\x81\x59\x72\x13\xd9\x89\x9c\xae\xc5\xb7\xc1\xec\x52\x5c\x1a\xbd\xd4\xdd\xda\xdd\x70\x35\x9b\xd7\x5f' | openssl enc -e -aes-256-cfb -K A656DA8926BADF9A633F2FF60C431990FC9D6D0A048DCBC838588D7B59924BBE -iv 9AB43333C2259FFDE252EE1CEBC6C799 -nopad | hd var expected = new byte[] { @@ -1064,13 +1065,13 @@ public void AES_CFB_256_Length64() 0xa1, 0xd6, 0x8a, 0xc4, 0xbc, 0xe1, 0xca, 0x0a, 0xaa, 0xa8, 0xea, 0x4f, 0x7c, 0xd2, 0xd2, 0xc4, 0xf6, 0xd4, 0x06, 0xef, 0x04, 0xf1, 0xe5, 0x53, 0x54, 0xd5, 0x80, 0xc2, 0x96, 0x6b, 0xc7, 0x07, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -1089,19 +1090,19 @@ public void AES_CTR_128_Length16() { 0x91, 0xf3, 0xba, 0x0b, 0x1e, 0xb2, 0x8f, 0xce, 0x59, 0x1b, 0xa8, 0xaf, 0xd4, 0xd1, 0xd0, 0x7e, }; - + // echo -n -e '\xc1\x4d\x74\x98\x2e\xcc\x5a\x18\x8a\x12\x50\xcd\x2c\x63\x41\xd0' | openssl enc -e -aes-128-ctr -K F4715B580FE5CED7FD7028B29EAEDC71 -iv 91F3BA0B1EB28FCE591BA8AFD4D1D07E -nopad | hd var expected = new byte[] { 0xe4, 0x03, 0x8f, 0x2a, 0xdd, 0x9d, 0xf6, 0x87, 0xf6, 0x29, 0xee, 0x27, 0x4c, 0xf3, 0xba, 0x82, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -1121,20 +1122,20 @@ public void AES_CTR_128_Length32() { 0xa1, 0xcc, 0x79, 0xf6, 0x95, 0x97, 0xd4, 0xdb, 0x6b, 0xe6, 0x99, 0xdd, 0x70, 0x95, 0x9e, 0x60, }; - + // echo -n -e '\x11\x1e\x28\x7a\x6a\x6f\x89\xdb\x7f\x9d\x9a\xbd\xa3\xa8\x79\xdc\x36\xde\x3c\x38\xa9\x35\xb2\x41\xe1\x8d\xff\xf4\x3d\x1e\x02\x2c' | openssl enc -e -aes-128-ctr -K A0AAA180866107216ADE8C8017D12AB1 -iv A1CC79F69597D4DB6BE699DD70959E60 -nopad | hd var expected = new byte[] { 0xa9, 0x27, 0xa5, 0xbd, 0x73, 0x59, 0xe3, 0x69, 0x79, 0x89, 0x62, 0xe8, 0x4c, 0x7d, 0x75, 0xcd, 0x9c, 0xb2, 0x30, 0x94, 0xdc, 0x88, 0xfa, 0x39, 0x05, 0x0c, 0x26, 0x25, 0x28, 0x6a, 0x9b, 0x4e, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -1156,7 +1157,7 @@ public void AES_CTR_128_Length64() { 0x92, 0xdb, 0xe4, 0x3e, 0xaf, 0x8f, 0x92, 0x13, 0x71, 0x56, 0xd1, 0x9f, 0x0f, 0x68, 0xc3, 0xc1, }; - + // echo -n -e '\x9b\x6e\x1d\xf8\x07\xf9\x55\xd4\xd7\x1a\xce\xca\xa8\x31\x29\x0f\x63\x4d\x52\x71\xa5\x0c\x96\x08\xd6\xc5\x14\xa0\xc8\x29\xb1\xd5\x40\x2c\xe5\xa9\xb4\x31\xa9\xa8\x76\xa5\x1e\x7a\xc8\x09\x32\x39\xbc\x89\x7a\x22\x42\x2c\xba\x8e\xd7\x15\x22\x41\xe4\xb5\x0b\xad' | openssl enc -e -aes-128-ctr -K 69F98A7C4B805B31A4AAFAFFED1C3FCC -iv 92DBE43EAF8F92137156D19F0F68C3C1 -nopad | hd var expected = new byte[] { @@ -1165,13 +1166,13 @@ public void AES_CTR_128_Length64() 0x1d, 0x18, 0x55, 0xfc, 0x56, 0x59, 0xaf, 0x0b, 0x2b, 0x80, 0x87, 0x0c, 0x87, 0x45, 0xb0, 0xe2, 0xec, 0x47, 0x81, 0x82, 0x89, 0x24, 0x76, 0xe2, 0x20, 0x6a, 0x99, 0xe2, 0xa7, 0x5a, 0xb0, 0x40, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -1191,19 +1192,19 @@ public void AES_CTR_192_Length16() { 0xec, 0xa8, 0x10, 0x66, 0x10, 0xfb, 0xe1, 0xb6, 0xb5, 0x15, 0xca, 0xb9, 0xb9, 0xba, 0xf0, 0xcd, }; - + // echo -n -e '\x9a\x70\x11\xcf\x7f\xb6\xee\x3b\x2e\x48\x7e\x97\x32\xbb\xa1\xbb' | openssl enc -e -aes-192-ctr -K D556AF09D0CCFEDA66760AF5AFBC223BE639657D0A704CDC -iv ECA8106610FBE1B6B515CAB9B9BAF0CD -nopad | hd var expected = new byte[] { 0xc4, 0x4e, 0x81, 0x32, 0xe6, 0x6d, 0x0a, 0x78, 0x49, 0xe5, 0x64, 0x6c, 0xe6, 0xc2, 0x91, 0xc9, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -1224,20 +1225,20 @@ public void AES_CTR_192_Length32() { 0x6d, 0xfd, 0x74, 0x57, 0xb9, 0xf2, 0x80, 0xbd, 0xbf, 0x85, 0xb0, 0xbd, 0x19, 0xdd, 0x5d, 0xc6, }; - + // echo -n -e '\x72\x37\x68\x09\xab\xf9\x8c\x72\x26\x42\xb1\xf9\x55\x24\xb1\x64\x09\xd2\x1c\x28\xbb\x97\xc9\x6b\x94\x54\x3f\x9a\xf2\x69\x82\x2b' | openssl enc -e -aes-192-ctr -K 48970AD3074330F31C9D40CE49E860916465AFE69EC812DB -iv 6DFD7457B9F280BDBF85B0BD19DD5DC6 -nopad | hd var expected = new byte[] { 0xfa, 0x30, 0x3f, 0x12, 0x3c, 0x7a, 0xa8, 0x1e, 0xfd, 0xaa, 0x17, 0x71, 0xbd, 0x01, 0xeb, 0xac, 0x85, 0xcd, 0x88, 0xa8, 0x25, 0xc8, 0xbd, 0xf8, 0xc3, 0xa9, 0x74, 0x36, 0x82, 0x19, 0xfc, 0xb3, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -1260,7 +1261,7 @@ public void AES_CTR_192_Length64() { 0xf1, 0x7a, 0x87, 0xdb, 0xf3, 0xb0, 0x86, 0x7e, 0x52, 0x13, 0xd4, 0x0c, 0x6f, 0x34, 0xca, 0xe0, }; - + // echo -n -e '\xa2\x28\x0b\x1e\x56\xfb\x21\xac\xf3\xae\x35\x8c\xb9\x9c\x8d\x80\x85\x2f\x66\x09\xce\xd8\x3a\x2a\x1d\x82\x0e\xc4\x37\xa3\x77\x86\x07\xe9\x43\x75\xbc\xf3\x84\x72\xdb\xc8\x63\x0b\xbc\xf3\x03\x23\xf7\x30\x38\xea\x77\x53\xf7\xc9\xee\xe0\x00\xd4\xec\x5d\x75\x50' | openssl enc -e -aes-192-ctr -K 36AF84CF5817C391AAF32D06742E6E297EEBCC066B8D0FB4 -iv F17A87DBF3B0867E5213D40C6F34CAE0 -nopad | hd var expected = new byte[] { @@ -1269,13 +1270,13 @@ public void AES_CTR_192_Length64() 0xba, 0x65, 0x2d, 0xe3, 0x7b, 0x60, 0x9c, 0x64, 0x4e, 0xcc, 0x32, 0xb5, 0x38, 0xa4, 0xed, 0x69, 0x2d, 0x26, 0x4a, 0x22, 0x97, 0x7a, 0x94, 0x5e, 0xb0, 0xb2, 0x3d, 0x42, 0x2b, 0x4a, 0x5e, 0x5d, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -1295,19 +1296,19 @@ public void AES_CTR_256_Length16() { 0x2e, 0x2b, 0x6d, 0x9e, 0x56, 0xeb, 0x50, 0x85, 0x07, 0x45, 0x16, 0x76, 0x3d, 0xf3, 0x64, 0x11, }; - + // echo -n -e '\x6d\xa6\x3f\x83\x25\xf1\x54\xbf\x72\xd7\x55\x00\x90\x6f\xe5\xa9' | openssl enc -e -aes-256-ctr -K 9FD0DEDE8FE79EFA6DAFB3615A61BA4A21EC98C44D8B8E0025C8691B5B85EEE3 -iv 2E2B6D9E56EB5085074516763DF36411 -nopad | hd var expected = new byte[] { 0xa6, 0x46, 0x19, 0x9d, 0x3e, 0xa5, 0x53, 0xc8, 0xd9, 0xb3, 0x46, 0xbc, 0x0b, 0x3e, 0x47, 0xf4, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -1328,20 +1329,20 @@ public void AES_CTR_256_Length32() { 0x1a, 0x87, 0x62, 0x25, 0x84, 0x4e, 0x41, 0x76, 0xc3, 0x24, 0x5f, 0x9b, 0xbe, 0x7c, 0x02, 0x11, }; - + // echo -n -e '\x1d\x0a\xdf\xa4\xd6\x20\x5c\x14\x41\xdd\xb9\xc6\x7e\x83\x9f\xe7\xc0\xd0\x32\x2f\xf4\x1b\xf4\x35\x9b\x13\xbd\x08\x74\x18\xc2\x32' | openssl enc -e -aes-256-ctr -K 6458FE51A5490C0DCF585D78328A0784A52FB56DC0351C0115AA09C36353A028 -iv 1A876225844E4176C3245F9BBE7C0211 -nopad | hd var expected = new byte[] { 0x72, 0xb6, 0xb0, 0x78, 0xae, 0x36, 0xaa, 0x9e, 0x6b, 0xb7, 0x63, 0x7a, 0x77, 0x68, 0x8b, 0x42, 0x1d, 0x7e, 0xe7, 0xe7, 0xa0, 0xae, 0x31, 0x9b, 0xb3, 0x21, 0xb8, 0x0c, 0x47, 0x3e, 0xaf, 0xdd, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -1364,7 +1365,7 @@ public void AES_CTR_256_Length64() { 0xdb, 0x2f, 0xcf, 0x6f, 0xf2, 0xed, 0xe7, 0xfb, 0x59, 0x86, 0x1b, 0x85, 0xc1, 0xf5, 0x32, 0xc2, }; - + // echo -n -e '\x0b\x38\x62\x45\x62\x55\x71\x2e\x3b\xfc\x3b\xfb\x40\x49\xaa\x7b\xb8\x34\x5d\xab\x27\xe1\xff\x57\xed\x3e\xa9\x9b\xd5\x80\x43\x98\xa7\xf7\xb7\x2a\xf0\x5a\xc6\xc4\x15\x34\xea\x88\x12\x46\x36\x79\x7a\xe4\xe3\x89\x1e\x57\xe9\x29\x39\x0b\x58\x23\xac\xd6\x58\xba' | openssl enc -e -aes-256-ctr -K B9A25348927F8B5D6E9896F3F77744A6082F20F19DB97A500E8EF1E502A2183E -iv DB2FCF6FF2EDE7FB59861B85C1F532C2 -nopad | hd var expected = new byte[] { @@ -1373,13 +1374,13 @@ public void AES_CTR_256_Length64() 0x15, 0xcc, 0x98, 0xc9, 0xe4, 0x6f, 0x29, 0x13, 0xf9, 0x61, 0x33, 0x77, 0x6b, 0x43, 0x44, 0xde, 0x92, 0xb0, 0x7b, 0x7a, 0x77, 0x65, 0xf0, 0xcc, 0xbd, 0xe4, 0x41, 0xea, 0x9e, 0xfd, 0xdf, 0x41, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -1398,19 +1399,19 @@ public void AES_OFB_128_Length16() { 0x5c, 0x2f, 0x1d, 0x50, 0x86, 0x9c, 0x89, 0x74, 0x11, 0xd0, 0x46, 0xef, 0xb2, 0xe3, 0x6d, 0xb3, }; - + // echo -n -e '\xc7\xb1\x1b\x7c\xb5\x66\x1d\xff\x28\x03\x3a\x03\x8d\xa6\x5b\xcc' | openssl enc -e -aes-128-ofb -K 805718C8A7D4B31B482598169EF48E19 -iv 5C2F1D50869C897411D046EFB2E36DB3 -nopad | hd var expected = new byte[] { 0xb0, 0x65, 0x77, 0x03, 0xb4, 0x54, 0x82, 0x92, 0x05, 0x82, 0x93, 0x1f, 0x8d, 0x7b, 0xb6, 0xf0, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -1430,20 +1431,20 @@ public void AES_OFB_128_Length32() { 0x6f, 0x12, 0x7a, 0x91, 0x3b, 0x0f, 0x2b, 0x20, 0x0a, 0x21, 0x9c, 0x39, 0xb2, 0x43, 0x64, 0x39, }; - + // echo -n -e '\x2a\x4f\x05\x69\xdd\x69\x1a\xf2\xfe\xff\x34\x8f\xcd\x06\x60\x34\x74\x21\xa7\x5d\x88\x0a\x45\xe4\xcd\xa3\xb7\xd7\x8e\xc4\x68\x64' | openssl enc -e -aes-128-ofb -K B8E5EC4EEE243BF2152B528667F9A70A -iv 6F127A913B0F2B200A219C39B2436439 -nopad | hd var expected = new byte[] { 0x11, 0x2d, 0xdf, 0xcf, 0x49, 0xc9, 0xd8, 0x0a, 0x7d, 0xd3, 0x2f, 0xf5, 0xc5, 0xec, 0x7e, 0xc9, 0x11, 0xb9, 0xd6, 0x67, 0x6c, 0xe7, 0xaa, 0x09, 0x93, 0xe3, 0x5f, 0xed, 0x38, 0x46, 0x37, 0xd2, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -1465,7 +1466,7 @@ public void AES_OFB_128_Length64() { 0x61, 0xf8, 0x28, 0xc1, 0xc4, 0x39, 0xf7, 0xdf, 0x28, 0x2f, 0xef, 0xf2, 0x91, 0x9f, 0x90, 0x54, }; - + // echo -n -e '\x97\xd0\xd7\xe8\x1a\x11\x45\x4f\xe5\xb5\x48\x5c\xb7\xbe\x7c\xd4\xfc\xac\x68\x7b\x49\xd7\x28\xa8\xba\xcb\x44\xcd\x88\x01\x3f\xd2\xc7\x19\xef\x97\x21\xbe\xef\x5d\xcc\x2b\xac\x86\xc7\xce\x69\x4b\xa4\xc7\x3d\x05\xda\xe8\xf0\xc0\xa7\x2f\x2d\x4f\xcd\x77\xc6\xe3' | openssl enc -e -aes-128-ofb -K 7576949ECEE5B23DBD0AAE1E2BA2E1EB -iv 61F828C1C439F7DF282FEFF2919F9054 -nopad | hd var expected = new byte[] { @@ -1474,13 +1475,13 @@ public void AES_OFB_128_Length64() 0x5e, 0xb0, 0xdb, 0x23, 0xc7, 0x33, 0x2b, 0x06, 0x0d, 0x01, 0x1e, 0x9b, 0xb8, 0xf1, 0xde, 0x27, 0xda, 0xad, 0x1b, 0xa5, 0x20, 0x67, 0xd2, 0xa6, 0x18, 0x26, 0x30, 0x43, 0x2f, 0xa2, 0x66, 0x0b, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -1500,19 +1501,19 @@ public void AES_OFB_192_Length16() { 0x7b, 0x69, 0xac, 0xc3, 0xf1, 0x26, 0xa5, 0x56, 0x9a, 0xe9, 0xa4, 0x4f, 0xb1, 0xbc, 0x05, 0x5e, }; - + // echo -n -e '\x64\xc8\x10\x50\x3a\xcb\x7d\xbf\x14\x00\x48\xd0\x39\xd2\x94\x05' | openssl enc -e -aes-192-ofb -K 4D41EDD44F051F3C7EB5759EF5C0AB1D7959BA629190B196 -iv 7B69ACC3F126A5569AE9A44FB1BC055E -nopad | hd var expected = new byte[] { 0x79, 0x41, 0x28, 0xc9, 0x3b, 0x89, 0x6f, 0x69, 0x92, 0xb0, 0x3e, 0x38, 0x11, 0x2c, 0xe5, 0xd8, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -1533,20 +1534,20 @@ public void AES_OFB_192_Length32() { 0x89, 0x79, 0x75, 0x36, 0xda, 0xbd, 0x39, 0xf8, 0xbe, 0x98, 0x8c, 0xbc, 0x79, 0xb6, 0xff, 0x64, }; - + // echo -n -e '\xa9\xd4\xd2\x85\x55\xde\xc9\x54\x54\x2a\x56\xe0\x17\x32\x74\xbd\x90\x57\x58\xe5\x59\x5b\x4a\x58\x0f\x1f\x04\x0b\x1b\x5c\x6b\xbd' | openssl enc -e -aes-192-ofb -K 545BB9BDBE2C419C9F576EC6D0C53E6875E6BF5A631F054D -iv 89797536DABD39F8BE988CBC79B6FF64 -nopad | hd var expected = new byte[] { 0x23, 0x79, 0x22, 0x9c, 0xa4, 0xfe, 0xc4, 0xf4, 0xd9, 0xc7, 0x4f, 0x63, 0x01, 0x54, 0xca, 0xe6, 0xe8, 0xe8, 0x8e, 0x1a, 0xa6, 0x25, 0xa5, 0x65, 0x0d, 0x5a, 0xe2, 0x9c, 0xd2, 0x7e, 0x06, 0x14, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -1569,7 +1570,7 @@ public void AES_OFB_192_Length64() { 0xae, 0x39, 0xad, 0x74, 0x21, 0xea, 0x87, 0xa1, 0x18, 0xf6, 0x91, 0x50, 0xb7, 0x18, 0xe1, 0x8a, }; - + // echo -n -e '\x15\xbc\x46\x01\xed\x84\x87\x4a\xe0\x9c\x96\x34\x9d\x11\x5a\x34\x56\x6b\x33\x44\xb7\x0b\xc2\xe1\x1e\x76\x07\x37\x39\x82\xee\xbe\xe7\x5b\x44\xa7\xd9\x03\x60\x04\xf1\x2a\x55\x3e\x27\x04\x5a\xad\x3e\x57\x65\x0d\x83\xbb\xac\x0a\xf9\x64\xe2\x76\x7d\x50\x11\x5e' | openssl enc -e -aes-192-ofb -K ADD74D42CCB35A520B2E528CB584B91A1C59F9E11CE03B2C -iv AE39AD7421EA87A118F69150B718E18A -nopad | hd var expected = new byte[] { @@ -1578,13 +1579,13 @@ public void AES_OFB_192_Length64() 0xdf, 0x14, 0x8b, 0xe4, 0xa9, 0x74, 0x3b, 0xc2, 0x50, 0xc3, 0x23, 0xfe, 0xc6, 0x27, 0x0d, 0x74, 0xc7, 0xd0, 0x21, 0x0a, 0x40, 0x1d, 0x32, 0x32, 0x88, 0x86, 0x40, 0xa9, 0x4c, 0x59, 0x9c, 0xb4, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -1604,19 +1605,19 @@ public void AES_OFB_256_Length16() { 0xb4, 0xc4, 0xb4, 0x96, 0x84, 0x4e, 0x84, 0x16, 0xe1, 0xe1, 0xad, 0xb7, 0xac, 0x95, 0x82, 0x41, }; - + // echo -n -e '\xfd\x13\x02\x54\x68\x20\x55\x75\xab\xc8\x5a\x23\x57\x30\x42\xcc' | openssl enc -e -aes-256-ofb -K 9C20949206E63121A6B173BFF2696303786EE408DEE6C38DE437C9588F644AE8 -iv B4C4B496844E8416E1E1ADB7AC958241 -nopad | hd var expected = new byte[] { 0x98, 0x85, 0x21, 0xeb, 0x42, 0x0c, 0x8b, 0xb3, 0xab, 0x64, 0x78, 0xe5, 0x67, 0xdd, 0xee, 0x36, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -1637,20 +1638,20 @@ public void AES_OFB_256_Length32() { 0x24, 0x5f, 0x19, 0x95, 0xe5, 0x58, 0x89, 0x06, 0xef, 0x90, 0x57, 0xb6, 0x94, 0x02, 0x89, 0x32, }; - + // echo -n -e '\x65\x56\xab\xe9\x4c\x39\xed\xb5\x5c\x06\xae\xce\x1d\xd8\x91\x42\x67\x8b\x0b\x2e\xb5\xcd\x7f\x29\xe9\xcd\x26\xfd\x39\x0c\xe1\x4e' | openssl enc -e -aes-256-ofb -K B487F339B9609C7AD6FE397DA0B6F9094F6B50208A548C97D681FF7E12F07B50 -iv 245F1995E5588906EF9057B694028932 -nopad | hd var expected = new byte[] { 0x46, 0xe6, 0x18, 0x3c, 0x18, 0xf9, 0x6d, 0x4f, 0xc2, 0x75, 0x89, 0xea, 0x0d, 0xc9, 0x9a, 0x4c, 0x39, 0x54, 0x2e, 0x9f, 0x81, 0x49, 0xd3, 0x6b, 0x58, 0x20, 0x03, 0x21, 0x8d, 0x41, 0x9a, 0x42, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } @@ -1673,7 +1674,7 @@ public void AES_OFB_256_Length64() { 0x55, 0x74, 0x31, 0x68, 0x12, 0x10, 0x5d, 0xb4, 0xcd, 0x5e, 0x56, 0xb5, 0xa1, 0xb1, 0xa6, 0x5f, }; - + // echo -n -e '\xd4\x1d\xad\xce\xbc\xc0\xc4\x60\xfb\x5b\x62\x37\x61\x1d\x68\xe6\x82\xe8\x58\x41\x9d\x63\x23\xf7\xe1\x49\x31\xfa\xfd\xd5\x03\xd4\xf8\xcd\xaa\xf4\x43\xad\x93\x64\x9b\xb8\x9a\x89\xf6\x51\xa5\xd1\x28\x71\x34\xab\xa9\x47\x95\x70\xf9\xb5\xec\x72\x8f\xc9\x63\x26' | openssl enc -e -aes-256-ofb -K 578D3F947373A3D554F4A6E4C99A018FA460D18BA1582BB03739FA8DC121D5D1 -iv 5574316812105DB4CD5E56B5A1B1A65F -nopad | hd var expected = new byte[] { @@ -1682,13 +1683,13 @@ public void AES_OFB_256_Length64() 0x5e, 0xa5, 0x16, 0x3f, 0x9b, 0x18, 0x86, 0x4e, 0x94, 0xe2, 0x60, 0x70, 0x1f, 0x39, 0xa9, 0x4d, 0x7a, 0x3a, 0x43, 0xa6, 0x8f, 0x48, 0xfe, 0x6e, 0x64, 0xf6, 0x01, 0x0d, 0xdf, 0x9d, 0x34, 0xee, }; - - var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); - + + var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); + CollectionAssert.AreEqual(expected, actual); - - var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); - + + var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); + CollectionAssert.AreEqual(input, decrypted); } diff --git a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Arc4CipherTest.cs b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Arc4CipherTest.cs index 144524ed7..7a95f7073 100644 --- a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Arc4CipherTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Arc4CipherTest.cs @@ -1,5 +1,7 @@ using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Security.Cryptography.Ciphers; using Renci.SshNet.Tests.Common; diff --git a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/BlowfishCipherTest.cs b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/BlowfishCipherTest.cs index bb31dbc98..828d1c5c4 100644 --- a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/BlowfishCipherTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/BlowfishCipherTest.cs @@ -1,10 +1,11 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Linq; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Security.Cryptography.Ciphers; using Renci.SshNet.Security.Cryptography.Ciphers.Modes; using Renci.SshNet.Tests.Common; -using System.Linq; - namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { /// diff --git a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/CastCipherTest.cs b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/CastCipherTest.cs index 74aaec9be..a01dde959 100644 --- a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/CastCipherTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/CastCipherTest.cs @@ -1,10 +1,11 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Linq; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Security.Cryptography.Ciphers; using Renci.SshNet.Security.Cryptography.Ciphers.Modes; using Renci.SshNet.Tests.Common; -using System.Linq; - namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { /// diff --git a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/DesCipherTest.cs b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/DesCipherTest.cs index 1c7bd3a27..73ba7c974 100644 --- a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/DesCipherTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/DesCipherTest.cs @@ -1,5 +1,7 @@ using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Security.Cryptography.Ciphers; using Renci.SshNet.Security.Cryptography.Ciphers.Modes; @@ -25,8 +27,8 @@ public void Cbc_Encrypt() }; var input = Encoding.ASCII.GetBytes("www.javaCODEgeeks.com!!!"); - var key = new byte[] {0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef}; - var iv = new byte[] {0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00}; + var key = new byte[] { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef }; + var iv = new byte[] { 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 }; var des = new DesCipher(key, new CbcCipherMode(iv), new PKCS7Padding()); var actualCypher = des.Encrypt(input); @@ -53,5 +55,5 @@ public void Cbc_Decrypt() Assert.IsTrue(expectedPlain.IsEqualTo(plain)); } - } -} \ No newline at end of file + } +} diff --git a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Paddings/PKCS5PaddingTest.cs b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Paddings/PKCS5PaddingTest.cs index dd7c20221..80a0d9c69 100644 --- a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Paddings/PKCS5PaddingTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Paddings/PKCS5PaddingTest.cs @@ -1,4 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Security.Cryptography.Ciphers.Paddings; @@ -18,8 +19,8 @@ public void SetUp() [TestMethod] public void Pad_BlockSizeAndInput_LessThanBlockSize() { - var input = new byte[] {0x01, 0x02, 0x03, 0x04, 0x05}; - var expected = new byte[] {0x01, 0x02, 0x03, 0x04, 0x05, 0x03, 0x03, 0x03}; + var input = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05 }; + var expected = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05, 0x03, 0x03, 0x03 }; var actual = _padding.Pad(8, input); diff --git a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Paddings/PKCS7PaddingTest.cs b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Paddings/PKCS7PaddingTest.cs index 80e5d47f1..801cf5e3a 100644 --- a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Paddings/PKCS7PaddingTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Paddings/PKCS7PaddingTest.cs @@ -1,4 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Security.Cryptography.Ciphers.Paddings; diff --git a/test/Renci.SshNet.Tests/Classes/Security/KeyAlgorithmTest.cs b/test/Renci.SshNet.Tests/Classes/Security/KeyAlgorithmTest.cs index d41199817..7ab1e07ce 100644 --- a/test/Renci.SshNet.Tests/Classes/Security/KeyAlgorithmTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Security/KeyAlgorithmTest.cs @@ -1,4 +1,4 @@ -using System.Security.Cryptography; +using System.Security.Cryptography; using System.Text; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/test/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanGroup14Sha1Test.cs b/test/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanGroup14Sha1Test.cs index 4f0ef37ab..d541f8196 100644 --- a/test/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanGroup14Sha1Test.cs +++ b/test/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanGroup14Sha1Test.cs @@ -1,4 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Security; using Renci.SshNet.Tests.Common; @@ -57,4 +58,4 @@ public void NameShouldBeDiffieHellmanGroup14Sha1() Assert.AreEqual("diffie-hellman-group14-sha1", _group14.Name); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanGroup16Sha512Test.cs b/test/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanGroup16Sha512Test.cs index 45d6f2956..73fd55cea 100644 --- a/test/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanGroup16Sha512Test.cs +++ b/test/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanGroup16Sha512Test.cs @@ -1,4 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Security; using Renci.SshNet.Tests.Common; @@ -67,4 +68,4 @@ public void NameShouldBeDiffieHellmanGroup16Sha512() Assert.AreEqual("diffie-hellman-group16-sha512", _group16.Name); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanGroup1Sha1Test.cs b/test/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanGroup1Sha1Test.cs index 9cbaaba2b..c5dcbd2c8 100644 --- a/test/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanGroup1Sha1Test.cs +++ b/test/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanGroup1Sha1Test.cs @@ -1,4 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Security; using Renci.SshNet.Tests.Common; @@ -48,4 +49,4 @@ public void NameShouldBeDiffieHellmanGroup1Sha1() Assert.AreEqual("diffie-hellman-group1-sha1", _group1.Name); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateConnector.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateConnector.cs index 22d2d4c00..4a35fcd72 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateConnector.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateConnector.cs @@ -1,7 +1,10 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Connection; -using System; namespace Renci.SshNet.Tests.Classes { diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_EndLStatThrowsSshException.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_EndLStatThrowsSshException.cs index 6184a05d1..c98f6a0f2 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_EndLStatThrowsSshException.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_EndLStatThrowsSshException.cs @@ -1,6 +1,9 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Abstractions; using Renci.SshNet.Common; using Renci.SshNet.Sftp; @@ -25,7 +28,7 @@ private void SetupData() { var random = new Random(); - _bufferSize = (uint)random.Next(1, int.MaxValue); + _bufferSize = (uint) random.Next(1, int.MaxValue); _openAsyncResult = new SftpOpenAsyncResult(null, null); _handle = CryptoAbstraction.GenerateRandom(random.Next(1, 10)); _statAsyncResult = new SFtpStatAsyncResult(null, null); diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsAlmostSixTimesGreaterThanChunkSize.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsAlmostSixTimesGreaterThanChunkSize.cs index c89bfb0f2..445ef84b9 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsAlmostSixTimesGreaterThanChunkSize.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsAlmostSixTimesGreaterThanChunkSize.cs @@ -1,6 +1,9 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Abstractions; using Renci.SshNet.Sftp; using Renci.SshNet.Tests.Common; @@ -95,4 +98,4 @@ public void CreateSftpFileReaderShouldReturnCreatedInstance() Assert.AreSame(_sftpFileReaderMock.Object, _actual); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsEqualToChunkSize.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsEqualToChunkSize.cs index dcab293cc..ddd318f12 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsEqualToChunkSize.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsEqualToChunkSize.cs @@ -1,6 +1,9 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Abstractions; using Renci.SshNet.Sftp; using Renci.SshNet.Tests.Common; @@ -27,12 +30,12 @@ private void SetupData() { var random = new Random(); - _bufferSize = (uint)random.Next(1, int.MaxValue); + _bufferSize = (uint) random.Next(1, int.MaxValue); _openAsyncResult = new SftpOpenAsyncResult(null, null); _handle = CryptoAbstraction.GenerateRandom(random.Next(1, 10)); _statAsyncResult = new SFtpStatAsyncResult(null, null); _fileName = random.Next().ToString(); - _chunkSize = (uint)random.Next(1000, int.MaxValue); + _chunkSize = (uint) random.Next(1000, int.MaxValue); _fileSize = _chunkSize; _fileAttributes = new SftpFileAttributesBuilder().WithSize(_fileSize).Build(); } @@ -95,4 +98,4 @@ public void CreateSftpFileReaderShouldReturnCreatedInstance() Assert.AreSame(_sftpFileReaderMock.Object, _actual); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsExactlyFiveTimesGreaterThanChunkSize.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsExactlyFiveTimesGreaterThanChunkSize.cs index affac00ab..3310205bc 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsExactlyFiveTimesGreaterThanChunkSize.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsExactlyFiveTimesGreaterThanChunkSize.cs @@ -1,6 +1,9 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Abstractions; using Renci.SshNet.Sftp; using Renci.SshNet.Tests.Common; @@ -95,4 +98,4 @@ public void CreateSftpFileReaderShouldReturnCreatedInstance() Assert.AreSame(_sftpFileReaderMock.Object, _actual); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsLessThanChunkSize.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsLessThanChunkSize.cs index 2c822a9c8..94f04901e 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsLessThanChunkSize.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsLessThanChunkSize.cs @@ -1,6 +1,9 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Abstractions; using Renci.SshNet.Sftp; using Renci.SshNet.Tests.Common; @@ -27,12 +30,12 @@ private void SetupData() { var random = new Random(); - _bufferSize = (uint)random.Next(1, int.MaxValue); + _bufferSize = (uint) random.Next(1, int.MaxValue); _openAsyncResult = new SftpOpenAsyncResult(null, null); _handle = CryptoAbstraction.GenerateRandom(random.Next(1, 10)); _statAsyncResult = new SFtpStatAsyncResult(null, null); _fileName = random.Next().ToString(); - _chunkSize = (uint)random.Next(1000, int.MaxValue); + _chunkSize = (uint) random.Next(1000, int.MaxValue); _fileSize = _chunkSize - random.Next(1, 10); _fileAttributes = new SftpFileAttributesBuilder().WithSize(_fileSize).Build(); } @@ -95,4 +98,4 @@ public void CreateSftpFileReaderShouldReturnCreatedInstance() Assert.AreSame(_sftpFileReaderMock.Object, _actual); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsLittleMoreThanFiveTimesGreaterThanChunkSize.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsLittleMoreThanFiveTimesGreaterThanChunkSize.cs index e1229298c..7d9e14926 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsLittleMoreThanFiveTimesGreaterThanChunkSize.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsLittleMoreThanFiveTimesGreaterThanChunkSize.cs @@ -1,6 +1,9 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Abstractions; using Renci.SshNet.Sftp; using Renci.SshNet.Tests.Common; @@ -27,12 +30,12 @@ private void SetupData() { var random = new Random(); - _bufferSize = (uint)random.Next(1, int.MaxValue); + _bufferSize = (uint) random.Next(1, int.MaxValue); _openAsyncResult = new SftpOpenAsyncResult(null, null); _handle = CryptoAbstraction.GenerateRandom(random.Next(1, 10)); _statAsyncResult = new SFtpStatAsyncResult(null, null); _fileName = random.Next().ToString(); - _chunkSize = (uint)random.Next(1000, 5000); + _chunkSize = (uint) random.Next(1000, 5000); _fileSize = (_chunkSize * 5) + 10; _fileAttributes = new SftpFileAttributesBuilder().WithSize(_fileSize).Build(); } @@ -95,4 +98,4 @@ public void CreateSftpFileReaderShouldReturnCreatedInstance() Assert.AreSame(_sftpFileReaderMock.Object, _actual); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanMaxPendingReadsTimesChunkSize.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanMaxPendingReadsTimesChunkSize.cs index 8fe220c80..1d034a4a5 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanMaxPendingReadsTimesChunkSize.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanMaxPendingReadsTimesChunkSize.cs @@ -1,6 +1,9 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Abstractions; using Renci.SshNet.Sftp; using Renci.SshNet.Tests.Common; @@ -29,7 +32,7 @@ private void SetupData() var random = new Random(); _maxPendingReads = 100; - _bufferSize = (uint)random.Next(1, int.MaxValue); + _bufferSize = (uint) random.Next(1, int.MaxValue); _openAsyncResult = new SftpOpenAsyncResult(null, null); _handle = CryptoAbstraction.GenerateRandom(random.Next(1, 10)); _statAsyncResult = new SFtpStatAsyncResult(null, null); @@ -97,4 +100,4 @@ public void CreateSftpFileReaderShouldReturnCreatedInstance() Assert.AreSame(_sftpFileReaderMock.Object, _actual); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsZero.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsZero.cs index c34b9cccf..eba0e9d36 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsZero.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsZero.cs @@ -1,6 +1,9 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Abstractions; using Renci.SshNet.Sftp; using Renci.SshNet.Tests.Common; @@ -95,4 +98,4 @@ public void CreateSftpFileReaderShouldReturnCreatedInstance() Assert.AreSame(_sftpFileReaderMock.Object, _actual); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs index e39991b57..041359311 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_ChannelOpenThrowsException.cs @@ -1,7 +1,10 @@ using System.Collections.Generic; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestReturnsFalse.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestReturnsFalse.cs index c3147d56e..c9a978295 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestReturnsFalse.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestReturnsFalse.cs @@ -1,7 +1,10 @@ using System.Collections.Generic; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestThrowsException.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestThrowsException.cs index c94b80291..fb3a8f3cb 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestThrowsException.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendPseudoTerminalRequestThrowsException.cs @@ -1,7 +1,10 @@ using System.Collections.Generic; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestReturnsFalse.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestReturnsFalse.cs index 97d44a93b..269eb28bc 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestReturnsFalse.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestReturnsFalse.cs @@ -1,7 +1,10 @@ using System.Collections.Generic; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestThrowsException.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestThrowsException.cs index b2ea49d38..8f9595412 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestThrowsException.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_SendShellRequestThrowsException.cs @@ -1,7 +1,10 @@ using System.Collections.Generic; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs index 7cf0c62c5..de06ca46c 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateShellStream_Success.cs @@ -1,7 +1,10 @@ using System.Collections.Generic; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest.cs b/test/Renci.SshNet.Tests/Classes/SessionTest.cs index bfb9a4288..05c7f3428 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest.cs @@ -85,9 +85,9 @@ public void ConstructorShouldThrowArgumentNullExceptionWhenSocketFactoryIsNull() private static ConnectionInfo CreateConnectionInfo(IPEndPoint serverEndPoint, TimeSpan timeout) { return new ConnectionInfo(serverEndPoint.Address.ToString(), serverEndPoint.Port, "eric", new NoneAuthenticationMethod("eric")) - { - Timeout = timeout - }; + { + Timeout = timeout + }; } } } diff --git a/test/Renci.SshNet.Tests/Classes/SessionTestBase.cs b/test/Renci.SshNet.Tests/Classes/SessionTestBase.cs index 8b3cce37f..e51c95cfd 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTestBase.cs @@ -1,4 +1,5 @@ using Moq; + using Renci.SshNet.Connection; using Renci.SshNet.Tests.Common; diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectToServerFails.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectToServerFails.cs index 1950f2759..373b7644b 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectToServerFails.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectToServerFails.cs @@ -33,8 +33,8 @@ protected override void SetupMocks() _ = ServiceFactoryMock.Setup(p => p.CreateConnector(_connectionInfo, SocketFactoryMock.Object)) .Returns(ConnectorMock.Object); - _ = ConnectorMock.Setup(p => p.Connect(_connectionInfo)) - .Throws(_connectException); + _ = ConnectorMock.Setup(p => p.Connect(_connectionInfo)) + .Throws(_connectException); } protected override void Act() @@ -152,7 +152,7 @@ public void WaitOnHandle_WaitOnHandle_WaitHandleAndTimeout_ShouldThrowArgumentNu [TestMethod] public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnDisconnected() { - var session = (ISession)_session; + var session = (ISession) _session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, Timeout.InfiniteTimeSpan); @@ -163,7 +163,7 @@ public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnDisconnected() [TestMethod] public void ISession_TryWait_WaitHandleAndTimeoutAndException_ShouldReturnDisconnected() { - var session = (ISession)_session; + var session = (ISession) _session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, Timeout.InfiniteTimeSpan, out var exception); @@ -175,14 +175,14 @@ public void ISession_TryWait_WaitHandleAndTimeoutAndException_ShouldReturnDiscon [TestMethod] public void ISession_ConnectionInfoShouldReturnConnectionInfoPassedThroughConstructor() { - var session = (ISession)_session; + var session = (ISession) _session; Assert.AreSame(_connectionInfo, session.ConnectionInfo); } [TestMethod] public void ISession_MessageListenerCompletedShouldBeSignaled() { - var session = (ISession)_session; + var session = (ISession) _session; Assert.IsNotNull(session.MessageListenerCompleted); Assert.IsTrue(session.MessageListenerCompleted.WaitOne(0)); @@ -191,7 +191,7 @@ public void ISession_MessageListenerCompletedShouldBeSignaled() [TestMethod] public void ISession_SendMessageShouldThrowShhConnectionException() { - var session = (ISession)_session; + var session = (ISession) _session; try { @@ -209,7 +209,7 @@ public void ISession_SendMessageShouldThrowShhConnectionException() [TestMethod] public void ISession_TrySendMessageShouldReturnFalse() { - var session = (ISession)_session; + var session = (ISession) _session; var actual = session.TrySendMessage(new IgnoreMessage()); @@ -220,7 +220,7 @@ public void ISession_TrySendMessageShouldReturnFalse() public void ISession_WaitOnHandle_WaitHandle_ShouldThrowArgumentNullExceptionWhenWaitHandleIsNull() { const WaitHandle waitHandle = null; - var session = (ISession)_session; + var session = (ISession) _session; try { @@ -238,7 +238,7 @@ public void ISession_WaitOnHandle_WaitHandle_ShouldThrowArgumentNullExceptionWhe public void ISession_WaitOnHandle_WaitHandleAndTimeout_ShouldThrowArgumentNullExceptionWhenWaitHandleIsNull() { const WaitHandle waitHandle = null; - var session = (ISession)_session; + var session = (ISession) _session; try { @@ -255,9 +255,9 @@ public void ISession_WaitOnHandle_WaitHandleAndTimeout_ShouldThrowArgumentNullEx private static ConnectionInfo CreateConnectionInfo(IPEndPoint serverEndPoint, TimeSpan timeout) { return new ConnectionInfo(serverEndPoint.Address.ToString(), serverEndPoint.Port, "eric", new NoneAuthenticationMethod("eric")) - { - Timeout = timeout - }; + { + Timeout = timeout + }; } } } diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected.cs index cdc95c12e..5aca5c1a6 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected.cs @@ -1,7 +1,10 @@ using System; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Messages.Transport; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectedBase.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectedBase.cs index 42c1f54a6..5a8e99beb 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectedBase.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectedBase.cs @@ -100,7 +100,7 @@ protected virtual void SetupData() _serverEndPoint.Port, "user", new PasswordAuthenticationMethod("user", "password")) - {Timeout = TimeSpan.FromSeconds(20)}; + { Timeout = TimeSpan.FromSeconds(20) }; _keyExchangeAlgorithm = Random.Next().ToString(CultureInfo.InvariantCulture); SessionId = new byte[10]; Random.NextBytes(SessionId); @@ -133,9 +133,9 @@ protected virtual void SetupData() }; ServerListener = new AsyncSocketListener(_serverEndPoint) - { - ShutdownRemoteCommunicationSocket = false - }; + { + ShutdownRemoteCommunicationSocket = false + }; ServerListener.Connected += socket => { ServerSocket = socket; @@ -284,7 +284,7 @@ public byte[] Build() var target = new ServiceAcceptMessage(); var sshDataStream = new SshDataStream(4 + 1 + 1 + 4 + serviceName.Length); - sshDataStream.Write((uint)(sshDataStream.Capacity - 4)); // packet length + sshDataStream.Write((uint) (sshDataStream.Capacity - 4)); // packet length sshDataStream.WriteByte(0); // padding length sshDataStream.WriteByte(target.MessageNumber); sshDataStream.WriteBinary(serviceName); diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_GlobalRequestMessageAfterAuthenticationRace.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_GlobalRequestMessageAfterAuthenticationRace.cs index a8ce5c963..64ea76d74 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_GlobalRequestMessageAfterAuthenticationRace.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_GlobalRequestMessageAfterAuthenticationRace.cs @@ -1,6 +1,8 @@ using System.Net.Sockets; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Messages.Connection; using Renci.SshNet.Tests.Common; diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerAndClientDisconnectRace.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerAndClientDisconnectRace.cs index b0e714811..3681bb6bf 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerAndClientDisconnectRace.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerAndClientDisconnectRace.cs @@ -6,7 +6,9 @@ using System.Security.Cryptography; using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Compression; using Renci.SshNet.Connection; @@ -108,18 +110,18 @@ protected virtual void SetupData() // having established the connection instead of when the client has been identified var keyExchangeInitMessage = new KeyExchangeInitMessage - { - CompressionAlgorithmsClientToServer = new string[0], - CompressionAlgorithmsServerToClient = new string[0], - EncryptionAlgorithmsClientToServer = new string[0], - EncryptionAlgorithmsServerToClient = new string[0], - KeyExchangeAlgorithms = new[] { _keyExchangeAlgorithm }, - LanguagesClientToServer = new string[0], - LanguagesServerToClient = new string[0], - MacAlgorithmsClientToServer = new string[0], - MacAlgorithmsServerToClient = new string[0], - ServerHostKeyAlgorithms = new string[0] - }; + { + CompressionAlgorithmsClientToServer = new string[0], + CompressionAlgorithmsServerToClient = new string[0], + EncryptionAlgorithmsClientToServer = new string[0], + EncryptionAlgorithmsServerToClient = new string[0], + KeyExchangeAlgorithms = new[] { _keyExchangeAlgorithm }, + LanguagesClientToServer = new string[0], + LanguagesServerToClient = new string[0], + MacAlgorithmsClientToServer = new string[0], + MacAlgorithmsServerToClient = new string[0], + ServerHostKeyAlgorithms = new string[0] + }; var keyExchangeInit = keyExchangeInitMessage.GetPacket(8, null); _ = ServerSocket.Send(keyExchangeInit, 4, keyExchangeInit.Length - 4, SocketFlags.None); }; @@ -204,7 +206,7 @@ protected virtual void Arrange() } [TestMethod] - public void Act() + public void Act() { for (var i = 0; i < 50; i++) { @@ -242,7 +244,7 @@ public byte[] Build() var target = new ServiceAcceptMessage(); var sshDataStream = new SshDataStream(4 + 1 + 1 + 4 + serviceName.Length); - sshDataStream.Write((uint)(sshDataStream.Capacity - 4)); // packet length + sshDataStream.Write((uint) (sshDataStream.Capacity - 4)); // packet length sshDataStream.WriteByte(0); // padding length sshDataStream.WriteByte(target.MessageNumber); sshDataStream.WriteBinary(serviceName); diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsBadPacket.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsBadPacket.cs index b7c49b8bf..40ac16508 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsBadPacket.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsBadPacket.cs @@ -19,7 +19,7 @@ protected override void SetupData() { base.SetupData(); - _packet = new byte[] {0x0a, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05}; + _packet = new byte[] { 0x0a, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 }; } protected override void Act() diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSendAfterSendingIncompletePacket.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSendAfterSendingIncompletePacket.cs index 0e4e0a91e..df8bfbf00 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSendAfterSendingIncompletePacket.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSendAfterSendingIncompletePacket.cs @@ -15,7 +15,7 @@ public class SessionTest_Connected_ServerShutsDownSendAfterSendingIncompletePack { protected override void Act() { - var incompletePacket = new byte[] {0x0a, 0x05, 0x05}; + var incompletePacket = new byte[] { 0x0a, 0x05, 0x05 }; _ = ServerSocket.Send(incompletePacket, 0, incompletePacket.Length, SocketFlags.None); diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSocket.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSocket.cs index a2abe735a..a4f760d3a 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSocket.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSocket.cs @@ -2,7 +2,9 @@ using System.Diagnostics; using System.Net.Sockets; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Messages.Transport; using Renci.SshNet.Tests.Common; diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_NotConnected.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_NotConnected.cs index 4bd134348..e8eb38915 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_NotConnected.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_NotConnected.cs @@ -225,9 +225,9 @@ public void ISession_WaitOnHandle_WaitHandleAndTimeout_ShouldThrowArgumentNullEx private static ConnectionInfo CreateConnectionInfo(IPEndPoint serverEndPoint, TimeSpan timeout) { return new ConnectionInfo(serverEndPoint.Address.ToString(), serverEndPoint.Port, "eric", new NoneAuthenticationMethod("eric")) - { - Timeout = timeout - }; + { + Timeout = timeout + }; } } } diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_SocketConnected_BadPacketAndDispose.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_SocketConnected_BadPacketAndDispose.cs index a077c774f..5afe3bc0f 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_SocketConnected_BadPacketAndDispose.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_SocketConnected_BadPacketAndDispose.cs @@ -54,9 +54,9 @@ protected void SetupData() { _serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122); _connectionInfo = new ConnectionInfo(_serverEndPoint.Address.ToString(), _serverEndPoint.Port, "user", new PasswordAuthenticationMethod("user", "password")) - { - Timeout = TimeSpan.FromMilliseconds(200) - }; + { + Timeout = TimeSpan.FromMilliseconds(200) + }; _actualException = null; _socketFactory = new SocketFactory(); 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 bad627f21..2d4ad67ac 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/FStatVfsRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/FStatVfsRequestTest.cs @@ -2,7 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Requests; @@ -23,8 +25,8 @@ public class FStatVfsRequestTest public void Init() { var random = new Random(); - _protocolVersion = (uint)random.Next(0, int.MaxValue); - _requestId = (uint)random.Next(0, int.MaxValue); + _protocolVersion = (uint) random.Next(0, int.MaxValue); + _requestId = (uint) random.Next(0, int.MaxValue); _handle = new byte[random.Next(1, 10)]; random.NextBytes(_handle); @@ -120,4 +122,4 @@ public void GetBytes() Assert.IsTrue(sshDataStream.IsEndOfData); } } -} \ No newline at end of file +} 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 787f99049..2dc65bb1c 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/HardLinkRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/HardLinkRequestTest.cs @@ -3,7 +3,9 @@ using System.Globalization; using System.Linq; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Requests; @@ -27,8 +29,8 @@ public class HardLinkRequestTest public void Init() { var random = new Random(); - _protocolVersion = (uint)random.Next(0, int.MaxValue); - _requestId = (uint)random.Next(0, int.MaxValue); + _protocolVersion = (uint) random.Next(0, int.MaxValue); + _requestId = (uint) random.Next(0, int.MaxValue); _oldPath = random.Next().ToString(CultureInfo.InvariantCulture); _oldPathBytes = Encoding.UTF8.GetBytes(_oldPath); _newPath = random.Next().ToString(CultureInfo.InvariantCulture); @@ -113,4 +115,4 @@ public void GetBytes() Assert.IsTrue(sshDataStream.IsEndOfData); } } -} \ No newline at end of file +} 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 60cc1d031..cb62095fd 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/PosixRenameRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/PosixRenameRequestTest.cs @@ -3,7 +3,9 @@ using System.Globalization; using System.Linq; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Requests; @@ -30,8 +32,8 @@ public void Init() var random = new Random(); _encoding = Encoding.Unicode; - _protocolVersion = (uint)random.Next(0, int.MaxValue); - _requestId = (uint)random.Next(0, int.MaxValue); + _protocolVersion = (uint) random.Next(0, int.MaxValue); + _requestId = (uint) random.Next(0, int.MaxValue); _oldPath = random.Next().ToString(CultureInfo.InvariantCulture); _oldPathBytes = _encoding.GetBytes(_oldPath); _newPath = random.Next().ToString(CultureInfo.InvariantCulture); @@ -93,7 +95,7 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); Assert.AreEqual((byte) SftpMessageTypes.Extended, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); Assert.AreEqual((uint) _nameBytes.Length, sshDataStream.ReadUInt32()); @@ -117,4 +119,4 @@ public void GetBytes() Assert.IsTrue(sshDataStream.IsEndOfData); } } -} \ No newline at end of file +} 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 89d315f3b..5cacdc76e 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/StatVfsRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/StatVfsRequestTest.cs @@ -3,7 +3,9 @@ using System.Globalization; using System.Linq; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Requests; @@ -28,8 +30,8 @@ public void Init() var random = new Random(); _encoding = Encoding.Unicode; - _protocolVersion = (uint)random.Next(0, int.MaxValue); - _requestId = (uint)random.Next(0, int.MaxValue); + _protocolVersion = (uint) random.Next(0, int.MaxValue); + _requestId = (uint) random.Next(0, int.MaxValue); _path = random.Next().ToString(CultureInfo.InvariantCulture); _pathBytes = _encoding.GetBytes(_path); @@ -126,4 +128,4 @@ public void GetBytes() Assert.IsTrue(sshDataStream.IsEndOfData); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpBlockRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpBlockRequestTest.cs index 221009935..97803c9d5 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpBlockRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpBlockRequestTest.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Requests; @@ -24,8 +26,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint)random.Next(0, int.MaxValue); - _requestId = (uint)random.Next(0, int.MaxValue); + _protocolVersion = (uint) random.Next(0, int.MaxValue); + _requestId = (uint) random.Next(0, int.MaxValue); _handle = new byte[random.Next(1, 10)]; random.NextBytes(_handle); _offset = (ulong) random.Next(0, int.MaxValue); @@ -99,4 +101,4 @@ public void GetBytes() Assert.IsTrue(sshDataStream.IsEndOfData); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpCloseRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpCloseRequestTest.cs index 3959af33b..603bf68a7 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpCloseRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpCloseRequestTest.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Requests; @@ -21,8 +23,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint)random.Next(0, int.MaxValue); - _requestId = (uint)random.Next(0, int.MaxValue); + _protocolVersion = (uint) random.Next(0, int.MaxValue); + _requestId = (uint) random.Next(0, int.MaxValue); _handle = new byte[random.Next(1, 10)]; random.NextBytes(_handle); } @@ -72,7 +74,7 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); Assert.AreEqual((byte) SftpMessageTypes.Close, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); @@ -84,4 +86,4 @@ public void GetBytes() Assert.IsTrue(sshDataStream.IsEndOfData); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFSetStatRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFSetStatRequestTest.cs index a91797ed7..a562f2002 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFSetStatRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFSetStatRequestTest.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Requests; @@ -23,8 +25,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint)random.Next(0, int.MaxValue); - _requestId = (uint)random.Next(0, int.MaxValue); + _protocolVersion = (uint) random.Next(0, int.MaxValue); + _requestId = (uint) random.Next(0, int.MaxValue); _handle = new byte[random.Next(1, 10)]; random.NextBytes(_handle); _attributes = SftpFileAttributes.Empty; @@ -93,4 +95,4 @@ public void GetBytes() Assert.IsTrue(sshDataStream.IsEndOfData); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFStatRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFStatRequestTest.cs index 03cf64a95..a547281a9 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFStatRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFStatRequestTest.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Requests; @@ -21,8 +23,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint)random.Next(0, int.MaxValue); - _requestId = (uint)random.Next(0, int.MaxValue); + _protocolVersion = (uint) random.Next(0, int.MaxValue); + _requestId = (uint) random.Next(0, int.MaxValue); _handle = new byte[random.Next(1, 10)]; random.NextBytes(_handle); } @@ -106,4 +108,4 @@ public void GetBytes() Assert.IsTrue(sshDataStream.IsEndOfData); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpInitRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpInitRequestTest.cs index 4f039b1f8..baaaebf30 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpInitRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpInitRequestTest.cs @@ -1,4 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes.Sftp.Requests @@ -7,4 +8,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests public class SftpInitRequestTest : TestBase { } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLStatRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLStatRequestTest.cs index 08313b057..8eb1cea99 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLStatRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLStatRequestTest.cs @@ -3,7 +3,9 @@ using System.Globalization; using System.Linq; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Requests; @@ -112,4 +114,4 @@ public void GetBytes() Assert.IsTrue(sshDataStream.IsEndOfData); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLinkRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLinkRequestTest.cs index eba2f2496..00639b9e3 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLinkRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLinkRequestTest.cs @@ -3,7 +3,9 @@ using System.Globalization; using System.Linq; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Requests; @@ -26,8 +28,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint)random.Next(0, int.MaxValue); - _requestId = (uint)random.Next(0, int.MaxValue); + _protocolVersion = (uint) random.Next(0, int.MaxValue); + _requestId = (uint) random.Next(0, int.MaxValue); _newLinkPath = random.Next().ToString(CultureInfo.InvariantCulture); _newLinkPathBytes = Encoding.UTF8.GetBytes(_newLinkPath); _existingPath = random.Next().ToString(CultureInfo.InvariantCulture); @@ -107,4 +109,4 @@ public void GetBytes() Assert.IsTrue(sshDataStream.IsEndOfData); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpMkDirRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpMkDirRequestTest.cs index d8a3a9eb1..628256454 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpMkDirRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpMkDirRequestTest.cs @@ -3,7 +3,9 @@ using System.Globalization; using System.Linq; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Requests; @@ -99,4 +101,4 @@ public void GetBytes() Assert.IsTrue(sshDataStream.IsEndOfData); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenDirRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenDirRequestTest.cs index 2ee19ad4d..0bf486e8c 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenDirRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenDirRequestTest.cs @@ -3,7 +3,9 @@ using System.Globalization; using System.Linq; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Requests; @@ -25,8 +27,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint)random.Next(0, int.MaxValue); - _requestId = (uint)random.Next(0, int.MaxValue); + _protocolVersion = (uint) random.Next(0, int.MaxValue); + _requestId = (uint) random.Next(0, int.MaxValue); _encoding = Encoding.Unicode; _path = random.Next().ToString(CultureInfo.InvariantCulture); _pathBytes = _encoding.GetBytes(_path); @@ -112,4 +114,4 @@ public void GetBytes() Assert.IsTrue(sshDataStream.IsEndOfData); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenRequestTest.cs index 9a82ae8e4..5a1a9d4a3 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenRequestTest.cs @@ -3,7 +3,9 @@ using System.Globalization; using System.Linq; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Requests; @@ -28,8 +30,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint)random.Next(0, int.MaxValue); - _requestId = (uint)random.Next(0, int.MaxValue); + _protocolVersion = (uint) random.Next(0, int.MaxValue); + _requestId = (uint) random.Next(0, int.MaxValue); _encoding = Encoding.Unicode; _filename = random.Next().ToString(CultureInfo.InvariantCulture); _filenameBytes = _encoding.GetBytes(_filename); @@ -140,4 +142,4 @@ public void GetBytes() Assert.IsTrue(sshDataStream.IsEndOfData); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadDirRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadDirRequestTest.cs index 01b21ed14..4ac390978 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadDirRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadDirRequestTest.cs @@ -2,7 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Requests; @@ -107,4 +109,4 @@ public void GetBytes() Assert.IsTrue(sshDataStream.IsEndOfData); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadLinkRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadLinkRequestTest.cs index 04dccf7b0..e15a0f4c8 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadLinkRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadLinkRequestTest.cs @@ -3,7 +3,9 @@ using System.Globalization; using System.Linq; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Requests; @@ -125,4 +127,4 @@ public void GetBytes() } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadRequestTest.cs index 6d4dc8828..6c8fd46ca 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadRequestTest.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Requests; diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRealPathRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRealPathRequestTest.cs index 1ee8653ca..fa6403ab2 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRealPathRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRealPathRequestTest.cs @@ -3,7 +3,9 @@ using System.Globalization; using System.Linq; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Requests; @@ -140,4 +142,4 @@ public void GetBytes() Assert.IsTrue(sshDataStream.IsEndOfData); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRemoveRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRemoveRequestTest.cs index b0910c56b..a7d150421 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRemoveRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRemoveRequestTest.cs @@ -3,7 +3,9 @@ using System.Globalization; using System.Linq; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Requests; @@ -90,4 +92,4 @@ public void GetBytes() Assert.IsTrue(sshDataStream.IsEndOfData); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRenameRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRenameRequestTest.cs index 0225e5055..211dab62e 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRenameRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRenameRequestTest.cs @@ -3,7 +3,9 @@ using System.Globalization; using System.Linq; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Requests; @@ -102,4 +104,4 @@ public void GetBytes() Assert.IsTrue(sshDataStream.IsEndOfData); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRmDirRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRmDirRequestTest.cs index f171a1278..3527e4967 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRmDirRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRmDirRequestTest.cs @@ -27,8 +27,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint)random.Next(0, int.MaxValue); - _requestId = (uint)random.Next(0, int.MaxValue); + _protocolVersion = (uint) random.Next(0, int.MaxValue); + _requestId = (uint) random.Next(0, int.MaxValue); _encoding = Encoding.Unicode; _path = random.Next().ToString(CultureInfo.InvariantCulture); _pathBytes = _encoding.GetBytes(_path); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSetStatRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSetStatRequestTest.cs index 7c1bb4542..541458adc 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSetStatRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSetStatRequestTest.cs @@ -3,7 +3,9 @@ using System.Globalization; using System.Linq; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Requests; @@ -27,8 +29,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint)random.Next(0, int.MaxValue); - _requestId = (uint)random.Next(0, int.MaxValue); + _protocolVersion = (uint) random.Next(0, int.MaxValue); + _requestId = (uint) random.Next(0, int.MaxValue); _encoding = Encoding.Unicode; _path = random.Next().ToString(CultureInfo.InvariantCulture); _pathBytes = _encoding.GetBytes(_path); @@ -104,4 +106,4 @@ public void GetBytes() Assert.IsTrue(sshDataStream.IsEndOfData); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpStatRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpStatRequestTest.cs index 8f6e9a319..da0c12f4d 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpStatRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpStatRequestTest.cs @@ -3,7 +3,9 @@ using System.Globalization; using System.Linq; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Requests; @@ -25,7 +27,7 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint)random.Next(0, int.MaxValue); + _protocolVersion = (uint) random.Next(0, int.MaxValue); _requestId = (uint) random.Next(0, int.MaxValue); _encoding = Encoding.Unicode; _path = random.Next().ToString(CultureInfo.InvariantCulture); @@ -110,4 +112,4 @@ public void GetBytes() Assert.IsTrue(sshDataStream.IsEndOfData); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSymLinkRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSymLinkRequestTest.cs index 8b9a6e6c5..d54222c3e 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSymLinkRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSymLinkRequestTest.cs @@ -3,7 +3,9 @@ using System.Globalization; using System.Linq; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Requests; @@ -120,4 +122,4 @@ public void GetBytes() Assert.IsTrue(sshDataStream.IsEndOfData); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpUnblockRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpUnblockRequestTest.cs index aabd4d857..b6c0a0699 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpUnblockRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpUnblockRequestTest.cs @@ -25,8 +25,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint)random.Next(0, int.MaxValue); - _requestId = (uint)random.Next(0, int.MaxValue); + _protocolVersion = (uint) random.Next(0, int.MaxValue); + _requestId = (uint) random.Next(0, int.MaxValue); _handle = new byte[random.Next(1, 10)]; random.NextBytes(_handle); _offset = (ulong) random.Next(0, int.MaxValue); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpWriteRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpWriteRequestTest.cs index 608ab78ec..9bf226f41 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpWriteRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpWriteRequestTest.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Requests; diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/ExtendedReplies/StatVfsReplyInfoTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/ExtendedReplies/StatVfsReplyInfoTest.cs index 4ea375652..83b4a87a2 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/ExtendedReplies/StatVfsReplyInfoTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/ExtendedReplies/StatVfsReplyInfoTest.cs @@ -30,15 +30,15 @@ public void Init() _random = new Random(); _responseId = (uint) _random.Next(0, int.MaxValue); _bsize = (ulong) _random.Next(0, int.MaxValue); - _frsize = (ulong)_random.Next(0, int.MaxValue); - _blocks = (ulong)_random.Next(0, int.MaxValue); - _bfree = (ulong)_random.Next(0, int.MaxValue); - _bavail = (ulong)_random.Next(0, int.MaxValue); - _files = (ulong)_random.Next(0, int.MaxValue); - _ffree = (ulong)_random.Next(0, int.MaxValue); - _favail = (ulong)_random.Next(0, int.MaxValue); - _sid = (ulong)_random.Next(0, int.MaxValue); - _namemax = (ulong)_random.Next(0, int.MaxValue); + _frsize = (ulong) _random.Next(0, int.MaxValue); + _blocks = (ulong) _random.Next(0, int.MaxValue); + _bfree = (ulong) _random.Next(0, int.MaxValue); + _bavail = (ulong) _random.Next(0, int.MaxValue); + _files = (ulong) _random.Next(0, int.MaxValue); + _ffree = (ulong) _random.Next(0, int.MaxValue); + _favail = (ulong) _random.Next(0, int.MaxValue); + _sid = (ulong) _random.Next(0, int.MaxValue); + _namemax = (ulong) _random.Next(0, int.MaxValue); } [TestMethod] diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpAttrsResponseTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpAttrsResponseTest.cs index 08b4b00ef..d0267b4a0 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpAttrsResponseTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpAttrsResponseTest.cs @@ -1,5 +1,7 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Responses; @@ -18,7 +20,7 @@ public void Init() { _random = new Random(); _protocolVersion = (uint) _random.Next(0, int.MaxValue); - _responseId = (uint)_random.Next(0, int.MaxValue); + _responseId = (uint) _random.Next(0, int.MaxValue); } [TestMethod] diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpDataResponseTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpDataResponseTest.cs index 3f10fc3f6..662e93dec 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpDataResponseTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpDataResponseTest.cs @@ -1,6 +1,8 @@ using System; using System.Linq; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Responses; diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpExtendedReplyResponseTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpExtendedReplyResponseTest.cs index ff5f9ac39..80cd27e93 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpExtendedReplyResponseTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpExtendedReplyResponseTest.cs @@ -63,10 +63,10 @@ public void GetReply_StatVfsReplyInfo() var namemax = (ulong) _random.Next(0, int.MaxValue); var sshDataStream = new SshDataStream(4 + 1 + 4 + 88) - { - Position = 4 // skip 4 bytes for SSH packet length - }; - sshDataStream.WriteByte((byte)SftpMessageTypes.Attrs); + { + Position = 4 // skip 4 bytes for SSH packet length + }; + sshDataStream.WriteByte((byte) SftpMessageTypes.Attrs); sshDataStream.Write(_responseId); sshDataStream.Write(bsize); sshDataStream.Write(frsize); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpHandleResponseTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpHandleResponseTest.cs index 8b83ed0f5..a75da1564 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpHandleResponseTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpHandleResponseTest.cs @@ -1,6 +1,8 @@ - using System; +using System; using System.Linq; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Responses; diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpNameResponseTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpNameResponseTest.cs index 2265e3f57..3f5ca974c 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpNameResponseTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpNameResponseTest.cs @@ -1,4 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes.Sftp.Responses @@ -7,4 +8,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Responses public class SftpNameResponseTest : TestBase { } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpStatusResponseTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpStatusResponseTest.cs index ca46720d8..c9f2bcffb 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpStatusResponseTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpStatusResponseTest.cs @@ -1,4 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes.Sftp.Responses @@ -7,4 +8,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Responses public class SftpStatusResponseTest : TestBase { } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpVersionResponseTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpVersionResponseTest.cs index 4cabe306c..90be16468 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpVersionResponseTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpVersionResponseTest.cs @@ -1,4 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes.Sftp.Responses @@ -7,4 +8,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Responses public class SftpVersionResponseTest : TestBase { } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpDataResponseBuilder.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpDataResponseBuilder.cs index 71cfbb676..d3aac4299 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpDataResponseBuilder.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpDataResponseBuilder.cs @@ -29,10 +29,10 @@ public SftpDataResponseBuilder WithData(byte[] data) public SftpDataResponse Build() { return new SftpDataResponse(_protocolVersion) - { - ResponseId = _responseId, - Data = _data - }; + { + ResponseId = _responseId, + Data = _data + }; } } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpDownloadAsyncResultTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpDownloadAsyncResultTest.cs index 439fc4c52..f3ba6d4cc 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpDownloadAsyncResultTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpDownloadAsyncResultTest.cs @@ -1,7 +1,9 @@ using System; using System.IO; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Sftp; using Renci.SshNet.Tests.Common; diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTestBase.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTestBase.cs index 0e952d337..eed1c71cc 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTestBase.cs @@ -1,15 +1,18 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Threading; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; -using System; -using System.Threading; namespace Renci.SshNet.Tests.Classes.Sftp { public abstract class SftpFileReaderTestBase { - internal Mock SftpSessionMock { get; private set;} + internal Mock SftpSessionMock { get; private set; } protected abstract void SetupData(); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_LastChunkBeforeEofIsComplete.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_LastChunkBeforeEofIsComplete.cs index 1f52d93d4..f2a661c5c 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_LastChunkBeforeEofIsComplete.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_LastChunkBeforeEofIsComplete.cs @@ -1,10 +1,14 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Diagnostics; +using System.Threading; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; -using System; -using System.Diagnostics; -using System.Threading; + using BufferedRead = Renci.SshNet.Sftp.SftpFileReader.BufferedRead; namespace Renci.SshNet.Tests.Classes.Sftp @@ -68,7 +72,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk1, false); }) - .Returns((SftpReadAsyncResult)null); + .Returns((SftpReadAsyncResult) null); SftpSessionMock.InSequence(_seq).Setup(p => p.OperationTimeout).Returns(_operationTimeout); SftpSessionMock.InSequence(_seq) .Setup(p => p.WaitAny(_waitHandleArray, _operationTimeout)) diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_LastChunkBeforeEofIsPartial.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_LastChunkBeforeEofIsPartial.cs index 02ae3f415..b3fa7f4ef 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_LastChunkBeforeEofIsPartial.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_LastChunkBeforeEofIsPartial.cs @@ -1,10 +1,14 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Diagnostics; +using System.Threading; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; -using System; -using System.Diagnostics; -using System.Threading; + using BufferedRead = Renci.SshNet.Sftp.SftpFileReader.BufferedRead; namespace Renci.SshNet.Tests.Classes.Sftp @@ -65,7 +69,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk1, false); }) - .Returns((SftpReadAsyncResult)null); + .Returns((SftpReadAsyncResult) null); SftpSessionMock.InSequence(_seq).Setup(p => p.OperationTimeout).Returns(_operationTimeout); SftpSessionMock.InSequence(_seq) .Setup(p => p.WaitAny(_waitHandleArray, _operationTimeout)) @@ -77,7 +81,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk2, false); }) - .Returns((SftpReadAsyncResult)null); + .Returns((SftpReadAsyncResult) null); SftpSessionMock.InSequence(_seq).Setup(p => p.OperationTimeout).Returns(_operationTimeout); SftpSessionMock.InSequence(_seq) .Setup(p => p.WaitAny(_waitHandleArray, _operationTimeout)) @@ -89,7 +93,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk3, false); }) - .Returns((SftpReadAsyncResult)null); + .Returns((SftpReadAsyncResult) null); } protected override void Arrange() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_PreviousChunkIsIncompleteAndEofIsNotReached.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_PreviousChunkIsIncompleteAndEofIsNotReached.cs index cedcff5cb..ddc4aa648 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_PreviousChunkIsIncompleteAndEofIsNotReached.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_PreviousChunkIsIncompleteAndEofIsNotReached.cs @@ -1,10 +1,14 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Diagnostics; +using System.Threading; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; -using System; -using System.Diagnostics; -using System.Threading; + using BufferedRead = Renci.SshNet.Sftp.SftpFileReader.BufferedRead; namespace Renci.SshNet.Tests.Classes.Sftp @@ -97,7 +101,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk1, false); }) - .Returns((SftpReadAsyncResult)null); + .Returns((SftpReadAsyncResult) null); _ = SftpSessionMock.InSequence(_seq) .Setup(p => p.OperationTimeout) .Returns(_operationTimeout); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_PreviousChunkIsIncompleteAndEofIsReached.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_PreviousChunkIsIncompleteAndEofIsReached.cs index 5d2ed04f3..b107b8668 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_PreviousChunkIsIncompleteAndEofIsReached.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_PreviousChunkIsIncompleteAndEofIsReached.cs @@ -1,10 +1,14 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Diagnostics; +using System.Threading; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; -using System; -using System.Diagnostics; -using System.Threading; + using BufferedRead = Renci.SshNet.Sftp.SftpFileReader.BufferedRead; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_ReadAheadEndInvokeException_DiscardsFurtherReadAheads.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_ReadAheadEndInvokeException_DiscardsFurtherReadAheads.cs index e99a582dc..72eb580e0 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_ReadAheadEndInvokeException_DiscardsFurtherReadAheads.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_ReadAheadEndInvokeException_DiscardsFurtherReadAheads.cs @@ -1,11 +1,15 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Diagnostics; +using System.Threading; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Abstractions; using Renci.SshNet.Common; using Renci.SshNet.Sftp; -using System; -using System.Diagnostics; -using System.Threading; + using BufferedRead = Renci.SshNet.Sftp.SftpFileReader.BufferedRead; namespace Renci.SshNet.Tests.Classes.Sftp @@ -87,7 +91,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk1, false); }) - .Returns((SftpReadAsyncResult)null); + .Returns((SftpReadAsyncResult) null); SftpSessionMock.InSequence(_seq).Setup(p => p.OperationTimeout).Returns(_operationTimeout); SftpSessionMock.InSequence(_seq) .Setup(p => p.WaitAny(_waitHandleArray, _operationTimeout)) @@ -110,7 +114,7 @@ protected override void SetupMocks() _readAheadChunk2Completed.Set(); }); }) - .Returns((SftpReadAsyncResult)null); + .Returns((SftpReadAsyncResult) null); SftpSessionMock.InSequence(_seq).Setup(p => p.OperationTimeout).Returns(_operationTimeout); SftpSessionMock.InSequence(_seq) .Setup(p => p.WaitAny(_waitHandleArray, _operationTimeout)) @@ -124,7 +128,7 @@ protected override void SetupMocks() // signal that we've completed the read-ahead for chunk3 _readAheadChunk3Completed.Set(); }) - .Returns((SftpReadAsyncResult)null); + .Returns((SftpReadAsyncResult) null); SftpSessionMock.InSequence(_seq).Setup(p => p.OperationTimeout).Returns(_operationTimeout); SftpSessionMock.InSequence(_seq) .Setup(p => p.WaitAny(_waitHandleArray, _operationTimeout)) diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_ReadAheadEndInvokeException_PreventsFurtherReadAheads.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_ReadAheadEndInvokeException_PreventsFurtherReadAheads.cs index 06f2c5433..ed4f6b788 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_ReadAheadEndInvokeException_PreventsFurtherReadAheads.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_ReadAheadEndInvokeException_PreventsFurtherReadAheads.cs @@ -98,7 +98,7 @@ protected override void SetupMocks() asyncResult.SetAsCompleted(_exception, false); }); }) - .Returns((SftpReadAsyncResult)null); + .Returns((SftpReadAsyncResult) null); _ = SftpSessionMock.InSequence(_seq) .Setup(p => p.OperationTimeout) .Returns(_operationTimeout); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInBeginRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInBeginRead.cs index a35803e6c..0ea24e11c 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInBeginRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInBeginRead.cs @@ -1,10 +1,14 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Diagnostics; +using System.Threading; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; -using System; -using System.Diagnostics; -using System.Threading; + using BufferedRead = Renci.SshNet.Sftp.SftpFileReader.BufferedRead; namespace Renci.SshNet.Tests.Classes.Sftp @@ -69,7 +73,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk1, false); }) - .Returns((SftpReadAsyncResult)null); + .Returns((SftpReadAsyncResult) null); SftpSessionMock.InSequence(_seq).Setup(p => p.OperationTimeout).Returns(_operationTimeout); SftpSessionMock.InSequence(_seq) .Setup(p => p.WaitAny(_waitHandleArray, _operationTimeout)) @@ -81,7 +85,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk2, false); }) - .Returns((SftpReadAsyncResult)null); + .Returns((SftpReadAsyncResult) null); SftpSessionMock.InSequence(_seq).Setup(p => p.OperationTimeout).Returns(_operationTimeout); SftpSessionMock.InSequence(_seq) .Setup(p => p.WaitAny(_waitHandleArray, _operationTimeout)) diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInWaitOnHandle_ChunkAvailable.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInWaitOnHandle_ChunkAvailable.cs index fd9d601c2..98e9a1229 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInWaitOnHandle_ChunkAvailable.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInWaitOnHandle_ChunkAvailable.cs @@ -1,10 +1,14 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Diagnostics; +using System.Threading; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; -using System; -using System.Diagnostics; -using System.Threading; + using BufferedRead = Renci.SshNet.Sftp.SftpFileReader.BufferedRead; namespace Renci.SshNet.Tests.Classes.Sftp @@ -66,7 +70,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk1, false); }) - .Returns((SftpReadAsyncResult)null); + .Returns((SftpReadAsyncResult) null); SftpSessionMock.InSequence(_seq).Setup(p => p.OperationTimeout).Returns(_operationTimeout); SftpSessionMock.InSequence(_seq) .Setup(p => p.WaitAny(_waitHandleArray, _operationTimeout)) diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInWaitOnHandle_NoChunkAvailable.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInWaitOnHandle_NoChunkAvailable.cs index 12991fb42..6ef4563bc 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInWaitOnHandle_NoChunkAvailable.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInWaitOnHandle_NoChunkAvailable.cs @@ -1,10 +1,14 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.Diagnostics; +using System.Threading; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; -using System; -using System.Diagnostics; -using System.Threading; + using BufferedRead = Renci.SshNet.Sftp.SftpFileReader.BufferedRead; namespace Renci.SshNet.Tests.Classes.Sftp @@ -55,7 +59,7 @@ protected override void SetupMocks() .Returns(() => WaitAny(_waitHandleArray, _operationTimeout)); SftpSessionMock.InSequence(_seq) .Setup(p => p.BeginRead(_handle, 0, ChunkLength, It.IsNotNull(), It.IsAny())) - .Returns((SftpReadAsyncResult)null); + .Returns((SftpReadAsyncResult) null); SftpSessionMock.InSequence(_seq).Setup(p => p.OperationTimeout).Returns(_operationTimeout); SftpSessionMock.InSequence(_seq) .Setup(p => p.WaitAny(_waitHandleArray, _operationTimeout)) diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamAsyncTestBase.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamAsyncTestBase.cs index 110a20bed..950b69ec7 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamAsyncTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamAsyncTestBase.cs @@ -1,7 +1,10 @@ using System; using System.Threading.Tasks; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTestBase.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTestBase.cs index 19497c6de..7fe0b3428 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTestBase.cs @@ -1,6 +1,9 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessRead.cs index 87ff5fbec..3671bfbe3 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessRead.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessReadWrite.cs index 2ae877f3b..29ad6bc27 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessReadWrite.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessWrite.cs index e82b347a2..656746b70 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessWrite.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessRead.cs index a1ab8bec8..a8daf091c 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessRead.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessReadWrite.cs index 97d7df8f4..7b76093e8 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessReadWrite.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessWrite.cs index d6b4856e1..dfcf89b04 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessWrite.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessRead.cs index 0105a780f..4326df384 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessRead.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessReadWrite.cs index 9dffd925c..2e386c20d 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessReadWrite.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessWrite.cs index c51af38d2..0760e0358 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessWrite.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessRead.cs index 8c0f4e143..32c3323df 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessRead.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessReadWrite.cs index b669811dc..6298cb7d4 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessReadWrite.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp @@ -32,7 +35,7 @@ protected override void SetupData() protected override void SetupMocks() { SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestOpen(_path, Flags.Read |Flags.Write, false)) + .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Write, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) .Setup(p => p.CalculateOptimalReadLength(_bufferSize)) diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessWrite.cs index 58238385b..15d854a57 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessWrite.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_Closed.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_Closed.cs index b52537fb8..5da38e1a9 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_Closed.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_Closed.cs @@ -32,10 +32,10 @@ protected void Arrange() { var random = new Random(); _path = random.Next().ToString(CultureInfo.InvariantCulture); - _handle = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) }; - _bufferSize = (uint)random.Next(1, 1000); - _readBufferSize = (uint)random.Next(0, 1000); - _writeBufferSize = (uint)random.Next(0, 1000); + _handle = new[] { (byte) random.Next(byte.MinValue, byte.MaxValue) }; + _bufferSize = (uint) random.Next(1, 1000); + _readBufferSize = (uint) random.Next(0, 1000); + _writeBufferSize = (uint) random.Next(0, 1000); _sftpSessionMock = new Mock(MockBehavior.Strict); @@ -56,7 +56,7 @@ protected void Arrange() _ = _sftpSessionMock.InSequence(sequence) .Setup(p => p.RequestClose(_handle)); - _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Open, FileAccess.Read, (int)_bufferSize); + _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Open, FileAccess.Read, (int) _bufferSize); _sftpFileStream.Close(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_Disposed.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_Disposed.cs index ee7d6548f..451d95324 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_Disposed.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_SessionNotOpen.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_SessionNotOpen.cs index 2d4c6e424..5145a7683 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_SessionNotOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_SessionNotOpen.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileAccessInvalid.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileAccessInvalid.cs index 29e36fbf0..bc1c9e737 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileAccessInvalid.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileAccessInvalid.cs @@ -1,6 +1,8 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeAppend_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeAppend_FileAccessRead.cs index e366914c7..cac46a882 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeAppend_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeAppend_FileAccessRead.cs @@ -1,6 +1,8 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Sftp; using Renci.SshNet.Tests.Common; diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeAppend_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeAppend_FileAccessReadWrite.cs index d4b311ffa..de5e72e4d 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeAppend_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeAppend_FileAccessReadWrite.cs @@ -1,6 +1,8 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Sftp; using Renci.SshNet.Tests.Common; diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeAppend_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeAppend_FileAccessWrite.cs index 25171b9f3..d221e0e20 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeAppend_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeAppend_FileAccessWrite.cs @@ -1,8 +1,11 @@ using System; using System.IO; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; using Renci.SshNet.Tests.Common; @@ -164,7 +167,7 @@ public void WriteShouldStartWritingAtEndOfFile() _target.Write(buffer, 0, buffer.Length); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(1)); - SftpSessionMock.Verify(p => p.RequestWrite(_handle, (ulong)_fileAttributes.Size, buffer, 0, buffer.Length, It.IsNotNull(), null), Times.Once); + SftpSessionMock.Verify(p => p.RequestWrite(_handle, (ulong) _fileAttributes.Size, buffer, 0, buffer.Length, It.IsNotNull(), null), Times.Once); } [TestMethod] diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreateNew_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreateNew_FileAccessReadWrite.cs index c8e46a2b2..5af19627c 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreateNew_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreateNew_FileAccessReadWrite.cs @@ -1,8 +1,11 @@ using System; using System.IO; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; @@ -30,8 +33,8 @@ protected override void SetupData() _fileMode = FileMode.CreateNew; _fileAccess = FileAccess.ReadWrite; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint)_random.Next(5, 1000); - _writeBufferSize = (uint)_random.Next(5, 1000); + _readBufferSize = (uint) _random.Next(5, 1000); + _writeBufferSize = (uint) _random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreateNew_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreateNew_FileAccessWrite.cs index 541fb21ef..50de48c4f 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreateNew_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreateNew_FileAccessWrite.cs @@ -1,8 +1,11 @@ using System; using System.IO; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessRead.cs index c70b3239f..fdc0e9a2c 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessRead.cs @@ -37,7 +37,7 @@ protected override void Act() { try { - _ =new SftpFileStream(SftpSessionMock.Object, _path, _fileMode, _fileAccess, _bufferSize); + _ = new SftpFileStream(SftpSessionMock.Object, _path, _fileMode, _fileAccess, _bufferSize); Assert.Fail(); } catch (ArgumentException ex) diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessReadWrite_FileDoesNotExist.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessReadWrite_FileDoesNotExist.cs index 73052060a..7bd303f62 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessReadWrite_FileDoesNotExist.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessReadWrite_FileDoesNotExist.cs @@ -1,8 +1,11 @@ using System; using System.IO; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; @@ -30,8 +33,8 @@ protected override void SetupData() _fileMode = FileMode.Create; _fileAccess = FileAccess.ReadWrite; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint)_random.Next(5, 1000); - _writeBufferSize = (uint)_random.Next(5, 1000); + _readBufferSize = (uint) _random.Next(5, 1000); + _writeBufferSize = (uint) _random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessReadWrite_FileExists.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessReadWrite_FileExists.cs index 235d6d9e2..b66fd1e82 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessReadWrite_FileExists.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessReadWrite_FileExists.cs @@ -1,8 +1,11 @@ using System; using System.IO; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; @@ -30,8 +33,8 @@ protected override void SetupData() _fileMode = FileMode.Create; _fileAccess = FileAccess.ReadWrite; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint)_random.Next(5, 1000); - _writeBufferSize = (uint)_random.Next(5, 1000); + _readBufferSize = (uint) _random.Next(5, 1000); + _writeBufferSize = (uint) _random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessWrite_FileDoesNotExist.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessWrite_FileDoesNotExist.cs index 846cbe7ea..78e1a8255 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessWrite_FileDoesNotExist.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessWrite_FileDoesNotExist.cs @@ -1,8 +1,11 @@ using System; using System.IO; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp @@ -29,8 +32,8 @@ protected override void SetupData() _fileMode = FileMode.Create; _fileAccess = FileAccess.Write; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint)_random.Next(5, 1000); - _writeBufferSize = (uint)_random.Next(5, 1000); + _readBufferSize = (uint) _random.Next(5, 1000); + _writeBufferSize = (uint) _random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessWrite_FileExists.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessWrite_FileExists.cs index 3fa061f05..3dfa943e1 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessWrite_FileExists.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessWrite_FileExists.cs @@ -1,8 +1,11 @@ using System; using System.IO; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeInvalid.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeInvalid.cs index ee82ec002..c2606ff0f 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeInvalid.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeInvalid.cs @@ -1,6 +1,8 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessRead.cs index 2f186a415..4f66e8e69 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessRead.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessReadWrite.cs index 834ef790c..2ff93f9af 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessReadWrite.cs @@ -1,8 +1,11 @@ using System; using System.IO; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; @@ -30,8 +33,8 @@ protected override void SetupData() _fileMode = FileMode.OpenOrCreate; _fileAccess = FileAccess.ReadWrite; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint)_random.Next(5, 1000); - _writeBufferSize = (uint)_random.Next(5, 1000); + _readBufferSize = (uint) _random.Next(5, 1000); + _writeBufferSize = (uint) _random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessWrite.cs index 5c30c3764..ae14e4589 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessWrite.cs @@ -1,8 +1,11 @@ using System; using System.IO; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessRead.cs index 65232bafb..4e71d19f4 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessRead.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; @@ -29,8 +32,8 @@ protected override void SetupData() _fileMode = FileMode.Open; _fileAccess = FileAccess.Read; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint)_random.Next(5, 1000); - _writeBufferSize = (uint)_random.Next(5, 1000); + _readBufferSize = (uint) _random.Next(5, 1000); + _writeBufferSize = (uint) _random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessReadWrite.cs index 63757f083..6ffc8c517 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessReadWrite.cs @@ -1,8 +1,11 @@ using System; using System.IO; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessWrite.cs index f48093acc..fd3904100 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessWrite.cs @@ -1,8 +1,11 @@ using System; using System.IO; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeTruncate_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeTruncate_FileAccessRead.cs index 9e520a597..dadd6f610 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeTruncate_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeTruncate_FileAccessRead.cs @@ -1,6 +1,8 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Sftp; using Renci.SshNet.Tests.Common; diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeTruncate_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeTruncate_FileAccessWrite.cs index 8638b26f8..49294444c 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeTruncate_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeTruncate_FileAccessWrite.cs @@ -1,8 +1,11 @@ using System; using System.IO; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_Disposed.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_Disposed.cs index 31b3e0962..ce41c8734 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_Disposed.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Finalize_SessionOpen.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Finalize_SessionOpen.cs index 1d55e17f4..0674c75fe 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Finalize_SessionOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Finalize_SessionOpen.cs @@ -1,8 +1,11 @@ using System; using System.Globalization; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_DataInBuffer_NotReadFromBuffer.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_DataInBuffer_NotReadFromBuffer.cs index 9795c514a..639122aad 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_DataInBuffer_NotReadFromBuffer.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_DataInBuffer_NotReadFromBuffer.cs @@ -67,7 +67,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int)_bufferSize); + (int) _bufferSize); _ = _target.Read(_readBytes, 0, _readBytes.Length); } @@ -101,7 +101,7 @@ public void ReadShouldReadFromServer() .Setup(p => p.IsOpen) .Returns(true); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestRead(_handle, (ulong)_readBytes.Length, _readBufferSize)) + .Setup(p => p.RequestRead(_handle, (ulong) _readBytes.Length, _readBufferSize)) .Returns(serverBytes2); var bytesRead = _target.Read(readBytes2, 2, 3); @@ -109,7 +109,7 @@ public void ReadShouldReadFromServer() Assert.AreEqual(3, bytesRead); CollectionAssert.AreEqual(expectedReadBytes, readBytes2); - SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong)_readBytes.Length, _readBufferSize), Times.Once); + SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong) _readBytes.Length, _readBufferSize), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(3)); } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_DataInBuffer_ReadFromBuffer.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_DataInBuffer_ReadFromBuffer.cs index d873f3209..5d513b1a7 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_DataInBuffer_ReadFromBuffer.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_DataInBuffer_ReadFromBuffer.cs @@ -1,10 +1,13 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.IO; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Tests.Common; -using System; -using System.IO; namespace Renci.SshNet.Tests.Classes.Sftp { @@ -29,7 +32,7 @@ protected override void SetupData() _path = random.Next().ToString(); _handle = GenerateRandom(5, random); - _bufferSize = (uint)random.Next(1, 1000); + _bufferSize = (uint) random.Next(1, 1000); _readBufferSize = 100; _writeBufferSize = 500; _readBytes1 = new byte[random.Next(1, (int) _readBufferSize - 10)]; @@ -70,7 +73,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int)_bufferSize); + (int) _bufferSize); _ = _target.Read(_readBytes1, 0, _readBytes1.Length); _ = _target.Read(_readBytes2, 0, _readBytes2.Length); } @@ -113,7 +116,7 @@ public void ReadShouldReadFromServer() Assert.AreEqual(2, bytesRead); CollectionAssert.AreEqual(expectedReadBytes, readBytes3); - SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong)(_readBytes1.Length + _readBytes2.Length), _readBufferSize), Times.Once); + SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong) (_readBytes1.Length + _readBytes2.Length), _readBufferSize), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(4)); } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_NoDataInBuffer.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_NoDataInBuffer.cs index 5388971e6..7d6b28b31 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_NoDataInBuffer.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_NoDataInBuffer.cs @@ -109,7 +109,7 @@ public void ReadShouldReadFromServer() Assert.AreEqual(3, bytesRead); CollectionAssert.AreEqual(expectedReadBytes, readBytes2); - SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong)_readBytes.Length, _readBufferSize), Times.Once); + SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong) _readBytes.Length, _readBufferSize), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(3)); } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_SessionNotOpen.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_SessionNotOpen.cs index 6aea777a7..12075a479 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_SessionNotOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_SessionNotOpen.cs @@ -1,8 +1,11 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.IO; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; -using System; -using System.IO; namespace Renci.SshNet.Tests.Classes.Sftp { diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_WriteMode_DataInBuffer.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_WriteMode_DataInBuffer.cs index 2bf5c2c67..a5bfc5940 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_WriteMode_DataInBuffer.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_WriteMode_DataInBuffer.cs @@ -35,7 +35,7 @@ protected override void SetupData() _path = random.Next().ToString(); _handle = GenerateRandom(5, random); - _bufferSize = (uint)random.Next(1, 1000); + _bufferSize = (uint) random.Next(1, 1000); _readBufferSize = 100; _writeBufferSize = 500; _writeBytes1 = GenerateRandom(_writeBufferSize); @@ -90,7 +90,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.ReadWrite, - (int)_bufferSize); + (int) _bufferSize); _target.Write(_writeBytes1, 0, _writeBytes1.Length); _target.Write(_writeBytes2, 0, _writeBytes2.Length); _target.Write(_writeBytes3, 0, _writeBytes3.Length); @@ -145,7 +145,7 @@ public void ReadShouldReadFromServer() Assert.AreEqual(3, bytesRead); CollectionAssert.AreEqual(expectedReadBytes, readBytes); - SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong)(_writeBytes1.Length + _writeBytes2.Length + _writeBytes3.Length), _readBufferSize), Times.Once); + SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong) (_writeBytes1.Length + _writeBytes2.Length + _writeBytes3.Length), _readBufferSize), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(5)); } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_WriteMode_NoDataInBuffer.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_WriteMode_NoDataInBuffer.cs index 32d0b833e..58bc643fc 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_WriteMode_NoDataInBuffer.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_WriteMode_NoDataInBuffer.cs @@ -1,12 +1,15 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; +using System.IO; +using System.Threading; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Responses; using Renci.SshNet.Tests.Common; -using System; -using System.IO; -using System.Threading; namespace Renci.SshNet.Tests.Classes.Sftp { @@ -28,7 +31,7 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(5, random); - _bufferSize = (uint)random.Next(1, 1000); + _bufferSize = (uint) random.Next(1, 1000); _readBufferSize = 100; _writeBufferSize = 500; _writeBytes = GenerateRandom(_writeBufferSize); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileAccessInvalid.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileAccessInvalid.cs index 4febea075..3a1ea7cb5 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileAccessInvalid.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileAccessInvalid.cs @@ -1,7 +1,9 @@ using System; using System.IO; using System.Threading.Tasks; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeAppend_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeAppend_FileAccessRead.cs index 242755a04..c922ab67a 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeAppend_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeAppend_FileAccessRead.cs @@ -1,7 +1,9 @@ using System; using System.IO; using System.Threading.Tasks; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Sftp; using Renci.SshNet.Tests.Common; diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeAppend_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeAppend_FileAccessReadWrite.cs index 776cec41f..5360ec63f 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeAppend_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeAppend_FileAccessReadWrite.cs @@ -1,7 +1,9 @@ using System; using System.IO; using System.Threading.Tasks; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Sftp; using Renci.SshNet.Tests.Common; diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeAppend_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeAppend_FileAccessWrite.cs index 14cce04e4..77af44043 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeAppend_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeAppend_FileAccessWrite.cs @@ -58,10 +58,10 @@ protected override void SetupMocks() .Setup(p => p.RequestFStatAsync(_handle, _cancellationToken)) .ReturnsAsync(_fileAttributes); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) .Returns(_readBufferSize); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) .Returns(_writeBufferSize); } @@ -140,13 +140,13 @@ public async Task WriteShouldStartWritingAtEndOfFile() .Setup(p => p.IsOpen) .Returns(true); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestWriteAsync(_handle, (ulong)_fileAttributes.Size, buffer, 0, buffer.Length, _cancellationToken)) + .Setup(p => p.RequestWriteAsync(_handle, (ulong) _fileAttributes.Size, buffer, 0, buffer.Length, _cancellationToken)) .Returns(Task.CompletedTask); await _target.WriteAsync(buffer, 0, buffer.Length, _cancellationToken); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(1)); - SftpSessionMock.Verify(p => p.RequestWriteAsync(_handle, (ulong)_fileAttributes.Size, buffer, 0, buffer.Length, _cancellationToken), Times.Once); + SftpSessionMock.Verify(p => p.RequestWriteAsync(_handle, (ulong) _fileAttributes.Size, buffer, 0, buffer.Length, _cancellationToken), Times.Once); } [TestMethod] diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreateNew_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreateNew_FileAccessReadWrite.cs index c1b271dd3..1b05fac3a 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreateNew_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreateNew_FileAccessReadWrite.cs @@ -2,8 +2,11 @@ using System.IO; using System.Threading; using System.Threading.Tasks; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; @@ -32,8 +35,8 @@ protected override void SetupData() _fileMode = FileMode.CreateNew; _fileAccess = FileAccess.ReadWrite; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint)_random.Next(5, 1000); - _writeBufferSize = (uint)_random.Next(5, 1000); + _readBufferSize = (uint) _random.Next(5, 1000); + _writeBufferSize = (uint) _random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _cancellationToken = new CancellationToken(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessReadWrite_FileDoesNotExist.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessReadWrite_FileDoesNotExist.cs index 100f08ac4..66569af15 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessReadWrite_FileDoesNotExist.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessReadWrite_FileDoesNotExist.cs @@ -35,8 +35,8 @@ protected override void SetupData() _fileMode = FileMode.Create; _fileAccess = FileAccess.ReadWrite; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint)_random.Next(5, 1000); - _writeBufferSize = (uint)_random.Next(5, 1000); + _readBufferSize = (uint) _random.Next(5, 1000); + _writeBufferSize = (uint) _random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _cancellationToken = new CancellationToken(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessReadWrite_FileExists.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessReadWrite_FileExists.cs index e2d5d061c..28cfabae1 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessReadWrite_FileExists.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessReadWrite_FileExists.cs @@ -2,8 +2,11 @@ using System.IO; using System.Threading; using System.Threading.Tasks; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; @@ -32,8 +35,8 @@ protected override void SetupData() _fileMode = FileMode.Create; _fileAccess = FileAccess.ReadWrite; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint)_random.Next(5, 1000); - _writeBufferSize = (uint)_random.Next(5, 1000); + _readBufferSize = (uint) _random.Next(5, 1000); + _writeBufferSize = (uint) _random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _cancellationToken = new CancellationToken(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessWrite_FileDoesNotExist.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessWrite_FileDoesNotExist.cs index aa29b7397..4a66b9247 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessWrite_FileDoesNotExist.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessWrite_FileDoesNotExist.cs @@ -2,8 +2,11 @@ using System.IO; using System.Threading; using System.Threading.Tasks; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp @@ -31,8 +34,8 @@ protected override void SetupData() _fileMode = FileMode.Create; _fileAccess = FileAccess.Write; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint)_random.Next(5, 1000); - _writeBufferSize = (uint)_random.Next(5, 1000); + _readBufferSize = (uint) _random.Next(5, 1000); + _writeBufferSize = (uint) _random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _cancellationToken = new CancellationToken(); } @@ -131,4 +134,4 @@ public void RequestOpenOnSftpSessionShouldBeInvokedOnceWithTruncateAndOnceWithCr SftpSessionMock.Verify(p => p.RequestOpenAsync(_path, Flags.Write | Flags.CreateNewOrOpen | Flags.Truncate, _cancellationToken), Times.Once); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeInvalid.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeInvalid.cs index 075967ac2..bdafe81ce 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeInvalid.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeInvalid.cs @@ -1,7 +1,9 @@ using System; using System.IO; using System.Threading.Tasks; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessRead.cs index 15a40915a..b0bfe7fac 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessRead.cs @@ -2,8 +2,11 @@ using System.IO; using System.Threading; using System.Threading.Tasks; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; @@ -136,4 +139,4 @@ public void RequestOpenOnSftpSessionShouldBeInvokedOnce() SftpSessionMock.Verify(p => p.RequestOpenAsync(_path, Flags.Read | Flags.CreateNewOrOpen, _cancellationToken), Times.Once); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessReadWrite.cs index 5803444e4..ed1a36a91 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessReadWrite.cs @@ -35,8 +35,8 @@ protected override void SetupData() _fileMode = FileMode.OpenOrCreate; _fileAccess = FileAccess.ReadWrite; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint)_random.Next(5, 1000); - _writeBufferSize = (uint)_random.Next(5, 1000); + _readBufferSize = (uint) _random.Next(5, 1000); + _writeBufferSize = (uint) _random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _cancellationToken = new CancellationToken(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessWrite.cs index 0b69f581e..656409e7e 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessWrite.cs @@ -2,8 +2,11 @@ using System.IO; using System.Threading; using System.Threading.Tasks; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessRead.cs index 76387888f..c6ad82aa9 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessRead.cs @@ -2,8 +2,11 @@ using System.IO; using System.Threading; using System.Threading.Tasks; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; @@ -32,8 +35,8 @@ protected override void SetupData() _fileMode = FileMode.Open; _fileAccess = FileAccess.Read; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint)_random.Next(5, 1000); - _writeBufferSize = (uint)_random.Next(5, 1000); + _readBufferSize = (uint) _random.Next(5, 1000); + _writeBufferSize = (uint) _random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _cancellationToken = new CancellationToken(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessWrite.cs index db61a2a6e..9726eb683 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessWrite.cs @@ -2,8 +2,11 @@ using System.IO; using System.Threading; using System.Threading.Tasks; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeTruncate_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeTruncate_FileAccessReadWrite.cs index ecde02148..59598ac51 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeTruncate_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeTruncate_FileAccessReadWrite.cs @@ -2,8 +2,11 @@ using System.IO; using System.Threading; using System.Threading.Tasks; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeTruncate_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeTruncate_FileAccessWrite.cs index 0c06eba6a..0caf13773 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeTruncate_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeTruncate_FileAccessWrite.cs @@ -2,8 +2,11 @@ using System.IO; using System.Threading; using System.Threading.Tasks; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp @@ -131,4 +134,4 @@ public void RequestOpenOnSftpSessionShouldBeInvokedOnce() SftpSessionMock.Verify(p => p.RequestOpenAsync(_path, Flags.Write | Flags.Truncate, _cancellationToken), Times.Once); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndEqualToBufferSize.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndEqualToBufferSize.cs index ef8dbebe1..2849db04e 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndEqualToBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndEqualToBufferSize.cs @@ -1,8 +1,11 @@ using System; using System.IO; using System.Threading.Tasks; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; @@ -32,7 +35,7 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(5, random); - _bufferSize = (uint)random.Next(1, 1000); + _bufferSize = (uint) random.Next(1, 1000); _readBufferSize = 20; _writeBufferSize = 500; @@ -64,7 +67,7 @@ protected override void SetupMocks() .Setup(p => p.RequestReadAsync(_handle, 0UL, _readBufferSize, default)) .ReturnsAsync(_serverData1); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestReadAsync(_handle, (ulong)_serverData1.Length, _readBufferSize, default)) + .Setup(p => p.RequestReadAsync(_handle, (ulong) _serverData1.Length, _readBufferSize, default)) .ReturnsAsync(_serverData2); } @@ -83,7 +86,7 @@ protected override async Task ArrangeAsync() _path, FileMode.Open, FileAccess.Read, - (int)_bufferSize, + (int) _bufferSize, default); } @@ -138,7 +141,7 @@ public async Task ReadShouldReturnAllRemaningBytesFromReadBufferWhenCountIsEqual public async Task ReadShouldReturnAllRemaningBytesFromReadBufferAndReadAgainWhenCountIsGreaterThanNumberOfRemainingBytesAndNewReadReturnsZeroBytes() { SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); - SftpSessionMock.InSequence(MockSequence).Setup(p => p.RequestReadAsync(_handle, (ulong)(_serverData1Length + _serverData2Length), _readBufferSize, default)).ReturnsAsync(Array.Empty()); + SftpSessionMock.InSequence(MockSequence).Setup(p => p.RequestReadAsync(_handle, (ulong) (_serverData1Length + _serverData2Length), _readBufferSize, default)).ReturnsAsync(Array.Empty()); var numberOfBytesRemainingInReadBuffer = _serverData1Length + _serverData2Length - _numberOfBytesToRead; @@ -151,7 +154,7 @@ public async Task ReadShouldReturnAllRemaningBytesFromReadBufferAndReadAgainWhen Assert.AreEqual(0, _buffer[numberOfBytesRemainingInReadBuffer]); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(2)); - SftpSessionMock.Verify(p => p.RequestReadAsync(_handle, (ulong)(_serverData1Length + _serverData2Length), _readBufferSize, default)); + SftpSessionMock.Verify(p => p.RequestReadAsync(_handle, (ulong) (_serverData1Length + _serverData2Length), _readBufferSize, default)); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndLessThanBufferSize.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndLessThanBufferSize.cs index 9d07681a6..ada78150d 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndLessThanBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndLessThanBufferSize.cs @@ -1,8 +1,11 @@ using System; using System.IO; using System.Threading.Tasks; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Tests.Common; @@ -32,7 +35,7 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(5, random); - _bufferSize = (uint)random.Next(1, 1000); + _bufferSize = (uint) random.Next(1, 1000); _readBufferSize = 20; _writeBufferSize = 500; @@ -80,7 +83,7 @@ protected override async Task ArrangeAsync() _path, FileMode.Open, FileAccess.Read, - (int)_bufferSize, + (int) _bufferSize, default); } @@ -126,7 +129,7 @@ public async Task SubsequentReadShouldReadAgainFromCurrentPositionFromServerAndR Assert.AreEqual(0, actual); Assert.IsTrue(_originalBuffer.IsEqualTo(buffer)); - SftpSessionMock.Verify(p => p.RequestReadAsync(_handle, (ulong)_actual, _readBufferSize, default), Times.Once); + SftpSessionMock.Verify(p => p.RequestReadAsync(_handle, (ulong) _actual, _readBufferSize, default), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(2)); } @@ -135,7 +138,7 @@ public async Task SubsequentReadShouldReadAgainFromCurrentPositionFromServerAndN { SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestReadAsync(_handle, (ulong)_actual, _readBufferSize, default)) + .Setup(p => p.RequestReadAsync(_handle, (ulong) _actual, _readBufferSize, default)) .ReturnsAsync(Array.Empty()); SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); @@ -143,7 +146,7 @@ public async Task SubsequentReadShouldReadAgainFromCurrentPositionFromServerAndN Assert.AreEqual(_actual, _target.Position); - SftpSessionMock.Verify(p => p.RequestReadAsync(_handle, (ulong)_actual, _readBufferSize, default), Times.Once); + SftpSessionMock.Verify(p => p.RequestReadAsync(_handle, (ulong) _actual, _readBufferSize, default), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(3)); } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadMoreBytesFromServerThanCount.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadMoreBytesFromServerThanCount.cs index 83ae8d42b..cf87df7cf 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadMoreBytesFromServerThanCount.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadMoreBytesFromServerThanCount.cs @@ -1,10 +1,13 @@ using System; using System.IO; +using System.Threading.Tasks; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; -using Renci.SshNet.Sftp; + using Renci.SshNet.Common; -using System.Threading.Tasks; +using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp { @@ -74,7 +77,7 @@ protected override async Task ArrangeAsync() _path, FileMode.Open, FileAccess.Read, - (int)_bufferSize, + (int) _bufferSize, default); } @@ -124,7 +127,7 @@ public async Task SubsequentReadShouldReturnAllRemaningBytesFromReadBufferWhenCo public async Task SubsequentReadShouldReturnAllRemaningBytesFromReadBufferAndReadAgainWhenCountIsGreaterThanNumberOfRemainingBytesAndNewReadReturnsZeroBytes() { SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); - SftpSessionMock.InSequence(MockSequence).Setup(p => p.RequestReadAsync(_handle, (ulong)(_serverData.Length), _readBufferSize, default)).ReturnsAsync(Array.Empty()); + SftpSessionMock.InSequence(MockSequence).Setup(p => p.RequestReadAsync(_handle, (ulong) (_serverData.Length), _readBufferSize, default)).ReturnsAsync(Array.Empty()); var buffer = new byte[_numberOfBytesToWriteToReadBuffer + 1]; @@ -135,7 +138,7 @@ public async Task SubsequentReadShouldReturnAllRemaningBytesFromReadBufferAndRea Assert.AreEqual(0, buffer[_numberOfBytesToWriteToReadBuffer]); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(2)); - SftpSessionMock.Verify(p => p.RequestReadAsync(_handle, (ulong)(_serverData.Length), _readBufferSize, default)); + SftpSessionMock.Verify(p => p.RequestReadAsync(_handle, (ulong) (_serverData.Length), _readBufferSize, default)); } } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadByte_ReadMode_NoDataInWriteBufferAndNoDataInReadBuffer_Eof.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadByte_ReadMode_NoDataInWriteBufferAndNoDataInReadBuffer_Eof.cs index d3bd505a8..75cb1df3a 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadByte_ReadMode_NoDataInWriteBufferAndNoDataInReadBuffer_Eof.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadByte_ReadMode_NoDataInWriteBufferAndNoDataInReadBuffer_Eof.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp @@ -60,7 +63,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int)_bufferSize); + (int) _bufferSize); } protected override void Act() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadByte_ReadMode_NoDataInWriteBufferAndNoDataInReadBuffer_LessDataThanReadBufferSizeAvailable.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadByte_ReadMode_NoDataInWriteBufferAndNoDataInReadBuffer_LessDataThanReadBufferSizeAvailable.cs index 442c7d3d8..01ebe7b5f 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadByte_ReadMode_NoDataInWriteBufferAndNoDataInReadBuffer_LessDataThanReadBufferSizeAvailable.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadByte_ReadMode_NoDataInWriteBufferAndNoDataInReadBuffer_LessDataThanReadBufferSizeAvailable.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp @@ -65,7 +68,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int)_bufferSize); + (int) _bufferSize); } protected override void Act() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndEqualToBufferSize.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndEqualToBufferSize.cs index 3932c28a9..9103f7448 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndEqualToBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndEqualToBufferSize.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; @@ -31,7 +34,7 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(5, random); - _bufferSize = (uint)random.Next(1, 1000); + _bufferSize = (uint) random.Next(1, 1000); _readBufferSize = 20; _writeBufferSize = 500; @@ -63,7 +66,7 @@ protected override void SetupMocks() .Setup(p => p.RequestRead(_handle, 0UL, _readBufferSize)) .Returns(_serverData1); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestRead(_handle, (ulong)_serverData1.Length, _readBufferSize)) + .Setup(p => p.RequestRead(_handle, (ulong) _serverData1.Length, _readBufferSize)) .Returns(_serverData2); } @@ -82,7 +85,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int)_bufferSize); + (int) _bufferSize); } protected override void Act() @@ -136,7 +139,7 @@ public void ReadShouldReturnAllRemaningBytesFromReadBufferWhenCountIsEqualToNumb public void ReadShouldReturnAllRemaningBytesFromReadBufferAndReadAgainWhenCountIsGreaterThanNumberOfRemainingBytesAndNewReadReturnsZeroBytes() { SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); - SftpSessionMock.InSequence(MockSequence).Setup(p => p.RequestRead(_handle, (ulong)(_serverData1Length + _serverData2Length), _readBufferSize)).Returns(Array.Empty()); + SftpSessionMock.InSequence(MockSequence).Setup(p => p.RequestRead(_handle, (ulong) (_serverData1Length + _serverData2Length), _readBufferSize)).Returns(Array.Empty()); var numberOfBytesRemainingInReadBuffer = _serverData1Length + _serverData2Length - _numberOfBytesToRead; @@ -149,7 +152,7 @@ public void ReadShouldReturnAllRemaningBytesFromReadBufferAndReadAgainWhenCountI Assert.AreEqual(0, _buffer[numberOfBytesRemainingInReadBuffer]); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(2)); - SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong)(_serverData1Length + _serverData2Length), _readBufferSize)); + SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong) (_serverData1Length + _serverData2Length), _readBufferSize)); } } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndLessThanBufferSize.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndLessThanBufferSize.cs index 794f6c7b0..833f5fce1 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndLessThanBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndLessThanBufferSize.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Tests.Common; @@ -31,7 +34,7 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(5, random); - _bufferSize = (uint)random.Next(1, 1000); + _bufferSize = (uint) random.Next(1, 1000); _readBufferSize = 20; _writeBufferSize = 500; @@ -79,7 +82,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int)_bufferSize); + (int) _bufferSize); } protected override void Act() @@ -124,7 +127,7 @@ public void SubsequentReadShouldReadAgainFromCurrentPositionFromServerAndReturnZ Assert.AreEqual(0, actual); Assert.IsTrue(_originalBuffer.IsEqualTo(buffer)); - SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong)_actual, _readBufferSize), Times.Once); + SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong) _actual, _readBufferSize), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(2)); } @@ -133,7 +136,7 @@ public void SubsequentReadShouldReadAgainFromCurrentPositionFromServerAndNotUpda { SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestRead(_handle, (ulong)_actual, _readBufferSize)) + .Setup(p => p.RequestRead(_handle, (ulong) _actual, _readBufferSize)) .Returns(Array.Empty()); SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); @@ -141,7 +144,7 @@ public void SubsequentReadShouldReadAgainFromCurrentPositionFromServerAndNotUpda Assert.AreEqual(_actual, _target.Position); - SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong)_actual, _readBufferSize), Times.Once); + SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong) _actual, _readBufferSize), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(3)); } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadMoreBytesFromServerThanCount.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadMoreBytesFromServerThanCount.cs index 1f6f2cf5c..42cf319f1 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadMoreBytesFromServerThanCount.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadMoreBytesFromServerThanCount.cs @@ -1,9 +1,12 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; -using Renci.SshNet.Sftp; + using Renci.SshNet.Common; +using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp { @@ -122,7 +125,7 @@ public void SubsequentReadShouldReturnAllRemaningBytesFromReadBufferWhenCountIsE public void SubsequentReadShouldReturnAllRemaningBytesFromReadBufferAndReadAgainWhenCountIsGreaterThanNumberOfRemainingBytesAndNewReadReturnsZeroBytes() { SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); - SftpSessionMock.InSequence(MockSequence).Setup(p => p.RequestRead(_handle, (ulong)(_serverData.Length), _readBufferSize)).Returns(Array.Empty()); + SftpSessionMock.InSequence(MockSequence).Setup(p => p.RequestRead(_handle, (ulong) (_serverData.Length), _readBufferSize)).Returns(Array.Empty()); var buffer = new byte[_numberOfBytesToWriteToReadBuffer + 1]; @@ -133,7 +136,7 @@ public void SubsequentReadShouldReturnAllRemaningBytesFromReadBufferAndReadAgain Assert.AreEqual(0, buffer[_numberOfBytesToWriteToReadBuffer]); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(2)); - SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong)(_serverData.Length), _readBufferSize)); + SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong) (_serverData.Length), _readBufferSize)); } } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetNegative.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetNegative.cs index 712880d85..dd901a4e6 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetNegative.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetNegative.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp @@ -30,8 +33,8 @@ protected override void SetupData() _fileMode = FileMode.OpenOrCreate; _fileAccess = FileAccess.Read; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint)_random.Next(5, 1000); - _writeBufferSize = (uint)_random.Next(5, 1000); + _readBufferSize = (uint) _random.Next(5, 1000); + _writeBufferSize = (uint) _random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _offset = _random.Next(int.MinValue, -1); } @@ -42,10 +45,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.CreateNewOrOpen, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) .Returns(_writeBufferSize); SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetPositive.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetPositive.cs index 8bf534ee5..74f474cbd 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetPositive.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetPositive.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp @@ -30,8 +33,8 @@ protected override void SetupData() _fileMode = FileMode.OpenOrCreate; _fileAccess = FileAccess.Read; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint)_random.Next(5, 1000); - _writeBufferSize = (uint)_random.Next(5, 1000); + _readBufferSize = (uint) _random.Next(5, 1000); + _writeBufferSize = (uint) _random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _offset = _random.Next(1, int.MaxValue); } @@ -42,10 +45,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.CreateNewOrOpen, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) .Returns(_writeBufferSize); SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetZero.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetZero.cs index 27e8d96fc..8adefbb3a 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetZero.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetZero.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp @@ -29,8 +32,8 @@ protected override void SetupData() _fileMode = FileMode.OpenOrCreate; _fileAccess = FileAccess.Read; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint)_random.Next(5, 1000); - _writeBufferSize = (uint)_random.Next(5, 1000); + _readBufferSize = (uint) _random.Next(5, 1000); + _writeBufferSize = (uint) _random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); } @@ -40,10 +43,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.CreateNewOrOpen, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) .Returns(_writeBufferSize); SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetNegative.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetNegative.cs index e47e716e1..c7b7b9ee2 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetNegative.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetNegative.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp @@ -32,8 +35,8 @@ protected override void SetupData() _fileMode = FileMode.OpenOrCreate; _fileAccess = FileAccess.Write; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint)_random.Next(5, 1000); - _writeBufferSize = (uint)_random.Next(5, 1000); + _readBufferSize = (uint) _random.Next(5, 1000); + _writeBufferSize = (uint) _random.Next(5, 1000); _length = _random.Next(5, 10000); _handle = GenerateRandom(_random.Next(1, 10), _random); _offset = _random.Next(-_length, -1); @@ -46,10 +49,10 @@ protected override void SetupMocks() .Setup(session => session.RequestOpen(_path, Flags.Write | Flags.CreateNewOrOpen, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(session => session.CalculateOptimalReadLength((uint)_bufferSize)) + .Setup(session => session.CalculateOptimalReadLength((uint) _bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(session => session.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) + .Setup(session => session.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) .Returns(_writeBufferSize); SftpSessionMock.InSequence(MockSequence) .Setup(session => session.IsOpen) diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetPositive.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetPositive.cs index 506342f1a..044fa5612 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetPositive.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetPositive.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp @@ -32,8 +35,8 @@ protected override void SetupData() _fileMode = FileMode.OpenOrCreate; _fileAccess = FileAccess.Write; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint)_random.Next(5, 1000); - _writeBufferSize = (uint)_random.Next(5, 1000); + _readBufferSize = (uint) _random.Next(5, 1000); + _writeBufferSize = (uint) _random.Next(5, 1000); _length = _random.Next(5, 10000); _handle = GenerateRandom(_random.Next(1, 10), _random); _offset = _random.Next(1, int.MaxValue); @@ -46,10 +49,10 @@ protected override void SetupMocks() .Setup(session => session.RequestOpen(_path, Flags.Write | Flags.CreateNewOrOpen, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(session => session.CalculateOptimalReadLength((uint)_bufferSize)) + .Setup(session => session.CalculateOptimalReadLength((uint) _bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(session => session.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) + .Setup(session => session.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) .Returns(_writeBufferSize); SftpSessionMock.InSequence(MockSequence) .Setup(session => session.IsOpen) diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetZero.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetZero.cs index 4791acf85..1f06a5262 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetZero.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetZero.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp @@ -32,8 +35,8 @@ protected override void SetupData() _fileMode = FileMode.OpenOrCreate; _fileAccess = FileAccess.Write; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint)_random.Next(5, 1000); - _writeBufferSize = (uint)_random.Next(5, 1000); + _readBufferSize = (uint) _random.Next(5, 1000); + _writeBufferSize = (uint) _random.Next(5, 1000); _length = _random.Next(5, 10000); _handle = GenerateRandom(_random.Next(1, 10), _random); _offset = 0; @@ -46,10 +49,10 @@ protected override void SetupMocks() .Setup(session => session.RequestOpen(_path, Flags.Write | Flags.CreateNewOrOpen, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(session => session.CalculateOptimalReadLength((uint)_bufferSize)) + .Setup(session => session.CalculateOptimalReadLength((uint) _bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(session => session.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) + .Setup(session => session.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) .Returns(_writeBufferSize); SftpSessionMock.InSequence(MockSequence) .Setup(session => session.IsOpen) diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtMiddleOfStream_OriginBeginAndOffsetZero_NoBuffering.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtMiddleOfStream_OriginBeginAndOffsetZero_NoBuffering.cs index 87a7df9ad..f75203edc 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtMiddleOfStream_OriginBeginAndOffsetZero_NoBuffering.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtMiddleOfStream_OriginBeginAndOffsetZero_NoBuffering.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp @@ -44,10 +47,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.CreateNewOrOpen, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) .Returns(_writeBufferSize); SftpSessionMock.InSequence(MockSequence) .Setup(p => p.IsOpen) diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtMiddleOfStream_OriginBeginAndOffsetZero_ReadBuffer.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtMiddleOfStream_OriginBeginAndOffsetZero_ReadBuffer.cs index 3e4702e17..f7201aece 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtMiddleOfStream_OriginBeginAndOffsetZero_ReadBuffer.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtMiddleOfStream_OriginBeginAndOffsetZero_ReadBuffer.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_Closed.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_Closed.cs index 5e8cf08c5..5268af499 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_Closed.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_Closed.cs @@ -1,8 +1,11 @@ using System; using System.Globalization; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp @@ -30,10 +33,10 @@ protected void Arrange() { var random = new Random(); _path = random.Next().ToString(CultureInfo.InvariantCulture); - _handle = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) }; - _bufferSize = (uint)random.Next(1, 1000); - _readBufferSize = (uint)random.Next(0, 1000); - _writeBufferSize = (uint)random.Next(0, 1000); + _handle = new[] { (byte) random.Next(byte.MinValue, byte.MaxValue) }; + _bufferSize = (uint) random.Next(1, 1000); + _readBufferSize = (uint) random.Next(0, 1000); + _writeBufferSize = (uint) random.Next(0, 1000); _sftpSessionMock = new Mock(MockBehavior.Strict); @@ -53,7 +56,7 @@ protected void Arrange() _sftpSessionMock.InSequence(sequence) .Setup(p => p.RequestClose(_handle)); - _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Write, (int)_bufferSize); + _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Write, (int) _bufferSize); _sftpFileStream.Close(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInReadBuffer_NewLengthGreatherThanPosition.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInReadBuffer_NewLengthGreatherThanPosition.cs index 59a0135f0..7795af3a0 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInReadBuffer_NewLengthGreatherThanPosition.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInReadBuffer_NewLengthGreatherThanPosition.cs @@ -1,13 +1,16 @@ using System; using System.Globalization; using System.IO; +using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; -using Renci.SshNet.Tests.Common; using Renci.SshNet.Sftp.Responses; -using System.Threading; +using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes.Sftp @@ -150,7 +153,7 @@ public void ReadShouldReadStartFromSamePositionAsBeforeSetLength() .Setup(p => p.RequestRead(_handle, (uint) (_readBytes1.Length + _readBytes2.Length), _readBufferSize)) - .Returns(new byte[] {0x0f}); + .Returns(new byte[] { 0x0f }); var byteRead = _sftpFileStream.ReadByte(); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInReadBuffer_NewLengthLessThanPosition.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInReadBuffer_NewLengthLessThanPosition.cs index 0709896d1..0fe6cb6df 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInReadBuffer_NewLengthLessThanPosition.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInReadBuffer_NewLengthLessThanPosition.cs @@ -1,13 +1,16 @@ using System; using System.Globalization; using System.IO; +using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + +using Renci.SshNet.Common; using Renci.SshNet.Sftp; -using Renci.SshNet.Tests.Common; -using System.Threading; using Renci.SshNet.Sftp.Responses; -using Renci.SshNet.Common; +using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes.Sftp { @@ -40,9 +43,9 @@ protected override void SetupData() _path = random.Next().ToString(CultureInfo.InvariantCulture); _handle = GenerateRandom(random.Next(2, 6), random); - _bufferSize = (uint)random.Next(1, 1000); - _readBufferSize = (uint)random.Next(1, 1000); - _writeBufferSize = (uint)random.Next(100, 1000); + _bufferSize = (uint) random.Next(1, 1000); + _readBufferSize = (uint) random.Next(1, 1000); + _writeBufferSize = (uint) random.Next(100, 1000); _readBytes = new byte[5]; _actualReadBytes = GenerateRandom(_readBytes.Length + 2, random); // add 2 bytes in read buffer _length = _readBytes.Length - 2; @@ -52,7 +55,7 @@ protected override void SetupData() .WithGroupId(random.Next()) .WithLastAccessTime(DateTime.UtcNow.AddSeconds(random.Next())) .WithLastWriteTime(DateTime.UtcNow.AddSeconds(random.Next())) - .WithPermissions((uint)random.Next()) + .WithPermissions((uint) random.Next()) .WithSize(_length + 100) .WithUserId(random.Next()) .Build(); @@ -93,7 +96,7 @@ protected override void Arrange() { base.Arrange(); - _sftpFileStream = new SftpFileStream(SftpSessionMock.Object, _path, FileMode.Open, FileAccess.ReadWrite, (int)_bufferSize); + _sftpFileStream = new SftpFileStream(SftpSessionMock.Object, _path, FileMode.Open, FileAccess.ReadWrite, (int) _bufferSize); _sftpFileStream.Read(_readBytes, 0, _readBytes.Length); } @@ -167,7 +170,7 @@ public void WriteShouldStartFromEndOfStream() Assert.IsNotNull(bytesWritten); CollectionAssert.AreEqual(bytesToWrite, bytesWritten); - SftpSessionMock.Verify(p => p.RequestWrite(_handle, (uint)_length, It.IsAny(), 0, bytesToWrite.Length, It.IsAny(), null), Times.Once); + SftpSessionMock.Verify(p => p.RequestWrite(_handle, (uint) _length, It.IsAny(), 0, bytesToWrite.Length, It.IsAny(), null), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(3)); } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInWriteBuffer_NewLengthGreatherThanPosition.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInWriteBuffer_NewLengthGreatherThanPosition.cs index c71b43c85..3038ec445 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInWriteBuffer_NewLengthGreatherThanPosition.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInWriteBuffer_NewLengthGreatherThanPosition.cs @@ -1,13 +1,16 @@ using System; using System.Globalization; using System.IO; +using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + +using Renci.SshNet.Common; using Renci.SshNet.Sftp; -using Renci.SshNet.Tests.Common; -using System.Threading; using Renci.SshNet.Sftp.Responses; -using Renci.SshNet.Common; +using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes.Sftp { @@ -56,7 +59,7 @@ protected override void SetupData() .WithGroupId(random.Next()) .WithLastAccessTime(DateTime.UtcNow.AddSeconds(random.Next())) .WithLastWriteTime(DateTime.UtcNow.AddSeconds(random.Next())) - .WithPermissions((uint)random.Next()) + .WithPermissions((uint) random.Next()) .WithSize(_length + 100) .WithUserId(random.Next()) .Build(); @@ -108,7 +111,7 @@ protected override void Arrange() { base.Arrange(); - _sftpFileStream = new SftpFileStream(SftpSessionMock.Object, _path, FileMode.Open, FileAccess.ReadWrite, (int)_bufferSize); + _sftpFileStream = new SftpFileStream(SftpSessionMock.Object, _path, FileMode.Open, FileAccess.ReadWrite, (int) _bufferSize); _sftpFileStream.Read(_readBytes, 0, _readBytes.Length); _sftpFileStream.Write(new byte[] { 0x01, 0x02, 0x03, 0x04 }, 0, 4); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInWriteBuffer_NewLengthLessThanPosition.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInWriteBuffer_NewLengthLessThanPosition.cs index 42a3ce841..27df355c1 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInWriteBuffer_NewLengthLessThanPosition.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInWriteBuffer_NewLengthLessThanPosition.cs @@ -1,13 +1,16 @@ using System; using System.Globalization; using System.IO; +using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + +using Renci.SshNet.Common; using Renci.SshNet.Sftp; -using Renci.SshNet.Tests.Common; -using System.Threading; using Renci.SshNet.Sftp.Responses; -using Renci.SshNet.Common; +using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes.Sftp { @@ -166,7 +169,7 @@ public void ReadShouldStartFromEndOfStream() Assert.AreEqual(-1, byteRead); - SftpSessionMock.Verify(p => p.RequestRead(_handle, (uint)_length, _readBufferSize), Times.Once); + SftpSessionMock.Verify(p => p.RequestRead(_handle, (uint) _length, _readBufferSize), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(4)); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_Disposed.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_Disposed.cs index 22db2ac45..86dc6f020 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_Disposed.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp @@ -29,7 +32,7 @@ protected void Arrange() { var random = new Random(); _path = random.Next().ToString(); - _handle = new[] {(byte) random.Next(byte.MinValue, byte.MaxValue)}; + _handle = new[] { (byte) random.Next(byte.MinValue, byte.MaxValue) }; _bufferSize = (uint) random.Next(1, 1000); _readBufferSize = (uint) random.Next(1, 1000); _writeBufferSize = (uint) random.Next(1, 1000); @@ -52,7 +55,7 @@ protected void Arrange() _sftpSessionMock.InSequence(sequence) .Setup(p => p.RequestClose(_handle)); - _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Write, (int)_bufferSize); + _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Write, (int) _bufferSize); _sftpFileStream.Dispose(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionNotOpen.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionNotOpen.cs index b4712c716..8daf5aba7 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionNotOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionNotOpen.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessRead.cs index 9ed804644..d1459811c 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessRead.cs @@ -1,7 +1,10 @@ using System; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessReadWrite.cs index a4a96eea5..3adef51f0 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessReadWrite.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Globalization; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp @@ -42,7 +45,7 @@ protected void Arrange() { var random = new Random(); _path = random.Next().ToString(CultureInfo.InvariantCulture); - _handle = new[] {(byte) random.Next(byte.MinValue, byte.MaxValue)}; + _handle = new[] { (byte) random.Next(byte.MinValue, byte.MaxValue) }; _bufferSize = (uint) random.Next(1, 1000); _readBufferSize = (uint) random.Next(1, 1000); _writeBufferSize = (uint) random.Next(1, 1000); @@ -85,7 +88,7 @@ protected void Arrange() .Setup(p => p.RequestFSetStat(_handle, _fileAttributes)) .Callback((bytes, attributes) => _lengthPassedToRequestFSetStat = attributes.Size); - _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.ReadWrite, (int)_bufferSize); + _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.ReadWrite, (int) _bufferSize); } protected void Act() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessWrite.cs index 1ac2be5ff..5f82dbfc0 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessWrite.cs @@ -2,8 +2,11 @@ using System.Collections.Generic; using System.Globalization; using System.IO; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes.Sftp @@ -42,7 +45,7 @@ protected void Arrange() { var random = new Random(); _path = random.Next().ToString(CultureInfo.InvariantCulture); - _handle = new[] {(byte) random.Next(byte.MinValue, byte.MaxValue)}; + _handle = new[] { (byte) random.Next(byte.MinValue, byte.MaxValue) }; _bufferSize = (uint) random.Next(1, 1000); _readBufferSize = (uint) random.Next(1, 1000); _writeBufferSize = (uint) random.Next(1, 1000); @@ -53,7 +56,7 @@ protected void Arrange() _fileAttributesSize = random.Next(); _fileAttributesUserId = random.Next(); _fileAttributesGroupId = random.Next(); - _fileAttributesPermissions = (uint)random.Next(); + _fileAttributesPermissions = (uint) random.Next(); _fileAttributesExtensions = new Dictionary(); _fileAttributes = new SftpFileAttributes(_fileAttributesLastAccessTime, _fileAttributesLastWriteTime, diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_WriteAsync_SessionOpen_CountGreatherThanTwoTimesTheWriteBufferSize.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_WriteAsync_SessionOpen_CountGreatherThanTwoTimesTheWriteBufferSize.cs index 8fb74b436..f27e68685 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_WriteAsync_SessionOpen_CountGreatherThanTwoTimesTheWriteBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_WriteAsync_SessionOpen_CountGreatherThanTwoTimesTheWriteBufferSize.cs @@ -38,7 +38,7 @@ protected override void SetupData() _random = new Random(); _path = _random.Next().ToString(CultureInfo.InvariantCulture); _handle = GenerateRandom(5, _random); - _bufferSize = (uint)_random.Next(1, 1000); + _bufferSize = (uint) _random.Next(1, 1000); _readBufferSize = (uint) _random.Next(0, 1000); _writeBufferSize = (uint) _random.Next(500, 1000); _data = new byte[(_writeBufferSize * 2) + 15]; @@ -51,8 +51,8 @@ protected override void SetupData() _count = ((int) _writeBufferSize * 2) + _random.Next(1, 5); _expectedWrittenByteCount = (2 * _writeBufferSize); - _expectedBufferedByteCount = (int)(_count - _expectedWrittenByteCount); - _expectedBufferedBytes = _data.Take(_offset + (int)_expectedWrittenByteCount, _expectedBufferedByteCount); + _expectedBufferedByteCount = (int) (_count - _expectedWrittenByteCount); + _expectedBufferedBytes = _data.Take(_offset + (int) _expectedWrittenByteCount, _expectedBufferedByteCount); _cancellationToken = new CancellationToken(); } @@ -69,10 +69,10 @@ protected override void SetupMocks() .Returns(_writeBufferSize); SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestWriteAsync(_handle, 0, _data, _offset, (int)_writeBufferSize, _cancellationToken)) + .Setup(p => p.RequestWriteAsync(_handle, 0, _data, _offset, (int) _writeBufferSize, _cancellationToken)) .Returns(Task.CompletedTask); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestWriteAsync(_handle, _writeBufferSize, _data, _offset + (int)_writeBufferSize, (int)_writeBufferSize, _cancellationToken)) + .Setup(p => p.RequestWriteAsync(_handle, _writeBufferSize, _data, _offset + (int) _writeBufferSize, (int) _writeBufferSize, _cancellationToken)) .Returns(Task.CompletedTask); } @@ -108,8 +108,8 @@ protected override Task ActAsync() [TestMethod] public void RequestWriteOnSftpSessionShouldBeInvokedTwice() { - SftpSessionMock.Verify(p => p.RequestWriteAsync(_handle, 0, _data, _offset, (int)_writeBufferSize, _cancellationToken), Times.Once); - SftpSessionMock.Verify(p => p.RequestWriteAsync(_handle, _writeBufferSize, _data, _offset + (int)_writeBufferSize, (int)_writeBufferSize, _cancellationToken), Times.Once); + SftpSessionMock.Verify(p => p.RequestWriteAsync(_handle, 0, _data, _offset, (int) _writeBufferSize, _cancellationToken), Times.Once); + SftpSessionMock.Verify(p => p.RequestWriteAsync(_handle, _writeBufferSize, _data, _offset + (int) _writeBufferSize, (int) _writeBufferSize, _cancellationToken), Times.Once); } [TestMethod] diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Write_SessionOpen_CountGreatherThanTwoTimesTheWriteBufferSize.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Write_SessionOpen_CountGreatherThanTwoTimesTheWriteBufferSize.cs index 229714c39..ae669fe2f 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Write_SessionOpen_CountGreatherThanTwoTimesTheWriteBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Write_SessionOpen_CountGreatherThanTwoTimesTheWriteBufferSize.cs @@ -2,8 +2,11 @@ using System.Globalization; using System.IO; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Responses; @@ -34,7 +37,7 @@ protected override void SetupData() _random = new Random(); _path = _random.Next().ToString(CultureInfo.InvariantCulture); _handle = GenerateRandom(5, _random); - _bufferSize = (uint)_random.Next(1, 1000); + _bufferSize = (uint) _random.Next(1, 1000); _readBufferSize = (uint) _random.Next(0, 1000); _writeBufferSize = (uint) _random.Next(500, 1000); _data = new byte[(_writeBufferSize * 2) + 15]; @@ -47,8 +50,8 @@ protected override void SetupData() _count = ((int) _writeBufferSize * 2) + _random.Next(1, 5); _expectedWrittenByteCount = (2 * _writeBufferSize); - _expectedBufferedByteCount = (int)(_count - _expectedWrittenByteCount); - _expectedBufferedBytes = _data.Take(_offset + (int)_expectedWrittenByteCount, _expectedBufferedByteCount); + _expectedBufferedByteCount = (int) (_count - _expectedWrittenByteCount); + _expectedBufferedBytes = _data.Take(_offset + (int) _expectedWrittenByteCount, _expectedBufferedByteCount); } protected override void SetupMocks() @@ -64,9 +67,9 @@ protected override void SetupMocks() .Returns(_writeBufferSize); SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestWrite(_handle, 0, _data, _offset, (int)_writeBufferSize, It.IsAny(), null)); + .Setup(p => p.RequestWrite(_handle, 0, _data, _offset, (int) _writeBufferSize, It.IsAny(), null)); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestWrite(_handle, _writeBufferSize, _data, _offset + (int)_writeBufferSize, (int)_writeBufferSize, It.IsAny(), null)); + .Setup(p => p.RequestWrite(_handle, _writeBufferSize, _data, _offset + (int) _writeBufferSize, (int) _writeBufferSize, It.IsAny(), null)); } [TestCleanup] @@ -104,8 +107,8 @@ protected override void Act() [TestMethod] public void RequestWriteOnSftpSessionShouldBeInvokedTwice() { - SftpSessionMock.Verify(p => p.RequestWrite(_handle, 0, _data, _offset, (int)_writeBufferSize, It.IsAny(), null), Times.Once); - SftpSessionMock.Verify(p => p.RequestWrite(_handle, _writeBufferSize, _data, _offset + (int)_writeBufferSize, (int)_writeBufferSize, It.IsAny(), null), Times.Once); + SftpSessionMock.Verify(p => p.RequestWrite(_handle, 0, _data, _offset, (int) _writeBufferSize, It.IsAny(), null), Times.Once); + SftpSessionMock.Verify(p => p.RequestWrite(_handle, _writeBufferSize, _data, _offset + (int) _writeBufferSize, (int) _writeBufferSize, It.IsAny(), null), Times.Once); } [TestMethod] diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpHandleResponseBuilder.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpHandleResponseBuilder.cs index d9f67f61d..5e425e947 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpHandleResponseBuilder.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpHandleResponseBuilder.cs @@ -29,10 +29,10 @@ public SftpHandleResponseBuilder WithHandle(byte[] handle) public SftpHandleResponse Build() { var sftpHandleResponse = new SftpHandleResponse(_protocolVersion) - { - ResponseId = _responseId, - Handle = _handle - }; + { + ResponseId = _responseId, + Handle = _handle + }; return sftpHandleResponse; } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpNameResponseBuilder.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpNameResponseBuilder.cs index 268f1c5c5..246fd6c9e 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpNameResponseBuilder.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpNameResponseBuilder.cs @@ -1,8 +1,9 @@ -using Renci.SshNet.Sftp; -using Renci.SshNet.Sftp.Responses; -using System.Collections.Generic; +using System.Collections.Generic; using System.Text; +using Renci.SshNet.Sftp; +using Renci.SshNet.Sftp.Responses; + namespace Renci.SshNet.Tests.Classes.Sftp { internal class SftpNameResponseBuilder @@ -54,10 +55,10 @@ public SftpNameResponseBuilder WithEncoding(Encoding encoding) public SftpNameResponse Build() { var sftpNameResponse = new SftpNameResponse(_protocolVersion, _encoding) - { - ResponseId = _responseId, - Files = _files.ToArray() - }; + { + ResponseId = _responseId, + Files = _files.ToArray() + }; return sftpNameResponse; } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpReadRequestBuilder.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpReadRequestBuilder.cs index 2dc995c02..9186ee990 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpReadRequestBuilder.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpReadRequestBuilder.cs @@ -1,6 +1,7 @@ -using Renci.SshNet.Sftp.Requests; +using System; + +using Renci.SshNet.Sftp.Requests; using Renci.SshNet.Sftp.Responses; -using System; namespace Renci.SshNet.Tests.Classes.Sftp { diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpRealPathRequestBuilder.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpRealPathRequestBuilder.cs index 536e07e2c..4676bd69b 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpRealPathRequestBuilder.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpRealPathRequestBuilder.cs @@ -1,8 +1,9 @@ -using Renci.SshNet.Sftp.Requests; -using Renci.SshNet.Sftp.Responses; -using System; +using System; using System.Text; +using Renci.SshNet.Sftp.Requests; +using Renci.SshNet.Sftp.Responses; + namespace Renci.SshNet.Tests.Classes.Sftp { internal class SftpRealPathRequestBuilder diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestRead.cs index 49f50ff28..609e39620 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestRead.cs @@ -1,12 +1,15 @@ using System; using System.Linq; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + +using Renci.SshNet.Abstractions; using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Sftp; -using Renci.SshNet.Abstractions; using Renci.SshNet.Sftp.Responses; namespace Renci.SshNet.Tests.Classes.Sftp @@ -160,4 +163,4 @@ public void ReturnedValueShouldBeDataOfSftpDataResponse() Assert.IsTrue(_data.SequenceEqual(_actual)); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestStatVfs.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestStatVfs.cs index 2d5e00774..233504aa0 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestStatVfs.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestStatVfs.cs @@ -138,8 +138,8 @@ private void SetupMocks() .Setup(p => p.SendData(_sftpStatVfsRequestBytes)) .Callback(() => { - _channelSessionMock.Raise(c => c.DataReceived += null, - new ChannelDataEventArgs(0, _sftpStatVfsResponse.GetBytes())); + _channelSessionMock.Raise(c => c.DataReceived += null, + new ChannelDataEventArgs(0, _sftpStatVfsResponse.GetBytes())); }); } @@ -169,5 +169,5 @@ public void AvailableBlocksInReturnedValueShouldMatchValueInSftpResponse() { Assert.AreEqual(_bAvail, _actual.AvailableBlocks); } - } + } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesInSingleSshDataMessage.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesInSingleSshDataMessage.cs index 2b4f14e18..79814e3a9 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesInSingleSshDataMessage.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesInSingleSshDataMessage.cs @@ -1,12 +1,15 @@ using System; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + +using Renci.SshNet.Abstractions; using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Responses; -using Renci.SshNet.Abstractions; namespace Renci.SshNet.Tests.Classes.Sftp { @@ -54,7 +57,7 @@ private void SetupData() #region SftpSession.Connect() _operationTimeout = random.Next(100, 500); - _protocolVersion = (uint)random.Next(0, 3); + _protocolVersion = (uint) random.Next(0, 3); _encoding = Encoding.UTF8; _sftpInitRequestBytes = new SftpInitRequestBuilder().WithVersion(SftpSession.MaximumSupportedVersion) @@ -131,7 +134,7 @@ private void SetupMocks() new ChannelDataEventArgs(0, _sftpVersionResponse.GetBytes())); }); _sftpResponseFactoryMock.InSequence(sequence) - .Setup(p => p.Create(0U, (byte)SftpMessageTypes.Version, _encoding)) + .Setup(p => p.Create(0U, (byte) SftpMessageTypes.Version, _encoding)) .Returns(_sftpVersionResponse); _channelSessionMock.InSequence(sequence).Setup(p => p.IsOpen).Returns(true); _channelSessionMock.InSequence(sequence).Setup(p => p.SendData(_sftpRealPathRequestBytes)) @@ -141,7 +144,7 @@ private void SetupMocks() new ChannelDataEventArgs(0, _sftpNameResponse.GetBytes())); }); _sftpResponseFactoryMock.InSequence(sequence) - .Setup(p => p.Create(_protocolVersion, (byte)SftpMessageTypes.Name, _encoding)) + .Setup(p => p.Create(_protocolVersion, (byte) SftpMessageTypes.Name, _encoding)) .Returns(_sftpNameResponse); #endregion SftpSession.Connect() @@ -197,4 +200,4 @@ public void ReturnedHandleShouldBeHandleOfSftpHandleResponse() Assert.IsTrue(_handle.IsEqualTo(_actualHandle)); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesSplitOverMultipleSshDataMessages.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesSplitOverMultipleSshDataMessages.cs index ab5a646b0..bf455910c 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesSplitOverMultipleSshDataMessages.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesSplitOverMultipleSshDataMessages.cs @@ -1,12 +1,15 @@ using System; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + +using Renci.SshNet.Abstractions; using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Responses; -using Renci.SshNet.Abstractions; namespace Renci.SshNet.Tests.Classes.Sftp { @@ -54,7 +57,7 @@ private void SetupData() #region SftpSession.Connect() _operationTimeout = random.Next(100, 500); - _protocolVersion = (uint)random.Next(0, 3); + _protocolVersion = (uint) random.Next(0, 3); _encoding = Encoding.UTF8; _sftpInitRequestBytes = new SftpInitRequestBuilder().WithVersion(SftpSession.MaximumSupportedVersion) @@ -131,7 +134,7 @@ private void SetupMocks() new ChannelDataEventArgs(0, _sftpVersionResponse.GetBytes())); }); _sftpResponseFactoryMock.InSequence(sequence) - .Setup(p => p.Create(0U, (byte)SftpMessageTypes.Version, _encoding)) + .Setup(p => p.Create(0U, (byte) SftpMessageTypes.Version, _encoding)) .Returns(_sftpVersionResponse); _channelSessionMock.InSequence(sequence).Setup(p => p.IsOpen).Returns(true); _channelSessionMock.InSequence(sequence).Setup(p => p.SendData(_sftpRealPathRequestBytes)) @@ -141,7 +144,7 @@ private void SetupMocks() new ChannelDataEventArgs(0, _sftpNameResponse.GetBytes())); }); _sftpResponseFactoryMock.InSequence(sequence) - .Setup(p => p.Create(_protocolVersion, (byte)SftpMessageTypes.Name, _encoding)) + .Setup(p => p.Create(_protocolVersion, (byte) SftpMessageTypes.Name, _encoding)) .Returns(_sftpNameResponse); #endregion SftpSession.Connect() @@ -204,4 +207,4 @@ public void ReturnedHandleShouldBeHandleOfSftpHandleResponse() Assert.IsTrue(_handle.IsEqualTo(_actualHandle)); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_SingleSftpMessageInSshDataMessage.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_SingleSftpMessageInSshDataMessage.cs index 4c55d66f1..dae1ca72f 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_SingleSftpMessageInSshDataMessage.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_SingleSftpMessageInSshDataMessage.cs @@ -1,12 +1,15 @@ using System; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + +using Renci.SshNet.Abstractions; using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Sftp; using Renci.SshNet.Sftp.Responses; -using Renci.SshNet.Abstractions; namespace Renci.SshNet.Tests.Classes.Sftp { @@ -162,4 +165,4 @@ public void ReturnedValueShouldBeDataOfSftpDataResponse() Assert.IsTrue(_data.IsEqualTo(_actual)); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpStatVfsRequestBuilder.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpStatVfsRequestBuilder.cs index d52b208a4..a5bd0c4c2 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpStatVfsRequestBuilder.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpStatVfsRequestBuilder.cs @@ -1,9 +1,9 @@ -using Renci.SshNet.Sftp.Requests; -using Renci.SshNet.Sftp.Responses; - -using System; +using System; using System.Text; +using Renci.SshNet.Sftp.Requests; +using Renci.SshNet.Sftp.Responses; + namespace Renci.SshNet.Tests.Classes.Sftp { internal class SftpStatVfsRequestBuilder @@ -44,7 +44,7 @@ public SftpStatVfsRequestBuilder WithExtendedAction(Action statusAction) { _statusAction = statusAction; diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpVersionResponseBuilder.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpVersionResponseBuilder.cs index 1e4d55efd..f69af49bd 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpVersionResponseBuilder.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpVersionResponseBuilder.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; + using Renci.SshNet.Sftp.Responses; namespace Renci.SshNet.Tests.Classes.Sftp @@ -28,10 +29,10 @@ public SftpVersionResponseBuilder WithExtension(string name, string data) public SftpVersionResponse Build() { var sftpVersionResponse = new SftpVersionResponse() - { - Version = _version, - Extentions = _extensions - }; + { + Version = _version, + Extentions = _extensions + }; return sftpVersionResponse; } } diff --git a/test/Renci.SshNet.Tests/Classes/SftpClientTest.Connect.cs b/test/Renci.SshNet.Tests/Classes/SftpClientTest.Connect.cs index db03567b4..499fc3045 100644 --- a/test/Renci.SshNet.Tests/Classes/SftpClientTest.Connect.cs +++ b/test/Renci.SshNet.Tests/Classes/SftpClientTest.Connect.cs @@ -1,4 +1,5 @@ using System.Net.Sockets; + using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/SftpClientTest.ConnectAsync.cs b/test/Renci.SshNet.Tests/Classes/SftpClientTest.ConnectAsync.cs index 88ab436db..170ac63be 100644 --- a/test/Renci.SshNet.Tests/Classes/SftpClientTest.ConnectAsync.cs +++ b/test/Renci.SshNet.Tests/Classes/SftpClientTest.ConnectAsync.cs @@ -1,6 +1,7 @@ using System; using System.Net.Sockets; using System.Threading.Tasks; + using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/SftpClientTest.DeleteDirectory.cs b/test/Renci.SshNet.Tests/Classes/SftpClientTest.DeleteDirectory.cs index d25fb37fd..c7d02323a 100644 --- a/test/Renci.SshNet.Tests/Classes/SftpClientTest.DeleteDirectory.cs +++ b/test/Renci.SshNet.Tests/Classes/SftpClientTest.DeleteDirectory.cs @@ -1,4 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Tests.Properties; diff --git a/test/Renci.SshNet.Tests/Classes/SftpClientTest.DeleteFile.cs b/test/Renci.SshNet.Tests/Classes/SftpClientTest.DeleteFile.cs index d3a615d43..b287ed6d1 100644 --- a/test/Renci.SshNet.Tests/Classes/SftpClientTest.DeleteFile.cs +++ b/test/Renci.SshNet.Tests/Classes/SftpClientTest.DeleteFile.cs @@ -1,6 +1,8 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Tests.Properties; -using System; namespace Renci.SshNet.Tests.Classes { @@ -21,4 +23,4 @@ public void Test_Sftp_DeleteFile_Null() } } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/SftpClientTest.DeleteFileAsync.cs b/test/Renci.SshNet.Tests/Classes/SftpClientTest.DeleteFileAsync.cs index 9d8464377..520023df9 100644 --- a/test/Renci.SshNet.Tests/Classes/SftpClientTest.DeleteFileAsync.cs +++ b/test/Renci.SshNet.Tests/Classes/SftpClientTest.DeleteFileAsync.cs @@ -1,8 +1,10 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Renci.SshNet.Tests.Properties; -using System; +using System; using System.Threading.Tasks; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Renci.SshNet.Tests.Properties; + namespace Renci.SshNet.Tests.Classes { /// @@ -22,4 +24,4 @@ public async Task Test_Sftp_DeleteFileAsync_Null() } } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/SftpClientTest.ListDirectory.cs b/test/Renci.SshNet.Tests/Classes/SftpClientTest.ListDirectory.cs index f44016ecb..c49fa0241 100644 --- a/test/Renci.SshNet.Tests/Classes/SftpClientTest.ListDirectory.cs +++ b/test/Renci.SshNet.Tests/Classes/SftpClientTest.ListDirectory.cs @@ -1,5 +1,7 @@ using System.Diagnostics; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Tests.Properties; diff --git a/test/Renci.SshNet.Tests/Classes/SftpClientTest.ListDirectoryAsync.cs b/test/Renci.SshNet.Tests/Classes/SftpClientTest.ListDirectoryAsync.cs index c800452eb..858eadc4b 100644 --- a/test/Renci.SshNet.Tests/Classes/SftpClientTest.ListDirectoryAsync.cs +++ b/test/Renci.SshNet.Tests/Classes/SftpClientTest.ListDirectoryAsync.cs @@ -1,7 +1,9 @@ using System.Diagnostics; using System.Threading; using System.Threading.Tasks; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Tests.Properties; diff --git a/test/Renci.SshNet.Tests/Classes/SftpClientTest.cs b/test/Renci.SshNet.Tests/Classes/SftpClientTest.cs index 37915174a..8e8ecd3a2 100644 --- a/test/Renci.SshNet.Tests/Classes/SftpClientTest.cs +++ b/test/Renci.SshNet.Tests/Classes/SftpClientTest.cs @@ -1,6 +1,8 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Tests.Common; -using System; namespace Renci.SshNet.Tests.Classes { @@ -35,9 +37,9 @@ public void OperationTimeout_InsideLimits() var operationTimeout = TimeSpan.FromMilliseconds(_random.Next(0, int.MaxValue - 1)); var connectionInfo = new PasswordConnectionInfo("host", 22, "admin", "pwd"); var target = new SftpClient(connectionInfo) - { - OperationTimeout = operationTimeout - }; + { + OperationTimeout = operationTimeout + }; var actual = target.OperationTimeout; @@ -50,9 +52,9 @@ public void OperationTimeout_LowerLimit() var operationTimeout = TimeSpan.FromMilliseconds(-1); var connectionInfo = new PasswordConnectionInfo("host", 22, "admin", "pwd"); var target = new SftpClient(connectionInfo) - { - OperationTimeout = operationTimeout - }; + { + OperationTimeout = operationTimeout + }; var actual = target.OperationTimeout; @@ -65,9 +67,9 @@ public void OperationTimeout_UpperLimit() var operationTimeout = TimeSpan.FromMilliseconds(int.MaxValue); var connectionInfo = new PasswordConnectionInfo("host", 22, "admin", "pwd"); var target = new SftpClient(connectionInfo) - { - OperationTimeout = operationTimeout - }; + { + OperationTimeout = operationTimeout + }; var actual = target.OperationTimeout; diff --git a/test/Renci.SshNet.Tests/Classes/SftpClientTestBase.cs b/test/Renci.SshNet.Tests/Classes/SftpClientTestBase.cs index e0ca2c91c..6a739dd9d 100644 --- a/test/Renci.SshNet.Tests/Classes/SftpClientTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/SftpClientTestBase.cs @@ -1,4 +1,5 @@ using Moq; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/SftpClientTest_Connect_SftpSessionConnectFailure.cs b/test/Renci.SshNet.Tests/Classes/SftpClientTest_Connect_SftpSessionConnectFailure.cs index 1b2a068c1..b8d85e0af 100644 --- a/test/Renci.SshNet.Tests/Classes/SftpClientTest_Connect_SftpSessionConnectFailure.cs +++ b/test/Renci.SshNet.Tests/Classes/SftpClientTest_Connect_SftpSessionConnectFailure.cs @@ -121,7 +121,7 @@ private static KeyHostAlgorithm GetKeyHostAlgorithm() using (var s = TestBase.GetData("Key.RSA.txt")) { var privateKey = new PrivateKeyFile(s); - return (KeyHostAlgorithm)privateKey.HostKeyAlgorithms.First(); + return (KeyHostAlgorithm) privateKey.HostKeyAlgorithms.First(); } } } diff --git a/test/Renci.SshNet.Tests/Classes/SftpClientTest_Dispose_Connected.cs b/test/Renci.SshNet.Tests/Classes/SftpClientTest_Dispose_Connected.cs index fe8ef9f63..ccbe418f6 100644 --- a/test/Renci.SshNet.Tests/Classes/SftpClientTest_Dispose_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SftpClientTest_Dispose_Connected.cs @@ -18,9 +18,9 @@ protected override void SetupData() _connectionInfo = new ConnectionInfo("host", "user", new NoneAuthenticationMethod("userauth")); _operationTimeout = new Random().Next(1000, 10000); _sftpClient = new SftpClient(_connectionInfo, false, ServiceFactoryMock.Object) - { - OperationTimeout = TimeSpan.FromMilliseconds(_operationTimeout) - }; + { + OperationTimeout = TimeSpan.FromMilliseconds(_operationTimeout) + }; } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/SftpClientTest_Dispose_Disconnected.cs b/test/Renci.SshNet.Tests/Classes/SftpClientTest_Dispose_Disconnected.cs index 0f8d0a469..693a9aa89 100644 --- a/test/Renci.SshNet.Tests/Classes/SftpClientTest_Dispose_Disconnected.cs +++ b/test/Renci.SshNet.Tests/Classes/SftpClientTest_Dispose_Disconnected.cs @@ -19,9 +19,9 @@ protected override void SetupData() _connectionInfo = new ConnectionInfo("host", "user", new NoneAuthenticationMethod("userauth")); _operationTimeout = new Random().Next(1000, 10000); _sftpClient = new SftpClient(_connectionInfo, false, ServiceFactoryMock.Object) - { - OperationTimeout = TimeSpan.FromMilliseconds(_operationTimeout) - }; + { + OperationTimeout = TimeSpan.FromMilliseconds(_operationTimeout) + }; } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/SftpClientTest_Dispose_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SftpClientTest_Dispose_Disposed.cs index 09208b8bc..473c29c02 100644 --- a/test/Renci.SshNet.Tests/Classes/SftpClientTest_Dispose_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/SftpClientTest_Dispose_Disposed.cs @@ -18,9 +18,9 @@ protected override void SetupData() _connectionInfo = new ConnectionInfo("host", "user", new NoneAuthenticationMethod("userauth")); _operationTimeout = new Random().Next(1000, 10000); _sftpClient = new SftpClient(_connectionInfo, false, ServiceFactoryMock.Object) - { - OperationTimeout = TimeSpan.FromMilliseconds(_operationTimeout) - }; + { + OperationTimeout = TimeSpan.FromMilliseconds(_operationTimeout) + }; } protected override void SetupMocks() diff --git a/test/Renci.SshNet.Tests/Classes/SftpClientTest_Finalize_Connected.cs b/test/Renci.SshNet.Tests/Classes/SftpClientTest_Finalize_Connected.cs index f98f6dad2..d096bba04 100644 --- a/test/Renci.SshNet.Tests/Classes/SftpClientTest_Finalize_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SftpClientTest_Finalize_Connected.cs @@ -19,9 +19,9 @@ protected override void SetupData() _connectionInfo = new ConnectionInfo("host", "user", new NoneAuthenticationMethod("userauth")); _operationTimeout = new Random().Next(1000, 10000); _sftpClient = new SftpClient(_connectionInfo, false, ServiceFactoryMock.Object) - { - OperationTimeout = TimeSpan.FromMilliseconds(_operationTimeout) - }; + { + OperationTimeout = TimeSpan.FromMilliseconds(_operationTimeout) + }; _sftpClientWeakRefence = new WeakReference(_sftpClient); } diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs index bc7f10d65..a7fb08247 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs @@ -3,8 +3,11 @@ using System.Globalization; using System.Text; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Tests.Common; @@ -37,8 +40,8 @@ protected override void OnInit() _terminalName = random.Next().ToString(CultureInfo.InvariantCulture); _widthColumns = (uint) random.Next(); _heightRows = (uint) random.Next(); - _widthPixels = (uint)random.Next(); - _heightPixels = (uint)random.Next(); + _widthPixels = (uint) random.Next(); + _heightPixels = (uint) random.Next(); _terminalModes = new Dictionary(); _bufferSize = random.Next(100, 500); @@ -95,7 +98,7 @@ public void WriteLine_Line_ShouldOnlyWriteLineTerminatorWhenLineIsNull() var shellStream = CreateShellStream(); const string line = null; var lineTerminator = _encoding.GetBytes("\r"); - + _ = _channelSessionMock.Setup(p => p.SendData( It.Is(data => data.Take(lineTerminator.Length).IsEqualTo(lineTerminator)), 0, diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteLessBytesThanBufferSize.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteLessBytesThanBufferSize.cs index 0668177d2..6df25acfc 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteLessBytesThanBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteLessBytesThanBufferSize.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Abstractions; using Renci.SshNet.Channels; using Renci.SshNet.Common; diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteMoreBytesThanBufferSize.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteMoreBytesThanBufferSize.cs index 64f95687e..f29cfc5e0 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteMoreBytesThanBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteMoreBytesThanBufferSize.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Abstractions; using Renci.SshNet.Channels; using Renci.SshNet.Common; @@ -44,10 +47,10 @@ private void SetupData() var random = new Random(); _terminalName = random.Next().ToString(); - _widthColumns = (uint)random.Next(); - _heightRows = (uint)random.Next(); - _widthPixels = (uint)random.Next(); - _heightPixels = (uint)random.Next(); + _widthColumns = (uint) random.Next(); + _heightRows = (uint) random.Next(); + _widthPixels = (uint) random.Next(); + _heightPixels = (uint) random.Next(); _terminalModes = new Dictionary(); _bufferSize = random.Next(100, 1000); diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteNumberOfBytesEqualToBufferSize.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteNumberOfBytesEqualToBufferSize.cs index d3d380036..4727a3146 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteNumberOfBytesEqualToBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteNumberOfBytesEqualToBufferSize.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Abstractions; using Renci.SshNet.Channels; using Renci.SshNet.Common; @@ -41,10 +44,10 @@ private void SetupData() var random = new Random(); _terminalName = random.Next().ToString(); - _widthColumns = (uint)random.Next(); - _heightRows = (uint)random.Next(); - _widthPixels = (uint)random.Next(); - _heightPixels = (uint)random.Next(); + _widthColumns = (uint) random.Next(); + _heightRows = (uint) random.Next(); + _widthPixels = (uint) random.Next(); + _heightPixels = (uint) random.Next(); _terminalModes = new Dictionary(); _bufferSize = random.Next(100, 1000); diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteZeroBytes.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteZeroBytes.cs index 94d55ca87..2355f758d 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteZeroBytes.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteZeroBytes.cs @@ -43,10 +43,10 @@ private void SetupData() var random = new Random(); _terminalName = random.Next().ToString(); - _widthColumns = (uint)random.Next(); - _heightRows = (uint)random.Next(); - _widthPixels = (uint)random.Next(); - _heightPixels = (uint)random.Next(); + _widthColumns = (uint) random.Next(); + _heightRows = (uint) random.Next(); + _widthPixels = (uint) random.Next(); + _heightPixels = (uint) random.Next(); _terminalModes = new Dictionary(); _bufferSize = random.Next(100, 1000); diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteLessBytesThanBufferSize.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteLessBytesThanBufferSize.cs index 40b095355..4da481227 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteLessBytesThanBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteLessBytesThanBufferSize.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Abstractions; using Renci.SshNet.Channels; using Renci.SshNet.Common; @@ -42,10 +45,10 @@ private void SetupData() var random = new Random(); _terminalName = random.Next().ToString(); - _widthColumns = (uint)random.Next(); - _heightRows = (uint)random.Next(); - _widthPixels = (uint)random.Next(); - _heightPixels = (uint)random.Next(); + _widthColumns = (uint) random.Next(); + _heightRows = (uint) random.Next(); + _widthPixels = (uint) random.Next(); + _heightPixels = (uint) random.Next(); _terminalModes = new Dictionary(); _bufferSize = random.Next(100, 1000); diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteZeroBytes.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteZeroBytes.cs index b58c0e970..fe20b4fc9 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteZeroBytes.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteZeroBytes.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Abstractions; using Renci.SshNet.Channels; using Renci.SshNet.Common; diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteLessBytesThanBufferCanContain.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteLessBytesThanBufferCanContain.cs index 99ed903e9..afa0346fe 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteLessBytesThanBufferCanContain.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteLessBytesThanBufferCanContain.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Abstractions; using Renci.SshNet.Channels; using Renci.SshNet.Common; diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteMoreBytesThanBufferCanContain.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteMoreBytesThanBufferCanContain.cs index de57d0512..fa938b863 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteMoreBytesThanBufferCanContain.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteMoreBytesThanBufferCanContain.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Abstractions; using Renci.SshNet.Channels; using Renci.SshNet.Common; diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteZeroBytes.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteZeroBytes.cs index c1c7d39ec..cd7be2ede 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteZeroBytes.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteZeroBytes.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Abstractions; using Renci.SshNet.Channels; using Renci.SshNet.Common; @@ -42,10 +45,10 @@ private void SetupData() var random = new Random(); _terminalName = random.Next().ToString(); - _widthColumns = (uint)random.Next(); - _heightRows = (uint)random.Next(); - _widthPixels = (uint)random.Next(); - _heightPixels = (uint)random.Next(); + _widthColumns = (uint) random.Next(); + _heightRows = (uint) random.Next(); + _widthPixels = (uint) random.Next(); + _heightPixels = (uint) random.Next(); _terminalModes = new Dictionary(); _bufferSize = random.Next(100, 1000); diff --git a/test/Renci.SshNet.Tests/Classes/SshClientTest.cs b/test/Renci.SshNet.Tests/Classes/SshClientTest.cs index e0012d7bd..063442823 100644 --- a/test/Renci.SshNet.Tests/Classes/SshClientTest.cs +++ b/test/Renci.SshNet.Tests/Classes/SshClientTest.cs @@ -1,12 +1,13 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Collections.Generic; +using System.IO; +using System.Text; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Tests.Common; using Renci.SshNet.Tests.Properties; -using System.Collections.Generic; -using System.IO; -using System.Text; - namespace Renci.SshNet.Tests.Classes { /// diff --git a/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSizeAndTerminalModes_Connected.cs b/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSizeAndTerminalModes_Connected.cs index 4dc5a2063..113c9cd76 100644 --- a/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSizeAndTerminalModes_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSizeAndTerminalModes_Connected.cs @@ -1,7 +1,10 @@ using System; using System.Collections.Generic; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; @@ -133,4 +136,4 @@ private ShellStream CreateShellStream() 1); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSize_Connected.cs b/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSize_Connected.cs index 861c8c725..41111de5c 100644 --- a/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSize_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSize_Connected.cs @@ -29,10 +29,10 @@ protected override void SetupData() _connectionInfo = new ConnectionInfo("host", "user", new NoneAuthenticationMethod("userauth")); _terminalName = random.Next().ToString(); - _widthColumns = (uint)random.Next(); - _heightRows = (uint)random.Next(); - _widthPixels = (uint)random.Next(); - _heightPixels = (uint)random.Next(); + _widthColumns = (uint) random.Next(); + _heightRows = (uint) random.Next(); + _widthPixels = (uint) random.Next(); + _heightPixels = (uint) random.Next(); _bufferSize = random.Next(100, 1000); _expected = CreateShellStream(); diff --git a/test/Renci.SshNet.Tests/Classes/SshClientTest_Disconnect_ForwardedPortStarted.cs b/test/Renci.SshNet.Tests/Classes/SshClientTest_Disconnect_ForwardedPortStarted.cs index 234512645..3f437fa0f 100644 --- a/test/Renci.SshNet.Tests/Classes/SshClientTest_Disconnect_ForwardedPortStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/SshClientTest_Disconnect_ForwardedPortStarted.cs @@ -1,5 +1,7 @@ using System.Linq; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/SshClientTest_Dispose_Connected.cs b/test/Renci.SshNet.Tests/Classes/SshClientTest_Dispose_Connected.cs index fd10b8937..8a96ed49f 100644 --- a/test/Renci.SshNet.Tests/Classes/SshClientTest_Dispose_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SshClientTest_Dispose_Connected.cs @@ -1,4 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/SshClientTest_Dispose_Disconnected.cs b/test/Renci.SshNet.Tests/Classes/SshClientTest_Dispose_Disconnected.cs index bae18feb5..ff475de9c 100644 --- a/test/Renci.SshNet.Tests/Classes/SshClientTest_Dispose_Disconnected.cs +++ b/test/Renci.SshNet.Tests/Classes/SshClientTest_Dispose_Disconnected.cs @@ -1,4 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/SshClientTest_Dispose_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SshClientTest_Dispose_Disposed.cs index c4dcf868a..47b7d0071 100644 --- a/test/Renci.SshNet.Tests/Classes/SshClientTest_Dispose_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/SshClientTest_Dispose_Disposed.cs @@ -1,4 +1,5 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/SshClientTest_Dispose_ForwardedPortStarted.cs b/test/Renci.SshNet.Tests/Classes/SshClientTest_Dispose_ForwardedPortStarted.cs index 213e11ef3..e7badbf36 100644 --- a/test/Renci.SshNet.Tests/Classes/SshClientTest_Dispose_ForwardedPortStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/SshClientTest_Dispose_ForwardedPortStarted.cs @@ -1,6 +1,8 @@ using System; using System.Linq; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; namespace Renci.SshNet.Tests.Classes @@ -76,7 +78,7 @@ public void IsConnectedShouldThrowObjectDisposedException() { var connected = _sshClient.IsConnected; Assert.Fail("IsConnected should have thrown {0} but returned {1}.", - typeof (ObjectDisposedException).FullName, connected); + typeof(ObjectDisposedException).FullName, connected); } catch (ObjectDisposedException) { diff --git a/test/Renci.SshNet.Tests/Classes/SshCommandTest.cs b/test/Renci.SshNet.Tests/Classes/SshCommandTest.cs index 13419a0da..a2b6c356e 100644 --- a/test/Renci.SshNet.Tests/Classes/SshCommandTest.cs +++ b/test/Renci.SshNet.Tests/Classes/SshCommandTest.cs @@ -1,8 +1,10 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Tests.Common; using Renci.SshNet.Tests.Properties; -using System; namespace Renci.SshNet.Tests.Classes { diff --git a/test/Renci.SshNet.Tests/Classes/SshCommandTest_BeginExecute_EndExecuteInvokedOnAsyncResultFromPreviousInvocation.cs b/test/Renci.SshNet.Tests/Classes/SshCommandTest_BeginExecute_EndExecuteInvokedOnAsyncResultFromPreviousInvocation.cs index 7f6be4a29..eff6e30aa 100644 --- a/test/Renci.SshNet.Tests/Classes/SshCommandTest_BeginExecute_EndExecuteInvokedOnAsyncResultFromPreviousInvocation.cs +++ b/test/Renci.SshNet.Tests/Classes/SshCommandTest_BeginExecute_EndExecuteInvokedOnAsyncResultFromPreviousInvocation.cs @@ -1,8 +1,11 @@ using System; using System.Globalization; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Tests.Common; diff --git a/test/Renci.SshNet.Tests/Classes/SshCommandTest_BeginExecute_EndExecuteNotInvokedOnAsyncResultFromPreviousInvocation.cs b/test/Renci.SshNet.Tests/Classes/SshCommandTest_BeginExecute_EndExecuteNotInvokedOnAsyncResultFromPreviousInvocation.cs index 2d259c01a..f968eb006 100644 --- a/test/Renci.SshNet.Tests/Classes/SshCommandTest_BeginExecute_EndExecuteNotInvokedOnAsyncResultFromPreviousInvocation.cs +++ b/test/Renci.SshNet.Tests/Classes/SshCommandTest_BeginExecute_EndExecuteNotInvokedOnAsyncResultFromPreviousInvocation.cs @@ -1,8 +1,11 @@ using System; using System.Globalization; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Tests.Common; diff --git a/test/Renci.SshNet.Tests/Classes/SshCommandTest_Dispose.cs b/test/Renci.SshNet.Tests/Classes/SshCommandTest_Dispose.cs index c51f8499f..61f671306 100644 --- a/test/Renci.SshNet.Tests/Classes/SshCommandTest_Dispose.cs +++ b/test/Renci.SshNet.Tests/Classes/SshCommandTest_Dispose.cs @@ -2,8 +2,11 @@ using System.Globalization; using System.IO; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Tests.Common; diff --git a/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute.cs b/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute.cs index ac7d0f6f8..51d4de496 100644 --- a/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute.cs +++ b/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute.cs @@ -1,8 +1,11 @@ using System; using System.Globalization; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Tests.Common; diff --git a/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_AsyncResultIsNull.cs b/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_AsyncResultIsNull.cs index 500a7169e..9029c3e4c 100644 --- a/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_AsyncResultIsNull.cs +++ b/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_AsyncResultIsNull.cs @@ -1,8 +1,11 @@ using System; using System.Globalization; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes diff --git a/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_ChannelOpen.cs b/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_ChannelOpen.cs index 0001a9184..f535f6d97 100644 --- a/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_ChannelOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_ChannelOpen.cs @@ -1,8 +1,11 @@ using System; using System.Globalization; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -99,7 +102,7 @@ public void EndExecuteShouldThrowArgumentExceptionWhenInvokedAgainWithSameAsyncR } catch (ArgumentException ex) { - Assert.AreEqual(typeof (ArgumentException), ex.GetType()); + Assert.AreEqual(typeof(ArgumentException), ex.GetType()); Assert.IsNull(ex.InnerException); Assert.AreEqual("EndExecute can only be called once for each asynchronous operation.", ex.Message); Assert.IsNull(ex.ParamName); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Connected.cs index a8fcb4dd1..238b277a9 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Connected.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Globalization; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Disposed.cs index 2d90ce740..5f538bc33 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_Disposed.cs @@ -77,7 +77,7 @@ protected void Act() public void ConnectShouldThrowObjectDisposedException() { Assert.IsNotNull(_actualException); - Assert.AreEqual(string.Format("Cannot access a disposed object.{0}Object name: '{1}'.", Environment.NewLine, _actualException.ObjectName),_actualException.Message); + Assert.AreEqual(string.Format("Cannot access a disposed object.{0}Object name: '{1}'.", Environment.NewLine, _actualException.ObjectName), _actualException.Message); Assert.AreEqual(typeof(SubsystemSessionStub).FullName, _actualException.ObjectName); } diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_SendSubsystemRequestFails.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_SendSubsystemRequestFails.cs index c3639a408..3df4c98ce 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_SendSubsystemRequestFails.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_Connect_SendSubsystemRequestFails.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Globalization; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Connected.cs index f8187a90c..81f5519e3 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Connected.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Globalization; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; @@ -36,8 +39,8 @@ protected void Arrange() _disconnectedRegister = new List(); _errorOccurredRegister = new List(); _channelDataEventArgs = new ChannelDataEventArgs( - (uint)random.Next(0, int.MaxValue), - new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) }); + (uint) random.Next(0, int.MaxValue), + new[] { (byte) random.Next(byte.MinValue, byte.MaxValue) }); _sessionMock = new Mock(MockBehavior.Strict); _channelMock = new Mock(MockBehavior.Strict); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Disposed.cs index 33dfac889..dd74ada28 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Disposed.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Globalization; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; @@ -35,8 +38,8 @@ protected void Arrange() _disconnectedRegister = new List(); _errorOccurredRegister = new List(); _channelDataEventArgs = new ChannelDataEventArgs( - (uint)random.Next(0, int.MaxValue), - new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) }); + (uint) random.Next(0, int.MaxValue), + new[] { (byte) random.Next(byte.MinValue, byte.MaxValue) }); _sessionMock = new Mock(MockBehavior.Strict); _channelMock = new Mock(MockBehavior.Strict); 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 43b9bbe3a..c3fe6cf33 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_OnDataReceived_Exception.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_OnDataReceived_Exception.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Globalization; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Tests.Common; @@ -21,7 +24,7 @@ public class SubsystemSession_OnChannelDataReceived_OnDataReceived_Exception private IList _errorOccurredRegister; private ChannelDataEventArgs _channelDataEventArgs; private Exception _onDataReceivedException; - + [TestInitialize] public void Setup() { @@ -38,7 +41,7 @@ protected void Arrange() _errorOccurredRegister = new List(); _channelDataEventArgs = new ChannelDataEventArgs( (uint) random.Next(0, int.MaxValue), - new [] {(byte) random.Next(byte.MinValue, byte.MaxValue)}); + new[] { (byte) random.Next(byte.MinValue, byte.MaxValue) }); _onDataReceivedException = new SystemException(); _sessionMock = new Mock(MockBehavior.Strict); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Connected.cs index e283c3220..5ab10b053 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Connected.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Globalization; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Tests.Common; diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Disposed.cs index 9f6f054ec..19df7854f 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Disposed.cs @@ -22,7 +22,7 @@ public class SubsystemSession_OnChannelException_Disposed private IList _disconnectedRegister; private IList _errorOccurredRegister; private ExceptionEventArgs _channelExceptionEventArgs; - + [TestInitialize] public void Setup() { diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionDisconnected_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionDisconnected_Disposed.cs index 177bbff33..cd555b47e 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionDisconnected_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionDisconnected_Disposed.cs @@ -21,7 +21,7 @@ public class SubsystemSession_OnSessionDisconnected_Disposed private int _operationTimeout; private IList _disconnectedRegister; private IList _errorOccurredRegister; - + [TestInitialize] public void Setup() { diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Connected.cs index 32151eb93..ebb5b859b 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Connected.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Globalization; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; using Renci.SshNet.Tests.Common; diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Disposed.cs index df18c0428..6a7f45665 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnSessionErrorOccurred_Disposed.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Globalization; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Connected.cs index 11a455c77..7e3b5a74e 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Connected.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Globalization; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; @@ -35,7 +38,7 @@ protected void Arrange() _operationTimeout = 30000; _disconnectedRegister = new List(); _errorOccurredRegister = new List(); - _data = new[] {(byte) random.Next(byte.MinValue, byte.MaxValue)}; + _data = new[] { (byte) random.Next(byte.MinValue, byte.MaxValue) }; _sessionMock = new Mock(MockBehavior.Strict); _channelMock = new Mock(MockBehavior.Strict); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Disposed.cs index b8ebc7fa8..121545be1 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Disposed.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Globalization; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_NeverConnected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_NeverConnected.cs index 3dd9f5cc1..b76436415 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_NeverConnected.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_NeverConnected.cs @@ -1,8 +1,11 @@ using System; using System.Collections.Generic; using System.Globalization; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Channels; using Renci.SshNet.Common; @@ -36,7 +39,7 @@ protected void Arrange() _operationTimeout = 30000; _disconnectedRegister = new List(); _errorOccurredRegister = new List(); - _data = new[] {(byte) random.Next(byte.MinValue, byte.MaxValue)}; + _data = new[] { (byte) random.Next(byte.MinValue, byte.MaxValue) }; _sessionMock = new Mock(MockBehavior.Strict); _channelMock = new Mock(MockBehavior.Strict); diff --git a/test/Renci.SshNet.Tests/Common/ArgumentExceptionAssert.cs b/test/Renci.SshNet.Tests/Common/ArgumentExceptionAssert.cs index 5caee457d..86f5d9247 100644 --- a/test/Renci.SshNet.Tests/Common/ArgumentExceptionAssert.cs +++ b/test/Renci.SshNet.Tests/Common/ArgumentExceptionAssert.cs @@ -1,4 +1,5 @@ using System; + using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Renci.SshNet.Tests.Common @@ -12,4 +13,4 @@ public static void MessageEquals(string expected, ArgumentException exception) Assert.AreEqual(newMessage.Message, exception.Message); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Common/AsyncSocketListener.cs b/test/Renci.SshNet.Tests/Common/AsyncSocketListener.cs index 0f7dac81f..d7bfbbbc3 100644 --- a/test/Renci.SshNet.Tests/Common/AsyncSocketListener.cs +++ b/test/Renci.SshNet.Tests/Common/AsyncSocketListener.cs @@ -103,7 +103,7 @@ private void StartListener(object state) { try { - var listener = (Socket)state; + var listener = (Socket) state; while (_started) { _ = _acceptCallbackDone.Reset(); @@ -128,7 +128,7 @@ private void AcceptCallback(IAsyncResult ar) _ = _acceptCallbackDone.Set(); // Get the socket that listens for inbound connections - var listener = (Socket)ar.AsyncState; + var listener = (Socket) ar.AsyncState; // Get the socket that handles the client request Socket handler; @@ -185,7 +185,7 @@ private void AcceptCallback(IAsyncResult ar) try { - _ =handler.BeginReceive(state.Buffer, 0, state.Buffer.Length, 0, ReadCallback, state); + _ = handler.BeginReceive(state.Buffer, 0, state.Buffer.Length, 0, ReadCallback, state); } catch (SocketException ex) { @@ -225,7 +225,7 @@ private void ReadCallback(IAsyncResult ar) { // Retrieve the state object and the handler socket // from the asynchronous state object - var state = (SocketStateObject)ar.AsyncState; + var state = (SocketStateObject) ar.AsyncState; var handler = state.Socket; int bytesRead; diff --git a/test/Renci.SshNet.Tests/Common/DictionaryAssert.cs b/test/Renci.SshNet.Tests/Common/DictionaryAssert.cs index ec45fb61a..6ebc89824 100644 --- a/test/Renci.SshNet.Tests/Common/DictionaryAssert.cs +++ b/test/Renci.SshNet.Tests/Common/DictionaryAssert.cs @@ -1,5 +1,6 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Collections.Generic; +using System.Collections.Generic; + +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Renci.SshNet.Tests.Common { diff --git a/test/Renci.SshNet.Tests/Common/Extensions.cs b/test/Renci.SshNet.Tests/Common/Extensions.cs index 2c2e04bef..5f8b1e319 100644 --- a/test/Renci.SshNet.Tests/Common/Extensions.cs +++ b/test/Renci.SshNet.Tests/Common/Extensions.cs @@ -1,6 +1,7 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; + using Renci.SshNet.Common; -using System; using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Common diff --git a/test/Renci.SshNet.Tests/Common/SftpFileAttributesBuilder.cs b/test/Renci.SshNet.Tests/Common/SftpFileAttributesBuilder.cs index 92521316e..ca14b16ca 100644 --- a/test/Renci.SshNet.Tests/Common/SftpFileAttributesBuilder.cs +++ b/test/Renci.SshNet.Tests/Common/SftpFileAttributesBuilder.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; + using Renci.SshNet.Sftp; namespace Renci.SshNet.Tests.Common diff --git a/test/Renci.SshNet.Tests/Common/TestBase.cs b/test/Renci.SshNet.Tests/Common/TestBase.cs index fb3768f21..66fe5c8e3 100644 --- a/test/Renci.SshNet.Tests/Common/TestBase.cs +++ b/test/Renci.SshNet.Tests/Common/TestBase.cs @@ -1,8 +1,9 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; +using System; using System.IO; using System.Reflection; +using Microsoft.VisualStudio.TestTools.UnitTesting; + namespace Renci.SshNet.Tests.Common { [TestClass] From e44b4f9096bc209e074028d4ddb9acf0b02c0ff6 Mon Sep 17 00:00:00 2001 From: Marius Thesing Date: Tue, 30 Apr 2024 17:35:41 +0200 Subject: [PATCH 3/9] new formatting fixes after merge --- ...onnectorTest_Connect_TimeoutConnectionReply.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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 a20137383..907f4ab6a 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_TimeoutConnectionReply.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_TimeoutConnectionReply.cs @@ -37,10 +37,12 @@ protected override void SetupData() _clientSocket = SocketFactory.Create(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); _proxyServer = new AsyncSocketListener(new IPEndPoint(IPAddress.Loopback, _connectionInfo.ProxyPort)); - _proxyServer.BytesReceived += (bytesReceived, socket) => { + _proxyServer.BytesReceived += (bytesReceived, socket) => + { _bytesReceivedByProxy.AddRange(bytesReceived); - if (_bytesReceivedByProxy.Count == 4) { + if (_bytesReceivedByProxy.Count == 4) + { _ = socket.Send(new byte[] { // SOCKS version @@ -76,10 +78,12 @@ protected override void Act() _ = Connector.Connect(_connectionInfo); Assert.Fail(); } - catch (SocketException ex) { + catch (SocketException ex) + { _actualException = ex; } - catch (SshOperationTimeoutException ex) { + catch (SshOperationTimeoutException ex) + { _actualException = ex; } finally @@ -89,7 +93,8 @@ protected override void Act() } [TestMethod] - public void ConnectShouldHaveThrownSshOperationTimeoutException() { + public void ConnectShouldHaveThrownSshOperationTimeoutException() + { Assert.IsNull(_actualException.InnerException); Assert.IsInstanceOfType(_actualException); } From 8412b2aac5da1346e1110c5e1090e8621d775dbd Mon Sep 17 00:00:00 2001 From: Marius Thesing Date: Tue, 30 Apr 2024 17:37:28 +0200 Subject: [PATCH 4/9] appveyor: set git autocrlf as suggested by sharwell to hopefully fix Windows CI. --- appveyor.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 53e5a05fb..7411c2104 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,8 @@ image: - Ubuntu2204 - Visual Studio 2022 +init: + - git config --global core.autocrlf true services: - docker From 60eca338d6e2de11458575dcc9a6ca154584185f Mon Sep 17 00:00:00 2001 From: Marius Thesing Date: Thu, 16 May 2024 21:21:10 +0200 Subject: [PATCH 5/9] use autocrlf input to hopefully fix Linux tests --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 7411c2104..68895fcbc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,7 +2,7 @@ image: - Ubuntu2204 - Visual Studio 2022 init: - - git config --global core.autocrlf true + - git config --global core.autocrlf input services: - docker From 992cb30db9c408b3715c8c891b579880d24ef731 Mon Sep 17 00:00:00 2001 From: Marius Thesing Date: Thu, 16 May 2024 21:25:35 +0200 Subject: [PATCH 6/9] fix formatting --- .../Classes/Security/Cryptography/RsaKeyTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/RsaKeyTest.cs b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/RsaKeyTest.cs index ce222a8e4..161c02947 100644 --- a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/RsaKeyTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/RsaKeyTest.cs @@ -35,7 +35,7 @@ private static void AssertEqual(byte[] actualBytes, string expectedHex) // e.g. sudo ssh-keygen -f Key.OPENSSH.RSA.Encrypted.txt -m PKCS8 -p // or sudo openssl pkcs8 -topk8 -nocrypt -in Key.RSA.Encrypted.Aes.128.CBC.12345.txt -out Key.RSA.Encrypted.Aes.128.CBC.12345.PKCS8.txt - + /* Something like this: using IndentedTextWriter tw = new(Console.Out); From 1c1ad5faf71e925e07d9b35e0d0b13f303c3c059 Mon Sep 17 00:00:00 2001 From: Marius Thesing Date: Thu, 16 May 2024 21:38:01 +0200 Subject: [PATCH 7/9] use autocrlf input for Linux only --- appveyor.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 68895fcbc..0b3ea9afa 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,8 +1,6 @@ image: - Ubuntu2204 - Visual Studio 2022 -init: - - git config --global core.autocrlf input services: - docker @@ -12,6 +10,9 @@ for: matrix: only: - image: Ubuntu2204 + + init: + - git config --global core.autocrlf input before_build: - sh: mkdir artifacts -p @@ -32,6 +33,9 @@ for: only: - image: Visual Studio 2022 + init: + - git config --global core.autocrlf true + before_build: - ps: mkdir artifacts -f From 6b102e3fc0fe65e17db40d7e2b36836fd17ca65c Mon Sep 17 00:00:00 2001 From: Marius Thesing Date: Thu, 16 May 2024 22:39:08 +0200 Subject: [PATCH 8/9] set csharp_space_after_cast to false --- .editorconfig | 2 +- .../Abstractions/SocketAbstraction.cs | 4 +- .../Abstractions/SocketExtensions.cs | 10 +- src/Renci.SshNet/AuthenticationMethod.cs | 2 +- src/Renci.SshNet/Channels/Channel.cs | 6 +- .../Channels/ChannelDirectTcpip.cs | 4 +- src/Renci.SshNet/Common/BigInteger.cs | 336 +++++++++--------- src/Renci.SshNet/Common/DerData.cs | 12 +- src/Renci.SshNet/Common/Pack.cs | 100 +++--- src/Renci.SshNet/Common/SshData.cs | 6 +- src/Renci.SshNet/Common/SshDataStream.cs | 10 +- src/Renci.SshNet/Common/TaskToAsyncResult.cs | 2 +- src/Renci.SshNet/Common/TimeSpanExtensions.cs | 2 +- src/Renci.SshNet/Connection/HttpConnector.cs | 2 +- src/Renci.SshNet/Connection/ProxyConnector.cs | 4 +- .../Connection/Socks4Connector.cs | 2 +- .../Connection/Socks5Connector.cs | 6 +- src/Renci.SshNet/ForwardedPortDynamic.cs | 4 +- src/Renci.SshNet/ForwardedPortLocal.cs | 8 +- src/Renci.SshNet/ForwardedPortRemote.cs | 2 +- .../InformationResponseMessage.cs | 2 +- .../PseudoTerminalRequestInfo.cs | 6 +- src/Renci.SshNet/Messages/Message.cs | 6 +- .../Messages/Transport/DisconnectMessage.cs | 4 +- .../PrivateKeyAuthenticationMethod.cs | 4 +- src/Renci.SshNet/PrivateKeyFile.cs | 26 +- src/Renci.SshNet/ScpClient.cs | 8 +- .../Cryptography/Ciphers/AesCipher.cs | 2 +- .../Cryptography/Ciphers/Arc4Cipher.cs | 4 +- .../Cryptography/Ciphers/CastCipher.cs | 42 +-- .../Cryptography/Ciphers/DesCipher.cs | 26 +- .../Ciphers/Modes/CfbCipherMode.cs | 4 +- .../Ciphers/Modes/CtrCipherMode.cs | 2 +- .../Ciphers/Modes/OfbCipherMode.cs | 2 +- .../Ciphers/Paddings/PKCS5Padding.cs | 2 +- .../Ciphers/Paddings/PKCS7Padding.cs | 2 +- .../Cryptography/Ciphers/SerpentCipher.cs | 14 +- .../Cryptography/Ciphers/TwofishCipher.cs | 50 +-- .../Cryptography/EcdsaDigitalSignature.cs | 2 +- .../Security/Cryptography/EcdsaKey.cs | 4 +- src/Renci.SshNet/Security/KeyExchange.cs | 2 +- src/Renci.SshNet/Security/KeyExchangeECDH.cs | 4 +- src/Renci.SshNet/ServiceFactory.cs | 2 +- src/Renci.SshNet/Session.cs | 16 +- .../Sftp/Requests/SftpOpenRequest.cs | 2 +- .../Sftp/Responses/SftpNameResponse.cs | 2 +- .../Sftp/Responses/SftpStatusResponse.cs | 2 +- src/Renci.SshNet/Sftp/SftpFileAttributes.cs | 18 +- src/Renci.SshNet/Sftp/SftpFileReader.cs | 14 +- src/Renci.SshNet/Sftp/SftpFileStream.cs | 32 +- src/Renci.SshNet/Sftp/SftpMessage.cs | 4 +- src/Renci.SshNet/Sftp/SftpResponseFactory.cs | 2 +- src/Renci.SshNet/Sftp/SftpSession.cs | 48 +-- src/Renci.SshNet/SftpClient.cs | 18 +- src/Renci.SshNet/Shell.cs | 2 +- src/Renci.SshNet/SshCommand.cs | 4 +- .../Common/HostKeyEventArgsBenchmarks.cs | 2 +- .../ED25519DigitalSignatureBenchmarks.cs | 2 +- .../RsaDigitalSignatureBenchmarks.cs | 2 +- .../Common/Socks5Handler.cs | 10 +- .../ConnectivityTests.cs | 10 +- .../ForwardedPortLocalTest.cs | 8 +- .../SftpTests.cs | 12 +- .../Renci.SshNet.IntegrationTests/SshTests.cs | 16 +- .../SshdConfig.cs | 2 +- ...Test_Connect_OnConnectedThrowsException.cs | 2 +- .../Channels/ChannelDirectTcpipTest.cs | 20 +- ...pose_SessionIsConnectedAndChannelIsOpen.cs | 14 +- ...pose_SessionIsConnectedAndChannelIsOpen.cs | 12 +- .../ChannelSessionTest_Dispose_Disposed.cs | 12 +- ...hannelEofReceived_DisposeInEventHandler.cs | 12 +- ...Received_SendChannelCloseMessageFailure.cs | 12 +- ...Received_SendChannelCloseMessageSuccess.cs | 12 +- ...Received_SendChannelCloseMessageFailure.cs | 12 +- ...Received_SendChannelCloseMessageSuccess.cs | 12 +- ...Received_SendChannelCloseMessageFailure.cs | 12 +- ...Received_SendChannelCloseMessageSuccess.cs | 12 +- ...Open_NoChannelCloseOrChannelEofReceived.cs | 12 +- ...ofReceived_SendChannelEofMessageFailure.cs | 12 +- ...sOpen_ChannelCloseAndChannelEofReceived.cs | 12 +- ...edAndChannelIsOpen_ChannelCloseReceived.cs | 12 +- ...Open_NoChannelCloseOrChannelEofReceived.cs | 12 +- ...ived_SessionIsConnectedAndChannelIsOpen.cs | 12 +- ...Open_ExceptionWaitingOnOpenConfirmation.cs | 6 +- ...nOpenFailureReceived_NoRetriesAvailable.cs | 8 +- ...n_OnOpenFailureReceived_RetriesAvalable.cs | 14 +- ...e_SessionIsConnectedAndChannelIsNotOpen.cs | 6 +- ...onnectedAndChannelIsOpen_EofNotReceived.cs | 12 +- ...nelIsOpen_EofNotReceived_SendEofInvoked.cs | 12 +- ...IsConnectedAndChannelIsOpen_EofReceived.cs | 12 +- ...DisconnectWaitingForChannelCloseMessage.cs | 12 +- ...ed_TimeoutWaitingForChannelCloseMessage.cs | 12 +- ...essionIsNotConnectedAndChannelIsNotOpen.cs | 6 +- ...e_SessionIsNotConnectedAndChannelIsOpen.cs | 6 +- ...nChannelCloseReceived_OnClose_Exception.cs | 4 +- ...Open_DisposeChannelInClosedEventHandler.cs | 12 +- ...onnectedAndChannelIsOpen_EofNotReceived.cs | 12 +- ...IsConnectedAndChannelIsOpen_EofReceived.cs | 12 +- ...ionChannelDataReceived_OnData_Exception.cs | 4 +- ...ssionChannelEofReceived_OnEof_Exception.cs | 12 +- ...edDataReceived_OnExtendedData_Exception.cs | 4 +- ...nnelFailureReceived_OnFailure_Exception.cs | 6 +- ...nelRequestReceived_HandleUnknownMessage.cs | 10 +- ...nnelRequestReceived_OnRequest_Exception.cs | 4 +- ...nnelSuccessReceived_OnSuccess_Exception.cs | 6 +- ...AdjustReceived_OnWindowAdjust_Exception.cs | 10 +- ...onDisconnected_OnDisconnected_Exception.cs | 4 +- ...cted_SessionIsConnectedAndChannelIsOpen.cs | 12 +- ...ErrorOccurred_OnErrorOccurred_Exception.cs | 4 +- .../ChannelTest_SendEof_ChannelIsNotOpen.cs | 6 +- .../ChannelTest_SendEof_ChannelIsOpen.cs | 12 +- ...onReceived_OnOpenConfirmation_Exception.cs | 6 +- ...FailureReceived_OnOpenFailure_Exception.cs | 4 +- .../Classes/Common/BigIntegerTest.cs | 266 +++++++------- .../Classes/Common/HostKeyEventArgsTest.cs | 2 +- .../Classes/Common/PackTest.cs | 10 +- .../Classes/Common/SshDataTest.cs | 4 +- .../Classes/Common/TimeSpanExtensionsTest.cs | 8 +- .../Connection/Socks5ConnectorTestBase.cs | 2 +- ...Connect_ProxySocksVersionIsNotSupported.cs | 2 +- ...wordAuthentication_AuthenticationFailed.cs | 4 +- ...swordAuthentication_ConnectionSucceeded.cs | 4 +- .../Classes/ConnectionInfoTest.cs | 4 +- .../Classes/ForwardedPortDynamicTest.cs | 4 +- ...ortDynamicTest_Dispose_PortNeverStarted.cs | 2 +- ...icTest_Dispose_PortStarted_ChannelBound.cs | 8 +- ...est_Dispose_PortStarted_ChannelNotBound.cs | 2 +- ...rdedPortDynamicTest_Dispose_PortStopped.cs | 2 +- ...cTest_SessionErrorOccurred_ChannelBound.cs | 8 +- ...dPortDynamicTest_Start_PortNeverStarted.cs | 2 +- ...wardedPortDynamicTest_Start_PortStarted.cs | 2 +- ...wardedPortDynamicTest_Start_PortStopped.cs | 2 +- ...rtDynamicTest_Start_SessionNotConnected.cs | 2 +- ...wardedPortDynamicTest_Start_SessionNull.cs | 2 +- ...t_Started_SocketSendShutdownImmediately.cs | 2 +- ...wardedPortDynamicTest_Stop_PortDisposed.cs | 2 +- ...edPortDynamicTest_Stop_PortNeverStarted.cs | 2 +- ...namicTest_Stop_PortStarted_ChannelBound.cs | 6 +- ...icTest_Stop_PortStarted_ChannelNotBound.cs | 2 +- ...rwardedPortDynamicTest_Stop_PortStopped.cs | 2 +- ...dPortLocalTest_Dispose_PortNeverStarted.cs | 4 +- ...alTest_Dispose_PortStarted_ChannelBound.cs | 2 +- ...est_Dispose_PortStarted_ChannelNotBound.cs | 4 +- ...wardedPortLocalTest_Dispose_PortStopped.cs | 2 +- ...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 +- ...rdedPortLocalTest_Stop_PortNeverStarted.cs | 4 +- ...LocalTest_Stop_PortStarted_ChannelBound.cs | 2 +- ...alTest_Stop_PortStarted_ChannelNotBound.cs | 4 +- ...ForwardedPortLocalTest_Stop_PortStopped.cs | 4 +- ...rdedPortRemoteTest_Dispose_PortDisposed.cs | 2 +- ...PortRemoteTest_Dispose_PortNeverStarted.cs | 10 +- ...teTest_Dispose_PortStarted_ChannelBound.cs | 24 +- ...ardedPortRemoteTest_Dispose_PortStopped.cs | 10 +- ...wardedPortRemoteTest_Start_PortDisposed.cs | 2 +- ...edPortRemoteTest_Start_PortNeverStarted.cs | 10 +- ...rwardedPortRemoteTest_Start_PortStarted.cs | 10 +- ...rwardedPortRemoteTest_Start_PortStopped.cs | 10 +- ...ortRemoteTest_Start_SessionNotConnected.cs | 10 +- ...rwardedPortRemoteTest_Start_SessionNull.cs | 2 +- .../ForwardedPortRemoteTest_Started.cs | 32 +- ...rwardedPortRemoteTest_Stop_PortDisposed.cs | 2 +- ...dedPortRemoteTest_Stop_PortNeverStarted.cs | 10 +- .../Connection/ChannelDataMessageTest.cs | 14 +- .../ChannelOpen/ChannelOpenMessageTest.cs | 54 +-- .../ChannelRequest/PseudoTerminalInfoTest.cs | 20 +- .../Messages/Transport/IgnoreMessageTest.cs | 2 +- .../KeyExchangeDhGroupExchangeReplyBuilder.cs | 4 +- .../KeyExchangeDhGroupExchangeRequestTest.cs | 6 +- ...st_Connect_NetConfSessionConnectFailure.cs | 2 +- .../PasswordAuthenticationMethodTest.cs | 2 +- .../Classes/PasswordConnectionInfoTest.cs | 2 +- ...ientTest_Upload_FileInfoAndPath_Success.cs | 4 +- .../Cryptography/Ciphers/AesCipherTest.cs | 160 ++++----- .../Cryptography/RsaDigitalSignatureTest.cs | 2 +- .../Security/Cryptography/RsaKeyTest.cs | 4 +- .../Classes/Security/KeyAlgorithmTest.cs | 2 +- .../ServiceFactoryTest_CreateConnector.cs | 10 +- ...tpFileReader_EndLStatThrowsSshException.cs | 4 +- ...izeIsAlmostSixTimesGreaterThanChunkSize.cs | 4 +- ...tpFileReader_FileSizeIsEqualToChunkSize.cs | 4 +- ...eIsExactlyFiveTimesGreaterThanChunkSize.cs | 4 +- ...pFileReader_FileSizeIsLessThanChunkSize.cs | 4 +- ...leMoreThanFiveTimesGreaterThanChunkSize.cs | 4 +- ...IsMoreThanMaxPendingReadsTimesChunkSize.cs | 4 +- ...est_CreateSftpFileReader_FileSizeIsZero.cs | 4 +- .../SessionTest_ConnectToServerFails.cs | 16 +- .../Classes/SessionTest_Connected.cs | 22 +- .../Classes/SessionTest_ConnectedBase.cs | 14 +- .../SessionTest_Connected_ConnectionReset.cs | 16 +- .../SessionTest_Connected_Disconnect.cs | 14 +- ...Connected_ServerAndClientDisconnectRace.cs | 14 +- ...sionTest_Connected_ServerSendsBadPacket.cs | 16 +- ..._Connected_ServerSendsDisconnectMessage.cs | 14 +- ...endsDisconnectMessageAndShutsDownSocket.cs | 12 +- ...ected_ServerSendsUnsupportedMessageType.cs | 16 +- ...utsDownSendAfterSendingIncompletePacket.cs | 16 +- ...ionTest_Connected_ServerShutsDownSocket.cs | 20 +- .../Classes/SessionTest_ConnectingBase.cs | 12 +- .../Classes/SessionTest_NotConnected.cs | 16 +- .../ExtendedRequests/FStatVfsRequestTest.cs | 12 +- .../ExtendedRequests/HardLinkRequestTest.cs | 14 +- .../PosixRenameRequestTest.cs | 14 +- .../ExtendedRequests/StatVfsRequestTest.cs | 12 +- .../Sftp/Requests/SftpBlockRequestTest.cs | 16 +- .../Sftp/Requests/SftpCloseRequestTest.cs | 10 +- .../Sftp/Requests/SftpFSetStatRequestTest.cs | 10 +- .../Sftp/Requests/SftpFStatRequestTest.cs | 10 +- .../Sftp/Requests/SftpLStatRequestTest.cs | 10 +- .../Sftp/Requests/SftpLinkRequestTest.cs | 12 +- .../Sftp/Requests/SftpMkDirRequestTest.cs | 10 +- .../Sftp/Requests/SftpOpenDirRequestTest.cs | 10 +- .../Sftp/Requests/SftpOpenRequestTest.cs | 12 +- .../Sftp/Requests/SftpReadDirRequestTest.cs | 10 +- .../Sftp/Requests/SftpReadLinkRequestTest.cs | 10 +- .../Sftp/Requests/SftpReadRequestTest.cs | 14 +- .../Sftp/Requests/SftpRealPathRequestTest.cs | 10 +- .../Sftp/Requests/SftpRemoveRequestTest.cs | 10 +- .../Sftp/Requests/SftpRenameRequestTest.cs | 12 +- .../Sftp/Requests/SftpRmDirRequestTest.cs | 10 +- .../Sftp/Requests/SftpSetStatRequestTest.cs | 10 +- .../Sftp/Requests/SftpStatRequestTest.cs | 10 +- .../Sftp/Requests/SftpSymLinkRequestTest.cs | 12 +- .../Sftp/Requests/SftpUnblockRequestTest.cs | 14 +- .../Sftp/Requests/SftpWriteRequestTest.cs | 14 +- .../ExtendedReplies/StatVfsReplyInfoTest.cs | 24 +- .../Sftp/Responses/SftpAttrsResponseTest.cs | 6 +- .../Sftp/Responses/SftpDataResponseTest.cs | 8 +- .../SftpExtendedReplyResponseTest.cs | 30 +- .../Sftp/Responses/SftpHandleResponseTest.cs | 8 +- ...ReaderTest_LastChunkBeforeEofIsComplete.cs | 4 +- ...eReaderTest_LastChunkBeforeEofIsPartial.cs | 6 +- ...iousChunkIsIncompleteAndEofIsNotReached.cs | 12 +- ...reviousChunkIsIncompleteAndEofIsReached.cs | 6 +- ...vokeException_DiscardsFurtherReadAheads.cs | 6 +- ...vokeException_PreventsFurtherReadAheads.cs | 4 +- ...Test_Read_ReadAheadExceptionInBeginRead.cs | 4 +- ...dExceptionInWaitOnHandle_ChunkAvailable.cs | 2 +- ...xceptionInWaitOnHandle_NoChunkAvailable.cs | 2 +- ...treamTest_CanRead_Closed_FileAccessRead.cs | 8 +- ...Test_CanRead_Closed_FileAccessReadWrite.cs | 8 +- ...reamTest_CanRead_Closed_FileAccessWrite.cs | 8 +- ...eamTest_CanRead_Disposed_FileAccessRead.cs | 8 +- ...st_CanRead_Disposed_FileAccessReadWrite.cs | 8 +- ...amTest_CanRead_Disposed_FileAccessWrite.cs | 8 +- ...reamTest_CanWrite_Closed_FileAccessRead.cs | 8 +- ...est_CanWrite_Closed_FileAccessReadWrite.cs | 8 +- ...eamTest_CanWrite_Closed_FileAccessWrite.cs | 8 +- ...amTest_CanWrite_Disposed_FileAccessRead.cs | 8 +- ...t_CanWrite_Disposed_FileAccessReadWrite.cs | 8 +- ...mTest_CanWrite_Disposed_FileAccessWrite.cs | 8 +- .../Sftp/SftpFileStreamTest_Close_Closed.cs | 10 +- .../Sftp/SftpFileStreamTest_Close_Disposed.cs | 8 +- ...SftpFileStreamTest_Close_SessionNotOpen.cs | 8 +- .../SftpFileStreamTest_Close_SessionOpen.cs | 8 +- ...est_Ctor_FileModeAppend_FileAccessWrite.cs | 14 +- ...r_FileModeCreateNew_FileAccessReadWrite.cs | 8 +- ..._Ctor_FileModeCreateNew_FileAccessWrite.cs | 8 +- ...te_FileAccessReadWrite_FileDoesNotExist.cs | 10 +- ...deCreate_FileAccessReadWrite_FileExists.cs | 8 +- ...Create_FileAccessWrite_FileDoesNotExist.cs | 10 +- ...leModeCreate_FileAccessWrite_FileExists.cs | 8 +- ...tor_FileModeOpenOrCreate_FileAccessRead.cs | 8 +- ...ileModeOpenOrCreate_FileAccessReadWrite.cs | 8 +- ...or_FileModeOpenOrCreate_FileAccessWrite.cs | 8 +- ...amTest_Ctor_FileModeOpen_FileAccessRead.cs | 8 +- ...t_Ctor_FileModeOpen_FileAccessReadWrite.cs | 8 +- ...mTest_Ctor_FileModeOpen_FileAccessWrite.cs | 8 +- ...or_FileModeTruncate_FileAccessReadWrite.cs | 8 +- ...t_Ctor_FileModeTruncate_FileAccessWrite.cs | 8 +- .../Sftp/SftpFileStreamTest_Dispose_Closed.cs | 8 +- .../SftpFileStreamTest_Dispose_Disposed.cs | 8 +- ...tpFileStreamTest_Dispose_SessionNotOpen.cs | 8 +- .../SftpFileStreamTest_Dispose_SessionOpen.cs | 8 +- ...SftpFileStreamTest_Finalize_SessionOpen.cs | 8 +- ...ReadMode_DataInBuffer_NotReadFromBuffer.cs | 10 +- ...sh_ReadMode_DataInBuffer_ReadFromBuffer.cs | 10 +- ...treamTest_Flush_ReadMode_NoDataInBuffer.cs | 10 +- ...SftpFileStreamTest_Flush_SessionNotOpen.cs | 4 +- ...StreamTest_Flush_WriteMode_DataInBuffer.cs | 10 +- ...reamTest_Flush_WriteMode_NoDataInBuffer.cs | 8 +- ...penAsync_FileModeAppend_FileAccessWrite.cs | 14 +- ...c_FileModeCreateNew_FileAccessReadWrite.cs | 8 +- ...Async_FileModeCreateNew_FileAccessWrite.cs | 8 +- ...te_FileAccessReadWrite_FileDoesNotExist.cs | 8 +- ...deCreate_FileAccessReadWrite_FileExists.cs | 8 +- ...Create_FileAccessWrite_FileDoesNotExist.cs | 8 +- ...leModeCreate_FileAccessWrite_FileExists.cs | 8 +- ...ync_FileModeOpenOrCreate_FileAccessRead.cs | 8 +- ...ileModeOpenOrCreate_FileAccessReadWrite.cs | 8 +- ...nc_FileModeOpenOrCreate_FileAccessWrite.cs | 8 +- ...t_OpenAsync_FileModeOpen_FileAccessRead.cs | 8 +- ...nAsync_FileModeOpen_FileAccessReadWrite.cs | 8 +- ..._OpenAsync_FileModeOpen_FileAccessWrite.cs | 8 +- ...nc_FileModeTruncate_FileAccessReadWrite.cs | 8 +- ...nAsync_FileModeTruncate_FileAccessWrite.cs | 8 +- ...FromServerThanCountAndEqualToBufferSize.cs | 16 +- ...romServerThanCountAndLessThanBufferSize.cs | 16 +- ...fferAndReadMoreBytesFromServerThanCount.cs | 8 +- ...aInWriteBufferAndNoDataInReadBuffer_Eof.cs | 8 +- ...fer_LessDataThanReadBufferSizeAvailable.cs | 10 +- ...FromServerThanCountAndEqualToBufferSize.cs | 16 +- ...romServerThanCountAndLessThanBufferSize.cs | 16 +- ...fferAndReadMoreBytesFromServerThanCount.cs | 8 +- ...ngOfStream_OriginBeginAndOffsetNegative.cs | 8 +- ...ngOfStream_OriginBeginAndOffsetPositive.cs | 8 +- ...inningOfStream_OriginBeginAndOffsetZero.cs | 8 +- ...ningOfStream_OriginEndAndOffsetNegative.cs | 8 +- ...ningOfStream_OriginEndAndOffsetPositive.cs | 8 +- ...eginningOfStream_OriginEndAndOffsetZero.cs | 8 +- ...am_OriginBeginAndOffsetZero_NoBuffering.cs | 6 +- ...eam_OriginBeginAndOffsetZero_ReadBuffer.cs | 10 +- .../SftpFileStreamTest_SetLength_Closed.cs | 10 +- ...eadBuffer_NewLengthGreatherThanPosition.cs | 18 +- ...aInReadBuffer_NewLengthLessThanPosition.cs | 18 +- ...iteBuffer_NewLengthGreatherThanPosition.cs | 20 +- ...InWriteBuffer_NewLengthLessThanPosition.cs | 20 +- .../SftpFileStreamTest_SetLength_Disposed.cs | 10 +- ...FileStreamTest_SetLength_SessionNotOpen.cs | 8 +- ...st_SetLength_SessionOpen_FileAccessRead.cs | 8 +- ...tLength_SessionOpen_FileAccessReadWrite.cs | 12 +- ...t_SetLength_SessionOpen_FileAccessWrite.cs | 12 +- ...tGreatherThanTwoTimesTheWriteBufferSize.cs | 22 +- ...tGreatherThanTwoTimesTheWriteBufferSize.cs | 22 +- .../SftpSessionTest_Connected_RequestRead.cs | 8 +- ...ftpSessionTest_Connected_RequestStatVfs.cs | 2 +- ...tipleSftpMessagesInSingleSshDataMessage.cs | 14 +- ...essagesSplitOverMultipleSshDataMessages.cs | 14 +- ...eived_SingleSftpMessageInSshDataMessage.cs | 12 +- ...tTest_Connect_SftpSessionConnectFailure.cs | 2 +- .../Classes/ShellStreamTest.cs | 8 +- ...ferEmptyAndWriteLessBytesThanBufferSize.cs | 8 +- ...ferEmptyAndWriteMoreBytesThanBufferSize.cs | 8 +- ...yAndWriteNumberOfBytesEqualToBufferSize.cs | 8 +- ...Write_WriteBufferEmptyAndWriteZeroBytes.cs | 8 +- ...fferFullAndWriteLessBytesThanBufferSize.cs | 8 +- ..._Write_WriteBufferFullAndWriteZeroBytes.cs | 8 +- ...tyAndWriteLessBytesThanBufferCanContain.cs | 8 +- ...tyAndWriteMoreBytesThanBufferCanContain.cs | 8 +- ...te_WriteBufferNotEmptyAndWriteZeroBytes.cs | 8 +- ...AndBufferSizeAndTerminalModes_Connected.cs | 8 +- ...ndWidthAndHeightAndBufferSize_Connected.cs | 8 +- .../SshCommandTest_EndExecute_ChannelOpen.cs | 2 +- ...Session_OnChannelDataReceived_Connected.cs | 4 +- ...mSession_OnChannelDataReceived_Disposed.cs | 4 +- ...elDataReceived_OnDataReceived_Exception.cs | 4 +- .../SubsystemSession_SendData_Connected.cs | 2 +- ...ubsystemSession_SendData_NeverConnected.cs | 2 +- .../Common/AsyncSocketListener.cs | 6 +- 353 files changed, 1960 insertions(+), 1960 deletions(-) diff --git a/.editorconfig b/.editorconfig index ebb0e9add..e45c85b25 100644 --- a/.editorconfig +++ b/.editorconfig @@ -928,7 +928,7 @@ csharp_indent_block_contents = true # Spacing options -csharp_space_after_cast = true +csharp_space_after_cast = false csharp_space_after_keywords_in_control_flow_statements = true csharp_space_between_parentheses = false csharp_space_before_colon_in_inheritance_clause = true diff --git a/src/Renci.SshNet/Abstractions/SocketAbstraction.cs b/src/Renci.SshNet/Abstractions/SocketAbstraction.cs index 4be67a508..0997a32f6 100644 --- a/src/Renci.SshNet/Abstractions/SocketAbstraction.cs +++ b/src/Renci.SshNet/Abstractions/SocketAbstraction.cs @@ -96,7 +96,7 @@ private static void ConnectCore(Socket socket, IPEndPoint remoteEndpoint, TimeSp if (args.SocketError != SocketError.Success) { - var socketError = (int) args.SocketError; + var socketError = (int)args.SocketError; if (ownsSocket) { @@ -374,7 +374,7 @@ public static bool IsErrorResumable(SocketError socketError) private static void ConnectCompleted(object sender, SocketAsyncEventArgs e) { - var eventWaitHandle = (ManualResetEvent) e.UserToken; + var eventWaitHandle = (ManualResetEvent)e.UserToken; _ = eventWaitHandle?.Set(); } } diff --git a/src/Renci.SshNet/Abstractions/SocketExtensions.cs b/src/Renci.SshNet/Abstractions/SocketExtensions.cs index f4d99c38b..03c9b050a 100644 --- a/src/Renci.SshNet/Abstractions/SocketExtensions.cs +++ b/src/Renci.SshNet/Abstractions/SocketExtensions.cs @@ -80,7 +80,7 @@ public void GetResult() if (SocketError != SocketError.Success) { - throw new SocketException((int) SocketError); + throw new SocketException((int)SocketError); } } } @@ -94,9 +94,9 @@ public static async Task ConnectAsync(this Socket socket, IPEndPoint remoteEndpo args.RemoteEndPoint = remoteEndpoint; #if NET || NETSTANDARD2_1_OR_GREATER - await using (cancellationToken.Register(o => ((AwaitableSocketAsyncEventArgs) o).SetCancelled(), args, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) + await using (cancellationToken.Register(o => ((AwaitableSocketAsyncEventArgs)o).SetCancelled(), args, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) #else - using (cancellationToken.Register(o => ((AwaitableSocketAsyncEventArgs) o).SetCancelled(), args, useSynchronizationContext: false)) + using (cancellationToken.Register(o => ((AwaitableSocketAsyncEventArgs)o).SetCancelled(), args, useSynchronizationContext: false)) #endif // NET || NETSTANDARD2_1_OR_GREATER { await args.ExecuteAsync(socket.ConnectAsync); @@ -113,9 +113,9 @@ public static async Task ReceiveAsync(this Socket socket, byte[] buffer, in args.SetBuffer(buffer, offset, length); #if NET || NETSTANDARD2_1_OR_GREATER - await using (cancellationToken.Register(o => ((AwaitableSocketAsyncEventArgs) o).SetCancelled(), args, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) + await using (cancellationToken.Register(o => ((AwaitableSocketAsyncEventArgs)o).SetCancelled(), args, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) #else - using (cancellationToken.Register(o => ((AwaitableSocketAsyncEventArgs) o).SetCancelled(), args, useSynchronizationContext: false)) + using (cancellationToken.Register(o => ((AwaitableSocketAsyncEventArgs)o).SetCancelled(), args, useSynchronizationContext: false)) #endif // NET || NETSTANDARD2_1_OR_GREATER { await args.ExecuteAsync(socket.ReceiveAsync); diff --git a/src/Renci.SshNet/AuthenticationMethod.cs b/src/Renci.SshNet/AuthenticationMethod.cs index 16783f1bd..e8ab026d5 100644 --- a/src/Renci.SshNet/AuthenticationMethod.cs +++ b/src/Renci.SshNet/AuthenticationMethod.cs @@ -60,7 +60,7 @@ protected AuthenticationMethod(string username) /// AuthenticationResult IAuthenticationMethod.Authenticate(ISession session) { - return Authenticate((Session) session); + return Authenticate((Session)session); } } } diff --git a/src/Renci.SshNet/Channels/Channel.cs b/src/Renci.SshNet/Channels/Channel.cs index 8ab9736d8..e1e154ffd 100644 --- a/src/Renci.SshNet/Channels/Channel.cs +++ b/src/Renci.SshNet/Channels/Channel.cs @@ -763,7 +763,7 @@ private void OnChannelFailure(object sender, MessageEventArgs, I { private const ulong Base = 0x100000000; private const int Bias = 1075; - private const int DecimalSignMask = unchecked((int) 0x80000000); + private const int DecimalSignMask = unchecked((int)0x80000000); private static readonly BigInteger ZeroSingleton = new BigInteger(0); private static readonly BigInteger OneSingleton = new BigInteger(1); @@ -181,7 +181,7 @@ public static BigInteger Random(int bitLength) { var bytesArray = new byte[(bitLength / 8) + (((bitLength % 8) > 0) ? 1 : 0)]; CryptoAbstraction.GenerateRandom(bytesArray); - bytesArray[bytesArray.Length - 1] = (byte) (bytesArray[bytesArray.Length - 1] & 0x7F); // Ensure not a negative value + bytesArray[bytesArray.Length - 1] = (byte)(bytesArray[bytesArray.Length - 1] & 0x7F); // Ensure not a negative value return new BigInteger(bytesArray); } @@ -207,12 +207,12 @@ public BigInteger(int value) else if (value > 0) { _sign = 1; - _data = new[] { (uint) value }; + _data = new[] { (uint)value }; } else { _sign = -1; - _data = new[] { (uint) -value }; + _data = new[] { (uint)-value }; } } @@ -249,8 +249,8 @@ public BigInteger(long value) else if (value > 0) { _sign = 1; - var low = (uint) value; - var high = (uint) (value >> 32); + var low = (uint)value; + var high = (uint)(value >> 32); _data = new uint[high != 0 ? 2 : 1]; _data[0] = low; @@ -263,8 +263,8 @@ public BigInteger(long value) { _sign = -1; value = -value; - var low = (uint) value; - var high = (uint) ((ulong) value >> 32); + var low = (uint)value; + var high = (uint)((ulong)value >> 32); _data = new uint[high != 0 ? 2 : 1]; _data[0] = low; @@ -290,8 +290,8 @@ public BigInteger(ulong value) else { _sign = 1; - var low = (uint) value; - var high = (uint) (value >> 32); + var low = (uint)value; + var high = (uint)(value >> 32); _data = new uint[high != 0 ? 2 : 1]; _data[0] = low; @@ -339,7 +339,7 @@ public BigInteger(double value) BigInteger res = mantissa; res = exponent > Bias ? res << (exponent - Bias) : res >> (Bias - exponent); - _sign = (short) (Negative(bytes) ? -1 : 1); + _sign = (short)(Negative(bytes) ? -1 : 1); _data = res._data; } } @@ -349,7 +349,7 @@ public BigInteger(double value) /// /// A single-precision floating-point value. public BigInteger(float value) - : this((double) value) + : this((double)value) { } @@ -375,18 +375,18 @@ public BigInteger(decimal value) return; } - _sign = (short) ((bits[3] & DecimalSignMask) != 0 ? -1 : 1); + _sign = (short)((bits[3] & DecimalSignMask) != 0 ? -1 : 1); _data = new uint[size]; - _data[0] = (uint) bits[0]; + _data[0] = (uint)bits[0]; if (size > 1) { - _data[1] = (uint) bits[1]; + _data[1] = (uint)bits[1]; } if (size > 2) { - _data[2] = (uint) bits[2]; + _data[2] = (uint)bits[2]; } } @@ -446,10 +446,10 @@ public BigInteger(byte[] value) var j = 0; for (var i = 0; i < fullWords; ++i) { - _data[i] = (uint) value[j++] | - (uint) (value[j++] << 8) | - (uint) (value[j++] << 16) | - (uint) (value[j++] << 24); + _data[i] = (uint)value[j++] | + (uint)(value[j++] << 8) | + (uint)(value[j++] << 16) | + (uint)(value[j++] << 24); } size = len & 0x3; @@ -458,7 +458,7 @@ public BigInteger(byte[] value) var idx = _data.Length - 1; for (var i = 0; i < size; ++i) { - _data[idx] |= (uint) (value[j++] << (i * 8)); + _data[idx] |= (uint)(value[j++] << (i * 8)); } } } @@ -479,14 +479,14 @@ public BigInteger(byte[] value) for (var i = 0; i < fullWords; ++i) { - word = (uint) value[j++] | - (uint) (value[j++] << 8) | - (uint) (value[j++] << 16) | - (uint) (value[j++] << 24); - - sub = (ulong) word - borrow; - word = (uint) sub; - borrow = (uint) (sub >> 32) & 0x1u; + word = (uint)value[j++] | + (uint)(value[j++] << 8) | + (uint)(value[j++] << 16) | + (uint)(value[j++] << 24); + + sub = (ulong)word - borrow; + word = (uint)sub; + borrow = (uint)(sub >> 32) & 0x1u; _data[i] = ~word; } @@ -498,13 +498,13 @@ public BigInteger(byte[] value) uint storeMask = 0; for (var i = 0; i < size; ++i) { - word |= (uint) (value[j++] << (i * 8)); + word |= (uint)(value[j++] << (i * 8)); storeMask = (storeMask << 8) | 0xFF; } sub = word - borrow; - word = (uint) sub; - borrow = (uint) (sub >> 32) & 0x1u; + word = (uint)sub; + borrow = (uint)(sub >> 32) & 0x1u; if ((~word & storeMask) == 0) { @@ -532,15 +532,15 @@ private static bool Negative(byte[] v) private static ushort Exponent(byte[] v) { - return (ushort) ((((ushort) (v[7] & 0x7F)) << (ushort) 4) | (((ushort) (v[6] & 0xF0)) >> 4)); + return (ushort)((((ushort)(v[7] & 0x7F)) << (ushort)4) | (((ushort)(v[6] & 0xF0)) >> 4)); } private static ulong Mantissa(byte[] v) { - var i1 = (uint) v[0] | ((uint) v[1] << 8) | ((uint) v[2] << 16) | ((uint) v[3] << 24); - var i2 = (uint) v[4] | ((uint) v[5] << 8) | ((uint) (v[6] & 0xF) << 16); + var i1 = (uint)v[0] | ((uint)v[1] << 8) | ((uint)v[2] << 16) | ((uint)v[3] << 24); + var i2 = (uint)v[4] | ((uint)v[5] << 8) | ((uint)(v[6] & 0xF) << 16); - return (ulong) i1 | ((ulong) i2 << 32); + return (ulong)i1 | ((ulong)i2 << 32); } /// @@ -575,7 +575,7 @@ private static int PopulationCount(uint x) x = (x + (x >> 4)) & 0x0F0F0F0F; x += x >> 8; x += x >> 16; - return (int) (x & 0x0000003F); + return (int)(x & 0x0000003F); } /// @@ -592,7 +592,7 @@ private static int PopulationCount(ulong x) x -= (x >> 1) & 0x5555555555555555UL; x = (x & 0x3333333333333333UL) + ((x >> 2) & 0x3333333333333333UL); x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0fUL; - return (int) ((x * 0x0101010101010101UL) >> 56); + return (int)((x * 0x0101010101010101UL) >> 56); } private static int LeadingZeroCount(uint value) @@ -660,13 +660,13 @@ private static double BuildDouble(int sign, ulong mantissa, int exponent) { unchecked { - var bits = mantissa | ((ulong) exponent << mantissaLength); + var bits = mantissa | ((ulong)exponent << mantissaLength); if (sign < 0) { bits |= negativeMark; } - return BitConverter.Int64BitsToDouble((long) bits); + return BitConverter.Int64BitsToDouble((long)bits); } } @@ -791,12 +791,12 @@ public static explicit operator int(BigInteger value) if (value._sign == 1) { - if (data > (uint) int.MaxValue) + if (data > (uint)int.MaxValue) { throw new OverflowException(); } - return (int) data; + return (int)data; } if (value._sign == -1) @@ -806,7 +806,7 @@ public static explicit operator int(BigInteger value) throw new OverflowException(); } - return -(int) data; + return -(int)data; } return 0; @@ -848,13 +848,13 @@ public static explicit operator uint(BigInteger value) public static explicit operator short(BigInteger value) #pragma warning restore CA2225 // Operator overloads have named alternates { - var val = (int) value; + var val = (int)value; if (val is < short.MinValue or > short.MaxValue) { throw new OverflowException(); } - return (short) val; + return (short)val; } /// @@ -869,13 +869,13 @@ public static explicit operator short(BigInteger value) public static explicit operator ushort(BigInteger value) #pragma warning restore CA2225 // Operator overloads have named alternates { - var val = (uint) value; + var val = (uint)value; if (val > ushort.MaxValue) { throw new OverflowException(); } - return (ushort) val; + return (ushort)val; } /// @@ -889,13 +889,13 @@ public static explicit operator ushort(BigInteger value) public static explicit operator byte(BigInteger value) #pragma warning restore CA2225 // Operator overloads have named alternates { - var val = (uint) value; + var val = (uint)value; if (val > byte.MaxValue) { throw new OverflowException(); } - return (byte) val; + return (byte)val; } /// @@ -910,13 +910,13 @@ public static explicit operator byte(BigInteger value) public static explicit operator sbyte(BigInteger value) #pragma warning restore CA2225 // Operator overloads have named alternates { - var val = (int) value; + var val = (int)value; if (val is < sbyte.MinValue or > sbyte.MaxValue) { throw new OverflowException(); } - return (sbyte) val; + return (sbyte)val; } /// @@ -946,10 +946,10 @@ public static explicit operator long(BigInteger value) { if (value._sign == 1) { - return (long) low; + return (long)low; } - var res = (long) low; + var res = (long)low; return -res; } @@ -962,7 +962,7 @@ public static explicit operator long(BigInteger value) throw new OverflowException(); } - return (((long) high) << 32) | low; + return (((long)high) << 32) | low; } /* @@ -975,7 +975,7 @@ long.MinValue works fine since it's bigint encoding looks like a negative number, but since long.MinValue == -long.MinValue, we're good. */ - var result = -((((long) high) << 32) | (long) low); + var result = -((((long)high) << 32) | (long)low); if (result > 0) { throw new OverflowException(); @@ -1013,7 +1013,7 @@ public static explicit operator ulong(BigInteger value) } var high = value._data[1]; - return (((ulong) high) << 32) | low; + return (((ulong)high) << 32) | low; } /// @@ -1037,11 +1037,11 @@ public static explicit operator double(BigInteger value) case 1: return BuildDouble(value._sign, value._data[0], 0); case 2: - return BuildDouble(value._sign, (ulong) value._data[1] << 32 | (ulong) value._data[0], 0); + return BuildDouble(value._sign, (ulong)value._data[1] << 32 | (ulong)value._data[0], 0); default: var index = value._data.Length - 1; var word = value._data[index]; - var mantissa = ((ulong) word << 32) | value._data[index - 1]; + var mantissa = ((ulong)word << 32) | value._data[index - 1]; var missing = LeadingZeroCount(word) - 11; // 11 = bits in exponent if (missing > 0) { @@ -1068,7 +1068,7 @@ public static explicit operator double(BigInteger value) public static explicit operator float(BigInteger value) #pragma warning restore CA2225 // Operator overloads have named alternates { - return (float) (double) value; + return (float)(double)value; } /// @@ -1096,17 +1096,17 @@ public static explicit operator decimal(BigInteger value) int lo = 0, mi = 0, hi = 0; if (data.Length > 2) { - hi = (int) data[2]; + hi = (int)data[2]; } if (data.Length > 1) { - mi = (int) data[1]; + mi = (int)data[1]; } if (data.Length > 0) { - lo = (int) data[0]; + lo = (int)data[0]; } return new decimal(lo, mi, hi, value._sign < 0, 0); @@ -1328,7 +1328,7 @@ public static explicit operator BigInteger(decimal value) if (left._sign == 0) { - return new BigInteger((short) -right._sign, right._data); + return new BigInteger((short)-right._sign, right._data); } if (left._sign == right._sign) @@ -1346,7 +1346,7 @@ public static explicit operator BigInteger(decimal value) return new BigInteger(left._sign, CoreSub(left._data, right._data)); } - return new BigInteger((short) -right._sign, CoreSub(right._data, left._data)); + return new BigInteger((short)-right._sign, CoreSub(right._data, left._data)); } return new BigInteger(left._sign, CoreAdd(left._data, right._data)); @@ -1374,7 +1374,7 @@ public static explicit operator BigInteger(decimal value) return right; } - return new BigInteger((short) -right._sign, right._data); + return new BigInteger((short)-right._sign, right._data); } if (right._data[0] == 1 && right._data.Length == 1) @@ -1384,7 +1384,7 @@ public static explicit operator BigInteger(decimal value) return left; } - return new BigInteger((short) -left._sign, left._data); + return new BigInteger((short)-left._sign, left._data); } var a = left._data; @@ -1400,15 +1400,15 @@ public static explicit operator BigInteger(decimal value) ulong carry = 0; for (var j = 0; j < b.Length; ++j) { - carry = carry + (((ulong) ai) * b[j]) + res[k]; - res[k++] = (uint) carry; + carry = carry + (((ulong)ai) * b[j]) + res[k]; + res[k++] = (uint)carry; carry >>= 32; } while (carry != 0) { carry += res[k]; - res[k++] = (uint) carry; + res[k++] = (uint)carry; carry >>= 32; } } @@ -1424,7 +1424,7 @@ public static explicit operator BigInteger(decimal value) Array.Resize(ref res, m + 1); } - return new BigInteger((short) (left._sign * right._sign), res); + return new BigInteger((short)(left._sign * right._sign), res); } /// @@ -1466,7 +1466,7 @@ public static explicit operator BigInteger(decimal value) Array.Resize(ref quotient, i + 1); } - return new BigInteger((short) (dividend._sign * divisor._sign), quotient); + return new BigInteger((short)(dividend._sign * divisor._sign), quotient); } /// @@ -1524,7 +1524,7 @@ public static explicit operator BigInteger(decimal value) return value; } - return new BigInteger((short) -value._sign, value._data); + return new BigInteger((short)-value._sign, value._data); } /// @@ -1661,8 +1661,8 @@ public static explicit operator BigInteger(decimal value) if (ls == -1) { ac = ~va + ac; - va = (uint) ac; - ac = (uint) (ac >> 32); + va = (uint)ac; + ac = (uint)(ac >> 32); } uint vb = 0; @@ -1674,8 +1674,8 @@ public static explicit operator BigInteger(decimal value) if (rs == -1) { bc = ~vb + bc; - vb = (uint) bc; - bc = (uint) (bc >> 32); + vb = (uint)bc; + bc = (uint)(bc >> 32); } var word = va & vb; @@ -1683,8 +1683,8 @@ public static explicit operator BigInteger(decimal value) if (negRes) { borrow = word - borrow; - word = ~(uint) borrow; - borrow = (uint) (borrow >> 32) & 0x1u; + word = ~(uint)borrow; + borrow = (uint)(borrow >> 32) & 0x1u; } result[i] = word; @@ -1705,7 +1705,7 @@ public static explicit operator BigInteger(decimal value) Array.Resize(ref result, i + 1); } - return new BigInteger(negRes ? (short) -1 : (short) 1, result); + return new BigInteger(negRes ? (short)-1 : (short)1, result); } /// @@ -1753,8 +1753,8 @@ public static explicit operator BigInteger(decimal value) if (ls == -1) { ac = ~va + ac; - va = (uint) ac; - ac = (uint) (ac >> 32); + va = (uint)ac; + ac = (uint)(ac >> 32); } uint vb = 0; @@ -1766,8 +1766,8 @@ public static explicit operator BigInteger(decimal value) if (rs == -1) { bc = ~vb + bc; - vb = (uint) bc; - bc = (uint) (bc >> 32); + vb = (uint)bc; + bc = (uint)(bc >> 32); } var word = va | vb; @@ -1775,8 +1775,8 @@ public static explicit operator BigInteger(decimal value) if (negRes) { borrow = word - borrow; - word = ~(uint) borrow; - borrow = (uint) (borrow >> 32) & 0x1u; + word = ~(uint)borrow; + borrow = (uint)(borrow >> 32) & 0x1u; } result[i] = word; @@ -1797,7 +1797,7 @@ public static explicit operator BigInteger(decimal value) Array.Resize(ref result, i + 1); } - return new BigInteger(negRes ? (short) -1 : (short) 1, result); + return new BigInteger(negRes ? (short)-1 : (short)1, result); } /// @@ -1845,8 +1845,8 @@ public static explicit operator BigInteger(decimal value) if (ls == -1) { ac = ~va + ac; - va = (uint) ac; - ac = (uint) (ac >> 32); + va = (uint)ac; + ac = (uint)(ac >> 32); } uint vb = 0; @@ -1858,8 +1858,8 @@ public static explicit operator BigInteger(decimal value) if (rs == -1) { bc = ~vb + bc; - vb = (uint) bc; - bc = (uint) (bc >> 32); + vb = (uint)bc; + bc = (uint)(bc >> 32); } var word = va ^ vb; @@ -1867,8 +1867,8 @@ public static explicit operator BigInteger(decimal value) if (negRes) { borrow = word - borrow; - word = ~(uint) borrow; - borrow = (uint) (borrow >> 32) & 0x1u; + word = ~(uint)borrow; + borrow = (uint)(borrow >> 32) & 0x1u; } result[i] = word; @@ -1889,7 +1889,7 @@ public static explicit operator BigInteger(decimal value) Array.Resize(ref result, i + 1); } - return new BigInteger(negRes ? (short) -1 : (short) 1, result); + return new BigInteger(negRes ? (short)-1 : (short)1, result); } /// @@ -1924,8 +1924,8 @@ public static explicit operator BigInteger(decimal value) if (sign == -1) { carry = ~word + carry; - word = (uint) carry; - carry = (uint) (carry >> 32); + word = (uint)carry; + carry = (uint)(carry >> 32); } word = ~word; @@ -1933,8 +1933,8 @@ public static explicit operator BigInteger(decimal value) if (negRes) { borrow = word - borrow; - word = ~(uint) borrow; - borrow = (uint) (borrow >> 32) & 0x1u; + word = ~(uint)borrow; + borrow = (uint)(borrow >> 32) & 0x1u; } result[i] = word; @@ -1955,7 +1955,7 @@ public static explicit operator BigInteger(decimal value) Array.Resize(ref result, i + 1); } - return new BigInteger(negRes ? (short) -1 : (short) 1, result); + return new BigInteger(negRes ? (short)-1 : (short)1, result); } /// @@ -2035,7 +2035,7 @@ private static int BitScanBackward(uint word) } } - return new BigInteger((short) sign, res); + return new BigInteger((short)sign, res); } /// @@ -2120,7 +2120,7 @@ private static int BitScanBackward(uint word) { if (data[i] != 0u) { - var tmp = new BigInteger((short) sign, res); + var tmp = new BigInteger((short)sign, res); --tmp; return tmp; } @@ -2128,13 +2128,13 @@ private static int BitScanBackward(uint word) if (bitShift > 0 && (data[idxShift] << carryShift) != 0u) { - var tmp = new BigInteger((short) sign, res); + var tmp = new BigInteger((short)sign, res); --tmp; return tmp; } } - return new BigInteger((short) sign, res); + return new BigInteger((short)sign, res); } /// @@ -2764,9 +2764,9 @@ private static uint[] MakeTwoComplement(uint[] v) for (var i = 0; i < v.Length; ++i) { var word = v[i]; - carry = (ulong) ~word + carry; - word = (uint) carry; - carry = (uint) (carry >> 32); + carry = (ulong)~word + carry; + word = (uint)carry; + carry = (uint)(carry >> 32); res[i] = word; } @@ -2827,7 +2827,7 @@ private readonly string ToString(uint radix, IFormatProvider provider) while (a != 0) { a = DivRem(a, radix, out var rem); - digits.Add(characterSet[(int) rem]); + digits.Add(characterSet[(int)rem]); } if (_sign == -1 && radix == 10) @@ -3016,7 +3016,7 @@ private static bool Parse(string value, NumberStyles style, IFormatProvider fp, if (fp != null) { var typeNfi = typeof(NumberFormatInfo); - nfi = (NumberFormatInfo) fp.GetFormat(typeNfi); + nfi = (NumberFormatInfo)fp.GetFormat(typeNfi); } nfi ??= NumberFormatInfo.CurrentInfo; @@ -3166,15 +3166,15 @@ private static bool Parse(string value, NumberStyles style, IFormatProvider fp, byte digitValue; if (char.IsDigit(hexDigit)) { - digitValue = (byte) (hexDigit - '0'); + digitValue = (byte)(hexDigit - '0'); } else if (char.IsLower(hexDigit)) { - digitValue = (byte) (hexDigit - 'a' + 10); + digitValue = (byte)(hexDigit - 'a' + 10); } else { - digitValue = (byte) (hexDigit - 'A' + 10); + digitValue = (byte)(hexDigit - 'A' + 10); } if (firstHexDigit && digitValue >= 8) @@ -3187,7 +3187,7 @@ private static bool Parse(string value, NumberStyles style, IFormatProvider fp, continue; } - number = (number * 10) + (byte) (value[pos++] - '0'); + number = (number * 10) + (byte)(value[pos++] - '0'); } // Post number stuff @@ -3358,7 +3358,7 @@ private static bool CheckStyle(NumberStyles style, bool tryParse, ref Exception return false; } } - else if ((uint) style > (uint) NumberStyles.Any) + else if ((uint)style > (uint)NumberStyles.Any) { if (!tryParse) { @@ -3478,7 +3478,7 @@ private static bool FindExponent(ref int pos, string s, ref int exponent, bool t } exc = null; - exponent = (int) exp; + exponent = (int)exp; pos = i; return true; } @@ -3600,7 +3600,7 @@ private static bool Parse(string value, bool tryParse, out BigInteger result, ou if (c is >= '0' and <= '9') { - var d = (byte) (c - '0'); + var d = (byte)(c - '0'); val = (val * 10) + d; @@ -3786,7 +3786,7 @@ public static BigInteger DivRem(BigInteger dividend, BigInteger divisor, out Big Array.Resize(ref quotient, i + 1); } - return new BigInteger((short) (dividend._sign * divisor._sign), quotient); + return new BigInteger((short)(dividend._sign * divisor._sign), quotient); } /// @@ -3934,7 +3934,7 @@ public static BigInteger GreatestCommonDivisor(BigInteger left, BigInteger right */ var yy = x._data[0]; - var xx = (uint) (y % yy); + var xx = (uint)(y % yy); var t = 0; @@ -4024,7 +4024,7 @@ public static double Log(BigInteger value, double baseValue) tempBitlen -= int.MaxValue; } - testBit <<= (int) tempBitlen; + testBit <<= (int)tempBitlen; for (var curbit = bitlen; curbit >= 0; --curbit) { @@ -4074,7 +4074,7 @@ public static double Log10(BigInteger value) /// public override readonly int GetHashCode() { - var hash = (uint) (_sign * 0x01010101u); + var hash = (uint)(_sign * 0x01010101u); if (_data != null) { foreach (var bit in _data) @@ -4083,7 +4083,7 @@ public override readonly int GetHashCode() } } - return (int) hash; + return (int)hash; } /// @@ -4283,8 +4283,8 @@ public readonly int CompareTo(ulong other) return 1; } - var high = (uint) (other >> 32); - var low = (uint) other; + var high = (uint)(other >> 32); + var low = (uint)other; return LongCompare(low, high); } @@ -4341,8 +4341,8 @@ public readonly int CompareTo(long other) other = -other; } - var low = (uint) other; - var high = (uint) ((ulong) other >> 32); + var low = (uint)other; + var high = (uint)((ulong)other >> 32); var r = LongCompare(low, high); if (ls == -1) @@ -4516,15 +4516,15 @@ public readonly byte[] ToByteArray() { var word = _data[i]; - res[j++] = (byte) word; - res[j++] = (byte) (word >> 8); - res[j++] = (byte) (word >> 16); - res[j++] = (byte) (word >> 24); + res[j++] = (byte)word; + res[j++] = (byte)(word >> 8); + res[j++] = (byte)(word >> 16); + res[j++] = (byte)(word >> 24); } while (extra-- > 0) { - res[j++] = (byte) topWord; + res[j++] = (byte)topWord; topWord >>= 8; } } @@ -4538,19 +4538,19 @@ public readonly byte[] ToByteArray() for (var i = 0; i < end; ++i) { word = _data[i]; - add = (ulong) ~word + carry; - word = (uint) add; - carry = (uint) (add >> 32); - - res[j++] = (byte) word; - res[j++] = (byte) (word >> 8); - res[j++] = (byte) (word >> 16); - res[j++] = (byte) (word >> 24); + add = (ulong)~word + carry; + word = (uint)add; + carry = (uint)(add >> 32); + + res[j++] = (byte)word; + res[j++] = (byte)(word >> 8); + res[j++] = (byte)(word >> 16); + res[j++] = (byte)(word >> 24); } - add = (ulong) ~topWord + carry; - word = (uint) add; - carry = (uint) (add >> 32); + add = (ulong)~topWord + carry; + word = (uint)add; + carry = (uint)(add >> 32); if (carry == 0) { var ex = FirstNonFfByte(word); @@ -4564,7 +4564,7 @@ public readonly byte[] ToByteArray() while (ex-- > 0) { - res[j++] = (byte) word; + res[j++] = (byte)word; word >>= 8; } @@ -4576,10 +4576,10 @@ public readonly byte[] ToByteArray() else { Array.Resize(ref res, bytes + 5); - res[j++] = (byte) word; - res[j++] = (byte) (word >> 8); - res[j++] = (byte) (word >> 16); - res[j++] = (byte) (word >> 24); + res[j++] = (byte)word; + res[j++] = (byte)(word >> 8); + res[j++] = (byte)(word >> 16); + res[j++] = (byte)(word >> 24); res[j++] = 0xFF; } } @@ -4607,21 +4607,21 @@ private static uint[] CoreAdd(uint[] a, uint[] b) for (; i < sl; i++) { sum = sum + a[i] + b[i]; - res[i] = (uint) sum; + res[i] = (uint)sum; sum >>= 32; } for (; i < bl; i++) { sum += a[i]; - res[i] = (uint) sum; + res[i] = (uint)sum; sum >>= 32; } if (sum != 0) { Array.Resize(ref res, bl + 1); - res[i] = (uint) sum; + res[i] = (uint)sum; } return res; @@ -4637,14 +4637,14 @@ private static uint[] CoreAdd(uint[] a, uint b) for (i = 0; i < len; i++) { sum += a[i]; - res[i] = (uint) sum; + res[i] = (uint)sum; sum >>= 32; } if (sum != 0) { Array.Resize(ref res, len + 1); - res[i] = (uint) sum; + res[i] = (uint)sum; } return res; @@ -4662,16 +4662,16 @@ private static uint[] CoreSub(uint[] a, uint[] b) int i; for (i = 0; i < sl; ++i) { - borrow = (ulong) a[i] - b[i] - borrow; + borrow = (ulong)a[i] - b[i] - borrow; - res[i] = (uint) borrow; + res[i] = (uint)borrow; borrow = (borrow >> 32) & 0x1; } for (; i < bl; i++) { - borrow = (ulong) a[i] - borrow; - res[i] = (uint) borrow; + borrow = (ulong)a[i] - borrow; + res[i] = (uint)borrow; borrow = (borrow >> 32) & 0x1; } @@ -4698,8 +4698,8 @@ private static uint[] CoreSub(uint[] a, uint b) int i; for (i = 0; i < len; i++) { - borrow = (ulong) a[i] - borrow; - res[i] = (uint) borrow; + borrow = (ulong)a[i] - borrow; + res[i] = (uint)borrow; borrow = (borrow >> 32) & 0x1; } @@ -4867,10 +4867,10 @@ private static void DivModUnsigned(uint[] u, uint[] v, out uint[] q, out uint[] var div = rem / v0; rem -= div * v0; - q[j] = (uint) div; + q[j] = (uint)div; } - r[0] = (uint) rem; + r[0] = (uint)rem; } else if (m >= n) { @@ -4899,7 +4899,7 @@ private static void DivModUnsigned(uint[] u, uint[] v, out uint[] q, out uint[] if ((qq >= Base) || (qq * vn[n - 2] > ((rr * Base) + un[j + n - 2]))) { qq--; - rr += (ulong) vn[n - 1]; + rr += (ulong)vn[n - 1]; if (rr < Base) { continue; @@ -4915,18 +4915,18 @@ private static void DivModUnsigned(uint[] u, uint[] v, out uint[] q, out uint[] for (i = 0; i < n; i++) { var p = vn[i] * qq; - t = (long) un[i + j] - (long) (uint) p - b; - un[i + j] = (uint) t; + t = (long)un[i + j] - (long)(uint)p - b; + un[i + j] = (uint)t; p >>= 32; t >>= 32; - b = (long) p - t; + b = (long)p - t; } - t = (long) un[j + n] - b; - un[j + n] = (uint) t; + t = (long)un[j + n] - b; + un[j + n] = (uint)t; // Store the calculated value - q[j] = (uint) qq; + q[j] = (uint)qq; // Add back vn[0..n] to un[j..j+n] if (t < 0) @@ -4935,13 +4935,13 @@ private static void DivModUnsigned(uint[] u, uint[] v, out uint[] q, out uint[] ulong c = 0; for (i = 0; i < n; i++) { - c = (ulong) vn[i] + un[j + i] + c; - un[j + i] = (uint) c; + c = (ulong)vn[i] + un[j + i] + c; + un[j + i] = (uint)c; c >>= 32; } - c += (ulong) un[j + n]; - un[j + n] = (uint) c; + c += (ulong)un[j + n]; + un[j + n] = (uint)c; } } diff --git a/src/Renci.SshNet/Common/DerData.cs b/src/Renci.SshNet/Common/DerData.cs index 0359f1a55..baf37be6c 100644 --- a/src/Renci.SshNet/Common/DerData.cs +++ b/src/Renci.SshNet/Common/DerData.cs @@ -189,7 +189,7 @@ public void Write(bool data) { _data.Add(Boolean); _data.Add(1); - _data.Add((byte) (data ? 1 : 0)); + _data.Add((byte)(data ? 1 : 0)); } /// @@ -246,7 +246,7 @@ public void Write(ObjectIdentifier identifier) var buffer = new byte[8]; var bufferIndex = buffer.Length - 1; - var current = (byte) (item & 0x7F); + var current = (byte)(item & 0x7F); do { buffer[bufferIndex] = current; @@ -256,7 +256,7 @@ public void Write(ObjectIdentifier identifier) } item >>= 7; - current = (byte) (item & 0x7F); + current = (byte)(item & 0x7F); bufferIndex--; } while (current > 0); @@ -329,17 +329,17 @@ private static byte[] GetLength(int length) } var data = new byte[size]; - data[0] = (byte) (size | 0x80); + data[0] = (byte)(size | 0x80); for (int i = (size - 1) * 8, j = 1; i >= 0; i -= 8, j++) { - data[j] = (byte) (length >> i); + data[j] = (byte)(length >> i); } return data; } - return new[] { (byte) length }; + return new[] { (byte)length }; } /// diff --git a/src/Renci.SshNet/Common/Pack.cs b/src/Renci.SshNet/Common/Pack.cs index d8b39d4ea..6662304c3 100644 --- a/src/Renci.SshNet/Common/Pack.cs +++ b/src/Renci.SshNet/Common/Pack.cs @@ -21,7 +21,7 @@ internal static ushort LittleEndianToUInt16(byte[] buffer) return BinaryPrimitives.ReadUInt16LittleEndian(buffer); #else ushort n = buffer[0]; - n |= (ushort) (buffer[1] << 8); + n |= (ushort)(buffer[1] << 8); return n; #endif } @@ -37,9 +37,9 @@ internal static uint LittleEndianToUInt32(byte[] buffer) return BinaryPrimitives.ReadUInt32LittleEndian(buffer); #else uint n = buffer[0]; - n |= (uint) buffer[1] << 8; - n |= (uint) buffer[2] << 16; - n |= (uint) buffer[3] << 24; + n |= (uint)buffer[1] << 8; + n |= (uint)buffer[2] << 16; + n |= (uint)buffer[3] << 24; return n; #endif } @@ -55,13 +55,13 @@ internal static ulong LittleEndianToUInt64(byte[] buffer) return BinaryPrimitives.ReadUInt64LittleEndian(buffer); #else ulong n = buffer[0]; - n |= (ulong) buffer[1] << 8; - n |= (ulong) buffer[2] << 16; - n |= (ulong) buffer[3] << 24; - n |= (ulong) buffer[4] << 32; - n |= (ulong) buffer[5] << 40; - n |= (ulong) buffer[6] << 48; - n |= (ulong) buffer[7] << 56; + n |= (ulong)buffer[1] << 8; + n |= (ulong)buffer[2] << 16; + n |= (ulong)buffer[3] << 24; + n |= (ulong)buffer[4] << 32; + n |= (ulong)buffer[5] << 40; + n |= (ulong)buffer[6] << 48; + n |= (ulong)buffer[7] << 56; return n; #endif } @@ -87,8 +87,8 @@ private static void UInt16ToLittleEndian(ushort value, byte[] buffer) #if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER BinaryPrimitives.WriteUInt16LittleEndian(buffer, value); #else - buffer[0] = (byte) (value & 0x00FF); - buffer[1] = (byte) ((value & 0xFF00) >> 8); + buffer[0] = (byte)(value & 0x00FF); + buffer[1] = (byte)((value & 0xFF00) >> 8); #endif } @@ -113,10 +113,10 @@ private static void UInt32ToLittleEndian(uint value, byte[] buffer) #if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER BinaryPrimitives.WriteUInt32LittleEndian(buffer, value); #else - buffer[0] = (byte) (value & 0x000000FF); - buffer[1] = (byte) ((value & 0x0000FF00) >> 8); - buffer[2] = (byte) ((value & 0x00FF0000) >> 16); - buffer[3] = (byte) ((value & 0xFF000000) >> 24); + buffer[0] = (byte)(value & 0x000000FF); + buffer[1] = (byte)((value & 0x0000FF00) >> 8); + buffer[2] = (byte)((value & 0x00FF0000) >> 16); + buffer[3] = (byte)((value & 0xFF000000) >> 24); #endif } @@ -141,14 +141,14 @@ private static void UInt64ToLittleEndian(ulong value, byte[] buffer) #if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER BinaryPrimitives.WriteUInt64LittleEndian(buffer, value); #else - buffer[0] = (byte) (value & 0x00000000000000FF); - buffer[1] = (byte) ((value & 0x000000000000FF00) >> 8); - buffer[2] = (byte) ((value & 0x0000000000FF0000) >> 16); - buffer[3] = (byte) ((value & 0x00000000FF000000) >> 24); - buffer[4] = (byte) ((value & 0x000000FF00000000) >> 32); - buffer[5] = (byte) ((value & 0x0000FF0000000000) >> 40); - buffer[6] = (byte) ((value & 0x00FF000000000000) >> 48); - buffer[7] = (byte) ((value & 0xFF00000000000000) >> 56); + buffer[0] = (byte)(value & 0x00000000000000FF); + buffer[1] = (byte)((value & 0x000000000000FF00) >> 8); + buffer[2] = (byte)((value & 0x0000000000FF0000) >> 16); + buffer[3] = (byte)((value & 0x00000000FF000000) >> 24); + buffer[4] = (byte)((value & 0x000000FF00000000) >> 32); + buffer[5] = (byte)((value & 0x0000FF0000000000) >> 40); + buffer[6] = (byte)((value & 0x00FF000000000000) >> 48); + buffer[7] = (byte)((value & 0xFF00000000000000) >> 56); #endif } @@ -164,8 +164,8 @@ internal static void UInt16ToBigEndian(ushort value, byte[] buffer, int offset) #if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER BinaryPrimitives.WriteUInt16BigEndian(buffer.AsSpan(offset), value); #else - buffer[offset] = (byte) (value >> 8); - buffer[offset + 1] = (byte) (value & 0x00FF); + buffer[offset] = (byte)(value >> 8); + buffer[offset + 1] = (byte)(value & 0x00FF); #endif } @@ -179,10 +179,10 @@ internal static void UInt32ToBigEndian(uint value, byte[] buffer, int offset) #if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER BinaryPrimitives.WriteUInt32BigEndian(buffer.AsSpan(offset), value); #else - buffer[offset++] = (byte) ((value & 0xFF000000) >> 24); - buffer[offset++] = (byte) ((value & 0x00FF0000) >> 16); - buffer[offset++] = (byte) ((value & 0x0000FF00) >> 8); - buffer[offset] = (byte) (value & 0x000000FF); + buffer[offset++] = (byte)((value & 0xFF000000) >> 24); + buffer[offset++] = (byte)((value & 0x00FF0000) >> 16); + buffer[offset++] = (byte)((value & 0x0000FF00) >> 8); + buffer[offset] = (byte)(value & 0x000000FF); #endif } @@ -205,14 +205,14 @@ private static void UInt64ToBigEndian(ulong value, byte[] buffer, int offset) #if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER BinaryPrimitives.WriteUInt64BigEndian(buffer.AsSpan(offset), value); #else - buffer[offset++] = (byte) ((value & 0xFF00000000000000) >> 56); - buffer[offset++] = (byte) ((value & 0x00FF000000000000) >> 48); - buffer[offset++] = (byte) ((value & 0x0000FF0000000000) >> 40); - buffer[offset++] = (byte) ((value & 0x000000FF00000000) >> 32); - buffer[offset++] = (byte) ((value & 0x00000000FF000000) >> 24); - buffer[offset++] = (byte) ((value & 0x0000000000FF0000) >> 16); - buffer[offset++] = (byte) ((value & 0x000000000000FF00) >> 8); - buffer[offset] = (byte) (value & 0x00000000000000FF); + buffer[offset++] = (byte)((value & 0xFF00000000000000) >> 56); + buffer[offset++] = (byte)((value & 0x00FF000000000000) >> 48); + buffer[offset++] = (byte)((value & 0x0000FF0000000000) >> 40); + buffer[offset++] = (byte)((value & 0x000000FF00000000) >> 32); + buffer[offset++] = (byte)((value & 0x00000000FF000000) >> 24); + buffer[offset++] = (byte)((value & 0x0000000000FF0000) >> 16); + buffer[offset++] = (byte)((value & 0x000000000000FF00) >> 8); + buffer[offset] = (byte)(value & 0x00000000000000FF); #endif } @@ -226,7 +226,7 @@ internal static ushort BigEndianToUInt16(byte[] buffer) #if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER return BinaryPrimitives.ReadUInt16BigEndian(buffer); #else - return (ushort) (buffer[0] << 8 | buffer[1]); + return (ushort)(buffer[0] << 8 | buffer[1]); #endif } @@ -241,9 +241,9 @@ internal static uint BigEndianToUInt32(byte[] buffer, int offset) #if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER return BinaryPrimitives.ReadUInt32BigEndian(buffer.AsSpan(offset)); #else - return (uint) buffer[offset + 0] << 24 | - (uint) buffer[offset + 1] << 16 | - (uint) buffer[offset + 2] << 8 | + return (uint)buffer[offset + 0] << 24 | + (uint)buffer[offset + 1] << 16 | + (uint)buffer[offset + 2] << 8 | buffer[offset + 3]; #endif } @@ -268,13 +268,13 @@ internal static ulong BigEndianToUInt64(byte[] buffer) #if NETSTANDARD2_1_OR_GREATER || NET6_0_OR_GREATER return BinaryPrimitives.ReadUInt64BigEndian(buffer); #else - return (ulong) buffer[0] << 56 | - (ulong) buffer[1] << 48 | - (ulong) buffer[2] << 40 | - (ulong) buffer[3] << 32 | - (ulong) buffer[4] << 24 | - (ulong) buffer[5] << 16 | - (ulong) buffer[6] << 8 | + return (ulong)buffer[0] << 56 | + (ulong)buffer[1] << 48 | + (ulong)buffer[2] << 40 | + (ulong)buffer[3] << 32 | + (ulong)buffer[4] << 24 | + (ulong)buffer[5] << 16 | + (ulong)buffer[6] << 8 | buffer[7]; #endif } diff --git a/src/Renci.SshNet/Common/SshData.cs b/src/Renci.SshNet/Common/SshData.cs index 578edb8c5..6f1e3d6d8 100644 --- a/src/Renci.SshNet/Common/SshData.cs +++ b/src/Renci.SshNet/Common/SshData.cs @@ -139,7 +139,7 @@ private void LoadInternal(byte[] value, int offset, int count) /// protected byte[] ReadBytes() { - var bytesLength = (int) (_stream.Length - _stream.Position); + var bytesLength = (int)(_stream.Length - _stream.Position); var data = new byte[bytesLength]; _ = _stream.Read(data, 0, bytesLength); return data; @@ -173,7 +173,7 @@ protected byte ReadByte() throw new InvalidOperationException("Attempt to read past the end of the SSH data stream."); } - return (byte) byteRead; + return (byte)byteRead; } /// @@ -319,7 +319,7 @@ protected void Write(byte data) /// data to write. protected void Write(bool data) { - Write(data ? (byte) 1 : (byte) 0); + Write(data ? (byte)1 : (byte)0); } /// diff --git a/src/Renci.SshNet/Common/SshDataStream.cs b/src/Renci.SshNet/Common/SshDataStream.cs index 9083c26b0..7fd39f9b8 100644 --- a/src/Renci.SshNet/Common/SshDataStream.cs +++ b/src/Renci.SshNet/Common/SshDataStream.cs @@ -131,7 +131,7 @@ public void Write(string s, Encoding encoding) var count = encoding.GetByteCount(value); var bytes = count <= 256 ? stackalloc byte[count] : new byte[count]; encoding.GetBytes(value, bytes); - Write((uint) count); + Write((uint)count); Write(bytes); #else var bytes = encoding.GetBytes(s); @@ -154,7 +154,7 @@ public byte[] ReadBinary() throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "Data longer than {0} is not supported.", int.MaxValue)); } - return ReadBytes((int) length); + return ReadBytes((int)length); } /// @@ -183,7 +183,7 @@ public void WriteBinary(byte[] buffer) /// or is negative. public void WriteBinary(byte[] buffer, int offset, int count) { - Write((uint) count); + Write((uint)count); Write(buffer, offset, count); } @@ -196,7 +196,7 @@ public void WriteBinary(byte[] buffer, int offset, int count) public BigInteger ReadBigInt() { var length = ReadUInt32(); - var data = ReadBytes((int) length); + var data = ReadBytes((int)length); return new BigInteger(data.Reverse()); } @@ -272,7 +272,7 @@ public string ReadString(Encoding encoding = null) throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "Strings longer than {0} is not supported.", int.MaxValue)); } - var bytes = ReadBytes((int) length); + var bytes = ReadBytes((int)length); return encoding.GetString(bytes, 0, bytes.Length); } diff --git a/src/Renci.SshNet/Common/TaskToAsyncResult.cs b/src/Renci.SshNet/Common/TaskToAsyncResult.cs index 947c9376c..df3e904ba 100644 --- a/src/Renci.SshNet/Common/TaskToAsyncResult.cs +++ b/src/Renci.SshNet/Common/TaskToAsyncResult.cs @@ -171,7 +171,7 @@ internal TaskAsyncResult(Task task, object? state, AsyncCallback? callback) public bool IsCompleted => _task.IsCompleted; /// - public WaitHandle AsyncWaitHandle => ((IAsyncResult) _task).AsyncWaitHandle; + public WaitHandle AsyncWaitHandle => ((IAsyncResult)_task).AsyncWaitHandle; } } } diff --git a/src/Renci.SshNet/Common/TimeSpanExtensions.cs b/src/Renci.SshNet/Common/TimeSpanExtensions.cs index 39470ef4f..874db9e64 100644 --- a/src/Renci.SshNet/Common/TimeSpanExtensions.cs +++ b/src/Renci.SshNet/Common/TimeSpanExtensions.cs @@ -23,7 +23,7 @@ public static int AsTimeout(this TimeSpan timeSpan, string callerMemberName) var timeoutInMilliseconds = timeSpan.TotalMilliseconds; return timeoutInMilliseconds is < -1d or > int.MaxValue ? throw new ArgumentOutOfRangeException(callerMemberName, OutOfRangeTimeoutMessage) - : (int) timeoutInMilliseconds; + : (int)timeoutInMilliseconds; } /// diff --git a/src/Renci.SshNet/Connection/HttpConnector.cs b/src/Renci.SshNet/Connection/HttpConnector.cs index afbaf0f01..812518006 100644 --- a/src/Renci.SshNet/Connection/HttpConnector.cs +++ b/src/Renci.SshNet/Connection/HttpConnector.cs @@ -75,7 +75,7 @@ protected override void HandleProxyConnect(IConnectionInfo connectionInfo, Socke if (statusMatch.Success) { var httpStatusCode = statusMatch.Result("${statusCode}"); - statusCode = (HttpStatusCode) int.Parse(httpStatusCode, CultureInfo.InvariantCulture); + statusCode = (HttpStatusCode)int.Parse(httpStatusCode, CultureInfo.InvariantCulture); if (statusCode != HttpStatusCode.OK) { throw new ProxyException($"HTTP: Status code {httpStatusCode}, \"{statusMatch.Result("${reasonPhrase}")}\""); diff --git a/src/Renci.SshNet/Connection/ProxyConnector.cs b/src/Renci.SshNet/Connection/ProxyConnector.cs index 68eb5921a..a3f947efa 100644 --- a/src/Renci.SshNet/Connection/ProxyConnector.cs +++ b/src/Renci.SshNet/Connection/ProxyConnector.cs @@ -28,9 +28,9 @@ Task HandleProxyConnectAsync(IConnectionInfo connectionInfo, Socket socket, Canc cancellationToken.ThrowIfCancellationRequested(); #if NET || NETSTANDARD2_1_OR_GREATER - await using (cancellationToken.Register(o => ((Socket) o).Dispose(), socket, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) + await using (cancellationToken.Register(o => ((Socket)o).Dispose(), socket, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) #else - using (cancellationToken.Register(o => ((Socket) o).Dispose(), socket, useSynchronizationContext: false)) + using (cancellationToken.Register(o => ((Socket)o).Dispose(), socket, useSynchronizationContext: false)) #endif // NET || NETSTANDARD2_1_OR_GREATER { #pragma warning disable MA0042 // Do not use blocking calls in an async method; false positive caused by https://github.com/meziantou/Meziantou.Analyzer/issues/613 diff --git a/src/Renci.SshNet/Connection/Socks4Connector.cs b/src/Renci.SshNet/Connection/Socks4Connector.cs index d6a1971c0..e3e9800f0 100644 --- a/src/Renci.SshNet/Connection/Socks4Connector.cs +++ b/src/Renci.SshNet/Connection/Socks4Connector.cs @@ -28,7 +28,7 @@ public Socks4Connector(ISocketFactory socketFactory) /// The . protected override void HandleProxyConnect(IConnectionInfo connectionInfo, Socket socket) { - var connectionRequest = CreateSocks4ConnectionRequest(connectionInfo.Host, (ushort) connectionInfo.Port, connectionInfo.ProxyUsername); + var connectionRequest = CreateSocks4ConnectionRequest(connectionInfo.Host, (ushort)connectionInfo.Port, connectionInfo.ProxyUsername); SocketAbstraction.Send(socket, connectionRequest); // Read reply version diff --git a/src/Renci.SshNet/Connection/Socks5Connector.cs b/src/Renci.SshNet/Connection/Socks5Connector.cs index cf69f8a7a..40ee547be 100644 --- a/src/Renci.SshNet/Connection/Socks5Connector.cs +++ b/src/Renci.SshNet/Connection/Socks5Connector.cs @@ -82,7 +82,7 @@ protected override void HandleProxyConnect(IConnectionInfo connectionInfo, Socke throw new ProxyException($"SOCKS5: Chosen authentication method '0x{authenticationMethod:x2}' is not supported."); } - var connectionRequest = CreateSocks5ConnectionRequest(connectionInfo.Host, (ushort) connectionInfo.Port); + var connectionRequest = CreateSocks5ConnectionRequest(connectionInfo.Host, (ushort)connectionInfo.Port); SocketAbstraction.Send(socket, connectionRequest); // Read Server SOCKS5 version @@ -181,14 +181,14 @@ private static byte[] CreateSocks5UserNameAndPasswordAuthenticationRequest(strin authenticationRequest[index++] = 0x01; // Length of the username - authenticationRequest[index++] = (byte) username.Length; + authenticationRequest[index++] = (byte)username.Length; // Username _ = SshData.Ascii.GetBytes(username, 0, username.Length, authenticationRequest, index); index += username.Length; // Length of the password - authenticationRequest[index++] = (byte) password.Length; + authenticationRequest[index++] = (byte)password.Length; // Password _ = SshData.Ascii.GetBytes(password, 0, password.Length, authenticationRequest, index); diff --git a/src/Renci.SshNet/ForwardedPortDynamic.cs b/src/Renci.SshNet/ForwardedPortDynamic.cs index 2a2c45f2c..e331edec6 100644 --- a/src/Renci.SshNet/ForwardedPortDynamic.cs +++ b/src/Renci.SshNet/ForwardedPortDynamic.cs @@ -164,7 +164,7 @@ private void InternalStart() ip = Dns.GetHostAddresses(BoundHost)[0]; } - var ep = new IPEndPoint(ip, (int) BoundPort); + var ep = new IPEndPoint(ip, (int)BoundPort); _listener = new Socket(ep.AddressFamily, SocketType.Stream, ProtocolType.Tcp) { NoDelay = true }; _listener.Bind(ep); @@ -738,7 +738,7 @@ private static string ReadString(Socket socket, TimeSpan timeout) break; } - _ = text.Append((char) byteRead); + _ = text.Append((char)byteRead); } return text.ToString(); diff --git a/src/Renci.SshNet/ForwardedPortLocal.cs b/src/Renci.SshNet/ForwardedPortLocal.cs index 2b0d678e4..1a34a5d9f 100644 --- a/src/Renci.SshNet/ForwardedPortLocal.cs +++ b/src/Renci.SshNet/ForwardedPortLocal.cs @@ -201,14 +201,14 @@ protected override void Dispose(bool disposing) private void InternalStart() { var addr = Dns.GetHostAddresses(BoundHost)[0]; - var ep = new IPEndPoint(addr, (int) BoundPort); + var ep = new IPEndPoint(addr, (int)BoundPort); _listener = new Socket(ep.AddressFamily, SocketType.Stream, ProtocolType.Tcp) { NoDelay = true }; _listener.Bind(ep); _listener.Listen(5); // update bound port (in case original was passed as zero) - BoundPort = (uint) ((IPEndPoint) _listener.LocalEndPoint).Port; + BoundPort = (uint)((IPEndPoint)_listener.LocalEndPoint).Port; Session.ErrorOccured += Session_ErrorOccured; Session.Disconnected += Session_Disconnected; @@ -305,10 +305,10 @@ private void ProcessAccept(Socket clientSocket) try { - var originatorEndPoint = (IPEndPoint) clientSocket.RemoteEndPoint; + var originatorEndPoint = (IPEndPoint)clientSocket.RemoteEndPoint; RaiseRequestReceived(originatorEndPoint.Address.ToString(), - (uint) originatorEndPoint.Port); + (uint)originatorEndPoint.Port); using (var channel = Session.CreateChannelDirectTcpip()) { diff --git a/src/Renci.SshNet/ForwardedPortRemote.cs b/src/Renci.SshNet/ForwardedPortRemote.cs index 183b220fe..17a1a569b 100644 --- a/src/Renci.SshNet/ForwardedPortRemote.cs +++ b/src/Renci.SshNet/ForwardedPortRemote.cs @@ -270,7 +270,7 @@ private void Session_ChannelOpening(object sender, MessageEventArgs protected override void SaveData() { - Write((uint) Responses.Count); + Write((uint)Responses.Count); foreach (var response in Responses) { diff --git a/src/Renci.SshNet/Messages/Connection/ChannelRequest/PseudoTerminalRequestInfo.cs b/src/Renci.SshNet/Messages/Connection/ChannelRequest/PseudoTerminalRequestInfo.cs index 22801a90b..e90bac45f 100644 --- a/src/Renci.SshNet/Messages/Connection/ChannelRequest/PseudoTerminalRequestInfo.cs +++ b/src/Renci.SshNet/Messages/Connection/ChannelRequest/PseudoTerminalRequestInfo.cs @@ -141,15 +141,15 @@ protected override void SaveData() // write total length of encoded terminal modes, which is 1 bytes for the opcode / terminal mode // and 4 bytes for the uint argument for each entry; the encoded terminal modes are terminated by // opcode TTY_OP_END (which is 1 byte) - Write(((uint) TerminalModeValues.Count * (1 + 4)) + 1); + Write(((uint)TerminalModeValues.Count * (1 + 4)) + 1); foreach (var item in TerminalModeValues) { - Write((byte) item.Key); + Write((byte)item.Key); Write(item.Value); } - Write((byte) TerminalModes.TTY_OP_END); + Write((byte)TerminalModes.TTY_OP_END); } else { diff --git a/src/Renci.SshNet/Messages/Message.cs b/src/Renci.SshNet/Messages/Message.cs index eaa5622b3..07b747472 100644 --- a/src/Renci.SshNet/Messages/Message.cs +++ b/src/Renci.SshNet/Messages/Message.cs @@ -73,7 +73,7 @@ internal byte[] GetPacket(byte paddingMultiplier, Compressor compressor, bool ex WriteBytes(sshDataStream); } - messageLength = (int) sshDataStream.Length - (outboundPacketSequenceSize + 4 + 1); + messageLength = (int)sshDataStream.Length - (outboundPacketSequenceSize + 4 + 1); var packetLength = messageLength + 4 + 1; @@ -139,12 +139,12 @@ internal byte[] GetPacket(byte paddingMultiplier, Compressor compressor, bool ex private static uint GetPacketDataLength(int messageLength, byte paddingLength) { - return (uint) (messageLength + paddingLength + 1); + return (uint)(messageLength + paddingLength + 1); } private static byte GetPaddingLength(byte paddingMultiplier, long packetLength) { - var paddingLength = (byte) ((-packetLength) & (paddingMultiplier - 1)); + var paddingLength = (byte)((-packetLength) & (paddingMultiplier - 1)); if (paddingLength < paddingMultiplier) { diff --git a/src/Renci.SshNet/Messages/Transport/DisconnectMessage.cs b/src/Renci.SshNet/Messages/Transport/DisconnectMessage.cs index 88ad5a01a..d873a8130 100644 --- a/src/Renci.SshNet/Messages/Transport/DisconnectMessage.cs +++ b/src/Renci.SshNet/Messages/Transport/DisconnectMessage.cs @@ -93,7 +93,7 @@ public DisconnectMessage(DisconnectReason reasonCode, string message) /// protected override void LoadData() { - ReasonCode = (DisconnectReason) ReadUInt32(); + ReasonCode = (DisconnectReason)ReadUInt32(); _description = ReadBinary(); _language = ReadBinary(); } @@ -103,7 +103,7 @@ protected override void LoadData() /// protected override void SaveData() { - Write((uint) ReasonCode); + Write((uint)ReasonCode); WriteBinaryString(_description); WriteBinaryString(_language); } diff --git a/src/Renci.SshNet/PrivateKeyAuthenticationMethod.cs b/src/Renci.SshNet/PrivateKeyAuthenticationMethod.cs index 30ed82548..d71490427 100644 --- a/src/Renci.SshNet/PrivateKeyAuthenticationMethod.cs +++ b/src/Renci.SshNet/PrivateKeyAuthenticationMethod.cs @@ -246,11 +246,11 @@ protected override void LoadData() protected override void SaveData() { WriteBinaryString(_sessionId); - Write((byte) RequestMessage.AuthenticationMessageCode); + Write((byte)RequestMessage.AuthenticationMessageCode); WriteBinaryString(_message.Username); WriteBinaryString(_serviceName); WriteBinaryString(_authenticationMethod); - Write((byte) 1); // TRUE + Write((byte)1); // TRUE WriteBinaryString(_message.PublicKeyAlgorithmName); WriteBinaryString(_message.PublicKeyData); } diff --git a/src/Renci.SshNet/PrivateKeyFile.cs b/src/Renci.SshNet/PrivateKeyFile.cs index ea192ce7b..8cf4da8bb 100644 --- a/src/Renci.SshNet/PrivateKeyFile.cs +++ b/src/Renci.SshNet/PrivateKeyFile.cs @@ -288,7 +288,7 @@ private void Open(Stream privateKey, string passPhrase) _ = reader.ReadUInt32(); // Read total bytes length including magic number var keyType = reader.ReadString(SshData.Ascii); var ssh2CipherName = reader.ReadString(SshData.Ascii); - var blobSize = (int) reader.ReadUInt32(); + var blobSize = (int)reader.ReadUInt32(); byte[] keyData; if (ssh2CipherName == "none") @@ -468,18 +468,18 @@ private static Key ParseOpenSshV1Key(byte[] keyFileData, string passPhrase) var kdfName = keyReader.ReadString(Encoding.UTF8); // kdf options length: 24 if passphrase, 0 if no passphrase - var kdfOptionsLen = (int) keyReader.ReadUInt32(); + var kdfOptionsLen = (int)keyReader.ReadUInt32(); byte[] salt = null; var rounds = 0; if (kdfOptionsLen > 0) { - var saltLength = (int) keyReader.ReadUInt32(); + var saltLength = (int)keyReader.ReadUInt32(); salt = keyReader.ReadBytes(saltLength); - rounds = (int) keyReader.ReadUInt32(); + rounds = (int)keyReader.ReadUInt32(); } // number of public keys, only supporting 1 for now - var numberOfPublicKeys = (int) keyReader.ReadUInt32(); + var numberOfPublicKeys = (int)keyReader.ReadUInt32(); if (numberOfPublicKeys != 1) { throw new SshException("At this time only one public key in the openssh key is supported."); @@ -489,7 +489,7 @@ private static Key ParseOpenSshV1Key(byte[] keyFileData, string passPhrase) _ = keyReader.ReadString(Encoding.UTF8); // possibly encrypted private key - var privateKeyLength = (int) keyReader.ReadUInt32(); + var privateKeyLength = (int)keyReader.ReadUInt32(); var privateKeyBytes = keyReader.ReadBytes(privateKeyLength); // decrypt private key if necessary @@ -551,8 +551,8 @@ private static Key ParseOpenSshV1Key(byte[] keyFileData, string passPhrase) var privateKeyReader = new SshDataReader(privateKeyBytes); // check ints should match, they wouldn't match for example if the wrong passphrase was supplied - var checkInt1 = (int) privateKeyReader.ReadUInt32(); - var checkInt2 = (int) privateKeyReader.ReadUInt32(); + var checkInt1 = (int)privateKeyReader.ReadUInt32(); + var checkInt2 = (int)privateKeyReader.ReadUInt32(); if (checkInt1 != checkInt2) { throw new SshException(string.Format(CultureInfo.InvariantCulture, @@ -583,7 +583,7 @@ private static Key ParseOpenSshV1Key(byte[] keyFileData, string passPhrase) case "ecdsa-sha2-nistp384": case "ecdsa-sha2-nistp521": // curve - var len = (int) privateKeyReader.ReadUInt32(); + var len = (int)privateKeyReader.ReadUInt32(); var curve = Encoding.ASCII.GetString(privateKeyReader.ReadBytes(len)); // public key @@ -613,7 +613,7 @@ private static Key ParseOpenSshV1Key(byte[] keyFileData, string passPhrase) var padding = privateKeyReader.ReadBytes(); for (var i = 0; i < padding.Length; i++) { - if ((int) padding[i] != i + 1) + if ((int)padding[i] != i + 1) { throw new SshException("Padding of openssh key format contained wrong byte at position: " + i.ToString(CultureInfo.InvariantCulture)); @@ -648,7 +648,7 @@ protected virtual void Dispose(bool disposing) var key = _key; if (key != null) { - ((IDisposable) key).Dispose(); + ((IDisposable)key).Dispose(); _key = null; } @@ -697,7 +697,7 @@ public SshDataReader(byte[] data) /// mpint read. public BigInteger ReadBigIntWithBits() { - var length = (int) base.ReadUInt32(); + var length = (int)base.ReadUInt32(); length = (length + 7) / 8; @@ -715,7 +715,7 @@ public BigInteger ReadBignum() public byte[] ReadBignum2() { - var length = (int) base.ReadUInt32(); + var length = (int)base.ReadUInt32(); return base.ReadBytes(length); } diff --git a/src/Renci.SshNet/ScpClient.cs b/src/Renci.SshNet/ScpClient.cs index 7aa57c62b..1c624681f 100644 --- a/src/Renci.SshNet/ScpClient.cs +++ b/src/Renci.SshNet/ScpClient.cs @@ -623,7 +623,7 @@ private string ReadString(Stream stream) while (b != SshNet.Session.LineFeed) { - buffer.Add((byte) b); + buffer.Add((byte)b); b = ReadByte(stream); } @@ -651,8 +651,8 @@ private void UploadTimes(IChannelSession channel, Stream input, FileSystemInfo f #else var zeroTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); #endif - var modificationSeconds = (long) (fileOrDirectory.LastWriteTimeUtc - zeroTime).TotalSeconds; - var accessSeconds = (long) (fileOrDirectory.LastAccessTimeUtc - zeroTime).TotalSeconds; + var modificationSeconds = (long)(fileOrDirectory.LastWriteTimeUtc - zeroTime).TotalSeconds; + var accessSeconds = (long)(fileOrDirectory.LastAccessTimeUtc - zeroTime).TotalSeconds; SendData(channel, string.Format(CultureInfo.InvariantCulture, "T{0} 0 {1} 0\n", modificationSeconds, accessSeconds)); CheckReturnCode(input); } @@ -707,7 +707,7 @@ private void InternalDownload(IChannel channel, Stream input, Stream output, str do { - var read = input.Read(buffer, 0, (int) Math.Min(needToRead, BufferSize)); + var read = input.Read(buffer, 0, (int)Math.Min(needToRead, BufferSize)); output.Write(buffer, 0, read); diff --git a/src/Renci.SshNet/Security/Cryptography/Ciphers/AesCipher.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/AesCipher.cs index 447e1aee3..a7c16f72c 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/AesCipher.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/AesCipher.cs @@ -47,7 +47,7 @@ public AesCipher(byte[] key, byte[] iv, AesCipherMode mode, bool pkcs7Padding = _impl = new BclImpl( key, iv, - (System.Security.Cryptography.CipherMode) mode, + (System.Security.Cryptography.CipherMode)mode, pkcs7Padding ? PaddingMode.PKCS7 : PaddingMode.None); } } diff --git a/src/Renci.SshNet/Security/Cryptography/Ciphers/Arc4Cipher.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/Arc4Cipher.cs index 3c60ad19b..43805d65f 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/Arc4Cipher.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/Arc4Cipher.cs @@ -103,7 +103,7 @@ private int ProcessBytes(byte[] inputBuffer, int inputOffset, int inputCount, by _engineState[_y] = tmp; // xor - outputBuffer[i + outputOffset] = (byte) (inputBuffer[i + inputOffset] ^ _engineState[(_engineState[_x] + _engineState[_y]) & 0xff]); + outputBuffer[i + outputOffset] = (byte)(inputBuffer[i + inputOffset] ^ _engineState[(_engineState[_x] + _engineState[_y]) & 0xff]); } return inputCount; @@ -119,7 +119,7 @@ private void SetKey(byte[] keyBytes) // reset the state of the engine for (var i = 0; i < STATE_LENGTH; i++) { - _engineState[i] = (byte) i; + _engineState[i] = (byte)i; } var i1 = 0; diff --git a/src/Renci.SshNet/Security/Cryptography/Ciphers/CastCipher.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/CastCipher.cs index 0fa0c9c58..00f3b42d9 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/CastCipher.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/CastCipher.cs @@ -515,10 +515,10 @@ private void SetKey(byte[] key) Bits32ToInts(z8B, z, 0x8); zCf = x47 ^ S5[z[0xA]] ^ S6[z[0x9]] ^ S7[z[0xB]] ^ S8[z[0x8]] ^ S6[x[0xB]]; Bits32ToInts(zCf, z, 0xC); - _kr[1] = (int) ((S5[z[0x8]] ^ S6[z[0x9]] ^ S7[z[0x7]] ^ S8[z[0x6]] ^ S5[z[0x2]]) & 0x1f); - _kr[2] = (int) ((S5[z[0xA]] ^ S6[z[0xB]] ^ S7[z[0x5]] ^ S8[z[0x4]] ^ S6[z[0x6]]) & 0x1f); - _kr[3] = (int) ((S5[z[0xC]] ^ S6[z[0xD]] ^ S7[z[0x3]] ^ S8[z[0x2]] ^ S7[z[0x9]]) & 0x1f); - _kr[4] = (int) ((S5[z[0xE]] ^ S6[z[0xF]] ^ S7[z[0x1]] ^ S8[z[0x0]] ^ S8[z[0xC]]) & 0x1f); + _kr[1] = (int)((S5[z[0x8]] ^ S6[z[0x9]] ^ S7[z[0x7]] ^ S8[z[0x6]] ^ S5[z[0x2]]) & 0x1f); + _kr[2] = (int)((S5[z[0xA]] ^ S6[z[0xB]] ^ S7[z[0x5]] ^ S8[z[0x4]] ^ S6[z[0x6]]) & 0x1f); + _kr[3] = (int)((S5[z[0xC]] ^ S6[z[0xD]] ^ S7[z[0x3]] ^ S8[z[0x2]] ^ S7[z[0x9]]) & 0x1f); + _kr[4] = (int)((S5[z[0xE]] ^ S6[z[0xF]] ^ S7[z[0x1]] ^ S8[z[0x0]] ^ S8[z[0xC]]) & 0x1f); z03 = IntsTo32Bits(z, 0x0); z47 = IntsTo32Bits(z, 0x4); @@ -532,10 +532,10 @@ private void SetKey(byte[] key) Bits32ToInts(x8B, x, 0x8); xCf = zCf ^ S5[x[0xA]] ^ S6[x[0x9]] ^ S7[x[0xB]] ^ S8[x[0x8]] ^ S6[z[0x3]]; Bits32ToInts(xCf, x, 0xC); - _kr[5] = (int) ((S5[x[0x3]] ^ S6[x[0x2]] ^ S7[x[0xC]] ^ S8[x[0xD]] ^ S5[x[0x8]]) & 0x1f); - _kr[6] = (int) ((S5[x[0x1]] ^ S6[x[0x0]] ^ S7[x[0xE]] ^ S8[x[0xF]] ^ S6[x[0xD]]) & 0x1f); - _kr[7] = (int) ((S5[x[0x7]] ^ S6[x[0x6]] ^ S7[x[0x8]] ^ S8[x[0x9]] ^ S7[x[0x3]]) & 0x1f); - _kr[8] = (int) ((S5[x[0x5]] ^ S6[x[0x4]] ^ S7[x[0xA]] ^ S8[x[0xB]] ^ S8[x[0x7]]) & 0x1f); + _kr[5] = (int)((S5[x[0x3]] ^ S6[x[0x2]] ^ S7[x[0xC]] ^ S8[x[0xD]] ^ S5[x[0x8]]) & 0x1f); + _kr[6] = (int)((S5[x[0x1]] ^ S6[x[0x0]] ^ S7[x[0xE]] ^ S8[x[0xF]] ^ S6[x[0xD]]) & 0x1f); + _kr[7] = (int)((S5[x[0x7]] ^ S6[x[0x6]] ^ S7[x[0x8]] ^ S8[x[0x9]] ^ S7[x[0x3]]) & 0x1f); + _kr[8] = (int)((S5[x[0x5]] ^ S6[x[0x4]] ^ S7[x[0xA]] ^ S8[x[0xB]] ^ S8[x[0x7]]) & 0x1f); x03 = IntsTo32Bits(x, 0x0); x47 = IntsTo32Bits(x, 0x4); @@ -549,10 +549,10 @@ private void SetKey(byte[] key) Bits32ToInts(z8B, z, 0x8); zCf = x47 ^ S5[z[0xA]] ^ S6[z[0x9]] ^ S7[z[0xB]] ^ S8[z[0x8]] ^ S6[x[0xB]]; Bits32ToInts(zCf, z, 0xC); - _kr[9] = (int) ((S5[z[0x3]] ^ S6[z[0x2]] ^ S7[z[0xC]] ^ S8[z[0xD]] ^ S5[z[0x9]]) & 0x1f); - _kr[10] = (int) ((S5[z[0x1]] ^ S6[z[0x0]] ^ S7[z[0xE]] ^ S8[z[0xF]] ^ S6[z[0xc]]) & 0x1f); - _kr[11] = (int) ((S5[z[0x7]] ^ S6[z[0x6]] ^ S7[z[0x8]] ^ S8[z[0x9]] ^ S7[z[0x2]]) & 0x1f); - _kr[12] = (int) ((S5[z[0x5]] ^ S6[z[0x4]] ^ S7[z[0xA]] ^ S8[z[0xB]] ^ S8[z[0x6]]) & 0x1f); + _kr[9] = (int)((S5[z[0x3]] ^ S6[z[0x2]] ^ S7[z[0xC]] ^ S8[z[0xD]] ^ S5[z[0x9]]) & 0x1f); + _kr[10] = (int)((S5[z[0x1]] ^ S6[z[0x0]] ^ S7[z[0xE]] ^ S8[z[0xF]] ^ S6[z[0xc]]) & 0x1f); + _kr[11] = (int)((S5[z[0x7]] ^ S6[z[0x6]] ^ S7[z[0x8]] ^ S8[z[0x9]] ^ S7[z[0x2]]) & 0x1f); + _kr[12] = (int)((S5[z[0x5]] ^ S6[z[0x4]] ^ S7[z[0xA]] ^ S8[z[0xB]] ^ S8[z[0x6]]) & 0x1f); z03 = IntsTo32Bits(z, 0x0); z47 = IntsTo32Bits(z, 0x4); @@ -566,10 +566,10 @@ private void SetKey(byte[] key) Bits32ToInts(x8B, x, 0x8); xCf = zCf ^ S5[x[0xA]] ^ S6[x[0x9]] ^ S7[x[0xB]] ^ S8[x[0x8]] ^ S6[z[0x3]]; Bits32ToInts(xCf, x, 0xC); - _kr[13] = (int) ((S5[x[0x8]] ^ S6[x[0x9]] ^ S7[x[0x7]] ^ S8[x[0x6]] ^ S5[x[0x3]]) & 0x1f); - _kr[14] = (int) ((S5[x[0xA]] ^ S6[x[0xB]] ^ S7[x[0x5]] ^ S8[x[0x4]] ^ S6[x[0x7]]) & 0x1f); - _kr[15] = (int) ((S5[x[0xC]] ^ S6[x[0xD]] ^ S7[x[0x3]] ^ S8[x[0x2]] ^ S7[x[0x8]]) & 0x1f); - _kr[16] = (int) ((S5[x[0xE]] ^ S6[x[0xF]] ^ S7[x[0x1]] ^ S8[x[0x0]] ^ S8[x[0xD]]) & 0x1f); + _kr[13] = (int)((S5[x[0x8]] ^ S6[x[0x9]] ^ S7[x[0x7]] ^ S8[x[0x6]] ^ S5[x[0x3]]) & 0x1f); + _kr[14] = (int)((S5[x[0xA]] ^ S6[x[0xB]] ^ S7[x[0x5]] ^ S8[x[0x4]] ^ S6[x[0x7]]) & 0x1f); + _kr[15] = (int)((S5[x[0xC]] ^ S6[x[0xD]] ^ S7[x[0x3]] ^ S8[x[0x2]] ^ S7[x[0x8]]) & 0x1f); + _kr[16] = (int)((S5[x[0xE]] ^ S6[x[0xF]] ^ S7[x[0x1]] ^ S8[x[0x0]] ^ S8[x[0xD]]) & 0x1f); } /// @@ -709,15 +709,15 @@ private void CastDecipher(uint l16, uint r16, uint[] result) private static void Bits32ToInts(uint inData, int[] b, int offset) { - b[offset + 3] = (int) (inData & 0xff); - b[offset + 2] = (int) ((inData >> 8) & 0xff); - b[offset + 1] = (int) ((inData >> 16) & 0xff); - b[offset] = (int) ((inData >> 24) & 0xff); + b[offset + 3] = (int)(inData & 0xff); + b[offset + 2] = (int)((inData >> 8) & 0xff); + b[offset + 1] = (int)((inData >> 16) & 0xff); + b[offset] = (int)((inData >> 24) & 0xff); } private static uint IntsTo32Bits(int[] b, int i) { - return (uint) (((b[i] & 0xff) << 24) | + return (uint)(((b[i] & 0xff) << 24) | ((b[i + 1] & 0xff) << 16) | ((b[i + 2] & 0xff) << 8) | (b[i + 3] & 0xff)); diff --git a/src/Renci.SshNet/Security/Cryptography/Ciphers/DesCipher.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/DesCipher.cs index 9679b8397..d1b282e4e 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/DesCipher.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/DesCipher.cs @@ -301,7 +301,7 @@ protected int[] GenerateWorkingKey(bool encrypting, byte[] key) { int l = Pc1[j]; - pc1m[j] = (key[(uint) l >> 3] & Bytebit[l & 07]) != 0; + pc1m[j] = (key[(uint)l >> 3] & Bytebit[l & 07]) != 0; } for (var i = 0; i < 16; i++) @@ -369,15 +369,15 @@ protected int[] GenerateWorkingKey(bool encrypting, byte[] key) var i1 = newKey[i]; var i2 = newKey[i + 1]; - newKey[i] = (int) ((uint) ((i1 & 0x00fc0000) << 6) | - (uint) ((i1 & 0x00000fc0) << 10) | - ((uint) (i2 & 0x00fc0000) >> 10) | - ((uint) (i2 & 0x00000fc0) >> 6)); + newKey[i] = (int)((uint)((i1 & 0x00fc0000) << 6) | + (uint)((i1 & 0x00000fc0) << 10) | + ((uint)(i2 & 0x00fc0000) >> 10) | + ((uint)(i2 & 0x00000fc0) >> 6)); - newKey[i + 1] = (int) ((uint) ((i1 & 0x0003f000) << 12) | - (uint) ((i1 & 0x0000003f) << 16) | - ((uint) (i2 & 0x0003f000) >> 4) | - (uint) (i2 & 0x0000003f)); + newKey[i + 1] = (int)((uint)((i1 & 0x0003f000) << 12) | + (uint)((i1 & 0x0000003f) << 16) | + ((uint)(i2 & 0x0003f000) >> 4) | + (uint)(i2 & 0x0000003f)); } return newKey; @@ -430,24 +430,24 @@ protected static void DesFunc(int[] wKey, byte[] input, int inOff, byte[] outByt for (var round = 0; round < 8; round++) { work = (right << 28) | (right >> 4); - work ^= (uint) wKey[(round * 4) + 0]; + work ^= (uint)wKey[(round * 4) + 0]; var fval = Sp7[work & 0x3f]; fval |= Sp5[(work >> 8) & 0x3f]; fval |= Sp3[(work >> 16) & 0x3f]; fval |= Sp1[(work >> 24) & 0x3f]; - work = right ^ (uint) wKey[(round * 4) + 1]; + work = right ^ (uint)wKey[(round * 4) + 1]; fval |= Sp8[work & 0x3f]; fval |= Sp6[(work >> 8) & 0x3f]; fval |= Sp4[(work >> 16) & 0x3f]; fval |= Sp2[(work >> 24) & 0x3f]; left ^= fval; work = (left << 28) | (left >> 4); - work ^= (uint) wKey[(round * 4) + 2]; + work ^= (uint)wKey[(round * 4) + 2]; fval = Sp7[work & 0x3f]; fval |= Sp5[(work >> 8) & 0x3f]; fval |= Sp3[(work >> 16) & 0x3f]; fval |= Sp1[(work >> 24) & 0x3f]; - work = left ^ (uint) wKey[(round * 4) + 3]; + work = left ^ (uint)wKey[(round * 4) + 3]; fval |= Sp8[work & 0x3f]; fval |= Sp6[(work >> 8) & 0x3f]; fval |= Sp4[(work >> 16) & 0x3f]; diff --git a/src/Renci.SshNet/Security/Cryptography/Ciphers/Modes/CfbCipherMode.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/Modes/CfbCipherMode.cs index fcc352123..23a4bb2f7 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/Modes/CfbCipherMode.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/Modes/CfbCipherMode.cs @@ -52,7 +52,7 @@ public override int EncryptBlock(byte[] inputBuffer, int inputOffset, int inputC for (var i = 0; i < _blockSize; i++) { - outputBuffer[outputOffset + i] = (byte) (_ivOutput[i] ^ inputBuffer[inputOffset + i]); + outputBuffer[outputOffset + i] = (byte)(_ivOutput[i] ^ inputBuffer[inputOffset + i]); } Buffer.BlockCopy(IV, _blockSize, IV, 0, IV.Length - _blockSize); @@ -96,7 +96,7 @@ public override int DecryptBlock(byte[] inputBuffer, int inputOffset, int inputC for (var i = 0; i < _blockSize; i++) { - outputBuffer[outputOffset + i] = (byte) (_ivOutput[i] ^ inputBuffer[inputOffset + i]); + outputBuffer[outputOffset + i] = (byte)(_ivOutput[i] ^ inputBuffer[inputOffset + i]); } return _blockSize; diff --git a/src/Renci.SshNet/Security/Cryptography/Ciphers/Modes/CtrCipherMode.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/Modes/CtrCipherMode.cs index fe06b55a0..a0ae5010b 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/Modes/CtrCipherMode.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/Modes/CtrCipherMode.cs @@ -52,7 +52,7 @@ public override int EncryptBlock(byte[] inputBuffer, int inputOffset, int inputC for (var i = 0; i < _blockSize; i++) { - outputBuffer[outputOffset + i] = (byte) (_ivOutput[i] ^ inputBuffer[inputOffset + i]); + outputBuffer[outputOffset + i] = (byte)(_ivOutput[i] ^ inputBuffer[inputOffset + i]); } var j = IV.Length; diff --git a/src/Renci.SshNet/Security/Cryptography/Ciphers/Modes/OfbCipherMode.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/Modes/OfbCipherMode.cs index 70b6473d3..df2ce60be 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/Modes/OfbCipherMode.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/Modes/OfbCipherMode.cs @@ -54,7 +54,7 @@ public override int EncryptBlock(byte[] inputBuffer, int inputOffset, int inputC for (var i = 0; i < _blockSize; i++) { - outputBuffer[outputOffset + i] = (byte) (_ivOutput[i] ^ inputBuffer[inputOffset + i]); + outputBuffer[outputOffset + i] = (byte)(_ivOutput[i] ^ inputBuffer[inputOffset + i]); } return _blockSize; diff --git a/src/Renci.SshNet/Security/Cryptography/Ciphers/Paddings/PKCS5Padding.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/Paddings/PKCS5Padding.cs index 18e85c597..131719b1c 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/Paddings/PKCS5Padding.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/Paddings/PKCS5Padding.cs @@ -40,7 +40,7 @@ public override byte[] Pad(byte[] input, int offset, int length, int paddingleng for (var i = 0; i < paddinglength; i++) { - output[length + i] = (byte) paddinglength; + output[length + i] = (byte)paddinglength; } return output; diff --git a/src/Renci.SshNet/Security/Cryptography/Ciphers/Paddings/PKCS7Padding.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/Paddings/PKCS7Padding.cs index eb950abf4..7234a4f53 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/Paddings/PKCS7Padding.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/Paddings/PKCS7Padding.cs @@ -40,7 +40,7 @@ public override byte[] Pad(byte[] input, int offset, int length, int paddingleng for (var i = 0; i < paddinglength; i++) { - output[length + i] = (byte) paddinglength; + output[length + i] = (byte)paddinglength; } return output; diff --git a/src/Renci.SshNet/Security/Cryptography/Ciphers/SerpentCipher.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/SerpentCipher.cs index 396ec5dbd..bbe163fd2 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/SerpentCipher.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/SerpentCipher.cs @@ -8,7 +8,7 @@ namespace Renci.SshNet.Security.Cryptography.Ciphers public sealed class SerpentCipher : BlockCipher { private const int Rounds = 32; - private const int Phi = unchecked((int) 0x9E3779B9); // (Sqrt(5) - 1) * 2**31 + private const int Phi = unchecked((int)0x9E3779B9); // (Sqrt(5) - 1) * 2**31 private readonly int[] _workingKey; @@ -669,12 +669,12 @@ private int[] MakeWorkingKey(byte[] key) private static int RotateLeft(int x, int bits) { - return (x << bits) | (int) ((uint) x >> (32 - bits)); + return (x << bits) | (int)((uint)x >> (32 - bits)); } private static int RotateRight(int x, int bits) { - return (int) ((uint) x >> bits) | (x << (32 - bits)); + return (int)((uint)x >> bits) | (x << (32 - bits)); } private static int BytesToWord(byte[] src, int srcOff) @@ -685,10 +685,10 @@ private static int BytesToWord(byte[] src, int srcOff) private static void WordToBytes(int word, byte[] dst, int dstOff) { - dst[dstOff + 3] = (byte) word; - dst[dstOff + 2] = (byte) ((uint) word >> 8); - dst[dstOff + 1] = (byte) ((uint) word >> 16); - dst[dstOff] = (byte) ((uint) word >> 24); + dst[dstOff + 3] = (byte)word; + dst[dstOff + 2] = (byte)((uint)word >> 8); + dst[dstOff + 1] = (byte)((uint)word >> 16); + dst[dstOff] = (byte)((uint)word >> 24); } /* diff --git a/src/Renci.SshNet/Security/Cryptography/Ciphers/TwofishCipher.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/TwofishCipher.cs index 067016156..e977f51d3 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/TwofishCipher.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/TwofishCipher.cs @@ -145,14 +145,14 @@ public override int EncryptBlock(byte[] inputBuffer, int inputOffset, int inputC var t0 = Fe32_0(_gSBox, x0); var t1 = Fe32_3(_gSBox, x1); x2 ^= t0 + t1 + _gSubKeys[k++]; - x2 = (int) ((uint) x2 >> 1) | x2 << 31; - x3 = (x3 << 1 | (int) ((uint) x3 >> 31)) ^ (t0 + (2 * t1) + _gSubKeys[k++]); + x2 = (int)((uint)x2 >> 1) | x2 << 31; + x3 = (x3 << 1 | (int)((uint)x3 >> 31)) ^ (t0 + (2 * t1) + _gSubKeys[k++]); t0 = Fe32_0(_gSBox, x2); t1 = Fe32_3(_gSBox, x3); x0 ^= t0 + t1 + _gSubKeys[k++]; - x0 = (int) ((uint) x0 >> 1) | x0 << 31; - x1 = (x1 << 1 | (int) ((uint) x1 >> 31)) ^ (t0 + (2 * t1) + _gSubKeys[k++]); + x0 = (int)((uint)x0 >> 1) | x0 << 31; + x1 = (x1 << 1 | (int)((uint)x1 >> 31)) ^ (t0 + (2 * t1) + _gSubKeys[k++]); } Bits32ToBytes(x2 ^ _gSubKeys[OUTPUT_WHITEN], outputBuffer, outputOffset); @@ -187,14 +187,14 @@ public override int DecryptBlock(byte[] inputBuffer, int inputOffset, int inputC var t0 = Fe32_0(_gSBox, x2); var t1 = Fe32_3(_gSBox, x3); x1 ^= t0 + (2 * t1) + _gSubKeys[k--]; - x0 = (x0 << 1 | (int) ((uint) x0 >> 31)) ^ (t0 + t1 + _gSubKeys[k--]); - x1 = (int) ((uint) x1 >> 1) | x1 << 31; + x0 = (x0 << 1 | (int)((uint)x0 >> 31)) ^ (t0 + t1 + _gSubKeys[k--]); + x1 = (int)((uint)x1 >> 1) | x1 << 31; t0 = Fe32_0(_gSBox, x0); t1 = Fe32_3(_gSBox, x1); x3 ^= t0 + (2 * t1) + _gSubKeys[k--]; - x2 = (x2 << 1 | (int) ((uint) x2 >> 31)) ^ (t0 + t1 + _gSubKeys[k--]); - x3 = (int) ((uint) x3 >> 1) | x3 << 31; + x2 = (x2 << 1 | (int)((uint)x2 >> 31)) ^ (t0 + t1 + _gSubKeys[k--]); + x3 = (int)((uint)x3 >> 1) | x3 << 31; } Bits32ToBytes(x0 ^ _gSubKeys[INPUT_WHITEN], outputBuffer, outputOffset); @@ -283,11 +283,11 @@ private void SetKey(byte[] key) var q = i * SK_STEP; var a = F32(q, k32e); var b = F32(q + SK_BUMP, k32o); - b = b << 8 | (int) ((uint) b >> 24); + b = b << 8 | (int)((uint)b >> 24); a += b; _gSubKeys[i * 2] = a; a += b; - _gSubKeys[(i * 2) + 1] = a << SK_ROTL | (int) ((uint) a >> (32 - SK_ROTL)); + _gSubKeys[(i * 2) + 1] = a << SK_ROTL | (int)((uint)a >> (32 - SK_ROTL)); } /* @@ -430,9 +430,9 @@ private static int RS_MDS_Encode(int k0, int k1) */ private static int RS_rem(int x) { - var b = (int) (((uint) x >> 24) & 0xff); + var b = (int)(((uint)x >> 24) & 0xff); var g2 = ((b << 1) ^ ((b & 0x80) != 0 ? RS_GF_FDBK : 0)) & 0xff; - var g3 = ((int) ((uint) b >> 1) ^ ((b & 0x01) != 0 ? (int) ((uint) RS_GF_FDBK >> 1) : 0)) ^ g2; + var g3 = ((int)((uint)b >> 1) ^ ((b & 0x01) != 0 ? (int)((uint)RS_GF_FDBK >> 1) : 0)) ^ g2; return (x << 8) ^ (g3 << 24) ^ (g2 << 16) ^ (g3 << 8) ^ b; } @@ -467,37 +467,37 @@ private static int M_b0(int x) private static int M_b1(int x) #pragma warning restore IDE1006 // Naming Styles { - return (int) ((uint) x >> 8) & 0xff; + return (int)((uint)x >> 8) & 0xff; } #pragma warning disable IDE1006 // Naming Styles private static int M_b2(int x) #pragma warning restore IDE1006 // Naming Styles { - return (int) ((uint) x >> 16) & 0xff; + return (int)((uint)x >> 16) & 0xff; } #pragma warning disable IDE1006 // Naming Styles private static int M_b3(int x) #pragma warning restore IDE1006 // Naming Styles { - return (int) ((uint) x >> 24) & 0xff; + return (int)((uint)x >> 24) & 0xff; } private static int Fe32_0(int[] gSBox1, int x) { return gSBox1[0x000 + (2 * (x & 0xff))] ^ - gSBox1[0x001 + (2 * ((int) ((uint) x >> 8) & 0xff))] ^ - gSBox1[0x200 + (2 * ((int) ((uint) x >> 16) & 0xff))] ^ - gSBox1[0x201 + (2 * ((int) ((uint) x >> 24) & 0xff))]; + gSBox1[0x001 + (2 * ((int)((uint)x >> 8) & 0xff))] ^ + gSBox1[0x200 + (2 * ((int)((uint)x >> 16) & 0xff))] ^ + gSBox1[0x201 + (2 * ((int)((uint)x >> 24) & 0xff))]; } private static int Fe32_3(int[] gSBox1, int x) { - return gSBox1[0x000 + (2 * ((int) ((uint) x >> 24) & 0xff))] ^ + return gSBox1[0x000 + (2 * ((int)((uint)x >> 24) & 0xff))] ^ gSBox1[0x001 + (2 * (x & 0xff))] ^ - gSBox1[0x200 + (2 * ((int) ((uint) x >> 8) & 0xff))] ^ - gSBox1[0x201 + (2 * ((int) ((uint) x >> 16) & 0xff))]; + gSBox1[0x200 + (2 * ((int)((uint)x >> 8) & 0xff))] ^ + gSBox1[0x201 + (2 * ((int)((uint)x >> 16) & 0xff))]; } private static int BytesTo32Bits(byte[] b, int p) @@ -510,10 +510,10 @@ private static int BytesTo32Bits(byte[] b, int p) private static void Bits32ToBytes(int inData, byte[] b, int offset) { - b[offset] = (byte) inData; - b[offset + 1] = (byte) (inData >> 8); - b[offset + 2] = (byte) (inData >> 16); - b[offset + 3] = (byte) (inData >> 24); + b[offset] = (byte)inData; + b[offset + 1] = (byte)(inData >> 8); + b[offset + 2] = (byte)(inData >> 16); + b[offset + 3] = (byte)(inData >> 24); } } } diff --git a/src/Renci.SshNet/Security/Cryptography/EcdsaDigitalSignature.cs b/src/Renci.SshNet/Security/Cryptography/EcdsaDigitalSignature.cs index 840eed49a..fd44b41d9 100644 --- a/src/Renci.SshNet/Security/Cryptography/EcdsaDigitalSignature.cs +++ b/src/Renci.SshNet/Security/Cryptography/EcdsaDigitalSignature.cs @@ -164,7 +164,7 @@ protected override void SaveData() throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "Strings longer than {0} is not supported.", int.MaxValue)); } - return ReadBytes((int) length); + return ReadBytes((int)length); } protected override int BufferCapacity diff --git a/src/Renci.SshNet/Security/Cryptography/EcdsaKey.cs b/src/Renci.SshNet/Security/Cryptography/EcdsaKey.cs index 19db7d810..6bf244bc4 100644 --- a/src/Renci.SshNet/Security/Cryptography/EcdsaKey.cs +++ b/src/Renci.SshNet/Security/Cryptography/EcdsaKey.cs @@ -159,7 +159,7 @@ public override BigInteger[] Public KeyBlobMagicNumber magic; using (var br = new BinaryReader(new MemoryStream(blob))) { - magic = (KeyBlobMagicNumber) br.ReadInt32(); + magic = (KeyBlobMagicNumber)br.ReadInt32(); var cbKey = br.ReadInt32(); qx = br.ReadBytes(cbKey); qy = br.ReadBytes(cbKey); @@ -388,7 +388,7 @@ private void Import(string curve_oid, byte[] publickey, byte[] privatekey) var blob = new byte[blobSize]; using (var bw = new BinaryWriter(new MemoryStream(blob))) { - bw.Write((int) curve_magic); + bw.Write((int)curve_magic); bw.Write(cord_size); bw.Write(qx); // q.x bw.Write(qy); // q.y diff --git a/src/Renci.SshNet/Security/KeyExchange.cs b/src/Renci.SshNet/Security/KeyExchange.cs index 4c798d078..d87b5f083 100644 --- a/src/Renci.SshNet/Security/KeyExchange.cs +++ b/src/Renci.SshNet/Security/KeyExchange.cs @@ -500,7 +500,7 @@ protected override void SaveData() { WriteBinaryString(SharedKey); Write(ExchangeHash); - Write((byte) Char); + Write((byte)Char); Write(SessionId); } } diff --git a/src/Renci.SshNet/Security/KeyExchangeECDH.cs b/src/Renci.SshNet/Security/KeyExchangeECDH.cs index 442a15d6f..f5bd46a1f 100644 --- a/src/Renci.SshNet/Security/KeyExchangeECDH.cs +++ b/src/Renci.SshNet/Security/KeyExchangeECDH.cs @@ -46,7 +46,7 @@ public override void Start(Session session, KeyExchangeInitMessage message, bool var aKeyPair = g.GenerateKeyPair(); _keyAgreement = new ECDHCBasicAgreement(); _keyAgreement.Init(aKeyPair.Private); - _clientExchangeValue = ((ECPublicKeyParameters) aKeyPair.Public).Q.GetEncoded(); + _clientExchangeValue = ((ECPublicKeyParameters)aKeyPair.Public).Q.GetEncoded(); SendMessage(new KeyExchangeEcdhInitMessage(_clientExchangeValue)); } @@ -92,7 +92,7 @@ private void HandleServerEcdhReply(byte[] hostKey, byte[] serverExchangeValue, b var y = new byte[cordSize]; Buffer.BlockCopy(serverExchangeValue, cordSize + 1, y, 0, y.Length); - var c = (FpCurve) _domainParameters.Curve; + var c = (FpCurve)_domainParameters.Curve; var q = c.CreatePoint(new Org.BouncyCastle.Math.BigInteger(1, x), new Org.BouncyCastle.Math.BigInteger(1, y)); var publicKey = new ECPublicKeyParameters("ECDH", q, _domainParameters); diff --git a/src/Renci.SshNet/ServiceFactory.cs b/src/Renci.SshNet/ServiceFactory.cs index 775e9422b..0cc9a6010 100644 --- a/src/Renci.SshNet/ServiceFactory.cs +++ b/src/Renci.SshNet/ServiceFactory.cs @@ -152,7 +152,7 @@ public ISftpFileReader CreateSftpFileReader(string fileName, ISftpSession sftpSe { var fileAttributes = sftpSession.EndLStat(statAsyncResult); fileSize = fileAttributes.Size; - maxPendingReads = Math.Min(100, (int) Math.Ceiling((double) fileAttributes.Size / chunkSize) + 1); + maxPendingReads = Math.Min(100, (int)Math.Ceiling((double)fileAttributes.Size / chunkSize) + 1); } catch (SshException ex) { diff --git a/src/Renci.SshNet/Session.cs b/src/Renci.SshNet/Session.cs index b48c6d6b4..6607b6bde 100644 --- a/src/Renci.SshNet/Session.cs +++ b/src/Renci.SshNet/Session.cs @@ -236,7 +236,7 @@ private uint NextChannelNumber { get { - return (uint) Interlocked.Increment(ref _nextChannelNumber); + return (uint)Interlocked.Increment(ref _nextChannelNumber); } } @@ -1036,7 +1036,7 @@ internal void SendMessage(Message message) DiagnosticAbstraction.Log(string.Format("[{0}] Sending message '{1}' to server: '{2}'.", ToHex(SessionId), message.GetType().Name, message)); - var paddingMultiplier = _clientCipher is null ? (byte) 8 : Math.Max((byte) 8, _clientCipher.MinimumSize); + var paddingMultiplier = _clientCipher is null ? (byte)8 : Math.Max((byte)8, _clientCipher.MinimumSize); var packetData = message.GetPacket(paddingMultiplier, _clientCompression, _clientEtm || _clientAead); // take a write lock to ensure the outbound packet sequence number is incremented @@ -1207,15 +1207,15 @@ private Message ReceiveMessage(Socket socket) // Determine the size of the first block which is 8 or cipher block size (whichever is larger) bytes, or 4 if "packet length" field is handled separately. if (_serverEtm || _serverAead) { - blockSize = (byte) 4; + blockSize = (byte)4; } else if (_serverCipher != null) { - blockSize = Math.Max((byte) 8, _serverCipher.MinimumSize); + blockSize = Math.Max((byte)8, _serverCipher.MinimumSize); } else { - blockSize = (byte) 8; + blockSize = (byte)8; } var serverMacLength = 0; @@ -1253,7 +1253,7 @@ private Message ReceiveMessage(Socket socket) packetLength = Pack.BigEndianToUInt32(firstBlock); // Test packet minimum and maximum boundaries - if (packetLength < Math.Max((byte) 16, blockSize) - 4 || packetLength > MaximumSshPacketSize - 4) + if (packetLength < Math.Max((byte)16, blockSize) - 4 || packetLength > MaximumSshPacketSize - 4) { throw new SshConnectionException(string.Format(CultureInfo.CurrentCulture, "Bad packet length: {0}.", packetLength), DisconnectReason.ProtocolError); @@ -1261,7 +1261,7 @@ private Message ReceiveMessage(Socket socket) // Determine the number of bytes left to read; We've already read "blockSize" bytes, but the // "packet length" field itself - which is 4 bytes - is not included in the length of the packet - var bytesToRead = (int) (packetLength - (blockSize - packetLengthFieldLength)) + serverMacLength; + var bytesToRead = (int)(packetLength - (blockSize - packetLengthFieldLength)) + serverMacLength; // Construct buffer for holding the payload and the inbound packet sequence as we need both in order // to generate the hash. @@ -1312,7 +1312,7 @@ private Message ReceiveMessage(Socket socket) } var paddingLength = data[inboundPacketSequenceLength + packetLengthFieldLength]; - var messagePayloadLength = (int) packetLength - paddingLength - paddingLengthFieldLength; + var messagePayloadLength = (int)packetLength - paddingLength - paddingLengthFieldLength; var messagePayloadOffset = inboundPacketSequenceLength + packetLengthFieldLength + paddingLengthFieldLength; // validate decrypted message against MAC diff --git a/src/Renci.SshNet/Sftp/Requests/SftpOpenRequest.cs b/src/Renci.SshNet/Sftp/Requests/SftpOpenRequest.cs index a356768a3..6a86b4dad 100644 --- a/src/Renci.SshNet/Sftp/Requests/SftpOpenRequest.cs +++ b/src/Renci.SshNet/Sftp/Requests/SftpOpenRequest.cs @@ -78,7 +78,7 @@ protected override void SaveData() base.SaveData(); WriteBinaryString(_fileName); - Write((uint) Flags); + Write((uint)Flags); Write(_attributes); } diff --git a/src/Renci.SshNet/Sftp/Responses/SftpNameResponse.cs b/src/Renci.SshNet/Sftp/Responses/SftpNameResponse.cs index 2bdf67891..0e6c9f464 100644 --- a/src/Renci.SshNet/Sftp/Responses/SftpNameResponse.cs +++ b/src/Renci.SshNet/Sftp/Responses/SftpNameResponse.cs @@ -47,7 +47,7 @@ protected override void SaveData() { base.SaveData(); - Write((uint) Files.Length); // count + Write((uint)Files.Length); // count for (var i = 0; i < Files.Length; i++) { diff --git a/src/Renci.SshNet/Sftp/Responses/SftpStatusResponse.cs b/src/Renci.SshNet/Sftp/Responses/SftpStatusResponse.cs index 2f43cdc37..4e31154b6 100644 --- a/src/Renci.SshNet/Sftp/Responses/SftpStatusResponse.cs +++ b/src/Renci.SshNet/Sftp/Responses/SftpStatusResponse.cs @@ -22,7 +22,7 @@ protected override void LoadData() { base.LoadData(); - StatusCode = (StatusCodes) ReadUInt32(); + StatusCode = (StatusCodes)ReadUInt32(); if (ProtocolVersion < 3) { diff --git a/src/Renci.SshNet/Sftp/SftpFileAttributes.cs b/src/Renci.SshNet/Sftp/SftpFileAttributes.cs index 2f32b4796..11d2fd8a8 100644 --- a/src/Renci.SshNet/Sftp/SftpFileAttributes.cs +++ b/src/Renci.SshNet/Sftp/SftpFileAttributes.cs @@ -535,13 +535,13 @@ public byte[] GetBytes() if (IsSizeChanged && IsRegularFile) { - stream.Write((ulong) Size); + stream.Write((ulong)Size); } if (IsUserIdChanged || IsGroupIdChanged) { - stream.Write((uint) UserId); - stream.Write((uint) GroupId); + stream.Write((uint)UserId); + stream.Write((uint)GroupId); } if (IsPermissionsChanged) @@ -551,9 +551,9 @@ public byte[] GetBytes() if (IsLastAccessTimeChanged || IsLastWriteTimeChanged) { - var time = (uint) ((LastAccessTimeUtc.ToFileTimeUtc() / 10000000) - 11644473600); + var time = (uint)((LastAccessTimeUtc.ToFileTimeUtc() / 10000000) - 11644473600); stream.Write(time); - time = (uint) ((LastWriteTimeUtc.ToFileTimeUtc() / 10000000) - 11644473600); + time = (uint)((LastWriteTimeUtc.ToFileTimeUtc() / 10000000) - 11644473600); stream.Write(time); } @@ -596,14 +596,14 @@ internal static SftpFileAttributes FromBytes(SshDataStream stream) if ((flag & SSH_FILEXFER_ATTR_SIZE) == SSH_FILEXFER_ATTR_SIZE) { - size = (long) stream.ReadUInt64(); + size = (long)stream.ReadUInt64(); } if ((flag & SSH_FILEXFER_ATTR_UIDGID) == SSH_FILEXFER_ATTR_UIDGID) { - userId = (int) stream.ReadUInt32(); + userId = (int)stream.ReadUInt32(); - groupId = (int) stream.ReadUInt32(); + groupId = (int)stream.ReadUInt32(); } if ((flag & SSH_FILEXFER_ATTR_PERMISSIONS) == SSH_FILEXFER_ATTR_PERMISSIONS) @@ -628,7 +628,7 @@ internal static SftpFileAttributes FromBytes(SshDataStream stream) if ((flag & SSH_FILEXFER_ATTR_EXTENDED) == SSH_FILEXFER_ATTR_EXTENDED) { - var extendedCount = (int) stream.ReadUInt32(); + var extendedCount = (int)stream.ReadUInt32(); extensions = new Dictionary(extendedCount); for (var i = 0; i < extendedCount; i++) { diff --git a/src/Renci.SshNet/Sftp/SftpFileReader.cs b/src/Renci.SshNet/Sftp/SftpFileReader.cs index 10f819f8c..f47a941d9 100644 --- a/src/Renci.SshNet/Sftp/SftpFileReader.cs +++ b/src/Renci.SshNet/Sftp/SftpFileReader.cs @@ -126,7 +126,7 @@ public byte[] Read() _ = _queue.Remove(_nextChunkIndex); // update offset - _offset += (ulong) data.Length; + _offset += (ulong)data.Length; // move to next chunk _nextChunkIndex++; @@ -141,7 +141,7 @@ public byte[] Read() // When we received an EOF for the next chunk and the size of the file is known, then // we only complete the current chunk if we haven't already read up to the file size. // This way we save an extra round-trip to the server. - if (data.Length == 0 && _fileSize.HasValue && _offset == (ulong) _fileSize.Value) + if (data.Length == 0 && _fileSize.HasValue && _offset == (ulong)_fileSize.Value) { // avoid future reads _isEndOfFileRead = true; @@ -176,7 +176,7 @@ public byte[] Read() * TODO: break loop and interrupt blocking wait in case of exception */ - var read = _sftpSession.RequestRead(_handle, _offset, (uint) bytesToCatchUp); + var read = _sftpSession.RequestRead(_handle, _offset, (uint)bytesToCatchUp); if (read.Length == 0) { // process data in read lock to avoid ObjectDisposedException while releasing semaphore @@ -214,7 +214,7 @@ public byte[] Read() } } - _offset += (uint) read.Length; + _offset += (uint)read.Length; return read; } @@ -334,7 +334,7 @@ private void StartReadAhead() // if the offset of the read-ahead chunk is greater than that file size, then // we can expect to be reading the last (zero-byte) chunk and switch to synchronous // mode to avoid having multiple read-aheads that read beyond EOF - if (_fileSize != null && (long) _readAheadOffset > _fileSize.Value) + if (_fileSize != null && (long)_readAheadOffset > _fileSize.Value) { var asyncResult = _sftpSession.BeginRead(_handle, _readAheadOffset, _chunkSize, callback: null, bufferedRead); var data = _sftpSession.EndRead(asyncResult); @@ -399,7 +399,7 @@ private void ReadCompleted(IAsyncResult result) return; } - var readAsyncResult = (SftpReadAsyncResult) result; + var readAsyncResult = (SftpReadAsyncResult)result; byte[] data; @@ -415,7 +415,7 @@ private void ReadCompleted(IAsyncResult result) // a read that completes with a zero-byte result signals EOF // but there may be pending reads before that read - var bufferedRead = (BufferedRead) readAsyncResult.AsyncState; + var bufferedRead = (BufferedRead)readAsyncResult.AsyncState; ReadCompletedCore(bufferedRead, data); } diff --git a/src/Renci.SshNet/Sftp/SftpFileStream.cs b/src/Renci.SshNet/Sftp/SftpFileStream.cs index 270ed1d1d..2494e2107 100644 --- a/src/Renci.SshNet/Sftp/SftpFileStream.cs +++ b/src/Renci.SshNet/Sftp/SftpFileStream.cs @@ -209,8 +209,8 @@ private SftpFileStream(ISftpSession session, string path, FileAccess access, int * or SSH_FXP_WRITE message. */ - _readBufferSize = (int) session.CalculateOptimalReadLength((uint) bufferSize); - _writeBufferSize = (int) session.CalculateOptimalWriteLength((uint) bufferSize, _handle); + _readBufferSize = (int)session.CalculateOptimalReadLength((uint)bufferSize); + _writeBufferSize = (int)session.CalculateOptimalWriteLength((uint)bufferSize, _handle); _position = position; } @@ -321,8 +321,8 @@ internal SftpFileStream(ISftpSession session, string path, FileMode mode, FileAc * or SSH_FXP_WRITE message. */ - _readBufferSize = (int) session.CalculateOptimalReadLength((uint) bufferSize); - _writeBufferSize = (int) session.CalculateOptimalWriteLength((uint) bufferSize, _handle); + _readBufferSize = (int)session.CalculateOptimalReadLength((uint)bufferSize); + _writeBufferSize = (int)session.CalculateOptimalWriteLength((uint)bufferSize, _handle); if (mode == FileMode.Append) { @@ -566,7 +566,7 @@ public override int Read(byte[] buffer, int offset, int count) var bytesAvailableInBuffer = _bufferLen - _bufferPosition; if (bytesAvailableInBuffer <= 0) { - var data = _session.RequestRead(_handle, (ulong) _position, (uint) _readBufferSize); + var data = _session.RequestRead(_handle, (ulong)_position, (uint)_readBufferSize); if (data.Length == 0) { @@ -708,7 +708,7 @@ public override async Task ReadAsync(byte[] buffer, int offset, int count, var bytesAvailableInBuffer = _bufferLen - _bufferPosition; if (bytesAvailableInBuffer <= 0) { - var data = await _session.RequestReadAsync(_handle, (ulong) _position, (uint) _readBufferSize, cancellationToken).ConfigureAwait(false); + var data = await _session.RequestReadAsync(_handle, (ulong)_position, (uint)_readBufferSize, cancellationToken).ConfigureAwait(false); if (data.Length == 0) { @@ -824,7 +824,7 @@ public override int ReadByte() // Read more data into the internal buffer if necessary. if (_bufferPosition >= _bufferLen) { - var data = _session.RequestRead(_handle, (ulong) _position, (uint) _readBufferSize); + var data = _session.RequestRead(_handle, (ulong)_position, (uint)_readBufferSize); if (data.Length == 0) { // We've reached EOF. @@ -900,7 +900,7 @@ public override long Seek(long offset, SeekOrigin origin) newPosn = _position - _bufferPosition; if (offset >= newPosn && offset < (newPosn + _bufferLen)) { - _bufferPosition = (int) (offset - newPosn); + _bufferPosition = (int)(offset - newPosn); _position = offset; return _position; } @@ -911,7 +911,7 @@ public override long Seek(long offset, SeekOrigin origin) if (newPosn >= (_position - _bufferPosition) && newPosn < (_position - _bufferPosition + _bufferLen)) { - _bufferPosition = (int) (newPosn - (_position - _bufferPosition)); + _bufferPosition = (int)(newPosn - (_position - _bufferPosition)); _position = newPosn; return _position; } @@ -1082,7 +1082,7 @@ public override void Write(byte[] buffer, int offset, int count) { using (var wait = new AutoResetEvent(initialState: false)) { - _session.RequestWrite(_handle, (ulong) _position, buffer, offset, tempLen, wait); + _session.RequestWrite(_handle, (ulong)_position, buffer, offset, tempLen, wait); } } else @@ -1104,7 +1104,7 @@ public override void Write(byte[] buffer, int offset, int count) { using (var wait = new AutoResetEvent(initialState: false)) { - _session.RequestWrite(_handle, (ulong) (_position - _bufferPosition), GetOrCreateWriteBuffer(), 0, _bufferPosition, wait); + _session.RequestWrite(_handle, (ulong)(_position - _bufferPosition), GetOrCreateWriteBuffer(), 0, _bufferPosition, wait); } _bufferPosition = 0; @@ -1180,7 +1180,7 @@ public override async Task WriteAsync(byte[] buffer, int offset, int count, Canc // Can we short-cut the internal buffer? if (_bufferPosition == 0 && tempLen == _writeBufferSize) { - await _session.RequestWriteAsync(_handle, (ulong) _position, buffer, offset, tempLen, cancellationToken).ConfigureAwait(false); + await _session.RequestWriteAsync(_handle, (ulong)_position, buffer, offset, tempLen, cancellationToken).ConfigureAwait(false); } else { @@ -1199,7 +1199,7 @@ public override async Task WriteAsync(byte[] buffer, int offset, int count, Canc // rather than waiting for the next call to this method. if (_bufferPosition >= _writeBufferSize) { - await _session.RequestWriteAsync(_handle, (ulong) (_position - _bufferPosition), GetOrCreateWriteBuffer(), 0, _bufferPosition, cancellationToken).ConfigureAwait(false); + await _session.RequestWriteAsync(_handle, (ulong)(_position - _bufferPosition), GetOrCreateWriteBuffer(), 0, _bufferPosition, cancellationToken).ConfigureAwait(false); _bufferPosition = 0; } } @@ -1228,7 +1228,7 @@ public override void WriteByte(byte value) { using (var wait = new AutoResetEvent(initialState: false)) { - _session.RequestWrite(_handle, (ulong) (_position - _bufferPosition), writeBuffer, 0, _bufferPosition, wait); + _session.RequestWrite(_handle, (ulong)(_position - _bufferPosition), writeBuffer, 0, _bufferPosition, wait); } _bufferPosition = 0; @@ -1312,7 +1312,7 @@ private void FlushWriteBuffer() { using (var wait = new AutoResetEvent(initialState: false)) { - _session.RequestWrite(_handle, (ulong) (_position - _bufferPosition), _writeBuffer, 0, _bufferPosition, wait); + _session.RequestWrite(_handle, (ulong)(_position - _bufferPosition), _writeBuffer, 0, _bufferPosition, wait); } _bufferPosition = 0; @@ -1323,7 +1323,7 @@ private async Task FlushWriteBufferAsync(CancellationToken cancellationToken) { if (_bufferPosition > 0) { - await _session.RequestWriteAsync(_handle, (ulong) (_position - _bufferPosition), _writeBuffer, 0, _bufferPosition, cancellationToken).ConfigureAwait(false); + await _session.RequestWriteAsync(_handle, (ulong)(_position - _bufferPosition), _writeBuffer, 0, _bufferPosition, cancellationToken).ConfigureAwait(false); _bufferPosition = 0; } } diff --git a/src/Renci.SshNet/Sftp/SftpMessage.cs b/src/Renci.SshNet/Sftp/SftpMessage.cs index 5ecb69bc8..811100127 100644 --- a/src/Renci.SshNet/Sftp/SftpMessage.cs +++ b/src/Renci.SshNet/Sftp/SftpMessage.cs @@ -31,7 +31,7 @@ protected override void LoadData() protected override void SaveData() { - Write((byte) SftpMessageType); + Write((byte)SftpMessageType); } /// @@ -59,7 +59,7 @@ protected override void WriteBytes(SshDataStream stream) // write the length of the SFTP message where we were positioned before we started // writing the SFTP message data stream.Position = startPosition; - stream.Write((uint) dataLength); + stream.Write((uint)dataLength); // move back to we were positioned when we finished writing the SFTP message data stream.Position = endPosition; diff --git a/src/Renci.SshNet/Sftp/SftpResponseFactory.cs b/src/Renci.SshNet/Sftp/SftpResponseFactory.cs index 1d5b4ad50..8e28b790a 100644 --- a/src/Renci.SshNet/Sftp/SftpResponseFactory.cs +++ b/src/Renci.SshNet/Sftp/SftpResponseFactory.cs @@ -10,7 +10,7 @@ internal sealed class SftpResponseFactory : ISftpResponseFactory { public SftpMessage Create(uint protocolVersion, byte messageType, Encoding encoding) { - var sftpMessageType = (SftpMessageTypes) messageType; + var sftpMessageType = (SftpMessageTypes)messageType; SftpMessage message; diff --git a/src/Renci.SshNet/Sftp/SftpSession.cs b/src/Renci.SshNet/Sftp/SftpSession.cs index 0e8e89f3a..457ccaaee 100644 --- a/src/Renci.SshNet/Sftp/SftpSession.cs +++ b/src/Renci.SshNet/Sftp/SftpSession.cs @@ -51,7 +51,7 @@ public uint NextRequestId { get { - return (uint) Interlocked.Increment(ref _requestId); + return (uint)Interlocked.Increment(ref _requestId); } } @@ -512,9 +512,9 @@ public async Task RequestOpenAsync(string path, Flags flags, Cancellatio var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); #if NET || NETSTANDARD2_1_OR_GREATER - await using (cancellationToken.Register(s => ((TaskCompletionSource) s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) + await using (cancellationToken.Register(s => ((TaskCompletionSource)s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) #else - using (cancellationToken.Register(s => ((TaskCompletionSource) s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false)) + using (cancellationToken.Register(s => ((TaskCompletionSource)s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false)) #endif // NET || NETSTANDARD2_1_OR_GREATER { SendRequest(new SftpOpenRequest(ProtocolVersion, @@ -659,9 +659,9 @@ public async Task RequestCloseAsync(byte[] handle, CancellationToken cancellatio cancellationToken.ThrowIfCancellationRequested(); #if NET || NETSTANDARD2_1_OR_GREATER - await using (cancellationToken.Register(s => ((TaskCompletionSource) s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) + await using (cancellationToken.Register(s => ((TaskCompletionSource)s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) #else - using (cancellationToken.Register(s => ((TaskCompletionSource) s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false)) + using (cancellationToken.Register(s => ((TaskCompletionSource)s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false)) #endif // NET || NETSTANDARD2_1_OR_GREATER { _ = await tcs.Task.ConfigureAwait(false); @@ -873,9 +873,9 @@ public async Task RequestReadAsync(byte[] handle, ulong offset, uint len var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); #if NET || NETSTANDARD2_1_OR_GREATER - await using (cancellationToken.Register(s => ((TaskCompletionSource) s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) + await using (cancellationToken.Register(s => ((TaskCompletionSource)s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) #else - using (cancellationToken.Register(s => ((TaskCompletionSource) s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false)) + using (cancellationToken.Register(s => ((TaskCompletionSource)s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false)) #endif // NET || NETSTANDARD2_1_OR_GREATER { SendRequest(new SftpReadRequest(ProtocolVersion, @@ -970,9 +970,9 @@ public async Task RequestWriteAsync(byte[] handle, ulong serverOffset, byte[] da var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); #if NET || NETSTANDARD2_1_OR_GREATER - await using (cancellationToken.Register(s => ((TaskCompletionSource) s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) + await using (cancellationToken.Register(s => ((TaskCompletionSource)s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) #else - using (cancellationToken.Register(s => ((TaskCompletionSource) s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false)) + using (cancellationToken.Register(s => ((TaskCompletionSource)s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false)) #endif // NET || NETSTANDARD2_1_OR_GREATER { SendRequest(new SftpWriteRequest(ProtocolVersion, @@ -1160,9 +1160,9 @@ public async Task RequestFStatAsync(byte[] handle, Cancellat var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); #if NET || NETSTANDARD2_1_OR_GREATER - await using (cancellationToken.Register(s => ((TaskCompletionSource) s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) + await using (cancellationToken.Register(s => ((TaskCompletionSource)s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) #else - using (cancellationToken.Register(s => ((TaskCompletionSource) s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false)) + using (cancellationToken.Register(s => ((TaskCompletionSource)s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false)) #endif // NET || NETSTANDARD2_1_OR_GREATER { SendRequest(new SftpFStatRequest(ProtocolVersion, @@ -1298,9 +1298,9 @@ public async Task RequestOpenDirAsync(string path, CancellationToken can var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); #if NET || NETSTANDARD2_1_OR_GREATER - await using (cancellationToken.Register(s => ((TaskCompletionSource) s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) + await using (cancellationToken.Register(s => ((TaskCompletionSource)s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) #else - using (cancellationToken.Register(s => ((TaskCompletionSource) s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false)) + using (cancellationToken.Register(s => ((TaskCompletionSource)s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false)) #endif // NET || NETSTANDARD2_1_OR_GREATER { SendRequest(new SftpOpenDirRequest(ProtocolVersion, @@ -1379,9 +1379,9 @@ public async Task[]> RequestReadDirAsyn var tcs = new TaskCompletionSource[]>(TaskCreationOptions.RunContinuationsAsynchronously); #if NET || NETSTANDARD2_1_OR_GREATER - await using (cancellationToken.Register(s => ((TaskCompletionSource[]>) s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) + await using (cancellationToken.Register(s => ((TaskCompletionSource[]>)s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) #else - using (cancellationToken.Register(s => ((TaskCompletionSource[]>) s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false)) + using (cancellationToken.Register(s => ((TaskCompletionSource[]>)s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false)) #endif // NET || NETSTANDARD2_1_OR_GREATER { SendRequest(new SftpReadDirRequest(ProtocolVersion, @@ -1450,9 +1450,9 @@ public async Task RequestRemoveAsync(string path, CancellationToken cancellation var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); #if NET || NETSTANDARD2_1_OR_GREATER - await using (cancellationToken.Register(s => ((TaskCompletionSource) s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) + await using (cancellationToken.Register(s => ((TaskCompletionSource)s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) #else - using (cancellationToken.Register(s => ((TaskCompletionSource) s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false)) + using (cancellationToken.Register(s => ((TaskCompletionSource)s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false)) #endif // NET || NETSTANDARD2_1_OR_GREATER { SendRequest(new SftpRemoveRequest(ProtocolVersion, @@ -1588,9 +1588,9 @@ internal async Task[]> RequestRealPathA var tcs = new TaskCompletionSource[]>(TaskCreationOptions.RunContinuationsAsynchronously); #if NET || NETSTANDARD2_1_OR_GREATER - await using (cancellationToken.Register(s => ((TaskCompletionSource[]>) s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) + await using (cancellationToken.Register(s => ((TaskCompletionSource[]>)s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) #else - using (cancellationToken.Register(s => ((TaskCompletionSource[]>) s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false)) + using (cancellationToken.Register(s => ((TaskCompletionSource[]>)s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false)) #endif // NET || NETSTANDARD2_1_OR_GREATER { SendRequest(new SftpRealPathRequest(ProtocolVersion, @@ -1824,9 +1824,9 @@ public async Task RequestRenameAsync(string oldPath, string newPath, Cancellatio var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); #if NET || NETSTANDARD2_1_OR_GREATER - await using (cancellationToken.Register(s => ((TaskCompletionSource) s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) + await using (cancellationToken.Register(s => ((TaskCompletionSource)s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) #else - using (cancellationToken.Register(s => ((TaskCompletionSource) s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false)) + using (cancellationToken.Register(s => ((TaskCompletionSource)s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false)) #endif // NET || NETSTANDARD2_1_OR_GREATER { SendRequest(new SftpRenameRequest(ProtocolVersion, @@ -2057,9 +2057,9 @@ public async Task RequestStatVfsAsync(string path, Can var tcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); #if NET || NETSTANDARD2_1_OR_GREATER - await using (cancellationToken.Register(s => ((TaskCompletionSource) s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) + await using (cancellationToken.Register(s => ((TaskCompletionSource)s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false).ConfigureAwait(continueOnCapturedContext: false)) #else - using (cancellationToken.Register(s => ((TaskCompletionSource) s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false)) + using (cancellationToken.Register(s => ((TaskCompletionSource)s).TrySetCanceled(cancellationToken), tcs, useSynchronizationContext: false)) #endif // NET || NETSTANDARD2_1_OR_GREATER { SendRequest(new StatVfsRequest(ProtocolVersion, @@ -2223,7 +2223,7 @@ public uint CalculateOptimalWriteLength(uint bufferSize, byte[] handle) * WinSCP uses data length of 32739 bytes (total 32768 bytes; 32739 + 25 + 4 bytes for handle) */ - var lengthOfNonDataProtocolFields = 25u + (uint) handle.Length; + var lengthOfNonDataProtocolFields = 25u + (uint)handle.Length; var maximumPacketSize = Channel.RemotePacketSize; return Math.Min(bufferSize, maximumPacketSize) - lengthOfNonDataProtocolFields; } diff --git a/src/Renci.SshNet/SftpClient.cs b/src/Renci.SshNet/SftpClient.cs index 932ed8620..fb599220d 100644 --- a/src/Renci.SshNet/SftpClient.cs +++ b/src/Renci.SshNet/SftpClient.cs @@ -161,7 +161,7 @@ public int ProtocolVersion throw new SshConnectionException("Client not connected."); } - return (int) _sftpSession.ProtocolVersion; + return (int)_sftpSession.ProtocolVersion; } } @@ -1364,7 +1364,7 @@ public StreamWriter AppendText(string path, Encoding encoding) throw new ArgumentNullException(nameof(encoding)); } - return new StreamWriter(new SftpFileStream(_sftpSession, path, FileMode.Append, FileAccess.Write, (int) _bufferSize), encoding); + return new StreamWriter(new SftpFileStream(_sftpSession, path, FileMode.Append, FileAccess.Write, (int)_bufferSize), encoding); } /// @@ -1385,7 +1385,7 @@ public SftpFileStream Create(string path) { CheckDisposed(); - return new SftpFileStream(_sftpSession, path, FileMode.Create, FileAccess.ReadWrite, (int) _bufferSize); + return new SftpFileStream(_sftpSession, path, FileMode.Create, FileAccess.ReadWrite, (int)_bufferSize); } /// @@ -1576,7 +1576,7 @@ public SftpFileStream Open(string path, FileMode mode, FileAccess access) { CheckDisposed(); - return new SftpFileStream(_sftpSession, path, mode, access, (int) _bufferSize); + return new SftpFileStream(_sftpSession, path, mode, access, (int)_bufferSize); } /// @@ -1609,7 +1609,7 @@ public Task OpenAsync(string path, FileMode mode, FileAccess acc cancellationToken.ThrowIfCancellationRequested(); - return SftpFileStream.OpenAsync(_sftpSession, path, mode, access, (int) _bufferSize, cancellationToken); + return SftpFileStream.OpenAsync(_sftpSession, path, mode, access, (int)_bufferSize, cancellationToken); } /// @@ -1659,7 +1659,7 @@ public SftpFileStream OpenWrite(string path) { CheckDisposed(); - return new SftpFileStream(_sftpSession, path, FileMode.OpenOrCreate, FileAccess.Write, (int) _bufferSize); + return new SftpFileStream(_sftpSession, path, FileMode.OpenOrCreate, FileAccess.Write, (int)_bufferSize); } /// @@ -2384,7 +2384,7 @@ private void InternalDownloadFile(string path, Stream output, SftpDownloadAsyncR output.Write(data, 0, data.Length); - totalBytesRead += (ulong) data.Length; + totalBytesRead += (ulong)data.Length; asyncResult?.Update(totalBytesRead); @@ -2451,7 +2451,7 @@ private void InternalUploadFile(Stream input, string path, Flags flags, SftpUplo if (bytesRead > 0) { - var writtenBytes = offset + (ulong) bytesRead; + var writtenBytes = offset + (ulong)bytesRead; _sftpSession.RequestWrite(handle, offset, buffer, offset: 0, bytesRead, wait: null, s => { @@ -2473,7 +2473,7 @@ private void InternalUploadFile(Stream input, string path, Flags flags, SftpUplo _ = Interlocked.Increment(ref expectedResponses); - offset += (ulong) bytesRead; + offset += (ulong)bytesRead; bytesRead = input.Read(buffer, 0, buffer.Length); } diff --git a/src/Renci.SshNet/Shell.cs b/src/Renci.SshNet/Shell.cs index 4a73e58fb..213d1a402 100644 --- a/src/Renci.SshNet/Shell.cs +++ b/src/Renci.SshNet/Shell.cs @@ -128,7 +128,7 @@ public void Start() while (_channel.IsOpen) { var readTask = _input.ReadAsync(buffer, 0, buffer.Length); - var readWaitHandle = ((IAsyncResult) readTask).AsyncWaitHandle; + var readWaitHandle = ((IAsyncResult)readTask).AsyncWaitHandle; if (WaitHandle.WaitAny(new[] { readWaitHandle, _channelClosedWaitHandle }) == 0) { diff --git a/src/Renci.SshNet/SshCommand.cs b/src/Renci.SshNet/SshCommand.cs index df61cda7e..bbdd349c9 100644 --- a/src/Renci.SshNet/SshCommand.cs +++ b/src/Renci.SshNet/SshCommand.cs @@ -448,7 +448,7 @@ private void SetAsyncComplete() ThreadAbstraction.ExecuteThread(() => _callback(_asyncResult)); } - _ = ((EventWaitHandle) _asyncResult.AsyncWaitHandle).Set(); + _ = ((EventWaitHandle)_asyncResult.AsyncWaitHandle).Set(); } private void Channel_Closed(object sender, ChannelEventArgs e) @@ -460,7 +460,7 @@ private void Channel_RequestReceived(object sender, ChannelRequestEventArgs e) { if (e.Info is ExitStatusRequestInfo exitStatusInfo) { - ExitStatus = (int) exitStatusInfo.ExitStatus; + ExitStatus = (int)exitStatusInfo.ExitStatus; if (exitStatusInfo.WantReply) { diff --git a/test/Renci.SshNet.Benchmarks/Common/HostKeyEventArgsBenchmarks.cs b/test/Renci.SshNet.Benchmarks/Common/HostKeyEventArgsBenchmarks.cs index c3b070884..3109ea26b 100644 --- a/test/Renci.SshNet.Benchmarks/Common/HostKeyEventArgsBenchmarks.cs +++ b/test/Renci.SshNet.Benchmarks/Common/HostKeyEventArgsBenchmarks.cs @@ -20,7 +20,7 @@ private static KeyHostAlgorithm GetKeyHostAlgorithm() using (var s = typeof(HostKeyEventArgsBenchmarks).Assembly.GetManifestResourceStream("Renci.SshNet.Benchmarks.Data.Key.RSA.txt")) { var privateKey = new PrivateKeyFile(s); - return (KeyHostAlgorithm) privateKey.HostKeyAlgorithms.First(); + return (KeyHostAlgorithm)privateKey.HostKeyAlgorithms.First(); } } diff --git a/test/Renci.SshNet.Benchmarks/Security/Cryptography/ED25519DigitalSignatureBenchmarks.cs b/test/Renci.SshNet.Benchmarks/Security/Cryptography/ED25519DigitalSignatureBenchmarks.cs index 44b2da8a6..eb390155d 100644 --- a/test/Renci.SshNet.Benchmarks/Security/Cryptography/ED25519DigitalSignatureBenchmarks.cs +++ b/test/Renci.SshNet.Benchmarks/Security/Cryptography/ED25519DigitalSignatureBenchmarks.cs @@ -21,7 +21,7 @@ public ED25519DigitalSignatureBenchmarks() using (var s = typeof(ED25519DigitalSignatureBenchmarks).Assembly.GetManifestResourceStream("Renci.SshNet.Benchmarks.Data.Key.OPENSSH.ED25519.txt")) { - _key = (ED25519Key) new PrivateKeyFile(s).Key; + _key = (ED25519Key)new PrivateKeyFile(s).Key; } _signature = new ED25519DigitalSignature(_key).Sign(_data); } diff --git a/test/Renci.SshNet.Benchmarks/Security/Cryptography/RsaDigitalSignatureBenchmarks.cs b/test/Renci.SshNet.Benchmarks/Security/Cryptography/RsaDigitalSignatureBenchmarks.cs index 38671e93c..9f5356694 100644 --- a/test/Renci.SshNet.Benchmarks/Security/Cryptography/RsaDigitalSignatureBenchmarks.cs +++ b/test/Renci.SshNet.Benchmarks/Security/Cryptography/RsaDigitalSignatureBenchmarks.cs @@ -23,7 +23,7 @@ public RsaDigitalSignatureBenchmarks() using (var s = typeof(RsaDigitalSignatureBenchmarks).Assembly.GetManifestResourceStream("Renci.SshNet.Benchmarks.Data.Key.OPENSSH.RSA.txt")) { - _key = (RsaKey) new PrivateKeyFile(s).Key; + _key = (RsaKey)new PrivateKeyFile(s).Key; } _signature = new RsaDigitalSignature(_key, HashAlgorithmName.SHA256).Sign(_data); } diff --git a/test/Renci.SshNet.IntegrationTests/Common/Socks5Handler.cs b/test/Renci.SshNet.IntegrationTests/Common/Socks5Handler.cs index 3e910d4b9..1a571d8e2 100644 --- a/test/Renci.SshNet.IntegrationTests/Common/Socks5Handler.cs +++ b/test/Renci.SshNet.IntegrationTests/Common/Socks5Handler.cs @@ -45,7 +45,7 @@ public Socket Connect(string host, int port) var addressBytes = new byte[host.Length + 2]; addressBytes[0] = 0x03; - addressBytes[1] = (byte) host.Length; + addressBytes[1] = (byte)host.Length; Encoding.ASCII.GetBytes(host, 0, host.Length, addressBytes, 2); return Connect(addressBytes, port); } @@ -87,7 +87,7 @@ private Socket Connect(byte[] addressBytes, int port) } // Send username length - SocketWriteByte(socket, (byte) username.Length); + SocketWriteByte(socket, (byte)username.Length); // Send username SocketAbstraction.Send(socket, username); @@ -100,7 +100,7 @@ private Socket Connect(byte[] addressBytes, int port) } // Send username length - SocketWriteByte(socket, (byte) password.Length); + SocketWriteByte(socket, (byte)password.Length); // Send username SocketAbstraction.Send(socket, password); @@ -138,8 +138,8 @@ private Socket Connect(byte[] addressBytes, int port) SocketAbstraction.Send(socket, addressBytes); // Send port - SocketWriteByte(socket, (byte) (port / 0xFF)); - SocketWriteByte(socket, (byte) (port % 0xFF)); + SocketWriteByte(socket, (byte)(port / 0xFF)); + SocketWriteByte(socket, (byte)(port % 0xFF)); // Read Server SOCKS5 version if (SocketReadByte(socket) != 5) diff --git a/test/Renci.SshNet.IntegrationTests/ConnectivityTests.cs b/test/Renci.SshNet.IntegrationTests/ConnectivityTests.cs index 2510f83b8..15451b1ef 100644 --- a/test/Renci.SshNet.IntegrationTests/ConnectivityTests.cs +++ b/test/Renci.SshNet.IntegrationTests/ConnectivityTests.cs @@ -80,7 +80,7 @@ public void Common_DisposeAfterLossOfNetworkConnectivity() Assert.IsNotNull(errorOccurred); Assert.AreEqual(typeof(SshConnectionException), errorOccurred.GetType()); - var connectionException = (SshConnectionException) errorOccurred; + var connectionException = (SshConnectionException)errorOccurred; Assert.AreEqual(DisconnectReason.ConnectionLost, connectionException.DisconnectReason); Assert.IsNull(connectionException.InnerException); Assert.AreEqual("An established connection was aborted by the server.", connectionException.Message); @@ -122,7 +122,7 @@ public void Common_DetectLossOfNetworkConnectivityThroughKeepAlive() Assert.IsNotNull(errorOccurred); Assert.AreEqual(typeof(SshConnectionException), errorOccurred.GetType()); - var connectionException = (SshConnectionException) errorOccurred; + var connectionException = (SshConnectionException)errorOccurred; Assert.AreEqual(DisconnectReason.ConnectionLost, connectionException.DisconnectReason); Assert.IsNull(connectionException.InnerException); Assert.AreEqual("An established connection was aborted by the server.", connectionException.Message); @@ -182,7 +182,7 @@ public void Common_DetectConnectionResetThroughSftpInvocation() Assert.IsNotNull(errorOccurred); Assert.AreEqual(typeof(SshConnectionException), errorOccurred.GetType()); - var connectionException = (SshConnectionException) errorOccurred; + var connectionException = (SshConnectionException)errorOccurred; Assert.AreEqual(DisconnectReason.ConnectionLost, connectionException.DisconnectReason); Assert.IsNull(connectionException.InnerException); Assert.AreEqual("An established connection was aborted by the server.", connectionException.Message); @@ -229,7 +229,7 @@ public void Common_LossOfNetworkConnectivityDisconnectAndConnect() Assert.IsNotNull(errorOccurred); Assert.AreEqual(typeof(SshConnectionException), errorOccurred.GetType()); - var connectionException = (SshConnectionException) errorOccurred; + var connectionException = (SshConnectionException)errorOccurred; Assert.AreEqual(DisconnectReason.ConnectionLost, connectionException.DisconnectReason); Assert.IsNull(connectionException.InnerException); Assert.AreEqual("An established connection was aborted by the server.", connectionException.Message); @@ -274,7 +274,7 @@ public void Common_DetectLossOfNetworkConnectivityThroughSftpInvocation() Assert.IsNotNull(errorOccurred); Assert.AreEqual(typeof(SshConnectionException), errorOccurred.GetType()); - var connectionException = (SshConnectionException) errorOccurred; + var connectionException = (SshConnectionException)errorOccurred; Assert.AreEqual(DisconnectReason.ConnectionLost, connectionException.DisconnectReason); Assert.IsNull(connectionException.InnerException); Assert.AreEqual("An established connection was aborted by the server.", connectionException.Message); diff --git a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/ForwardedPortLocalTest.cs b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/ForwardedPortLocalTest.cs index 09ce7cd7f..f97345175 100644 --- a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/ForwardedPortLocalTest.cs +++ b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/ForwardedPortLocalTest.cs @@ -49,8 +49,8 @@ public void Test_PortForwarding_Local_Stop_Hangs_On_Wait() .GetAwaiter() .GetResult(); #else - var request = (HttpWebRequest) WebRequest.Create(url); - var response = (HttpWebResponse) request.GetResponse(); + var request = (HttpWebRequest)WebRequest.Create(url); + var response = (HttpWebResponse)request.GetResponse(); #endif // NET6_0_OR_GREATER Assert.IsNotNull(response); @@ -125,8 +125,8 @@ public void Test_PortForwarding_Local_Without_Connecting() { var data = ReadStream(response.Content.ReadAsStream()); #else - var request = (HttpWebRequest) WebRequest.Create("http://localhost:8084"); - using (var response = (HttpWebResponse) request.GetResponse()) + var request = (HttpWebRequest)WebRequest.Create("http://localhost:8084"); + using (var response = (HttpWebResponse)request.GetResponse()) { var data = ReadStream(response.GetResponseStream()); #endif // NET6_0_OR_GREATER diff --git a/test/Renci.SshNet.IntegrationTests/SftpTests.cs b/test/Renci.SshNet.IntegrationTests/SftpTests.cs index ff5acf024..689a2c3b1 100644 --- a/test/Renci.SshNet.IntegrationTests/SftpTests.cs +++ b/test/Renci.SshNet.IntegrationTests/SftpTests.cs @@ -114,7 +114,7 @@ public void Sftp_BeginUploadFile() { const string content = "SftpBeginUploadFile"; - var expectedByteCount = (ulong) Encoding.ASCII.GetByteCount(content); + var expectedByteCount = (ulong)Encoding.ASCII.GetByteCount(content); using (var client = new SftpClient(_connectionInfoFactory.Create())) { @@ -4775,7 +4775,7 @@ public void Sftp_SftpFileStream_Seek_NegativeOffSet_SeekOriginEnd() client.DeleteFile(remoteFile); // buffer holding the data that we'll write to the file - var writeBuffer = GenerateRandom(size: (int) client.BufferSize + 200); + var writeBuffer = GenerateRandom(size: (int)client.BufferSize + 200); using (var fs = client.OpenWrite(remoteFile)) { @@ -4843,7 +4843,7 @@ public void Sftp_SftpFileStream_Seek_NegativeOffSet_SeekOriginEnd() client.DeleteFile(remoteFile); // buffer holding the data that we'll write to the file - writeBuffer = GenerateRandom(size: (int) client.BufferSize * 4); + writeBuffer = GenerateRandom(size: (int)client.BufferSize * 4); // seek within EOF and beyond buffer size // write less bytes than buffer size @@ -4867,7 +4867,7 @@ public void Sftp_SftpFileStream_Seek_NegativeOffSet_SeekOriginEnd() Assert.AreEqual(writeBuffer.Length, fs.Length); // First part of file should not have been touched - var readBuffer = new byte[(int) client.BufferSize * 2]; + var readBuffer = new byte[(int)client.BufferSize * 2]; Assert.AreEqual(readBuffer.Length, fs.Read(readBuffer, offset: 0, readBuffer.Length)); Assert.IsTrue(readBuffer.SequenceEqual(writeBuffer.Take(readBuffer.Length))); @@ -4878,9 +4878,9 @@ public void Sftp_SftpFileStream_Seek_NegativeOffSet_SeekOriginEnd() Assert.AreEqual(0x07, fs.ReadByte()); // Remaining bytes should not have been touched - readBuffer = new byte[((int) client.BufferSize * 2) - 4]; + readBuffer = new byte[((int)client.BufferSize * 2) - 4]; Assert.AreEqual(readBuffer.Length, fs.Read(readBuffer, offset: 0, readBuffer.Length)); - Assert.IsTrue(readBuffer.SequenceEqual(writeBuffer.Skip(((int) client.BufferSize * 2) + 4).Take(readBuffer.Length))); + Assert.IsTrue(readBuffer.SequenceEqual(writeBuffer.Skip(((int)client.BufferSize * 2) + 4).Take(readBuffer.Length))); // Ensure we've reached end of the stream Assert.AreEqual(-1, fs.ReadByte()); diff --git a/test/Renci.SshNet.IntegrationTests/SshTests.cs b/test/Renci.SshNet.IntegrationTests/SshTests.cs index 28b96c6d4..ea11818e6 100644 --- a/test/Renci.SshNet.IntegrationTests/SshTests.cs +++ b/test/Renci.SshNet.IntegrationTests/SshTests.cs @@ -484,7 +484,7 @@ public void Ssh_LocalPortForwardingCloseChannels() for (var i = 0; i < (connectionInfo.MaxSessions + 1); i++) { var forwardedPort = new ForwardedPortLocal(localEndPoint.Address.ToString(), - (uint) localEndPoint.Port, + (uint)localEndPoint.Port, hostNameAlias, 80); client.AddForwardedPort(forwardedPort); @@ -492,14 +492,14 @@ public void Ssh_LocalPortForwardingCloseChannels() try { - var httpRequest = (HttpWebRequest) WebRequest.Create("http://" + localEndPoint); + var httpRequest = (HttpWebRequest)WebRequest.Create("http://" + localEndPoint); httpRequest.Host = hostName; httpRequest.Method = "GET"; httpRequest.AllowAutoRedirect = false; try { - using (var httpResponse = (HttpWebResponse) httpRequest.GetResponse()) + using (var httpResponse = (HttpWebResponse)httpRequest.GetResponse()) { Assert.AreEqual(HttpStatusCode.MovedPermanently, httpResponse.StatusCode); } @@ -551,7 +551,7 @@ public void Ssh_LocalPortForwarding() var localEndPoint = new IPEndPoint(IPAddress.Loopback, 1225); var forwardedPort = new ForwardedPortLocal(localEndPoint.Address.ToString(), - (uint) localEndPoint.Port, + (uint)localEndPoint.Port, hostNameAlias, 80); forwardedPort.Exception += @@ -561,7 +561,7 @@ public void Ssh_LocalPortForwarding() try { - var httpRequest = (HttpWebRequest) WebRequest.Create("http://" + localEndPoint); + var httpRequest = (HttpWebRequest)WebRequest.Create("http://" + localEndPoint); httpRequest.Host = hostName; httpRequest.Method = "GET"; httpRequest.Accept = "text/html"; @@ -569,7 +569,7 @@ public void Ssh_LocalPortForwarding() try { - using (var httpResponse = (HttpWebResponse) httpRequest.GetResponse()) + using (var httpResponse = (HttpWebResponse)httpRequest.GetResponse()) { Assert.AreEqual(HttpStatusCode.MovedPermanently, httpResponse.StatusCode); } @@ -628,7 +628,7 @@ public void Ssh_RemotePortForwarding() var forwardedPort1 = new ForwardedPortRemote(IPAddress.Loopback, 10002, endpoint1.Address, - (uint) endpoint1.Port); + (uint)endpoint1.Port); forwardedPort1.Exception += (sender, args) => Console.WriteLine(@"forwardedPort1 exception: " + args.Exception); client.AddForwardedPort(forwardedPort1); forwardedPort1.Start(); @@ -636,7 +636,7 @@ public void Ssh_RemotePortForwarding() var forwardedPort2 = new ForwardedPortRemote(IPAddress.Loopback, 10003, endpoint2.Address, - (uint) endpoint2.Port); + (uint)endpoint2.Port); forwardedPort2.Exception += (sender, args) => Console.WriteLine(@"forwardedPort2 exception: " + args.Exception); client.AddForwardedPort(forwardedPort2); forwardedPort2.Start(); diff --git a/test/Renci.SshNet.TestTools.OpenSSH/SshdConfig.cs b/test/Renci.SshNet.TestTools.OpenSSH/SshdConfig.cs index a5bae901a..e5609be7b 100644 --- a/test/Renci.SshNet.TestTools.OpenSSH/SshdConfig.cs +++ b/test/Renci.SshNet.TestTools.OpenSSH/SshdConfig.cs @@ -329,7 +329,7 @@ private static void ProcessGlobalOption(SshdConfig sshdConfig, string line) sshdConfig.KeyboardInteractiveAuthentication = ToBool(value); break; case "LogLevel": - sshdConfig.LogLevel = (LogLevel) Enum.Parse(typeof(LogLevel), value, ignoreCase: true); + sshdConfig.LogLevel = (LogLevel)Enum.Parse(typeof(LogLevel), value, ignoreCase: true); break; case "Subsystem": sshdConfig.Subsystems.Add(Subsystem.FromConfig(value)); diff --git a/test/Renci.SshNet.Tests/Classes/BaseClientTest_Connect_OnConnectedThrowsException.cs b/test/Renci.SshNet.Tests/Classes/BaseClientTest_Connect_OnConnectedThrowsException.cs index 6450a72c1..caeb7f231 100644 --- a/test/Renci.SshNet.Tests/Classes/BaseClientTest_Connect_OnConnectedThrowsException.cs +++ b/test/Renci.SshNet.Tests/Classes/BaseClientTest_Connect_OnConnectedThrowsException.cs @@ -142,7 +142,7 @@ private static KeyHostAlgorithm GetKeyHostAlgorithm() using (var s = TestBase.GetData("Key.RSA.txt")) { var privateKey = new PrivateKeyFile(s); - return (KeyHostAlgorithm) privateKey.HostKeyAlgorithms.First(); + return (KeyHostAlgorithm)privateKey.HostKeyAlgorithms.First(); } } diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest.cs index e3daf22f6..0b67b9174 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest.cs @@ -38,14 +38,14 @@ protected override void OnInit() var random = new Random(); - _localWindowSize = (uint) random.Next(2000, 3000); - _localPacketSize = (uint) random.Next(1000, 2000); + _localWindowSize = (uint)random.Next(2000, 3000); + _localPacketSize = (uint)random.Next(1000, 2000); _remoteHost = random.Next().ToString(CultureInfo.InvariantCulture); - _port = (uint) random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(100, 200); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); + _port = (uint)random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(100, 200); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); _channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20)); _sessionMock = new Mock(MockBehavior.Strict); @@ -61,7 +61,7 @@ public void SocketShouldBeClosedAndBindShouldEndWhenForwardedPortSignalsClosingE _ = _sessionMock.Setup(p => p.SendMessage(It.IsAny())) .Callback(m => _sessionMock.Raise(p => p.ChannelOpenConfirmationReceived += null, new MessageEventArgs( - new ChannelOpenConfirmationMessage(((ChannelOpenMessage) m).LocalChannelNumber, + new ChannelOpenConfirmationMessage(((ChannelOpenMessage)m).LocalChannelNumber, _remoteWindowSize, _remotePacketSize, _remoteChannelNumber)))); @@ -117,7 +117,7 @@ public void SocketShouldBeClosedAndBindShouldEndWhenOnErrorOccurredIsInvoked() _ = _sessionMock.Setup(p => p.SendMessage(It.IsAny())) .Callback(m => _sessionMock.Raise(p => p.ChannelOpenConfirmationReceived += null, new MessageEventArgs( - new ChannelOpenConfirmationMessage(((ChannelOpenMessage) m).LocalChannelNumber, + new ChannelOpenConfirmationMessage(((ChannelOpenMessage)m).LocalChannelNumber, _remoteWindowSize, _remotePacketSize, _remoteChannelNumber)))); @@ -177,7 +177,7 @@ public void SocketShouldBeClosedAndEofShouldBeSentToServerWhenClientShutsDownSoc .Setup(p => p.SendMessage(It.IsAny())) .Callback(m => _sessionMock.Raise(p => p.ChannelOpenConfirmationReceived += null, new MessageEventArgs( - new ChannelOpenConfirmationMessage(((ChannelOpenMessage) m).LocalChannelNumber, + new ChannelOpenConfirmationMessage(((ChannelOpenMessage)m).LocalChannelNumber, _remoteWindowSize, _remotePacketSize, _remoteChannelNumber)))); diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs index 94487075b..ba0e44458 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs @@ -63,19 +63,19 @@ private void Arrange() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(2000, 3000); - _localPacketSize = (uint) random.Next(1000, 2000); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(2000, 3000); + _localPacketSize = (uint)random.Next(1000, 2000); _channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20)); _remoteHost = random.Next().ToString(CultureInfo.InvariantCulture); - _port = (uint) random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort); + _port = (uint)random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort); _channelBindFinishedWaitHandle = new ManualResetEvent(false); _clientReceivedFinishedWaitHandle = new ManualResetEvent(false); _channelException = null; - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(100, 200); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(100, 200); _sessionMock = new Mock(MockBehavior.Strict); _connectionInfoMock = new Mock(MockBehavior.Strict); 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 393eae093..b92ebfebb 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelForwardedTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelForwardedTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen.cs @@ -69,12 +69,12 @@ public void CleanUp() private void Arrange() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(2000, 3000); - _localPacketSize = (uint) random.Next(1000, 2000); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(100, 200); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(2000, 3000); + _localPacketSize = (uint)random.Next(1000, 2000); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(100, 200); _channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20)); _channelBindFinishedWaitHandle = new ManualResetEvent(false); _channelException = null; 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 5b0ac256b..42ef98747 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_Disposed.cs @@ -31,12 +31,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(2000, 3000); - _localPacketSize = (uint) random.Next(1000, 2000); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(100, 200); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(2000, 3000); + _localPacketSize = (uint)random.Next(1000, 2000); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(100, 200); _channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20)); _sessionSemaphore = new SemaphoreSlim(1); _channelClosedRegister = new List(); 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 5b868e37a..da7438b97 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 @@ -34,12 +34,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20)); _channelClosedRegister = new List(); _channelExceptionRegister = new List(); 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 e8b8f5357..80fc2e038 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 @@ -32,12 +32,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _channelClosedRegister = new List(); _channelExceptionRegister = new List(); _initialSessionSemaphoreCount = random.Next(10, 20); 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 5d16d83fd..1684b364d 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 @@ -33,12 +33,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20)); _channelClosedRegister = new List(); _channelExceptionRegister = new List(); 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 26224f8b9..3fbba4e9e 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 @@ -32,12 +32,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _channelClosedRegister = new List(); _channelExceptionRegister = new List(); _initialSessionSemaphoreCount = random.Next(10, 20); 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 c020e52aa..075b02a55 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 @@ -33,12 +33,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20)); _channelClosedRegister = new List(); _channelExceptionRegister = new List(); 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 c6a2eccb1..44e661708 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 @@ -32,12 +32,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _channelClosedRegister = new List(); _channelExceptionRegister = new List(); _initialSessionSemaphoreCount = random.Next(10, 20); 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 ef6859501..3d6a4407b 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 @@ -32,12 +32,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20)); _channelClosedRegister = new List(); _channelExceptionRegister = new List(); 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 f73825e7e..0824ace27 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 @@ -31,12 +31,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(2000, 3000); - _localPacketSize = (uint) random.Next(1000, 2000); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(100, 200); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(2000, 3000); + _localPacketSize = (uint)random.Next(1000, 2000); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(100, 200); _channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20)); _sessionSemaphore = new SemaphoreSlim(1); _channelClosedRegister = new List(); 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 bbc15bc5b..d7a14aa24 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 @@ -31,12 +31,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(2000, 3000); - _localPacketSize = (uint) random.Next(1000, 2000); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(100, 200); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(2000, 3000); + _localPacketSize = (uint)random.Next(1000, 2000); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(100, 200); _channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20)); _sessionSemaphore = new SemaphoreSlim(1); _channelClosedRegister = new List(); 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 15d743d1c..3c3b30bb8 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 @@ -32,12 +32,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _channelClosedRegister = new List(); _channelExceptionRegister = new List(); _initialSessionSemaphoreCount = random.Next(10, 20); 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 aeaccfb8b..b584fa2d0 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 @@ -32,12 +32,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _channelClosedRegister = new List(); _channelExceptionRegister = new List(); _initialSessionSemaphoreCount = random.Next(10, 20); 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 b417543e9..23a619c5c 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 @@ -32,12 +32,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _channelClosedRegister = new List(); _channelExceptionRegister = new List(); _initialSessionSemaphoreCount = random.Next(10, 20); 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 e8b03cbfb..22bb7dda3 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen.cs @@ -34,12 +34,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20)); _channelClosedRegister = new List(); _channelExceptionRegister = new List(); 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 d6972517d..43a19936d 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_ExceptionWaitingOnOpenConfirmation.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_ExceptionWaitingOnOpenConfirmation.cs @@ -30,9 +30,9 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(2000, 3000); - _localPacketSize = (uint) random.Next(1000, 2000); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(2000, 3000); + _localPacketSize = (uint)random.Next(1000, 2000); _initialSessionSemaphoreCount = random.Next(10, 20); _sessionSemaphore = new SemaphoreSlim(_initialSessionSemaphoreCount); _channelClosedRegister = new List(); 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 9f986ca8b..5ff15cec2 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 @@ -33,16 +33,16 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(2000, 3000); - _localPacketSize = (uint) random.Next(1000, 2000); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(2000, 3000); + _localPacketSize = (uint)random.Next(1000, 2000); _initialSessionSemaphoreCount = random.Next(10, 20); _sessionSemaphore = new SemaphoreSlim(_initialSessionSemaphoreCount); _channelClosedRegister = new List(); _channelExceptionRegister = new List(); _actualException = null; - _failureReasonCode = (uint) random.Next(0, int.MaxValue); + _failureReasonCode = (uint)random.Next(0, int.MaxValue); _failureDescription = random.Next().ToString(CultureInfo.InvariantCulture); _failureLanguage = random.Next().ToString(CultureInfo.InvariantCulture); } diff --git a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_OnOpenFailureReceived_RetriesAvalable.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_OnOpenFailureReceived_RetriesAvalable.cs index ce3f324bf..2ecc40920 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_OnOpenFailureReceived_RetriesAvalable.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Open_OnOpenFailureReceived_RetriesAvalable.cs @@ -35,18 +35,18 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(2000, 3000); - _localPacketSize = (uint) random.Next(1000, 2000); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(2000, 3000); + _localPacketSize = (uint)random.Next(1000, 2000); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _initialSessionSemaphoreCount = random.Next(10, 20); _sessionSemaphore = new SemaphoreSlim(_initialSessionSemaphoreCount); _channelClosedRegister = new List(); _channelExceptionRegister = new List(); - _failureReasonCode = (uint) random.Next(0, int.MaxValue); + _failureReasonCode = (uint)random.Next(0, int.MaxValue); _failureDescription = random.Next().ToString(CultureInfo.InvariantCulture); _failureLanguage = random.Next().ToString(CultureInfo.InvariantCulture); } 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 6263e3056..a6fa84184 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsNotOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsConnectedAndChannelIsNotOpen.cs @@ -25,9 +25,9 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); _channelClosedRegister = new List(); _channelExceptionRegister = new List(); } 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 b6454c68d..e6af7394b 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 @@ -32,12 +32,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20)); _closeTimer = new Stopwatch(); _channelClosedRegister = new List(); 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 031618699..89dc6c987 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 @@ -42,12 +42,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _closeTimer = new Stopwatch(); _channelClosedEventHandlerCompleted = new ManualResetEvent(false); _channelClosedRegister = new List(); 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 b394d0a63..4f11009bb 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 @@ -33,12 +33,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20)); _channelClosedRegister = new List(); _channelEndOfDataRegister = new List(); 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 8b41f5532..a9ea77825 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 @@ -30,12 +30,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20)); _channelClosedRegister = new List(); _channelEndOfDataRegister = new List(); 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 d4333a5d1..cc3f8547a 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 @@ -30,12 +30,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _channelCloseTimeout = TimeSpan.FromSeconds(random.Next()); _channelClosedRegister = new List(); _channelEndOfDataRegister = new List(); 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 e073a6dd0..2cd622443 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsNotConnectedAndChannelIsNotOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsNotConnectedAndChannelIsNotOpen.cs @@ -25,9 +25,9 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); _channelClosedRegister = new List(); _channelExceptionRegister = new List(); } 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 bc8542b0e..f0553cceb 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsNotConnectedAndChannelIsOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_Dispose_SessionIsNotConnectedAndChannelIsOpen.cs @@ -24,9 +24,9 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); _channelClosedRegister = new List(); _channelExceptionRegister = new List(); } 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 8a7368499..af4936e17 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 @@ -22,9 +22,9 @@ protected override void SetupData() { var random = new Random(); - _localWindowSize = (uint) random.Next(1000, int.MaxValue); + _localWindowSize = (uint)random.Next(1000, int.MaxValue); _localPacketSize = _localWindowSize - 1; - _localChannelNumber = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); _onCloseException = new SystemException(); _channelExceptionRegister = new List(); } 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 05963363a..27a1929e5 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 @@ -32,12 +32,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20)); _channelClosedWaitHandleSignaled = false; _channelClosedRegister = new List(); 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 443bf4684..c9227791f 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 @@ -31,12 +31,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20)); _channelClosedRegister = new List(); _channelExceptionRegister = new List(); 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 c64a07da6..101c169d3 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 @@ -31,12 +31,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20)); _channelClosedRegister = new List(); _channelExceptionRegister = new List(); 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 bdb3cadfa..0703ca604 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 @@ -22,9 +22,9 @@ protected override void SetupData() { var random = new Random(); - _localWindowSize = (uint) random.Next(1000, int.MaxValue); + _localWindowSize = (uint)random.Next(1000, int.MaxValue); _localPacketSize = _localWindowSize - 1; - _localChannelNumber = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); _onDataException = new SystemException(); _channelExceptionRegister = new List(); } 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 69a5adb47..a97031bf2 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 @@ -25,12 +25,12 @@ protected override void SetupData() { var random = new Random(); - _localWindowSize = (uint) random.Next(0, 1000); - _localPacketSize = (uint) random.Next(1001, int.MaxValue); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, 1000); + _localPacketSize = (uint)random.Next(1001, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _onEofException = new SystemException(); _channelExceptionRegister = new List(); } 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 c27f73392..f07e01987 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 @@ -22,9 +22,9 @@ protected override void SetupData() { var random = new Random(); - _localWindowSize = (uint) random.Next(1000, int.MaxValue); + _localWindowSize = (uint)random.Next(1000, int.MaxValue); _localPacketSize = _localWindowSize - 1; - _localChannelNumber = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); _onExtendedDataException = new SystemException(); _channelExceptionRegister = new List(); } 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 360628ca2..3709b2de8 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 @@ -22,9 +22,9 @@ protected override void SetupData() { var random = new Random(); - _localWindowSize = (uint) random.Next(0, 1000); - _localPacketSize = (uint) random.Next(1001, int.MaxValue); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, 1000); + _localPacketSize = (uint)random.Next(1001, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); _onFailureException = new SystemException(); _channelExceptionRegister = new List(); } 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 426b2463a..fa02dc49b 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelRequestReceived_HandleUnknownMessage.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionChannelRequestReceived_HandleUnknownMessage.cs @@ -28,12 +28,12 @@ protected override void SetupData() { var random = new Random(); - _localWindowSize = (uint) random.Next(1000, int.MaxValue); + _localWindowSize = (uint)random.Next(1000, int.MaxValue); _localPacketSize = _localWindowSize - 1; - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _channelExceptionRegister = new List(); _requestInfo = new UnknownRequestInfoWithWantReply(); } 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 407480dea..62fe98ad8 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 @@ -23,9 +23,9 @@ protected override void SetupData() { var random = new Random(); - _localWindowSize = (uint) random.Next(1000, int.MaxValue); + _localWindowSize = (uint)random.Next(1000, int.MaxValue); _localPacketSize = _localWindowSize - 1; - _localChannelNumber = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); _onRequestException = new SystemException(); _channelExceptionRegister = new List(); _requestInfo = new SignalRequestInfo("ABC"); 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 09a9e1ea2..b49b0b7ba 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 @@ -22,9 +22,9 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, 1000); - _localPacketSize = (uint) random.Next(1001, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, 1000); + _localPacketSize = (uint)random.Next(1001, int.MaxValue); _onSuccessException = new SystemException(); _channelExceptionRegister = new List(); } 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 1019204b2..afad6eb87 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 @@ -26,13 +26,13 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(1000, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(1000, int.MaxValue); _localPacketSize = _localWindowSize - 1; - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(1000, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(1000, int.MaxValue); _remotePacketSize = _localWindowSize - 1; - _bytesToAdd = (uint) random.Next(0, int.MaxValue); + _bytesToAdd = (uint)random.Next(0, int.MaxValue); _onWindowAdjustException = new SystemException(); _channelExceptionRegister = new List(); } 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 989ea952c..693adbd75 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 @@ -21,9 +21,9 @@ protected override void SetupData() { var random = new Random(); - _localWindowSize = (uint) random.Next(1000, int.MaxValue); + _localWindowSize = (uint)random.Next(1000, int.MaxValue); _localPacketSize = _localWindowSize - 1; - _localChannelNumber = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); _onDisconnectedException = new SystemException(); _channelExceptionRegister = new List(); } 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 327aa1268..d7f04dabe 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionDisconnected_SessionIsConnectedAndChannelIsOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_OnSessionDisconnected_SessionIsConnectedAndChannelIsOpen.cs @@ -24,12 +24,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _channelClosedRegister = new List(); _channelExceptionRegister = new List(); } 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 b47127ab3..1dd45bbe7 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 @@ -22,9 +22,9 @@ protected override void SetupData() { var random = new Random(); - _localWindowSize = (uint) random.Next(1000, int.MaxValue); + _localWindowSize = (uint)random.Next(1000, int.MaxValue); _localPacketSize = _localWindowSize - 1; - _localChannelNumber = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); _onErrorOccurredException = new SystemException(); _channelExceptionRegister = new List(); _errorOccurredException = new SystemException(); 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 0bdb0d378..4a922ad3c 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_SendEof_ChannelIsNotOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_SendEof_ChannelIsNotOpen.cs @@ -25,9 +25,9 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); _channelClosedRegister = new List(); _channelExceptionRegister = new List(); _actualException = null; 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 06c3ca374..fe8092250 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_SendEof_ChannelIsOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelTest_SendEof_ChannelIsOpen.cs @@ -27,12 +27,12 @@ protected override void SetupData() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(0, int.MaxValue); - _localPacketSize = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); - _remoteWindowSize = (uint) random.Next(0, int.MaxValue); - _remotePacketSize = (uint) random.Next(0, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(0, int.MaxValue); + _localPacketSize = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); + _remoteWindowSize = (uint)random.Next(0, int.MaxValue); + _remotePacketSize = (uint)random.Next(0, int.MaxValue); _channelClosedRegister = new List(); _channelExceptionRegister = new List(); } 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 413501ac5..9fcdc6d40 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 @@ -32,10 +32,10 @@ public void Initialize() private void Arrange() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(1000, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(1000, int.MaxValue); _localPacketSize = _localWindowSize - 1; - _remoteChannelNumber = (uint) random.Next(0, int.MaxValue); + _remoteChannelNumber = (uint)random.Next(0, int.MaxValue); _onOpenConfirmationException = new SystemException(); _channelExceptionRegister = new List(); 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 ebe10428e..ad2b6ad1f 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 @@ -31,8 +31,8 @@ public void Initialize() private void Arrange() { var random = new Random(); - _localChannelNumber = (uint) random.Next(0, int.MaxValue); - _localWindowSize = (uint) random.Next(1000, int.MaxValue); + _localChannelNumber = (uint)random.Next(0, int.MaxValue); + _localWindowSize = (uint)random.Next(1000, int.MaxValue); _localPacketSize = _localWindowSize - 1; _onOpenFailureException = new SystemException(); _channelExceptionRegister = new List(); diff --git a/test/Renci.SshNet.Tests/Classes/Common/BigIntegerTest.cs b/test/Renci.SshNet.Tests/Classes/Common/BigIntegerTest.cs index 6a5e5ed18..f3786ece3 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/BigIntegerTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/BigIntegerTest.cs @@ -132,7 +132,7 @@ public void Mul() var a = new BigInteger(values[i]); var b = new BigInteger(values[j]); var c = a * b; - Assert.AreEqual(values[i] * values[j], (long) c, "#_" + i + "_" + j); + Assert.AreEqual(values[i] * values[j], (long)c, "#_" + i + "_" + j); } } } @@ -164,8 +164,8 @@ public void DivRem() var b = new BigInteger(values[j]); var c = BigInteger.DivRem(a, b, out var d); - Assert.AreEqual(values[i] / values[j], (long) c, "#a_" + i + "_" + j); - Assert.AreEqual(values[i] % values[j], (long) d, "#b_" + i + "_" + j); + Assert.AreEqual(values[i] / values[j], (long)c, "#a_" + i + "_" + j); + Assert.AreEqual(values[i] % values[j], (long)d, "#b_" + i + "_" + j); } } } @@ -191,11 +191,11 @@ public void Pow() } catch (ArgumentOutOfRangeException) { } - Assert.AreEqual(1, (int) BigInteger.Pow(99999, 0), "#2"); - Assert.AreEqual(99999, (int) BigInteger.Pow(99999, 1), "#5"); - Assert.AreEqual(59049, (int) BigInteger.Pow(3, 10), "#4"); - Assert.AreEqual(177147, (int) BigInteger.Pow(3, 11), "#5"); - Assert.AreEqual(-177147, (int) BigInteger.Pow(-3, 11), "#6"); + Assert.AreEqual(1, (int)BigInteger.Pow(99999, 0), "#2"); + Assert.AreEqual(99999, (int)BigInteger.Pow(99999, 1), "#5"); + Assert.AreEqual(59049, (int)BigInteger.Pow(3, 10), "#4"); + Assert.AreEqual(177147, (int)BigInteger.Pow(3, 11), "#5"); + Assert.AreEqual(-177147, (int)BigInteger.Pow(-3, 11), "#6"); } [TestMethod] @@ -215,36 +215,36 @@ public void ModPow() } catch (DivideByZeroException) { } - Assert.AreEqual(4L, (long) BigInteger.ModPow(3, 2, 5), "#2"); - Assert.AreEqual(20L, (long) BigInteger.ModPow(555, 10, 71), "#3"); - Assert.AreEqual(20L, (long) BigInteger.ModPow(-555, 10, 71), "#3"); - Assert.AreEqual(-24L, (long) BigInteger.ModPow(-555, 11, 71), "#3"); + Assert.AreEqual(4L, (long)BigInteger.ModPow(3, 2, 5), "#2"); + Assert.AreEqual(20L, (long)BigInteger.ModPow(555, 10, 71), "#3"); + Assert.AreEqual(20L, (long)BigInteger.ModPow(-555, 10, 71), "#3"); + Assert.AreEqual(-24L, (long)BigInteger.ModPow(-555, 11, 71), "#3"); } [TestMethod] public void GreatestCommonDivisor() { - Assert.AreEqual(999999, (int) BigInteger.GreatestCommonDivisor(999999, 0), "#1"); - Assert.AreEqual(999999, (int) BigInteger.GreatestCommonDivisor(0, 999999), "#2"); - Assert.AreEqual(1, (int) BigInteger.GreatestCommonDivisor(999999, 1), "#3"); - Assert.AreEqual(1, (int) BigInteger.GreatestCommonDivisor(1, 999999), "#4"); - Assert.AreEqual(1, (int) BigInteger.GreatestCommonDivisor(1, 0), "#5"); - Assert.AreEqual(1, (int) BigInteger.GreatestCommonDivisor(0, 1), "#6"); + Assert.AreEqual(999999, (int)BigInteger.GreatestCommonDivisor(999999, 0), "#1"); + Assert.AreEqual(999999, (int)BigInteger.GreatestCommonDivisor(0, 999999), "#2"); + Assert.AreEqual(1, (int)BigInteger.GreatestCommonDivisor(999999, 1), "#3"); + Assert.AreEqual(1, (int)BigInteger.GreatestCommonDivisor(1, 999999), "#4"); + Assert.AreEqual(1, (int)BigInteger.GreatestCommonDivisor(1, 0), "#5"); + Assert.AreEqual(1, (int)BigInteger.GreatestCommonDivisor(0, 1), "#6"); - Assert.AreEqual(1, (int) BigInteger.GreatestCommonDivisor(999999, -1), "#7"); - Assert.AreEqual(1, (int) BigInteger.GreatestCommonDivisor(-1, 999999), "#8"); - Assert.AreEqual(1, (int) BigInteger.GreatestCommonDivisor(-1, 0), "#9"); - Assert.AreEqual(1, (int) BigInteger.GreatestCommonDivisor(0, -1), "#10"); + Assert.AreEqual(1, (int)BigInteger.GreatestCommonDivisor(999999, -1), "#7"); + Assert.AreEqual(1, (int)BigInteger.GreatestCommonDivisor(-1, 999999), "#8"); + Assert.AreEqual(1, (int)BigInteger.GreatestCommonDivisor(-1, 0), "#9"); + Assert.AreEqual(1, (int)BigInteger.GreatestCommonDivisor(0, -1), "#10"); - Assert.AreEqual(2, (int) BigInteger.GreatestCommonDivisor(12345678, 8765432), "#11"); - Assert.AreEqual(2, (int) BigInteger.GreatestCommonDivisor(-12345678, 8765432), "#12"); - Assert.AreEqual(2, (int) BigInteger.GreatestCommonDivisor(12345678, -8765432), "#13"); - Assert.AreEqual(2, (int) BigInteger.GreatestCommonDivisor(-12345678, -8765432), "#14"); + Assert.AreEqual(2, (int)BigInteger.GreatestCommonDivisor(12345678, 8765432), "#11"); + Assert.AreEqual(2, (int)BigInteger.GreatestCommonDivisor(-12345678, 8765432), "#12"); + Assert.AreEqual(2, (int)BigInteger.GreatestCommonDivisor(12345678, -8765432), "#13"); + Assert.AreEqual(2, (int)BigInteger.GreatestCommonDivisor(-12345678, -8765432), "#14"); - Assert.AreEqual(40, (int) BigInteger.GreatestCommonDivisor(5581 * 40, 6671 * 40), "#15"); + Assert.AreEqual(40, (int)BigInteger.GreatestCommonDivisor(5581 * 40, 6671 * 40), "#15"); - Assert.AreEqual(5, (int) BigInteger.GreatestCommonDivisor(-5, 0), "#16"); - Assert.AreEqual(5, (int) BigInteger.GreatestCommonDivisor(0, -5), "#17"); + Assert.AreEqual(5, (int)BigInteger.GreatestCommonDivisor(-5, 0), "#16"); + Assert.AreEqual(5, (int)BigInteger.GreatestCommonDivisor(0, -5), "#17"); } [TestMethod] @@ -322,7 +322,7 @@ public void TestAdd2() var a = new BigInteger(values[i]); var b = new BigInteger(values[j]); var c = a + b; - Assert.AreEqual(values[i] + values[j], (long) c, "#_" + i + "_" + j); + Assert.AreEqual(values[i] + values[j], (long)c, "#_" + i + "_" + j); } } } @@ -351,8 +351,8 @@ public void TestSub() var c = a - b; var d = BigInteger.Subtract(a, b); - Assert.AreEqual(values[i] - values[j], (long) c, "#_" + i + "_" + j); - Assert.AreEqual(values[i] - values[j], (long) d, "#_" + i + "_" + j); + Assert.AreEqual(values[i] - values[j], (long)c, "#_" + i + "_" + j); + Assert.AreEqual(values[i] - values[j], (long)d, "#_" + i + "_" + j); } } } @@ -370,7 +370,7 @@ public void TestMin() var b = new BigInteger(values[j]); var c = BigInteger.Min(a, b); - Assert.AreEqual(Math.Min(values[i], values[j]), (long) c, "#_" + i + "_" + j); + Assert.AreEqual(Math.Min(values[i], values[j]), (long)c, "#_" + i + "_" + j); } } } @@ -388,7 +388,7 @@ public void TestMax() var b = new BigInteger(values[j]); var c = BigInteger.Max(a, b); - Assert.AreEqual(Math.Max(values[i], values[j]), (long) c, "#_" + i + "_" + j); + Assert.AreEqual(Math.Max(values[i], values[j]), (long)c, "#_" + i + "_" + j); } } } @@ -403,7 +403,7 @@ public void TestAbs() var a = new BigInteger(values[i]); var c = BigInteger.Abs(a); - Assert.AreEqual(Math.Abs(values[i]), (long) c, "#_" + i); + Assert.AreEqual(Math.Abs(values[i]), (long)c, "#_" + i); } } @@ -418,8 +418,8 @@ public void TestNegate() var c = -a; var d = BigInteger.Negate(a); - Assert.AreEqual(-values[i], (long) c, "#_" + i); - Assert.AreEqual(-values[i], (long) d, "#_" + i); + Assert.AreEqual(-values[i], (long)c, "#_" + i); + Assert.AreEqual(-values[i], (long)d, "#_" + i); } } @@ -433,7 +433,7 @@ public void TestInc() var a = new BigInteger(values[i]); var b = ++a; - Assert.AreEqual(++values[i], (long) b, "#_" + i); + Assert.AreEqual(++values[i], (long)b, "#_" + i); } } @@ -447,7 +447,7 @@ public void TestDec() var a = new BigInteger(values[i]); var b = --a; - Assert.AreEqual(--values[i], (long) b, "#_" + i); + Assert.AreEqual(--values[i], (long)b, "#_" + i); } } @@ -463,10 +463,10 @@ public void TestBitwiseOps() var a = new BigInteger(values[i]); var b = new BigInteger(values[j]); - Assert.AreEqual(values[i] | values[j], (long) (a | b), "#b_" + i + "_" + j); - Assert.AreEqual(values[i] & values[j], (long) (a & b), "#a_" + i + "_" + j); - Assert.AreEqual(values[i] ^ values[j], (long) (a ^ b), "#c_" + i + "_" + j); - Assert.AreEqual(~values[i], (long) ~a, "#d_" + i + "_" + j); + Assert.AreEqual(values[i] | values[j], (long)(a | b), "#b_" + i + "_" + j); + Assert.AreEqual(values[i] & values[j], (long)(a & b), "#a_" + i + "_" + j); + Assert.AreEqual(values[i] ^ values[j], (long)(a ^ b), "#c_" + i + "_" + j); + Assert.AreEqual(~values[i], (long)~a, "#d_" + i + "_" + j); } } } @@ -634,9 +634,9 @@ public void Ctor_ByteArray_ShouldThrowArgumentNullExceptionWhenValueIsNull() [TestMethod] public void ByteArrayCtor() { - Assert.AreEqual(0, (int) new BigInteger(new byte[0])); - Assert.AreEqual(0, (int) new BigInteger(new byte[1])); - Assert.AreEqual(0, (int) new BigInteger(new byte[2])); + Assert.AreEqual(0, (int)new BigInteger(new byte[0])); + Assert.AreEqual(0, (int)new BigInteger(new byte[1])); + Assert.AreEqual(0, (int)new BigInteger(new byte[2])); } [TestMethod] @@ -654,8 +654,8 @@ public void IntCtorRoundTrip() var a = new BigInteger(val); var b = new BigInteger(a.ToByteArray()); - Assert.AreEqual(val, (int) a, "#a_" + val); - Assert.AreEqual(val, (int) b, "#b_" + val); + Assert.AreEqual(val, (int)a, "#a_" + val); + Assert.AreEqual(val, (int)b, "#b_" + val); } } @@ -676,8 +676,8 @@ public void LongCtorRoundTrip() var a = new BigInteger(val); var b = new BigInteger(a.ToByteArray()); - Assert.AreEqual(val, (long) a, "#a_" + val); - Assert.AreEqual(val, (long) b, "#b_" + val); + Assert.AreEqual(val, (long)a, "#a_" + val); + Assert.AreEqual(val, (long)b, "#b_" + val); Assert.AreEqual(a, b, "#a == #b (" + val + ")"); } catch (Exception e) @@ -824,27 +824,27 @@ public void TestToIntOperator() { try { - _ = (int) new BigInteger(Huge_a); + _ = (int)new BigInteger(Huge_a); Assert.Fail("#1"); } catch (OverflowException) { } try { - _ = (int) new BigInteger(1L + int.MaxValue); + _ = (int)new BigInteger(1L + int.MaxValue); Assert.Fail("#2"); } catch (OverflowException) { } try { - _ = (int) new BigInteger(-1L + int.MinValue); + _ = (int)new BigInteger(-1L + int.MinValue); Assert.Fail("#3"); } catch (OverflowException) { } - Assert.AreEqual(int.MaxValue, (int) new BigInteger(int.MaxValue), "#4"); - Assert.AreEqual(int.MinValue, (int) new BigInteger(int.MinValue), "#5"); + Assert.AreEqual(int.MaxValue, (int)new BigInteger(int.MaxValue), "#4"); + Assert.AreEqual(int.MinValue, (int)new BigInteger(int.MinValue), "#5"); } @@ -853,7 +853,7 @@ public void TestToLongOperator() { try { - _ = (long) new BigInteger(Huge_a); + _ = (long)new BigInteger(Huge_a); Assert.Fail("#1"); } catch (OverflowException) { } @@ -861,7 +861,7 @@ public void TestToLongOperator() //long.MaxValue + 1 try { - _ = (long) new BigInteger(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00 }); + _ = (long)new BigInteger(new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00 }); Assert.Fail("#2"); } catch (OverflowException) { } @@ -869,13 +869,13 @@ public void TestToLongOperator() //TODO long.MinValue - 1 try { - _ = (long) new BigInteger(new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF }); + _ = (long)new BigInteger(new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF }); Assert.Fail("#3"); } catch (OverflowException) { } - Assert.AreEqual(long.MaxValue, (long) new BigInteger(long.MaxValue), "#4"); - Assert.AreEqual(long.MinValue, (long) new BigInteger(long.MinValue), "#5"); + Assert.AreEqual(long.MaxValue, (long)new BigInteger(long.MaxValue), "#4"); + Assert.AreEqual(long.MinValue, (long)new BigInteger(long.MinValue), "#5"); } [TestMethod] @@ -934,19 +934,19 @@ public void CompareTo() [TestMethod] public void ShortOperators() { - Assert.AreEqual(22, (int) new BigInteger(22), "#1"); - Assert.AreEqual(-22, (int) new BigInteger(-22), "#2"); + Assert.AreEqual(22, (int)new BigInteger(22), "#1"); + Assert.AreEqual(-22, (int)new BigInteger(-22), "#2"); try { - _ = (short) new BigInteger(10000000); + _ = (short)new BigInteger(10000000); Assert.Fail("#3"); } catch (OverflowException) { } try { - _ = (short) new BigInteger(-10000000); + _ = (short)new BigInteger(-10000000); Assert.Fail("#4"); } catch (OverflowException) { } @@ -994,63 +994,63 @@ public void Ctor_Double_PositiveInfinity() [TestMethod] public void Ctor_Double() { - Assert.AreEqual(10000, (int) new BigInteger(10000.2)); - Assert.AreEqual(10000, (int) new BigInteger(10000.9)); - Assert.AreEqual(10000, (int) new BigInteger(10000.2)); - Assert.AreEqual(0, (int) new BigInteger(0.9)); - Assert.AreEqual(12345678999L, (long) new BigInteger(12345678999.33)); + Assert.AreEqual(10000, (int)new BigInteger(10000.2)); + Assert.AreEqual(10000, (int)new BigInteger(10000.9)); + Assert.AreEqual(10000, (int)new BigInteger(10000.2)); + Assert.AreEqual(0, (int)new BigInteger(0.9)); + Assert.AreEqual(12345678999L, (long)new BigInteger(12345678999.33)); } [TestMethod] public void DoubleConversion() { - Assert.AreEqual(999d, (double) new BigInteger(999), "#1"); - Assert.AreEqual(double.PositiveInfinity, (double) BigInteger.Pow(2, 1024), "#2"); - Assert.AreEqual(double.NegativeInfinity, (double) BigInteger.Pow(-2, 1025), "#3"); + Assert.AreEqual(999d, (double)new BigInteger(999), "#1"); + Assert.AreEqual(double.PositiveInfinity, (double)BigInteger.Pow(2, 1024), "#2"); + Assert.AreEqual(double.NegativeInfinity, (double)BigInteger.Pow(-2, 1025), "#3"); - Assert.AreEqual(0d, (double) BigInteger.Zero, "#4"); - Assert.AreEqual(1d, (double) BigInteger.One, "#5"); - Assert.AreEqual(-1d, (double) BigInteger.MinusOne, "#6"); + Assert.AreEqual(0d, (double)BigInteger.Zero, "#4"); + Assert.AreEqual(1d, (double)BigInteger.One, "#5"); + Assert.AreEqual(-1d, (double)BigInteger.MinusOne, "#6"); var result1 = BitConverter.Int64BitsToDouble(-4337852273739220173); - Assert.AreEqual(result1, (double) new BigInteger(new byte[] { 53, 152, 137, 177, 240, 81, 75, 198 }), "#7"); + Assert.AreEqual(result1, (double)new BigInteger(new byte[] { 53, 152, 137, 177, 240, 81, 75, 198 }), "#7"); var result2 = BitConverter.Int64BitsToDouble(4893382453283402035); - Assert.AreEqual(result2, (double) new BigInteger(new byte[] { 53, 152, 137, 177, 240, 81, 75, 198, 0 }), "#8"); + Assert.AreEqual(result2, (double)new BigInteger(new byte[] { 53, 152, 137, 177, 240, 81, 75, 198, 0 }), "#8"); var result3 = BitConverter.Int64BitsToDouble(5010775143622804480); var result4 = BitConverter.Int64BitsToDouble(5010775143622804481); var result5 = BitConverter.Int64BitsToDouble(5010775143622804482); - Assert.AreEqual(result3, (double) new BigInteger(new byte[] { 0, 0, 0, 0, 16, 128, 208, 159, 60, 46, 59, 3 }), "#9"); - Assert.AreEqual(result3, (double) new BigInteger(new byte[] { 0, 0, 0, 0, 17, 128, 208, 159, 60, 46, 59, 3 }), "#10"); - Assert.AreEqual(result3, (double) new BigInteger(new byte[] { 0, 0, 0, 0, 24, 128, 208, 159, 60, 46, 59, 3 }), "#11"); - Assert.AreEqual(result4, (double) new BigInteger(new byte[] { 0, 0, 0, 0, 32, 128, 208, 159, 60, 46, 59, 3 }), "#12"); - Assert.AreEqual(result4, (double) new BigInteger(new byte[] { 0, 0, 0, 0, 48, 128, 208, 159, 60, 46, 59, 3 }), "#13"); - Assert.AreEqual(result5, (double) new BigInteger(new byte[] { 0, 0, 0, 0, 64, 128, 208, 159, 60, 46, 59, 3 }), "#14"); + Assert.AreEqual(result3, (double)new BigInteger(new byte[] { 0, 0, 0, 0, 16, 128, 208, 159, 60, 46, 59, 3 }), "#9"); + Assert.AreEqual(result3, (double)new BigInteger(new byte[] { 0, 0, 0, 0, 17, 128, 208, 159, 60, 46, 59, 3 }), "#10"); + Assert.AreEqual(result3, (double)new BigInteger(new byte[] { 0, 0, 0, 0, 24, 128, 208, 159, 60, 46, 59, 3 }), "#11"); + Assert.AreEqual(result4, (double)new BigInteger(new byte[] { 0, 0, 0, 0, 32, 128, 208, 159, 60, 46, 59, 3 }), "#12"); + Assert.AreEqual(result4, (double)new BigInteger(new byte[] { 0, 0, 0, 0, 48, 128, 208, 159, 60, 46, 59, 3 }), "#13"); + Assert.AreEqual(result5, (double)new BigInteger(new byte[] { 0, 0, 0, 0, 64, 128, 208, 159, 60, 46, 59, 3 }), "#14"); - Assert.AreEqual(BitConverter.Int64BitsToDouble(-2748107935317889142), (double) new BigInteger(Huge_a), "#15"); - Assert.AreEqual(BitConverter.Int64BitsToDouble(-2354774254443231289), (double) new BigInteger(Huge_b), "#16"); - Assert.AreEqual(BitConverter.Int64BitsToDouble(8737073938546854790), (double) new BigInteger(Huge_mul), "#17"); + Assert.AreEqual(BitConverter.Int64BitsToDouble(-2748107935317889142), (double)new BigInteger(Huge_a), "#15"); + Assert.AreEqual(BitConverter.Int64BitsToDouble(-2354774254443231289), (double)new BigInteger(Huge_b), "#16"); + Assert.AreEqual(BitConverter.Int64BitsToDouble(8737073938546854790), (double)new BigInteger(Huge_mul), "#17"); - Assert.AreEqual(BitConverter.Int64BitsToDouble(6912920136897069886), (double) (2278888483353476799 * BigInteger.Pow(2, 451)), "#18"); - Assert.AreEqual(double.PositiveInfinity, (double) (843942696292817306 * BigInteger.Pow(2, 965)), "#19"); + Assert.AreEqual(BitConverter.Int64BitsToDouble(6912920136897069886), (double)(2278888483353476799 * BigInteger.Pow(2, 451)), "#18"); + Assert.AreEqual(double.PositiveInfinity, (double)(843942696292817306 * BigInteger.Pow(2, 965)), "#19"); } [TestMethod] public void DecimalCtor() { - Assert.AreEqual(999, (int) new BigInteger(999.99m), "#1"); - Assert.AreEqual(-10000, (int) new BigInteger(-10000m), "#2"); - Assert.AreEqual(0, (int) new BigInteger(0m), "#3"); + Assert.AreEqual(999, (int)new BigInteger(999.99m), "#1"); + Assert.AreEqual(-10000, (int)new BigInteger(-10000m), "#2"); + Assert.AreEqual(0, (int)new BigInteger(0m), "#3"); } [TestMethod] public void DecimalConversion() { - Assert.AreEqual(999m, (decimal) new BigInteger(999), "#1"); + Assert.AreEqual(999m, (decimal)new BigInteger(999), "#1"); try { - var x = (decimal) BigInteger.Pow(2, 1024); + var x = (decimal)BigInteger.Pow(2, 1024); Assert.Fail("#2: " + x); } catch (OverflowException) @@ -1059,18 +1059,18 @@ public void DecimalConversion() try { - var x = (decimal) BigInteger.Pow(-2, 1025); + var x = (decimal)BigInteger.Pow(-2, 1025); Assert.Fail("#3: " + x); } catch (OverflowException) { } - Assert.AreEqual(0m, (decimal) new BigInteger(0), "#4"); - Assert.AreEqual(1m, (decimal) new BigInteger(1), "#5"); - Assert.AreEqual(-1m, (decimal) new BigInteger(-1), "#6"); - Assert.AreEqual(9999999999999999999999999999m, (decimal) new BigInteger(9999999999999999999999999999m), "#7"); - Assert.AreEqual(0m, (decimal) new BigInteger(), "#8"); + Assert.AreEqual(0m, (decimal)new BigInteger(0), "#4"); + Assert.AreEqual(1m, (decimal)new BigInteger(1), "#5"); + Assert.AreEqual(-1m, (decimal)new BigInteger(-1), "#6"); + Assert.AreEqual(9999999999999999999999999999m, (decimal)new BigInteger(9999999999999999999999999999m), "#7"); + Assert.AreEqual(0m, (decimal)new BigInteger(), "#8"); } [TestMethod] @@ -1119,26 +1119,26 @@ public void Parse() } catch (FormatException) { } - Assert.AreEqual(10, (int) BigInteger.Parse("+10"), "#7"); - Assert.AreEqual(10, (int) BigInteger.Parse("10 "), "#8"); - Assert.AreEqual(-10, (int) BigInteger.Parse("-10 "), "#9"); - Assert.AreEqual(10, (int) BigInteger.Parse(" 10 "), "#10"); - Assert.AreEqual(-10, (int) BigInteger.Parse(" -10 "), "#11"); + Assert.AreEqual(10, (int)BigInteger.Parse("+10"), "#7"); + Assert.AreEqual(10, (int)BigInteger.Parse("10 "), "#8"); + Assert.AreEqual(-10, (int)BigInteger.Parse("-10 "), "#9"); + Assert.AreEqual(10, (int)BigInteger.Parse(" 10 "), "#10"); + Assert.AreEqual(-10, (int)BigInteger.Parse(" -10 "), "#11"); - Assert.AreEqual(-1, (int) BigInteger.Parse("F", NumberStyles.AllowHexSpecifier), "#12"); - Assert.AreEqual(-8, (int) BigInteger.Parse("8", NumberStyles.AllowHexSpecifier), "#13"); - Assert.AreEqual(8, (int) BigInteger.Parse("08", NumberStyles.AllowHexSpecifier), "#14"); - Assert.AreEqual(15, (int) BigInteger.Parse("0F", NumberStyles.AllowHexSpecifier), "#15"); - Assert.AreEqual(-1, (int) BigInteger.Parse("FF", NumberStyles.AllowHexSpecifier), "#16"); - Assert.AreEqual(255, (int) BigInteger.Parse("0FF", NumberStyles.AllowHexSpecifier), "#17"); + Assert.AreEqual(-1, (int)BigInteger.Parse("F", NumberStyles.AllowHexSpecifier), "#12"); + Assert.AreEqual(-8, (int)BigInteger.Parse("8", NumberStyles.AllowHexSpecifier), "#13"); + Assert.AreEqual(8, (int)BigInteger.Parse("08", NumberStyles.AllowHexSpecifier), "#14"); + Assert.AreEqual(15, (int)BigInteger.Parse("0F", NumberStyles.AllowHexSpecifier), "#15"); + Assert.AreEqual(-1, (int)BigInteger.Parse("FF", NumberStyles.AllowHexSpecifier), "#16"); + Assert.AreEqual(255, (int)BigInteger.Parse("0FF", NumberStyles.AllowHexSpecifier), "#17"); - Assert.AreEqual(-17, (int) BigInteger.Parse(" (17) ", NumberStyles.AllowParentheses | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite), "#18"); - Assert.AreEqual(-23, (int) BigInteger.Parse(" -23 ", NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite), "#19"); + Assert.AreEqual(-17, (int)BigInteger.Parse(" (17) ", NumberStyles.AllowParentheses | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite), "#18"); + Assert.AreEqual(-23, (int)BigInteger.Parse(" -23 ", NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite), "#19"); - Assert.AreEqual(300000, (int) BigInteger.Parse("3E5", NumberStyles.AllowExponent), "#20"); + Assert.AreEqual(300000, (int)BigInteger.Parse("3E5", NumberStyles.AllowExponent), "#20"); var dsep = NumberFormatInfo.CurrentInfo.NumberDecimalSeparator; - Assert.AreEqual(250, (int) BigInteger.Parse("2" + dsep + "5E2", NumberStyles.AllowExponent | NumberStyles.AllowDecimalPoint), "#21");//2.5E2 = 250 - Assert.AreEqual(25, (int) BigInteger.Parse("2500E-2", NumberStyles.AllowExponent), "#22"); + Assert.AreEqual(250, (int)BigInteger.Parse("2" + dsep + "5E2", NumberStyles.AllowExponent | NumberStyles.AllowDecimalPoint), "#21");//2.5E2 = 250 + Assert.AreEqual(25, (int)BigInteger.Parse("2500E-2", NumberStyles.AllowExponent), "#22"); Assert.AreEqual("136236974127783066520110477975349088954559032721408", BigInteger.Parse("136236974127783066520110477975349088954559032721408", NumberStyles.None).ToString(), "#23"); Assert.AreEqual("136236974127783066520110477975349088954559032721408", BigInteger.Parse("136236974127783066520110477975349088954559032721408").ToString(), "#24"); @@ -1190,13 +1190,13 @@ public void TryParse_Value() Assert.AreEqual(BigInteger.Zero, x); Assert.IsTrue(BigInteger.TryParse(" 99", out x)); - Assert.AreEqual(99, (int) x); + Assert.AreEqual(99, (int)x); Assert.IsTrue(BigInteger.TryParse("+133", out x)); - Assert.AreEqual(133, (int) x); + Assert.AreEqual(133, (int)x); Assert.IsTrue(BigInteger.TryParse("-010", out x)); - Assert.AreEqual(-10, (int) x); + Assert.AreEqual(-10, (int)x); } [TestMethod] @@ -1218,16 +1218,16 @@ public void TryParse_ValueAndStyleAndProvider() Assert.AreEqual(BigInteger.Zero, x); Assert.IsTrue(BigInteger.TryParse("-10", NumberStyles.AllowLeadingSign, null, out x)); - Assert.AreEqual(-10, (int) x); + Assert.AreEqual(-10, (int)x); Assert.IsTrue(BigInteger.TryParse("(10)", NumberStyles.AllowParentheses, null, out x)); - Assert.AreEqual(-10, (int) x); + Assert.AreEqual(-10, (int)x); Assert.IsTrue(BigInteger.TryParse(" 10", NumberStyles.AllowLeadingWhite, null, out x)); - Assert.AreEqual(10, (int) x); + Assert.AreEqual(10, (int)x); Assert.IsTrue(BigInteger.TryParse("10 ", NumberStyles.AllowTrailingWhite, null, out x)); - Assert.AreEqual(10, (int) x); + Assert.AreEqual(10, (int)x); Assert.IsFalse(BigInteger.TryParse("$10", NumberStyles.None, null, out x)); Assert.AreEqual(BigInteger.Zero, x); @@ -1242,10 +1242,10 @@ public void TryParse_ValueAndStyleAndProvider() Assert.AreEqual(BigInteger.Zero, x); Assert.IsTrue(BigInteger.TryParse("10", NumberStyles.None, null, out x)); - Assert.AreEqual(10, (int) x); + Assert.AreEqual(10, (int)x); Assert.IsTrue(BigInteger.TryParse(_nfi.CurrencySymbol + "10", NumberStyles.AllowCurrencySymbol, _nfi, out x)); - Assert.AreEqual(10, (int) x); + Assert.AreEqual(10, (int)x); Assert.IsFalse(BigInteger.TryParse("%10", NumberStyles.AllowCurrencySymbol, _nfi, out x)); Assert.AreEqual(BigInteger.Zero, x); @@ -1270,20 +1270,20 @@ public void TestUserCurrency() Assert.AreEqual("1234/5/67:000 XYZ-", s, "Currency value type 1 is not what we want to try to parse"); var v = BigInteger.Parse("1234/5/67:000 XYZ-", NumberStyles.Currency, _nfiUser); - Assert.AreEqual(val1, (int) v); + Assert.AreEqual(val1, (int)v); s = val2.ToString("c", _nfiUser); Assert.AreEqual("1234/5/67:000 XYZ", s, "Currency value type 2 is not what we want to try to parse"); v = BigInteger.Parse(s, NumberStyles.Currency, _nfiUser); - Assert.AreEqual(val2, (int) v); + Assert.AreEqual(val2, (int)v); } [TestMethod] public void TryParseWeirdCulture() { var old = Thread.CurrentThread.CurrentCulture; - var cur = (CultureInfo) old.Clone(); + var cur = (CultureInfo)old.Clone(); cur.NumberFormat = new NumberFormatInfo { NegativeSign = ">", @@ -1295,10 +1295,10 @@ public void TryParseWeirdCulture() try { Assert.IsTrue(BigInteger.TryParse("%11", out var x)); - Assert.AreEqual(11, (int) x); + Assert.AreEqual(11, (int)x); Assert.IsTrue(BigInteger.TryParse(">11", out x)); - Assert.AreEqual(-11, (int) x); + Assert.AreEqual(-11, (int)x); } finally { @@ -1520,13 +1520,13 @@ public void DefaultCtorWorks() Assert.AreEqual(true, a.IsEven, "#8"); a = new BigInteger(); - Assert.AreEqual(0, (int) a, "#9"); + Assert.AreEqual(0, (int)a, "#9"); a = new BigInteger(); - Assert.AreEqual((uint) 0, (uint) a, "#10"); + Assert.AreEqual((uint)0, (uint)a, "#10"); a = new BigInteger(); - Assert.AreEqual((ulong) 0, (ulong) a, "#11"); + Assert.AreEqual((ulong)0, (ulong)a, "#11"); a = new BigInteger(); Assert.AreEqual(true, a.Equals(a), "#12"); @@ -1553,7 +1553,7 @@ public void Bug16526() Assert.AreEqual("-9223372036854775809", x.ToString(), "#1"); try { - x = (long) x; + x = (long)x; Assert.Fail("#2 Must OVF: " + x); } catch (OverflowException) diff --git a/test/Renci.SshNet.Tests/Classes/Common/HostKeyEventArgsTest.cs b/test/Renci.SshNet.Tests/Classes/Common/HostKeyEventArgsTest.cs index b298c8d85..4c67be7b6 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/HostKeyEventArgsTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/HostKeyEventArgsTest.cs @@ -90,7 +90,7 @@ private static KeyHostAlgorithm GetKeyHostAlgorithm() using (var s = GetData("Key.RSA.txt")) { var privateKey = new PrivateKeyFile(s); - return (KeyHostAlgorithm) privateKey.HostKeyAlgorithms.Single(x => x.Name == "rsa-sha2-512"); + return (KeyHostAlgorithm)privateKey.HostKeyAlgorithms.Single(x => x.Name == "rsa-sha2-512"); } } diff --git a/test/Renci.SshNet.Tests/Classes/Common/PackTest.cs b/test/Renci.SshNet.Tests/Classes/Common/PackTest.cs index 13696757a..443b749ef 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/PackTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/PackTest.cs @@ -53,11 +53,11 @@ public void BigEndianToUInt64() [TestMethod] public void LittleEndianToUInt16() { - Assert.AreEqual((ushort) 0, Pack.LittleEndianToUInt16(new byte[] { 0, 0 })); - Assert.AreEqual((ushort) 1, Pack.LittleEndianToUInt16(new byte[] { 1, 0 })); - Assert.AreEqual((ushort) 256, Pack.LittleEndianToUInt16(new byte[] { 0, 1 })); - Assert.AreEqual((ushort) 257, Pack.LittleEndianToUInt16(new byte[] { 1, 1 })); - Assert.AreEqual((ushort) 1025, Pack.LittleEndianToUInt16(new byte[] { 1, 4 })); + Assert.AreEqual((ushort)0, Pack.LittleEndianToUInt16(new byte[] { 0, 0 })); + Assert.AreEqual((ushort)1, Pack.LittleEndianToUInt16(new byte[] { 1, 0 })); + Assert.AreEqual((ushort)256, Pack.LittleEndianToUInt16(new byte[] { 0, 1 })); + Assert.AreEqual((ushort)257, Pack.LittleEndianToUInt16(new byte[] { 1, 1 })); + Assert.AreEqual((ushort)1025, Pack.LittleEndianToUInt16(new byte[] { 1, 4 })); Assert.AreEqual(ushort.MaxValue, Pack.LittleEndianToUInt16(new byte[] { 255, 255 })); } diff --git a/test/Renci.SshNet.Tests/Classes/Common/SshDataTest.cs b/test/Renci.SshNet.Tests/Classes/Common/SshDataTest.cs index 03b489121..1518dda11 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/SshDataTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/SshDataTest.cs @@ -16,7 +16,7 @@ public void Write_Boolean_False() var bytes = sshData.GetBytes(); - Assert.AreEqual((byte) 0, bytes[0]); + Assert.AreEqual((byte)0, bytes[0]); } [TestMethod] @@ -26,7 +26,7 @@ public void Write_Boolean_True() var bytes = sshData.GetBytes(); - Assert.AreEqual((byte) 1, bytes[0]); + Assert.AreEqual((byte)1, bytes[0]); } [TestMethod] diff --git a/test/Renci.SshNet.Tests/Classes/Common/TimeSpanExtensionsTest.cs b/test/Renci.SshNet.Tests/Classes/Common/TimeSpanExtensionsTest.cs index 71f91c8ee..87e30daf4 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/TimeSpanExtensionsTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/TimeSpanExtensionsTest.cs @@ -33,7 +33,7 @@ public void AsTimeout_NegativeTimeSpan_ThrowsArgumentOutOfRangeException() [ExpectedException(typeof(ArgumentOutOfRangeException))] public void AsTimeout_TimeSpanExceedingMaxValue_ThrowsArgumentOutOfRangeException() { - var timeSpan = TimeSpan.FromMilliseconds((double) int.MaxValue + 1); + var timeSpan = TimeSpan.FromMilliseconds((double)int.MaxValue + 1); timeSpan.AsTimeout("TestMethodName"); } @@ -44,7 +44,7 @@ public void AsTimeout_ArgumentOutOfRangeException_HasCorrectInformation() try { - var timeSpan = TimeSpan.FromMilliseconds((double) int.MaxValue + 1); + var timeSpan = TimeSpan.FromMilliseconds((double)int.MaxValue + 1); timeSpan.AsTimeout("TestMethodName"); } @@ -77,7 +77,7 @@ public void EnsureValidTimeout_NegativeTimeSpan_ThrowsArgumentOutOfRangeExceptio [ExpectedException(typeof(ArgumentOutOfRangeException))] public void EnsureValidTimeout_TimeSpanExceedingMaxValue_ThrowsArgumentOutOfRangeException() { - var timeSpan = TimeSpan.FromMilliseconds((double) int.MaxValue + 1); + var timeSpan = TimeSpan.FromMilliseconds((double)int.MaxValue + 1); timeSpan.EnsureValidTimeout("TestMethodName"); } @@ -88,7 +88,7 @@ public void EnsureValidTimeout_ArgumentOutOfRangeException_HasCorrectInformation try { - var timeSpan = TimeSpan.FromMilliseconds((double) int.MaxValue + 1); + var timeSpan = TimeSpan.FromMilliseconds((double)int.MaxValue + 1); timeSpan.EnsureValidTimeout("TestMethodName"); } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTestBase.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTestBase.cs index bbac79c7e..24809f614 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTestBase.cs @@ -60,7 +60,7 @@ protected static string GenerateRandomString(int minLength, int maxLength) for (var i = 0; i < length; i++) { - var c = (char) random.Next(offset, offset + 26); + var c = (char)random.Next(offset, offset + 26); _ = sb.Append(c); } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_ProxySocksVersionIsNotSupported.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_ProxySocksVersionIsNotSupported.cs index 76cd2568f..1c26de2f6 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_ProxySocksVersionIsNotSupported.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_ProxySocksVersionIsNotSupported.cs @@ -115,7 +115,7 @@ private static byte GetNotSupportedSocksVersion() var socksVersion = random.Next(1, 255); if (socksVersion != 5) { - return (byte) socksVersion; + return (byte)socksVersion; } } } diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_AuthenticationFailed.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_AuthenticationFailed.cs index ca2c51af8..74d31196e 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_AuthenticationFailed.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_AuthenticationFailed.cs @@ -132,11 +132,11 @@ public void ProxyShouldHaveReceivedExpectedSocksRequest() // Version of the negotiation expectedSocksRequest.Add(0x01); // Length of the username - expectedSocksRequest.Add((byte) _connectionInfo.ProxyUsername.Length); + expectedSocksRequest.Add((byte)_connectionInfo.ProxyUsername.Length); // Username expectedSocksRequest.AddRange(Encoding.ASCII.GetBytes(_connectionInfo.ProxyUsername)); // Length of the password - expectedSocksRequest.Add((byte) _connectionInfo.ProxyPassword.Length); + expectedSocksRequest.Add((byte)_connectionInfo.ProxyPassword.Length); // Password expectedSocksRequest.AddRange(Encoding.ASCII.GetBytes(_connectionInfo.ProxyPassword)); diff --git a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_ConnectionSucceeded.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_ConnectionSucceeded.cs index 9941ad786..3c69ac5c4 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_ConnectionSucceeded.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_UserNamePasswordAuthentication_ConnectionSucceeded.cs @@ -167,11 +167,11 @@ public void ProxyShouldHaveReceivedExpectedSocksRequest() // Version of the negotiation expectedSocksRequest.Add(0x01); // Length of the username - expectedSocksRequest.Add((byte) _connectionInfo.ProxyUsername.Length); + expectedSocksRequest.Add((byte)_connectionInfo.ProxyUsername.Length); // Username expectedSocksRequest.AddRange(Encoding.ASCII.GetBytes(_connectionInfo.ProxyUsername)); // Length of the password - expectedSocksRequest.Add((byte) _connectionInfo.ProxyPassword.Length); + expectedSocksRequest.Add((byte)_connectionInfo.ProxyPassword.Length); // Password expectedSocksRequest.AddRange(Encoding.ASCII.GetBytes(_connectionInfo.ProxyPassword)); diff --git a/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest.cs b/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest.cs index 82b580cc5..4e143bbc6 100644 --- a/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest.cs +++ b/test/Renci.SshNet.Tests/Classes/ConnectionInfoTest.cs @@ -306,7 +306,7 @@ public void Test_ConnectionInfo_Timeout_Valid() try { - connectionInfo.Timeout = TimeSpan.FromMilliseconds((double) int.MaxValue + 1); + connectionInfo.Timeout = TimeSpan.FromMilliseconds((double)int.MaxValue + 1); } catch (ArgumentOutOfRangeException ex) { @@ -345,7 +345,7 @@ public void Test_ConnectionInfo_ChannelCloseTimeout_Valid() try { - connectionInfo.ChannelCloseTimeout = TimeSpan.FromMilliseconds((double) int.MaxValue + 1); + connectionInfo.ChannelCloseTimeout = TimeSpan.FromMilliseconds((double)int.MaxValue + 1); } catch (ArgumentOutOfRangeException ex) { diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest.cs index 873f61268..3055b6ee3 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest.cs @@ -14,7 +14,7 @@ public class ForwardedPortDynamicTest : TestBase public void Constructor_HostAndPort() { var host = new Random().Next().ToString(CultureInfo.InvariantCulture); - var port = (uint) new Random().Next(0, int.MaxValue); + var port = (uint)new Random().Next(0, int.MaxValue); var target = new ForwardedPortDynamic(host, port); @@ -25,7 +25,7 @@ public void Constructor_HostAndPort() [TestMethod()] public void Constructor_Port() { - var port = (uint) new Random().Next(0, int.MaxValue); + var port = (uint)new Random().Next(0, int.MaxValue); var target = new ForwardedPortDynamic(port); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortNeverStarted.cs index ae38206de..dfd07a273 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortNeverStarted.cs @@ -51,7 +51,7 @@ protected void Arrange() _sessionMock.Setup(p => p.IsConnected).Returns(true); _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; 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 e76b4b0dd..64f2ab371 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelBound.cs @@ -87,7 +87,7 @@ private void SetupData() _channelBindStarted = new ManualResetEvent(false); _channelBindCompleted = new ManualResetEvent(false); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; @@ -106,7 +106,7 @@ private void SetupMocks() _sessionMock.Setup(p => p.IsConnected).Returns(true); _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); _sessionMock.Setup(p => p.CreateChannelDirectTcpip()).Returns(_channelMock.Object); - _channelMock.Setup(p => p.Open(_remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port, _forwardedPort, It.IsAny())); + _channelMock.Setup(p => p.Open(_remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port, _forwardedPort, It.IsAny())); _channelMock.Setup(p => p.IsOpen).Returns(true); _channelMock.Setup(p => p.Bind()).Callback(() => { @@ -201,7 +201,7 @@ public void OpenOnChannelShouldBeInvokedOnce() { _channelMock.Verify( p => - p.Open(_remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port, _forwardedPort, + p.Open(_remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port, _forwardedPort, It.IsAny()), Times.Once); } @@ -221,7 +221,7 @@ private void EstablishSocks4Connection(Socket client) { var userNameBytes = Encoding.ASCII.GetBytes(_userName); var addressBytes = _remoteEndpoint.Address.GetAddressBytes(); - var portBytes = BitConverter.GetBytes((ushort) _remoteEndpoint.Port).Reverse().ToArray(); + var portBytes = BitConverter.GetBytes((ushort)_remoteEndpoint.Port).Reverse().ToArray(); _client.Connect(_endpoint); 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 a41c6b3a0..fb148f66e 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelNotBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelNotBound.cs @@ -65,7 +65,7 @@ protected void Arrange() _sessionMock.Setup(p => p.CreateChannelDirectTcpip()).Returns(_channelMock.Object); _channelMock.Setup(p => p.Dispose()); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStopped.cs index 27b6741f1..5e8d9c3e2 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStopped.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStopped.cs @@ -51,7 +51,7 @@ protected void Arrange() _sessionMock.Setup(p => p.IsConnected).Returns(true); _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_SessionErrorOccurred_ChannelBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_SessionErrorOccurred_ChannelBound.cs index 1fc785b34..af699acc9 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_SessionErrorOccurred_ChannelBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_SessionErrorOccurred_ChannelBound.cs @@ -85,7 +85,7 @@ private void SetupData() _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); _bindSleepTime = TimeSpan.FromMilliseconds(random.Next(100, 500)); _userName = random.Next().ToString(CultureInfo.InvariantCulture); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); _sessionException = new Exception(); _channelBindStarted = new ManualResetEvent(false); _channelBindCompleted = new ManualResetEvent(false); @@ -108,7 +108,7 @@ private void SetupMocks() _sessionMock.Setup(p => p.IsConnected).Returns(true); _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); _sessionMock.Setup(p => p.CreateChannelDirectTcpip()).Returns(_channelMock.Object); - _channelMock.Setup(p => p.Open(_remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port, _forwardedPort, It.IsAny())); + _channelMock.Setup(p => p.Open(_remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port, _forwardedPort, It.IsAny())); _channelMock.Setup(p => p.IsOpen).Returns(true); _channelMock.Setup(p => p.Bind()).Callback(() => { @@ -208,7 +208,7 @@ public void OpenOnChannelShouldBeInvokedOnce() { _channelMock.Verify( p => - p.Open(_remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port, _forwardedPort, + p.Open(_remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port, _forwardedPort, It.IsAny()), Times.Once); } @@ -228,7 +228,7 @@ private void EstablishSocks4Connection(Socket client) { var userNameBytes = Encoding.ASCII.GetBytes(_userName); var addressBytes = _remoteEndpoint.Address.GetAddressBytes(); - var portBytes = BitConverter.GetBytes((ushort) _remoteEndpoint.Port).Reverse().ToArray(); + var portBytes = BitConverter.GetBytes((ushort)_remoteEndpoint.Port).Reverse().ToArray(); _client.Connect(_endpoint); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortNeverStarted.cs index 24c623e55..0bdb35cd9 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortNeverStarted.cs @@ -55,7 +55,7 @@ protected void Arrange() _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); _sessionMock.Setup(p => p.CreateChannelDirectTcpip()).Returns(_channelMock.Object); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStarted.cs index 54c5fae9d..0124a8db7 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStarted.cs @@ -56,7 +56,7 @@ protected void Arrange() _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); _sessionMock.Setup(p => p.CreateChannelDirectTcpip()).Returns(_channelMock.Object); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStopped.cs index 9b500a79f..ea869931f 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStopped.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStopped.cs @@ -55,7 +55,7 @@ protected void Arrange() _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); _sessionMock.Setup(p => p.CreateChannelDirectTcpip()).Returns(_channelMock.Object); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNotConnected.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNotConnected.cs index cca1cc9c8..b873df284 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNotConnected.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNotConnected.cs @@ -52,7 +52,7 @@ protected void Arrange() _sessionMock.Setup(p => p.IsConnected).Returns(false); _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNull.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNull.cs index f571b2731..c326c00d1 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNull.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNull.cs @@ -41,7 +41,7 @@ protected void Arrange() _exceptionRegister = new List(); _endpoint = new IPEndPoint(IPAddress.Loopback, 8122); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketSendShutdownImmediately.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketSendShutdownImmediately.cs index 9859be49f..a5e1b796c 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketSendShutdownImmediately.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketSendShutdownImmediately.cs @@ -73,7 +73,7 @@ private void SetupData() _channelDisposed = new ManualResetEvent(false); _forwardedPortEndPoint = new IPEndPoint(IPAddress.Loopback, 8122); - _forwardedPort = new ForwardedPortDynamic((uint) _forwardedPortEndPoint.Port); + _forwardedPort = new ForwardedPortDynamic((uint)_forwardedPortEndPoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortDisposed.cs index db03e78e7..58b020323 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortDisposed.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortDisposed.cs @@ -40,7 +40,7 @@ protected void Arrange() _exceptionRegister = new List(); _endpoint = new IPEndPoint(IPAddress.Loopback, 8122); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Dispose(); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortNeverStarted.cs index b32536d7e..118b075e4 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortNeverStarted.cs @@ -40,7 +40,7 @@ protected void Arrange() _exceptionRegister = new List(); _endpoint = new IPEndPoint(IPAddress.Loopback, 8122); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); } 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 67efbff15..2ade89d8f 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelBound.cs @@ -86,7 +86,7 @@ private void SetupData() _channelBindStarted = new ManualResetEvent(false); _channelBindCompleted = new ManualResetEvent(false); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; @@ -105,7 +105,7 @@ private void SetupMocks() _sessionMock.Setup(p => p.IsConnected).Returns(true); _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); _sessionMock.Setup(p => p.CreateChannelDirectTcpip()).Returns(_channelMock.Object); - _channelMock.Setup(p => p.Open(_remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port, _forwardedPort, It.IsAny())); + _channelMock.Setup(p => p.Open(_remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port, _forwardedPort, It.IsAny())); _channelMock.Setup(p => p.IsOpen).Returns(true); _channelMock.Setup(p => p.Bind()).Callback(() => { @@ -208,7 +208,7 @@ private void EstablishSocks4Connection(Socket client) { var userNameBytes = Encoding.ASCII.GetBytes(_userName); var addressBytes = _remoteEndpoint.Address.GetAddressBytes(); - var portBytes = BitConverter.GetBytes((ushort) _remoteEndpoint.Port).Reverse().ToArray(); + var portBytes = BitConverter.GetBytes((ushort)_remoteEndpoint.Port).Reverse().ToArray(); _client.Connect(_endpoint); 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 e9bae905c..ed6301e72 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelNotBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelNotBound.cs @@ -69,7 +69,7 @@ protected void Arrange() .Returns(_channelMock.Object); _ = _channelMock.Setup(p => p.Dispose()); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStopped.cs index d61349903..2c5c50973 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStopped.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStopped.cs @@ -51,7 +51,7 @@ protected void Arrange() _sessionMock.Setup(p => p.IsConnected).Returns(true); _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); - _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint) _endpoint.Port); + _forwardedPort = new ForwardedPortDynamic(_endpoint.Address.ToString(), (uint)_endpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortNeverStarted.cs index 7a92472df..c45f26612 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortNeverStarted.cs @@ -56,8 +56,8 @@ protected void Arrange() _sessionMock.Setup(p => p.IsConnected).Returns(true); _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); - _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint) _localEndpoint.Port, - _remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint)_localEndpoint.Port, + _remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; 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 42872742e..3b28f5387 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelBound.cs @@ -69,7 +69,7 @@ protected void Arrange() _localEndpoint = new IPEndPoint(IPAddress.Loopback, 8122); _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); _bindSleepTime = TimeSpan.FromMilliseconds(random.Next(100, 500)); - _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint) _localEndpoint.Port, _remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint)_localEndpoint.Port, _remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port); _channelBindStarted = new ManualResetEvent(false); _channelBindCompleted = new ManualResetEvent(false); 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 4a754843f..d25ba1f72 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelNotBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStarted_ChannelNotBound.cs @@ -59,8 +59,8 @@ protected void Arrange() _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); _sessionMock.Setup(p => p.CreateChannelDirectTcpip()).Returns(_channelMock.Object); - _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint) _localEndpoint.Port, - _remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint)_localEndpoint.Port, + _remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStopped.cs index 087b48ba9..5975536b5 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStopped.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortStopped.cs @@ -56,7 +56,7 @@ protected void Arrange() _sessionMock.Setup(p => p.IsConnected).Returns(true); _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); - _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint) _localEndpoint.Port, _remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint)_localEndpoint.Port, _remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortDisposed.cs index be89d8fef..6d841b9c9 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortDisposed.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortDisposed.cs @@ -44,8 +44,8 @@ protected void Arrange() _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); - _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint) _localEndpoint.Port, - _remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint)_localEndpoint.Port, + _remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Dispose(); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortNeverStarted.cs index 6cc47cabf..361c7e75f 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortNeverStarted.cs @@ -61,8 +61,8 @@ protected void Arrange() _ = _sessionMock.Setup(p => p.ConnectionInfo) .Returns(_connectionInfoMock.Object); - _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint) _localEndpoint.Port, - _remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint)_localEndpoint.Port, + _remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStarted.cs index 08eef568b..e9e07e393 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStarted.cs @@ -61,8 +61,8 @@ protected void Arrange() _ = _sessionMock.Setup(p => p.ConnectionInfo) .Returns(_connectionInfoMock.Object); - _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint) _localEndpoint.Port, - _remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint)_localEndpoint.Port, + _remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStopped.cs index 7998ea99f..0c169b1bb 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStopped.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortStopped.cs @@ -62,8 +62,8 @@ protected void Arrange() .Returns(_connectionInfoMock.Object); _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), - (uint) _localEndpoint.Port, - _remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port); + (uint)_localEndpoint.Port, + _remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNotConnected.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNotConnected.cs index c6c980af1..0f8462e0f 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNotConnected.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNotConnected.cs @@ -56,8 +56,8 @@ protected void Arrange() _sessionMock.Setup(p => p.IsConnected).Returns(false); - _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint) _localEndpoint.Port, - _remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint)_localEndpoint.Port, + _remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNull.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNull.cs index 45c62e04e..d6e9ca4b1 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNull.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNull.cs @@ -56,8 +56,8 @@ protected void Arrange() _sessionMock.Setup(p => p.IsConnected).Returns(false); _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); - _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint) _localEndpoint.Port, - _remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint)_localEndpoint.Port, + _remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortNeverStarted.cs index 2508eefb4..17b6c11bb 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortNeverStarted.cs @@ -53,8 +53,8 @@ protected void Arrange() _sessionMock = new Mock(MockBehavior.Strict); _connectionInfoMock = new Mock(MockBehavior.Strict); - _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint) _localEndpoint.Port, - _remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint)_localEndpoint.Port, + _remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; 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 2aba926b6..47d1acd80 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelBound.cs @@ -80,7 +80,7 @@ private void SetupData() _channelBound = new ManualResetEvent(false); _channelBindCompleted = new ManualResetEvent(false); - _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint) _localEndpoint.Port, _remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint)_localEndpoint.Port, _remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; 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 49b959954..10fa71582 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelNotBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStarted_ChannelNotBound.cs @@ -59,8 +59,8 @@ protected void Arrange() _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); _sessionMock.Setup(p => p.CreateChannelDirectTcpip()).Returns(_channelMock.Object); - _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint) _localEndpoint.Port, - _remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint)_localEndpoint.Port, + _remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStopped.cs index 7f4ec5ce2..31b383a17 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStopped.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortStopped.cs @@ -55,8 +55,8 @@ protected void Arrange() _sessionMock.Setup(p => p.IsConnected).Returns(true); _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); - _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint) _localEndpoint.Port, - _remoteEndpoint.Address.ToString(), (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortLocal(_localEndpoint.Address.ToString(), (uint)_localEndpoint.Port, + _remoteEndpoint.Address.ToString(), (uint)_remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortDisposed.cs index 1e55dcd61..2cedfbe5a 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortDisposed.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortDisposed.cs @@ -42,7 +42,7 @@ protected void Arrange() _bindEndpoint = new IPEndPoint(IPAddress.Any, random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); - _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Dispose(); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortNeverStarted.cs index 62e454506..3f6c7edf2 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortNeverStarted.cs @@ -57,7 +57,7 @@ protected void Arrange() _sessionMock.Setup(p => p.IsConnected).Returns(true); _sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object); - _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; @@ -77,11 +77,11 @@ public void IsStartedShouldReturnFalse() [TestMethod] public void ForwardedPortShouldIgnoreChannelOpenMessagesWhenDisposed() { - var channelNumberDisposed = (uint) new Random().Next(1001, int.MaxValue); - var initialWindowSizeDisposed = (uint) new Random().Next(0, int.MaxValue); - var maximumPacketSizeDisposed = (uint) new Random().Next(0, int.MaxValue); + var channelNumberDisposed = (uint)new Random().Next(1001, int.MaxValue); + var initialWindowSizeDisposed = (uint)new Random().Next(0, int.MaxValue); + var maximumPacketSizeDisposed = (uint)new Random().Next(0, int.MaxValue); var originatorAddressDisposed = new Random().Next().ToString(CultureInfo.InvariantCulture); - var originatorPortDisposed = (uint) new Random().Next(0, int.MaxValue); + var originatorPortDisposed = (uint)new Random().Next(0, int.MaxValue); var channelMock = new Mock(MockBehavior.Strict); _sessionMock.Setup( 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 7ffd2aafd..07f092201 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStarted_ChannelBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStarted_ChannelBound.cs @@ -83,18 +83,18 @@ private void SetUpData() _bindEndpoint = new IPEndPoint(IPAddress.Any, random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); _bindSleepTime = TimeSpan.FromMilliseconds(random.Next(100, 500)); - _remoteChannelNumberWhileClosing = (uint) random.Next(0, 1000); - _remoteWindowSizeWhileClosing = (uint) random.Next(0, int.MaxValue); - _remotePacketSizeWhileClosing = (uint) random.Next(0, int.MaxValue); - _remoteChannelNumberStarted = (uint) random.Next(0, 1000); - _remoteWindowSizeStarted = (uint) random.Next(0, int.MaxValue); - _remotePacketSizeStarted = (uint) random.Next(0, int.MaxValue); + _remoteChannelNumberWhileClosing = (uint)random.Next(0, 1000); + _remoteWindowSizeWhileClosing = (uint)random.Next(0, int.MaxValue); + _remotePacketSizeWhileClosing = (uint)random.Next(0, int.MaxValue); + _remoteChannelNumberStarted = (uint)random.Next(0, 1000); + _remoteWindowSizeStarted = (uint)random.Next(0, int.MaxValue); + _remotePacketSizeStarted = (uint)random.Next(0, int.MaxValue); _originatorAddress = random.Next().ToString(CultureInfo.InvariantCulture); - _originatorPort = (uint) random.Next(0, int.MaxValue); + _originatorPort = (uint)random.Next(0, int.MaxValue); _channelBindStarted = new ManualResetEvent(false); _channelBindCompleted = new ManualResetEvent(false); - ForwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); + ForwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); ForwardedPort.Closing += (sender, args) => { _closingRegister.Add(args); @@ -193,11 +193,11 @@ public void ForwardedPortShouldRejectChannelOpenMessagesThatAreReceivedWhileTheS [TestMethod] public void ForwardedPortShouldIgnoreChannelOpenMessagesWhenDisposed() { - var channelNumberDisposed = (uint) new Random().Next(1001, int.MaxValue); - var initialWindowSizeDisposed = (uint) new Random().Next(0, int.MaxValue); - var maximumPacketSizeDisposed = (uint) new Random().Next(0, int.MaxValue); + var channelNumberDisposed = (uint)new Random().Next(1001, int.MaxValue); + var initialWindowSizeDisposed = (uint)new Random().Next(0, int.MaxValue); + var maximumPacketSizeDisposed = (uint)new Random().Next(0, int.MaxValue); var originatorAddressDisposed = new Random().Next().ToString(CultureInfo.InvariantCulture); - var originatorPortDisposed = (uint) new Random().Next(0, int.MaxValue); + var originatorPortDisposed = (uint)new Random().Next(0, int.MaxValue); var channelMock = new Mock(MockBehavior.Strict); _sessionMock.Setup( diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStopped.cs index 4539254a5..6a12103f1 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStopped.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStopped.cs @@ -50,7 +50,7 @@ protected void Arrange() _exceptionRegister = new List(); _bindEndpoint = new IPEndPoint(IPAddress.Any, random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); - ForwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); + ForwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); @@ -107,11 +107,11 @@ public void IsStartedShouldReturnFalse() [TestMethod] public void ForwardedPortShouldIgnoreChannelOpenMessagesWhenDisposed() { - var channelNumberDisposed = (uint) new Random().Next(1001, int.MaxValue); - var initialWindowSizeDisposed = (uint) new Random().Next(0, int.MaxValue); - var maximumPacketSizeDisposed = (uint) new Random().Next(0, int.MaxValue); + var channelNumberDisposed = (uint)new Random().Next(1001, int.MaxValue); + var initialWindowSizeDisposed = (uint)new Random().Next(0, int.MaxValue); + var maximumPacketSizeDisposed = (uint)new Random().Next(0, int.MaxValue); var originatorAddressDisposed = new Random().Next().ToString(CultureInfo.InvariantCulture); - var originatorPortDisposed = (uint) new Random().Next(0, int.MaxValue); + var originatorPortDisposed = (uint)new Random().Next(0, int.MaxValue); var channelMock = new Mock(MockBehavior.Strict); _sessionMock.Setup( diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortDisposed.cs index 9bf5596db..8b0b05112 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortDisposed.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortDisposed.cs @@ -42,7 +42,7 @@ protected void Arrange() _exceptionRegister = new List(); _bindEndpoint = new IPEndPoint(IPAddress.Any, random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); - _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs index 9babccc17..8fecf98c8 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs @@ -57,7 +57,7 @@ protected void Arrange() _exceptionRegister = new List(); _bindEndpoint = new IPEndPoint(IPAddress.Any, random.Next(IPEndPoint.MinPort, 1000)); _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); - _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); @@ -101,11 +101,11 @@ public void IsStartedShouldReturnTrue() [TestMethod] public void ForwardedPortShouldAcceptNewConnections() { - var channelNumber = (uint) new Random().Next(1001, int.MaxValue); - var initialWindowSize = (uint) new Random().Next(0, int.MaxValue); - var maximumPacketSize = (uint) new Random().Next(0, int.MaxValue); + var channelNumber = (uint)new Random().Next(1001, int.MaxValue); + var initialWindowSize = (uint)new Random().Next(0, int.MaxValue); + var maximumPacketSize = (uint)new Random().Next(0, int.MaxValue); var originatorAddress = new Random().Next().ToString(CultureInfo.InvariantCulture); - var originatorPort = (uint) new Random().Next(0, int.MaxValue); + var originatorPort = (uint)new Random().Next(0, int.MaxValue); var channelMock = new Mock(MockBehavior.Strict); _sessionMock.Setup( diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStarted.cs index cf8a64990..c6cf0850e 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStarted.cs @@ -58,7 +58,7 @@ protected void Arrange() _exceptionRegister = new List(); _bindEndpoint = new IPEndPoint(IPAddress.Any, random.Next(IPEndPoint.MinPort, 1000)); _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); - _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); @@ -118,11 +118,11 @@ public void IsStartedShouldReturnTrue() [TestMethod] public void ForwardedPortShouldAcceptNewConnections() { - var channelNumber = (uint) new Random().Next(1001, int.MaxValue); - var initialWindowSize = (uint) new Random().Next(0, int.MaxValue); - var maximumPacketSize = (uint) new Random().Next(0, int.MaxValue); + var channelNumber = (uint)new Random().Next(1001, int.MaxValue); + var initialWindowSize = (uint)new Random().Next(0, int.MaxValue); + var maximumPacketSize = (uint)new Random().Next(0, int.MaxValue); var originatorAddress = new Random().Next().ToString(CultureInfo.InvariantCulture); - var originatorPort = (uint) new Random().Next(0, int.MaxValue); + var originatorPort = (uint)new Random().Next(0, int.MaxValue); var channelMock = new Mock(MockBehavior.Strict); _sessionMock.Setup( diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStopped.cs index c568af8b4..9e056da77 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStopped.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStopped.cs @@ -57,7 +57,7 @@ protected void Arrange() _exceptionRegister = new List(); _bindEndpoint = new IPEndPoint(IPAddress.Any, random.Next(IPEndPoint.MinPort, 1000)); _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); - _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); @@ -117,11 +117,11 @@ public void IsStartedShouldReturnTrue() [TestMethod] public void ForwardedPortShouldAcceptNewConnections() { - var channelNumber = (uint) new Random().Next(1001, int.MaxValue); - var initialWindowSize = (uint) new Random().Next(0, int.MaxValue); - var maximumPacketSize = (uint) new Random().Next(0, int.MaxValue); + var channelNumber = (uint)new Random().Next(1001, int.MaxValue); + var initialWindowSize = (uint)new Random().Next(0, int.MaxValue); + var maximumPacketSize = (uint)new Random().Next(0, int.MaxValue); var originatorAddress = new Random().Next().ToString(CultureInfo.InvariantCulture); - var originatorPort = (uint) new Random().Next(0, int.MaxValue); + var originatorPort = (uint)new Random().Next(0, int.MaxValue); var channelMock = new Mock(MockBehavior.Strict); var channelDisposed = new ManualResetEvent(false); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNotConnected.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNotConnected.cs index abb85676b..21202686b 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNotConnected.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNotConnected.cs @@ -61,7 +61,7 @@ protected void Arrange() _ = _sessionMock.Setup(p => p.IsConnected) .Returns(false); - _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); _forwardedPort.Session = _sessionMock.Object; @@ -96,11 +96,11 @@ public void IsStartedShouldReturnFalse() [TestMethod] public void ForwardedPortShouldIgnoreReceivedSignalForNewConnection() { - var channelNumber = (uint) new Random().Next(1001, int.MaxValue); - var initialWindowSize = (uint) new Random().Next(0, int.MaxValue); - var maximumPacketSize = (uint) new Random().Next(0, int.MaxValue); + var channelNumber = (uint)new Random().Next(1001, int.MaxValue); + var initialWindowSize = (uint)new Random().Next(0, int.MaxValue); + var maximumPacketSize = (uint)new Random().Next(0, int.MaxValue); var originatorAddress = new Random().Next().ToString(CultureInfo.InvariantCulture); - var originatorPort = (uint) new Random().Next(0, int.MaxValue); + var originatorPort = (uint)new Random().Next(0, int.MaxValue); var channelMock = new Mock(MockBehavior.Strict); _ = _sessionMock.Setup(p => p.CreateChannelForwardedTcpip(channelNumber, initialWindowSize, maximumPacketSize)).Returns(channelMock.Object); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNull.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNull.cs index 2e3acb115..9cd3a3046 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNull.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNull.cs @@ -43,7 +43,7 @@ protected void Arrange() _bindEndpoint = new IPEndPoint(IPAddress.Any, random.Next(IPEndPoint.MinPort, 1000)); _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); - _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); } diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Started.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Started.cs index 6c1445388..649848ba1 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Started.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Started.cs @@ -55,7 +55,7 @@ protected void Arrange() _exceptionRegister = new List(); _bindEndpoint = new IPEndPoint(IPAddress.Any, random.Next(IPEndPoint.MinPort, 1000)); _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); - _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); @@ -93,11 +93,11 @@ protected void Act() [TestMethod] public void ForwardedPortShouldAcceptChannelOpenMessageForBoundAddressAndBoundPort() { - var channelNumber = (uint) new Random().Next(1001, int.MaxValue); - var initialWindowSize = (uint) new Random().Next(0, int.MaxValue); - var maximumPacketSize = (uint) new Random().Next(0, int.MaxValue); + var channelNumber = (uint)new Random().Next(1001, int.MaxValue); + var initialWindowSize = (uint)new Random().Next(0, int.MaxValue); + var maximumPacketSize = (uint)new Random().Next(0, int.MaxValue); var originatorAddress = new Random().Next().ToString(CultureInfo.InvariantCulture); - var originatorPort = (uint) new Random().Next(0, int.MaxValue); + var originatorPort = (uint)new Random().Next(0, int.MaxValue); var channelMock = new Mock(MockBehavior.Strict); var channelDisposed = new ManualResetEvent(false); @@ -132,11 +132,11 @@ public void ForwardedPortShouldAcceptChannelOpenMessageForBoundAddressAndBoundPo [TestMethod] public void ForwardedPortShouldIgnoreChannelOpenMessageForBoundHostAndOtherPort() { - var channelNumber = (uint) new Random().Next(1001, int.MaxValue); - var initialWindowSize = (uint) new Random().Next(0, int.MaxValue); - var maximumPacketSize = (uint) new Random().Next(0, int.MaxValue); + var channelNumber = (uint)new Random().Next(1001, int.MaxValue); + var initialWindowSize = (uint)new Random().Next(0, int.MaxValue); + var maximumPacketSize = (uint)new Random().Next(0, int.MaxValue); var originatorAddress = new Random().Next().ToString(CultureInfo.InvariantCulture); - var originatorPort = (uint) new Random().Next(0, int.MaxValue); + var originatorPort = (uint)new Random().Next(0, int.MaxValue); var channelMock = new Mock(MockBehavior.Strict); _sessionMock.Setup( @@ -158,11 +158,11 @@ public void ForwardedPortShouldIgnoreChannelOpenMessageForBoundHostAndOtherPort( [TestMethod] public void ForwardedPortShouldIgnoreChannelOpenMessageForOtherHostAndBoundPort() { - var channelNumber = (uint) new Random().Next(1001, int.MaxValue); - var initialWindowSize = (uint) new Random().Next(0, int.MaxValue); - var maximumPacketSize = (uint) new Random().Next(0, int.MaxValue); + var channelNumber = (uint)new Random().Next(1001, int.MaxValue); + var initialWindowSize = (uint)new Random().Next(0, int.MaxValue); + var maximumPacketSize = (uint)new Random().Next(0, int.MaxValue); var originatorAddress = new Random().Next().ToString(CultureInfo.InvariantCulture); - var originatorPort = (uint) new Random().Next(0, int.MaxValue); + var originatorPort = (uint)new Random().Next(0, int.MaxValue); var channelMock = new Mock(MockBehavior.Strict); _sessionMock.Setup( @@ -184,9 +184,9 @@ public void ForwardedPortShouldIgnoreChannelOpenMessageForOtherHostAndBoundPort( [TestMethod] public void ForwardedPortShouldIgnoreChannelOpenMessageWhenChannelOpenInfoIsNotForwardedTcpipChannelInfo() { - var channelNumber = (uint) new Random().Next(1001, int.MaxValue); - var initialWindowSize = (uint) new Random().Next(0, int.MaxValue); - var maximumPacketSize = (uint) new Random().Next(0, int.MaxValue); + var channelNumber = (uint)new Random().Next(1001, int.MaxValue); + var initialWindowSize = (uint)new Random().Next(0, int.MaxValue); + var maximumPacketSize = (uint)new Random().Next(0, int.MaxValue); var channelMock = new Mock(MockBehavior.Strict); _sessionMock.Setup( diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortDisposed.cs index 62fc59e19..796bdda4d 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortDisposed.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortDisposed.cs @@ -41,7 +41,7 @@ protected void Arrange() _exceptionRegister = new List(); _bindEndpoint = new IPEndPoint(IPAddress.Any, random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); - _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); _forwardedPort.Closing += (sender, args) => _closingRegister.Add(args); _forwardedPort.Exception += (sender, args) => _exceptionRegister.Add(args); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortNeverStarted.cs index 532cc86e9..979431901 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortNeverStarted.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortNeverStarted.cs @@ -57,7 +57,7 @@ protected void Arrange() _exceptionRegister = new List(); _bindEndpoint = new IPEndPoint(IPAddress.Any, random.Next(IPEndPoint.MinPort, 1000)); _remoteEndpoint = new IPEndPoint(IPAddress.Parse("193.168.1.5"), random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort)); - _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint) _bindEndpoint.Port, _remoteEndpoint.Address, (uint) _remoteEndpoint.Port); + _forwardedPort = new ForwardedPortRemote(_bindEndpoint.Address, (uint)_bindEndpoint.Port, _remoteEndpoint.Address, (uint)_remoteEndpoint.Port); _connectionInfoMock = new Mock(MockBehavior.Strict); _sessionMock = new Mock(MockBehavior.Strict); @@ -101,11 +101,11 @@ public void IsStartedShouldReturnFalse() [TestMethod] public void ForwardedPortShouldIgnoreNewConnections() { - var channelNumberDisposed = (uint) new Random().Next(1001, int.MaxValue); - var initialWindowSizeDisposed = (uint) new Random().Next(0, int.MaxValue); - var maximumPacketSizeDisposed = (uint) new Random().Next(0, int.MaxValue); + var channelNumberDisposed = (uint)new Random().Next(1001, int.MaxValue); + var initialWindowSizeDisposed = (uint)new Random().Next(0, int.MaxValue); + var maximumPacketSizeDisposed = (uint)new Random().Next(0, int.MaxValue); var originatorAddressDisposed = new Random().Next().ToString(CultureInfo.InvariantCulture); - var originatorPortDisposed = (uint) new Random().Next(0, int.MaxValue); + var originatorPortDisposed = (uint)new Random().Next(0, int.MaxValue); var channelMock = new Mock(MockBehavior.Strict); _sessionMock.Setup( diff --git a/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelDataMessageTest.cs b/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelDataMessageTest.cs index fb2470593..071b48c0f 100644 --- a/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelDataMessageTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelDataMessageTest.cs @@ -32,7 +32,7 @@ public void Constructor_LocalChannelNumberAndData() { var random = new Random(); - var localChannelNumber = (uint) random.Next(0, int.MaxValue); + var localChannelNumber = (uint)random.Next(0, int.MaxValue); var data = new byte[3]; var target = new ChannelDataMessage(localChannelNumber, data); @@ -45,7 +45,7 @@ public void Constructor_LocalChannelNumberAndData() [TestMethod] public void Constructor_LocalChannelNumberAndData_ShouldThrowArgumentNullExceptionWhenDataIsNull() { - var localChannelNumber = (uint) new Random().Next(0, int.MaxValue); + var localChannelNumber = (uint)new Random().Next(0, int.MaxValue); const byte[] data = null; try @@ -63,7 +63,7 @@ public void Constructor_LocalChannelNumberAndData_ShouldThrowArgumentNullExcepti [TestMethod] public void Constructor_LocalChannelNumberAndDataAndOffsetAndSize() { - var localChannelNumber = (uint) new Random().Next(0, int.MaxValue); + var localChannelNumber = (uint)new Random().Next(0, int.MaxValue); var data = new byte[4]; const int offset = 2; const int size = 1; @@ -78,7 +78,7 @@ public void Constructor_LocalChannelNumberAndDataAndOffsetAndSize() [TestMethod] public void Constructor_LocalChannelNumberAndDataAndOffsetAndSize_ShouldThrowArgumentNullExceptionWhenDataIsNull() { - var localChannelNumber = (uint) new Random().Next(0, int.MaxValue); + var localChannelNumber = (uint)new Random().Next(0, int.MaxValue); const byte[] data = null; const int offset = 0; const int size = 0; @@ -100,7 +100,7 @@ public void GetBytes() { var random = new Random(); - var localChannelNumber = (uint) random.Next(0, int.MaxValue); + var localChannelNumber = (uint)random.Next(0, int.MaxValue); var data = CryptoAbstraction.GenerateRandom(random.Next(10, 20)); var offset = random.Next(0, data.Length - 1); var size = random.Next(0, data.Length - offset); @@ -120,7 +120,7 @@ public void GetBytes() Assert.AreEqual(target.MessageNumber, sshDataStream.ReadByte()); Assert.AreEqual(localChannelNumber, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) size, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)size, sshDataStream.ReadUInt32()); var actualData = new byte[size]; sshDataStream.Read(actualData, 0, size); @@ -134,7 +134,7 @@ public void Load() { var random = new Random(); - var localChannelNumber = (uint) random.Next(0, int.MaxValue); + var localChannelNumber = (uint)random.Next(0, int.MaxValue); var data = CryptoAbstraction.GenerateRandom(random.Next(10, 20)); var offset = random.Next(0, data.Length - 1); 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 e67e7e8f6..75fca950d 100644 --- a/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelOpen/ChannelOpenMessageTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelOpen/ChannelOpenMessageTest.cs @@ -38,9 +38,9 @@ public void DefaultConstructor() [TestMethod] public void Constructor_LocalChannelNumberAndInitialWindowSizeAndMaximumPacketSizeAndInfo() { - var localChannelNumber = (uint) _random.Next(0, int.MaxValue); - var initialWindowSize = (uint) _random.Next(0, int.MaxValue); - var maximumPacketSize = (uint) _random.Next(0, int.MaxValue); + var localChannelNumber = (uint)_random.Next(0, int.MaxValue); + var initialWindowSize = (uint)_random.Next(0, int.MaxValue); + var maximumPacketSize = (uint)_random.Next(0, int.MaxValue); var info = new DirectTcpipChannelInfo("host", 22, "originator", 25); var target = new ChannelOpenMessage(localChannelNumber, initialWindowSize, maximumPacketSize, info); @@ -55,9 +55,9 @@ public void Constructor_LocalChannelNumberAndInitialWindowSizeAndMaximumPacketSi [TestMethod] public void Constructor_LocalChannelNumberAndInitialWindowSizeAndMaximumPacketSizeAndInfo_ShouldThrowArgumentNullExceptionWhenInfoIsNull() { - var localChannelNumber = (uint) _random.Next(0, int.MaxValue); - var initialWindowSize = (uint) _random.Next(0, int.MaxValue); - var maximumPacketSize = (uint) _random.Next(0, int.MaxValue); + var localChannelNumber = (uint)_random.Next(0, int.MaxValue); + var initialWindowSize = (uint)_random.Next(0, int.MaxValue); + var maximumPacketSize = (uint)_random.Next(0, int.MaxValue); ChannelOpenInfo info = null; try @@ -75,9 +75,9 @@ public void Constructor_LocalChannelNumberAndInitialWindowSizeAndMaximumPacketSi [TestMethod] public void GetBytes() { - var localChannelNumber = (uint) _random.Next(0, int.MaxValue); - var initialWindowSize = (uint) _random.Next(0, int.MaxValue); - var maximumPacketSize = (uint) _random.Next(0, int.MaxValue); + var localChannelNumber = (uint)_random.Next(0, int.MaxValue); + var initialWindowSize = (uint)_random.Next(0, int.MaxValue); + var maximumPacketSize = (uint)_random.Next(0, int.MaxValue); var info = new DirectTcpipChannelInfo("host", 22, "originator", 25); var infoBytes = info.GetBytes(); var target = new ChannelOpenMessage(localChannelNumber, initialWindowSize, maximumPacketSize, info); @@ -99,10 +99,10 @@ public void GetBytes() Assert.AreEqual(target.MessageNumber, sshDataStream.ReadByte()); var actualChannelTypeLength = sshDataStream.ReadUInt32(); - Assert.AreEqual((uint) target.ChannelType.Length, actualChannelTypeLength); + Assert.AreEqual((uint)target.ChannelType.Length, actualChannelTypeLength); var actualChannelType = new byte[actualChannelTypeLength]; - sshDataStream.Read(actualChannelType, 0, (int) actualChannelTypeLength); + sshDataStream.Read(actualChannelType, 0, (int)actualChannelTypeLength); Assert.IsTrue(target.ChannelType.SequenceEqual(actualChannelType)); Assert.AreEqual(localChannelNumber, sshDataStream.ReadUInt32()); @@ -119,9 +119,9 @@ public void GetBytes() [TestMethod] public void Load_DirectTcpipChannelInfo() { - var localChannelNumber = (uint) _random.Next(0, int.MaxValue); - var initialWindowSize = (uint) _random.Next(0, int.MaxValue); - var maximumPacketSize = (uint) _random.Next(0, int.MaxValue); + var localChannelNumber = (uint)_random.Next(0, int.MaxValue); + var initialWindowSize = (uint)_random.Next(0, int.MaxValue); + var maximumPacketSize = (uint)_random.Next(0, int.MaxValue); var info = new DirectTcpipChannelInfo("host", 22, "originator", 25); var target = new ChannelOpenMessage(localChannelNumber, initialWindowSize, maximumPacketSize, info); var bytes = target.GetBytes(); @@ -146,9 +146,9 @@ public void Load_DirectTcpipChannelInfo() [TestMethod] public void Load_ForwardedTcpipChannelInfo() { - var localChannelNumber = (uint) _random.Next(0, int.MaxValue); - var initialWindowSize = (uint) _random.Next(0, int.MaxValue); - var maximumPacketSize = (uint) _random.Next(0, int.MaxValue); + var localChannelNumber = (uint)_random.Next(0, int.MaxValue); + var initialWindowSize = (uint)_random.Next(0, int.MaxValue); + var maximumPacketSize = (uint)_random.Next(0, int.MaxValue); var info = new ForwardedTcpipChannelInfo("connected", 25, "originator", 21); var target = new ChannelOpenMessage(localChannelNumber, initialWindowSize, maximumPacketSize, info); var bytes = target.GetBytes(); @@ -173,9 +173,9 @@ public void Load_ForwardedTcpipChannelInfo() [TestMethod] public void Load_SessionChannelOpenInfo() { - var localChannelNumber = (uint) _random.Next(0, int.MaxValue); - var initialWindowSize = (uint) _random.Next(0, int.MaxValue); - var maximumPacketSize = (uint) _random.Next(0, int.MaxValue); + var localChannelNumber = (uint)_random.Next(0, int.MaxValue); + var initialWindowSize = (uint)_random.Next(0, int.MaxValue); + var maximumPacketSize = (uint)_random.Next(0, int.MaxValue); var info = new SessionChannelOpenInfo(); var target = new ChannelOpenMessage(localChannelNumber, initialWindowSize, maximumPacketSize, info); var bytes = target.GetBytes(); @@ -197,9 +197,9 @@ public void Load_SessionChannelOpenInfo() [TestMethod] public void Load_X11ChannelOpenInfo() { - var localChannelNumber = (uint) _random.Next(0, int.MaxValue); - var initialWindowSize = (uint) _random.Next(0, int.MaxValue); - var maximumPacketSize = (uint) _random.Next(0, int.MaxValue); + var localChannelNumber = (uint)_random.Next(0, int.MaxValue); + var initialWindowSize = (uint)_random.Next(0, int.MaxValue); + var maximumPacketSize = (uint)_random.Next(0, int.MaxValue); var info = new X11ChannelOpenInfo("address", 26); var target = new ChannelOpenMessage(localChannelNumber, initialWindowSize, maximumPacketSize, info); var bytes = target.GetBytes(); @@ -222,16 +222,16 @@ public void Load_X11ChannelOpenInfo() [TestMethod] public void Load_ShouldThrowNotSupportedExceptionWhenChannelTypeIsNotSupported() { - var localChannelNumber = (uint) _random.Next(0, int.MaxValue); - var initialWindowSize = (uint) _random.Next(0, int.MaxValue); - var maximumPacketSize = (uint) _random.Next(0, int.MaxValue); + var localChannelNumber = (uint)_random.Next(0, int.MaxValue); + var initialWindowSize = (uint)_random.Next(0, int.MaxValue); + var maximumPacketSize = (uint)_random.Next(0, int.MaxValue); var channelName = "dunno_" + _random.Next().ToString(CultureInfo.InvariantCulture); var channelType = _ascii.GetBytes(channelName); var target = new ChannelOpenMessage(); var sshDataStream = new SshDataStream(1 + 4 + channelType.Length + 4 + 4 + 4); sshDataStream.WriteByte(target.MessageNumber); - sshDataStream.Write((uint) channelType.Length); + sshDataStream.Write((uint)channelType.Length); sshDataStream.Write(channelType, 0, channelType.Length); sshDataStream.Write(localChannelNumber); sshDataStream.Write(initialWindowSize); 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 0d855b266..a03feef3a 100644 --- a/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelRequest/PseudoTerminalInfoTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Messages/Connection/ChannelRequest/PseudoTerminalInfoTest.cs @@ -31,10 +31,10 @@ public void Init() _environmentVariable = random.Next().ToString(CultureInfo.InvariantCulture); _environmentVariableBytes = Encoding.UTF8.GetBytes(_environmentVariable); - _columns = (uint) random.Next(0, int.MaxValue); - _rows = (uint) random.Next(0, int.MaxValue); - _width = (uint) random.Next(0, int.MaxValue); - _height = (uint) random.Next(0, int.MaxValue); + _columns = (uint)random.Next(0, int.MaxValue); + _rows = (uint)random.Next(0, int.MaxValue); + _width = (uint)random.Next(0, int.MaxValue); + _height = (uint)random.Next(0, int.MaxValue); _terminalModeValues = new Dictionary { {TerminalModes.CS8, 433}, @@ -69,12 +69,12 @@ public void GetBytes() Assert.AreEqual(_rows, sshDataStream.ReadUInt32()); Assert.AreEqual(_width, sshDataStream.ReadUInt32()); Assert.AreEqual(_height, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) ((_terminalModeValues.Count * (1 + 4)) + 1), sshDataStream.ReadUInt32()); - Assert.AreEqual((int) TerminalModes.CS8, sshDataStream.ReadByte()); + Assert.AreEqual((uint)((_terminalModeValues.Count * (1 + 4)) + 1), sshDataStream.ReadUInt32()); + Assert.AreEqual((int)TerminalModes.CS8, sshDataStream.ReadByte()); Assert.AreEqual(_terminalModeValues[TerminalModes.CS8], sshDataStream.ReadUInt32()); - Assert.AreEqual((int) TerminalModes.ECHO, sshDataStream.ReadByte()); + Assert.AreEqual((int)TerminalModes.ECHO, sshDataStream.ReadByte()); Assert.AreEqual(_terminalModeValues[TerminalModes.ECHO], sshDataStream.ReadUInt32()); - Assert.AreEqual((int) TerminalModes.TTY_OP_END, sshDataStream.ReadByte()); + Assert.AreEqual((int)TerminalModes.TTY_OP_END, sshDataStream.ReadByte()); Assert.IsTrue(sshDataStream.IsEndOfData); } @@ -105,7 +105,7 @@ public void GetBytes_TerminalModeValues_Null() Assert.AreEqual(_rows, sshDataStream.ReadUInt32()); Assert.AreEqual(_width, sshDataStream.ReadUInt32()); Assert.AreEqual(_height, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) 0, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)0, sshDataStream.ReadUInt32()); Assert.IsTrue(sshDataStream.IsEndOfData); } @@ -141,7 +141,7 @@ public void GetBytes_TerminalModeValues_Empty() Assert.AreEqual(_rows, sshDataStream.ReadUInt32()); Assert.AreEqual(_width, sshDataStream.ReadUInt32()); Assert.AreEqual(_height, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) 0, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)0, sshDataStream.ReadUInt32()); Assert.IsTrue(sshDataStream.IsEndOfData); } diff --git a/test/Renci.SshNet.Tests/Classes/Messages/Transport/IgnoreMessageTest.cs b/test/Renci.SshNet.Tests/Classes/Messages/Transport/IgnoreMessageTest.cs index 1da1cebd3..8b493f897 100644 --- a/test/Renci.SshNet.Tests/Classes/Messages/Transport/IgnoreMessageTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Messages/Transport/IgnoreMessageTest.cs @@ -71,7 +71,7 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); Assert.AreEqual(request.MessageNumber, sshDataStream.ReadByte()); - Assert.AreEqual((uint) _data.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_data.Length, sshDataStream.ReadUInt32()); var actualData = new byte[_data.Length]; sshDataStream.Read(actualData, 0, actualData.Length); diff --git a/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeReplyBuilder.cs b/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeReplyBuilder.cs index 659ee1a29..f36106f2b 100644 --- a/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeReplyBuilder.cs +++ b/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeReplyBuilder.cs @@ -44,8 +44,8 @@ public byte[] Build() var sshDataStream = new SshDataStream(0); var target = new KeyExchangeDhGroupExchangeReply(); sshDataStream.WriteByte(target.MessageNumber); - sshDataStream.Write((uint) (4 + _hostKeyAlgorithm.Length + _hostKeys.Length)); - sshDataStream.Write((uint) _hostKeyAlgorithm.Length); + sshDataStream.Write((uint)(4 + _hostKeyAlgorithm.Length + _hostKeys.Length)); + sshDataStream.Write((uint)_hostKeyAlgorithm.Length); sshDataStream.Write(_hostKeyAlgorithm, 0, _hostKeyAlgorithm.Length); sshDataStream.Write(_hostKeys, 0, _hostKeys.Length); sshDataStream.Write(_f); diff --git a/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeRequestTest.cs index da1d04976..35e401c66 100644 --- a/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeRequestTest.cs @@ -20,9 +20,9 @@ public class KeyExchangeDhGroupExchangeRequestTest public void Init() { var random = new Random(); - _minimum = (uint) random.Next(1, int.MaxValue); - _preferred = (uint) random.Next(1, int.MaxValue); - _maximum = (uint) random.Next(1, int.MaxValue); + _minimum = (uint)random.Next(1, int.MaxValue); + _preferred = (uint)random.Next(1, int.MaxValue); + _maximum = (uint)random.Next(1, int.MaxValue); } diff --git a/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Connect_NetConfSessionConnectFailure.cs b/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Connect_NetConfSessionConnectFailure.cs index c1e659aaf..1585d8734 100644 --- a/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Connect_NetConfSessionConnectFailure.cs +++ b/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Connect_NetConfSessionConnectFailure.cs @@ -112,7 +112,7 @@ private static KeyHostAlgorithm GetKeyHostAlgorithm() using (var s = TestBase.GetData("Key.RSA.txt")) { var privateKey = new PrivateKeyFile(s); - return (KeyHostAlgorithm) privateKey.HostKeyAlgorithms.First(); + return (KeyHostAlgorithm)privateKey.HostKeyAlgorithms.First(); } } } diff --git a/test/Renci.SshNet.Tests/Classes/PasswordAuthenticationMethodTest.cs b/test/Renci.SshNet.Tests/Classes/PasswordAuthenticationMethodTest.cs index 76ef793f8..8eac98253 100644 --- a/test/Renci.SshNet.Tests/Classes/PasswordAuthenticationMethodTest.cs +++ b/test/Renci.SshNet.Tests/Classes/PasswordAuthenticationMethodTest.cs @@ -29,7 +29,7 @@ public void Password_Test_Pass_Null_Username() [ExpectedException(typeof(ArgumentNullException))] public void Password_Test_Pass_Null_Password() { - new PasswordAuthenticationMethod("valid", (string) null); + new PasswordAuthenticationMethod("valid", (string)null); } [TestMethod] diff --git a/test/Renci.SshNet.Tests/Classes/PasswordConnectionInfoTest.cs b/test/Renci.SshNet.Tests/Classes/PasswordConnectionInfoTest.cs index 8929e53f9..8de23b54c 100644 --- a/test/Renci.SshNet.Tests/Classes/PasswordConnectionInfoTest.cs +++ b/test/Renci.SshNet.Tests/Classes/PasswordConnectionInfoTest.cs @@ -44,7 +44,7 @@ public void Test_ConnectionInfo_Username_Is_Null() [ExpectedException(typeof(ArgumentNullException))] public void Test_ConnectionInfo_Password_Is_Null() { - _ = new PasswordConnectionInfo(Resources.HOST, Resources.USERNAME, (string) null); + _ = new PasswordConnectionInfo(Resources.HOST, Resources.USERNAME, (string)null); } [TestMethod] 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 cdc88c5ed..5a562fe38 100644 --- a/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_FileInfoAndPath_Success.cs +++ b/test/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_FileInfoAndPath_Success.cs @@ -108,7 +108,7 @@ protected override void Arrange() _scpClient = new ScpClient(_connectionInfo, false, ServiceFactoryMock.Object) { - BufferSize = (uint) _bufferSize + BufferSize = (uint)_bufferSize }; _scpClient.Uploading += (sender, args) => _uploadingRegister.Add(args); _scpClient.Connect(); @@ -178,7 +178,7 @@ private static byte[] CreateContent(int length) for (var i = 0; i < length; i++) { - content[i] = (byte) random.Next(byte.MinValue, byte.MaxValue); + content[i] = (byte)random.Next(byte.MinValue, byte.MaxValue); } return content; diff --git a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/AesCipherTest.cs b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/AesCipherTest.cs index e11ab1248..ee1868269 100644 --- a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/AesCipherTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/AesCipherTest.cs @@ -42,7 +42,7 @@ public void AES_CTR_Encrypt_Should_Preserve_Cipher_Stream_State() 0xec, 0x47, 0x81, 0x82, 0x89, 0x24, 0x76, 0xe2, 0x20, 0x6a, 0x99, 0xe2, 0xa7, 0x5a, 0xb0, 0x40, }; - var cipher = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false); + var cipher = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false); var actual1 = cipher.Encrypt(input.Take(32)); var actual2 = cipher.Encrypt(input.Take(32, 32)); @@ -78,7 +78,7 @@ public void AES_CTR_Decrypt_Should_Preserve_Cipher_Stream_State() 0xbc, 0x89, 0x7a, 0x22, 0x42, 0x2c, 0xba, 0x8e, 0xd7, 0x15, 0x22, 0x41, 0xe4, 0xb5, 0x0b, 0xad, }; - var cipher = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false); + var cipher = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false); var actual1 = cipher.Decrypt(input.Take(32)); var actual2 = cipher.Decrypt(input.Take(32, 32)); @@ -115,11 +115,11 @@ public void AES_CTR_IV_Overflow() 0xfd, 0x34, 0xc5, 0x81, 0xfa, 0xb9, 0xe3, 0xc4, 0x10, 0xed, 0x06, 0x6e, 0x91, 0x5e, 0xfc, 0x47, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -133,7 +133,7 @@ public void Encrypt_InputAndOffsetAndLength_128_CBC() var key = new byte[] { 0xe4, 0x94, 0xf9, 0xb1, 0x00, 0x4f, 0x16, 0x2a, 0x80, 0x11, 0xea, 0x73, 0x0d, 0xb9, 0xbf, 0x64 }; var iv = new byte[] { 0x74, 0x8b, 0x4f, 0xe6, 0xc1, 0x29, 0xb3, 0x54, 0xec, 0x77, 0x92, 0xf3, 0x15, 0xa0, 0x41, 0xa8 }; var expected = new byte[] { 0x19, 0x7f, 0x80, 0xd8, 0xc9, 0x89, 0xc4, 0xa7, 0xc6, 0xc6, 0x3f, 0x9f, 0x1e, 0x00, 0x1f, 0x72, 0xa7, 0x5e, 0xde, 0x40, 0x88, 0xa2, 0x72, 0xf2, 0xed, 0x3f, 0x81, 0x45, 0xb6, 0xbd, 0x45, 0x87, 0x15, 0xa5, 0x10, 0x92, 0x4a, 0x37, 0x9e, 0xa9, 0x80, 0x1c, 0x14, 0x83, 0xa3, 0x39, 0x45, 0x28 }; - var testCipher = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false); + var testCipher = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false); var actual = testCipher.Encrypt(input, 2, input.Length - 5); @@ -147,7 +147,7 @@ public void Encrypt_Input_128_CTR() var key = new byte[] { 0x17, 0x78, 0x56, 0xe1, 0x3e, 0xbd, 0x3e, 0x50, 0x1d, 0x79, 0x3f, 0x0f, 0x55, 0x37, 0x45, 0x54 }; var iv = new byte[] { 0xe6, 0x65, 0x36, 0x0d, 0xdd, 0xd7, 0x50, 0xc3, 0x48, 0xdb, 0x48, 0x07, 0xa1, 0x30, 0xd2, 0x38 }; var expected = new byte[] { 0xca, 0xfb, 0x1c, 0x49, 0xbf, 0x82, 0x2a, 0xbb, 0x1c, 0x52, 0xc7, 0x86, 0x22, 0x8a, 0xe5, 0xa4, 0xf3, 0xda, 0x4e, 0x1c, 0x3a, 0x87, 0x41, 0x1c, 0xd2, 0x6e, 0x76, 0xdc, 0xc2, 0xe9, 0xc2, 0x0e, 0xf5, 0xc7, 0xbd, 0x12, 0x85, 0xfa, 0x0e, 0xda, 0xee, 0x50, 0xd7, 0xfd, 0x81, 0x34, 0x25, 0x6d }; - var testCipher = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false); + var testCipher = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false); var actual = testCipher.Encrypt(input); @@ -161,7 +161,7 @@ public void Decrypt_Input_128_CTR() var iv = new byte[] { 0xe6, 0x65, 0x36, 0x0d, 0xdd, 0xd7, 0x50, 0xc3, 0x48, 0xdb, 0x48, 0x07, 0xa1, 0x30, 0xd2, 0x38 }; var input = new byte[] { 0xca, 0xfb, 0x1c, 0x49, 0xbf, 0x82, 0x2a, 0xbb, 0x1c, 0x52, 0xc7, 0x86, 0x22, 0x8a, 0xe5, 0xa4, 0xf3, 0xda, 0x4e, 0x1c, 0x3a, 0x87, 0x41, 0x1c, 0xd2, 0x6e, 0x76, 0xdc, 0xc2, 0xe9, 0xc2, 0x0e, 0xf5, 0xc7, 0xbd, 0x12, 0x85, 0xfa, 0x0e, 0xda, 0xee, 0x50, 0xd7, 0xfd, 0x81, 0x34, 0x25, 0x6d }; var expected = new byte[] { 0x00, 0x00, 0x00, 0x2c, 0x1a, 0x05, 0x00, 0x00, 0x00, 0x0c, 0x73, 0x73, 0x68, 0x2d, 0x75, 0x73, 0x65, 0x72, 0x61, 0x75, 0x74, 0x68, 0xb0, 0x74, 0x21, 0x87, 0x16, 0xb9, 0x69, 0x48, 0x33, 0xce, 0xb3, 0xe7, 0xdc, 0x3f, 0x50, 0xdc, 0xcc, 0xd5, 0x27, 0xb7, 0xfe, 0x7a, 0x78, 0x22, 0xae, 0xc8 }; - var testCipher = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false); + var testCipher = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false); var actual = testCipher.Decrypt(input); @@ -175,7 +175,7 @@ public void Decrypt_InputAndOffsetAndLength_128_CTR() var iv = new byte[] { 0xe6, 0x65, 0x36, 0x0d, 0xdd, 0xd7, 0x50, 0xc3, 0x48, 0xdb, 0x48, 0x07, 0xa1, 0x30, 0xd2, 0x38 }; var input = new byte[] { 0x0a, 0xca, 0xfb, 0x1c, 0x49, 0xbf, 0x82, 0x2a, 0xbb, 0x1c, 0x52, 0xc7, 0x86, 0x22, 0x8a, 0xe5, 0xa4, 0xf3, 0xda, 0x4e, 0x1c, 0x3a, 0x87, 0x41, 0x1c, 0xd2, 0x6e, 0x76, 0xdc, 0xc2, 0xe9, 0xc2, 0x0e, 0xf5, 0xc7, 0xbd, 0x12, 0x85, 0xfa, 0x0e, 0xda, 0xee, 0x50, 0xd7, 0xfd, 0x81, 0x34, 0x25, 0x6d, 0x0a, 0x05 }; var expected = new byte[] { 0x00, 0x00, 0x00, 0x2c, 0x1a, 0x05, 0x00, 0x00, 0x00, 0x0c, 0x73, 0x73, 0x68, 0x2d, 0x75, 0x73, 0x65, 0x72, 0x61, 0x75, 0x74, 0x68, 0xb0, 0x74, 0x21, 0x87, 0x16, 0xb9, 0x69, 0x48, 0x33, 0xce, 0xb3, 0xe7, 0xdc, 0x3f, 0x50, 0xdc, 0xcc, 0xd5, 0x27, 0xb7, 0xfe, 0x7a, 0x78, 0x22, 0xae, 0xc8 }; - var testCipher = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false); + var testCipher = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false); var actual = testCipher.Decrypt(input, 1, input.Length - 3); @@ -479,11 +479,11 @@ public void AES_CBC_128_Length16() 0x49, 0x0e, 0xa9, 0x6f, 0x55, 0xb3, 0x57, 0xdf, 0x7c, 0x18, 0x77, 0x0c, 0xca, 0x46, 0x0d, 0x83, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -512,11 +512,11 @@ public void AES_CBC_128_Length32() 0x2d, 0x87, 0x42, 0x20, 0xf1, 0x0b, 0x78, 0x96, 0xd5, 0x7c, 0xeb, 0xa2, 0x7f, 0x4b, 0x5a, 0xff, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -549,11 +549,11 @@ public void AES_CBC_128_Length64() 0x3d, 0x61, 0x9e, 0x0d, 0x54, 0x7f, 0xe1, 0xc4, 0x78, 0xf2, 0x04, 0x00, 0x68, 0xa9, 0x9b, 0x32, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -581,11 +581,11 @@ public void AES_CBC_192_Length16() 0xe1, 0x2f, 0x71, 0xad, 0x59, 0xae, 0xa7, 0xe3, 0xd3, 0x23, 0x43, 0x81, 0x31, 0xc2, 0xe5, 0xd9, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -615,11 +615,11 @@ public void AES_CBC_192_Length32() 0x07, 0xf2, 0x98, 0x41, 0xbb, 0x58, 0x3d, 0xe5, 0xcf, 0x56, 0xf5, 0x4b, 0x33, 0xf7, 0xa0, 0x9a, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -653,11 +653,11 @@ public void AES_CBC_192_Length64() 0xda, 0xba, 0xde, 0xb2, 0x7d, 0xbc, 0x71, 0xf8, 0x9b, 0xaa, 0x93, 0x52, 0xf4, 0x26, 0x3c, 0x6f, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -685,11 +685,11 @@ public void AES_CBC_256_Length16() 0xe7, 0xa5, 0x53, 0xd7, 0x28, 0x4c, 0x16, 0x4e, 0xfc, 0xa2, 0xa8, 0x86, 0xfc, 0xcb, 0x71, 0x61, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -719,11 +719,11 @@ public void AES_CBC_256_Length32() 0x6a, 0xfb, 0x4a, 0x8b, 0xc8, 0x25, 0x87, 0x5c, 0x9b, 0x47, 0xf5, 0x3f, 0x42, 0xf5, 0xc6, 0x08, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -757,11 +757,11 @@ public void AES_CBC_256_Length64() 0x08, 0x19, 0x66, 0x47, 0xe7, 0xd9, 0x1d, 0x1c, 0x42, 0xdc, 0x97, 0x9c, 0xf0, 0x9a, 0x14, 0x34, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -788,11 +788,11 @@ public void AES_CFB_128_Length16() 0x76, 0xd2, 0x2b, 0x69, 0xa6, 0xdf, 0x3b, 0x4d, 0x4a, 0x52, 0x8a, 0x7a, 0x54, 0x9d, 0xbe, 0x55, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -821,11 +821,11 @@ public void AES_CFB_128_Length32() 0x18, 0xc5, 0xf7, 0x41, 0x78, 0x5f, 0x38, 0x6b, 0x4d, 0x04, 0x00, 0x3b, 0x61, 0x8c, 0xaf, 0xe7, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -858,11 +858,11 @@ public void AES_CFB_128_Length64() 0xf7, 0x49, 0xbc, 0xbf, 0xcb, 0x5c, 0xfa, 0x12, 0xcb, 0xcc, 0x38, 0x71, 0x68, 0xd6, 0xe9, 0x64, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -890,11 +890,11 @@ public void AES_CFB_192_Length16() 0x4f, 0x9b, 0xdf, 0x72, 0x2d, 0x10, 0x1b, 0xb9, 0xa1, 0xe1, 0x06, 0xba, 0xbc, 0xc5, 0xfe, 0x13, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -924,11 +924,11 @@ public void AES_CFB_192_Length32() 0x72, 0xcf, 0x57, 0x7f, 0xf9, 0x5d, 0xfe, 0xb1, 0x36, 0x9a, 0x1d, 0x02, 0x0d, 0x4b, 0x8f, 0x35, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -962,11 +962,11 @@ public void AES_CFB_192_Length64() 0x69, 0x90, 0x2a, 0xf9, 0xf4, 0xe8, 0xcc, 0xa5, 0x2b, 0xdd, 0x9c, 0xbc, 0x44, 0xcd, 0x1e, 0x5b, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -994,11 +994,11 @@ public void AES_CFB_256_Length16() 0xf0, 0xfa, 0x95, 0x5c, 0xfc, 0x3f, 0xbe, 0xe5, 0x4b, 0x55, 0x57, 0xad, 0x93, 0x63, 0x36, 0x07, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -1028,11 +1028,11 @@ public void AES_CFB_256_Length32() 0xc2, 0xc1, 0x54, 0x9c, 0xfd, 0xf9, 0x43, 0xd0, 0xdc, 0xa7, 0x20, 0x68, 0x3e, 0xc3, 0x8f, 0x3c, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -1066,11 +1066,11 @@ public void AES_CFB_256_Length64() 0xf6, 0xd4, 0x06, 0xef, 0x04, 0xf1, 0xe5, 0x53, 0x54, 0xd5, 0x80, 0xc2, 0x96, 0x6b, 0xc7, 0x07, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -1097,11 +1097,11 @@ public void AES_CTR_128_Length16() 0xe4, 0x03, 0x8f, 0x2a, 0xdd, 0x9d, 0xf6, 0x87, 0xf6, 0x29, 0xee, 0x27, 0x4c, 0xf3, 0xba, 0x82, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -1130,11 +1130,11 @@ public void AES_CTR_128_Length32() 0x9c, 0xb2, 0x30, 0x94, 0xdc, 0x88, 0xfa, 0x39, 0x05, 0x0c, 0x26, 0x25, 0x28, 0x6a, 0x9b, 0x4e, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -1167,11 +1167,11 @@ public void AES_CTR_128_Length64() 0xec, 0x47, 0x81, 0x82, 0x89, 0x24, 0x76, 0xe2, 0x20, 0x6a, 0x99, 0xe2, 0xa7, 0x5a, 0xb0, 0x40, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -1199,11 +1199,11 @@ public void AES_CTR_192_Length16() 0xc4, 0x4e, 0x81, 0x32, 0xe6, 0x6d, 0x0a, 0x78, 0x49, 0xe5, 0x64, 0x6c, 0xe6, 0xc2, 0x91, 0xc9, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -1233,11 +1233,11 @@ public void AES_CTR_192_Length32() 0x85, 0xcd, 0x88, 0xa8, 0x25, 0xc8, 0xbd, 0xf8, 0xc3, 0xa9, 0x74, 0x36, 0x82, 0x19, 0xfc, 0xb3, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -1271,11 +1271,11 @@ public void AES_CTR_192_Length64() 0x2d, 0x26, 0x4a, 0x22, 0x97, 0x7a, 0x94, 0x5e, 0xb0, 0xb2, 0x3d, 0x42, 0x2b, 0x4a, 0x5e, 0x5d, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -1303,11 +1303,11 @@ public void AES_CTR_256_Length16() 0xa6, 0x46, 0x19, 0x9d, 0x3e, 0xa5, 0x53, 0xc8, 0xd9, 0xb3, 0x46, 0xbc, 0x0b, 0x3e, 0x47, 0xf4, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -1337,11 +1337,11 @@ public void AES_CTR_256_Length32() 0x1d, 0x7e, 0xe7, 0xe7, 0xa0, 0xae, 0x31, 0x9b, 0xb3, 0x21, 0xb8, 0x0c, 0x47, 0x3e, 0xaf, 0xdd, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -1375,11 +1375,11 @@ public void AES_CTR_256_Length64() 0x92, 0xb0, 0x7b, 0x7a, 0x77, 0x65, 0xf0, 0xcc, 0xbd, 0xe4, 0x41, 0xea, 0x9e, 0xfd, 0xdf, 0x41, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -1406,11 +1406,11 @@ public void AES_OFB_128_Length16() 0xb0, 0x65, 0x77, 0x03, 0xb4, 0x54, 0x82, 0x92, 0x05, 0x82, 0x93, 0x1f, 0x8d, 0x7b, 0xb6, 0xf0, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -1439,11 +1439,11 @@ public void AES_OFB_128_Length32() 0x11, 0xb9, 0xd6, 0x67, 0x6c, 0xe7, 0xaa, 0x09, 0x93, 0xe3, 0x5f, 0xed, 0x38, 0x46, 0x37, 0xd2, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -1476,11 +1476,11 @@ public void AES_OFB_128_Length64() 0xda, 0xad, 0x1b, 0xa5, 0x20, 0x67, 0xd2, 0xa6, 0x18, 0x26, 0x30, 0x43, 0x2f, 0xa2, 0x66, 0x0b, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -1508,11 +1508,11 @@ public void AES_OFB_192_Length16() 0x79, 0x41, 0x28, 0xc9, 0x3b, 0x89, 0x6f, 0x69, 0x92, 0xb0, 0x3e, 0x38, 0x11, 0x2c, 0xe5, 0xd8, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -1542,11 +1542,11 @@ public void AES_OFB_192_Length32() 0xe8, 0xe8, 0x8e, 0x1a, 0xa6, 0x25, 0xa5, 0x65, 0x0d, 0x5a, 0xe2, 0x9c, 0xd2, 0x7e, 0x06, 0x14, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -1580,11 +1580,11 @@ public void AES_OFB_192_Length64() 0xc7, 0xd0, 0x21, 0x0a, 0x40, 0x1d, 0x32, 0x32, 0x88, 0x86, 0x40, 0xa9, 0x4c, 0x59, 0x9c, 0xb4, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -1612,11 +1612,11 @@ public void AES_OFB_256_Length16() 0x98, 0x85, 0x21, 0xeb, 0x42, 0x0c, 0x8b, 0xb3, 0xab, 0x64, 0x78, 0xe5, 0x67, 0xdd, 0xee, 0x36, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -1646,11 +1646,11 @@ public void AES_OFB_256_Length32() 0x39, 0x54, 0x2e, 0x9f, 0x81, 0x49, 0xd3, 0x6b, 0x58, 0x20, 0x03, 0x21, 0x8d, 0x41, 0x9a, 0x42, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } @@ -1684,11 +1684,11 @@ public void AES_OFB_256_Length64() 0x7a, 0x3a, 0x43, 0xa6, 0x8f, 0x48, 0xfe, 0x6e, 0x64, 0xf6, 0x01, 0x0d, 0xdf, 0x9d, 0x34, 0xee, }; - var actual = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); + var actual = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Encrypt(input); CollectionAssert.AreEqual(expected, actual); - var decrypted = new AesCipher(key, (byte[]) iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); CollectionAssert.AreEqual(input, decrypted); } diff --git a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/RsaDigitalSignatureTest.cs b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/RsaDigitalSignatureTest.cs index a438ce1a1..17901523b 100644 --- a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/RsaDigitalSignatureTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/RsaDigitalSignatureTest.cs @@ -165,7 +165,7 @@ private static RsaKey GetRsaKey() { using (var stream = GetData("Key.RSA.txt")) { - return (RsaKey) new PrivateKeyFile(stream).Key; + return (RsaKey)new PrivateKeyFile(stream).Key; } } } diff --git a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/RsaKeyTest.cs b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/RsaKeyTest.cs index 161c02947..a58af2799 100644 --- a/test/Renci.SshNet.Tests/Classes/Security/Cryptography/RsaKeyTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/RsaKeyTest.cs @@ -17,7 +17,7 @@ private static RsaKey GetRsaKey(string fileName, string passPhrase = null) { using (var stream = GetData(fileName)) { - return (RsaKey) new PrivateKeyFile(stream, passPhrase).Key; + return (RsaKey)new PrivateKeyFile(stream, passPhrase).Key; } } @@ -266,7 +266,7 @@ public void Key_RSA_1277() using MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(keyString)); - RsaKey rsaKey = (RsaKey) new PrivateKeyFile(stream).Key; + RsaKey rsaKey = (RsaKey)new PrivateKeyFile(stream).Key; RSAParameters p = rsaKey.GetRSAParameters(); diff --git a/test/Renci.SshNet.Tests/Classes/Security/KeyAlgorithmTest.cs b/test/Renci.SshNet.Tests/Classes/Security/KeyAlgorithmTest.cs index 7ab1e07ce..ae8575733 100644 --- a/test/Renci.SshNet.Tests/Classes/Security/KeyAlgorithmTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Security/KeyAlgorithmTest.cs @@ -176,7 +176,7 @@ private static RsaKey GetRsaKey() { using (var stream = GetData("Key.RSA.txt")) { - return (RsaKey) new PrivateKeyFile(stream).Key; + return (RsaKey)new PrivateKeyFile(stream).Key; } } diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateConnector.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateConnector.cs index 4a35fcd72..56c5eeb07 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateConnector.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateConnector.cs @@ -67,7 +67,7 @@ public void ProxyType_Http() Assert.IsNotNull(actual); Assert.AreEqual(typeof(HttpConnector), actual.GetType()); - var httpConnector = (HttpConnector) actual; + var httpConnector = (HttpConnector)actual; Assert.AreSame(_socketFactoryMock.Object, httpConnector.SocketFactory); _connectionInfoMock.Verify(p => p.ProxyType, Times.Once); @@ -83,7 +83,7 @@ public void ProxyType_None() Assert.IsNotNull(actual); Assert.AreEqual(typeof(DirectConnector), actual.GetType()); - var directConnector = (DirectConnector) actual; + var directConnector = (DirectConnector)actual; Assert.AreSame(_socketFactoryMock.Object, directConnector.SocketFactory); _connectionInfoMock.Verify(p => p.ProxyType, Times.Once); @@ -99,7 +99,7 @@ public void ProxyType_Socks4() Assert.IsNotNull(actual); Assert.AreEqual(typeof(Socks4Connector), actual.GetType()); - var socks4Connector = (Socks4Connector) actual; + var socks4Connector = (Socks4Connector)actual; Assert.AreSame(_socketFactoryMock.Object, socks4Connector.SocketFactory); _connectionInfoMock.Verify(p => p.ProxyType, Times.Once); @@ -115,7 +115,7 @@ public void ProxyType_Socks5() Assert.IsNotNull(actual); Assert.AreEqual(typeof(Socks5Connector), actual.GetType()); - var socks5Connector = (Socks5Connector) actual; + var socks5Connector = (Socks5Connector)actual; Assert.AreSame(_socketFactoryMock.Object, socks5Connector.SocketFactory); _connectionInfoMock.Verify(p => p.ProxyType, Times.Once); @@ -124,7 +124,7 @@ public void ProxyType_Socks5() [TestMethod] public void ProxyType_Undefined() { - _connectionInfoMock.Setup(p => p.ProxyType).Returns((ProxyTypes) 666); + _connectionInfoMock.Setup(p => p.ProxyType).Returns((ProxyTypes)666); try { diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_EndLStatThrowsSshException.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_EndLStatThrowsSshException.cs index c98f6a0f2..ce5c7b04d 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_EndLStatThrowsSshException.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_EndLStatThrowsSshException.cs @@ -28,12 +28,12 @@ private void SetupData() { var random = new Random(); - _bufferSize = (uint) random.Next(1, int.MaxValue); + _bufferSize = (uint)random.Next(1, int.MaxValue); _openAsyncResult = new SftpOpenAsyncResult(null, null); _handle = CryptoAbstraction.GenerateRandom(random.Next(1, 10)); _statAsyncResult = new SFtpStatAsyncResult(null, null); _fileName = random.Next().ToString(); - _chunkSize = (uint) random.Next(1, int.MaxValue); + _chunkSize = (uint)random.Next(1, int.MaxValue); } private void CreateMocks() diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsAlmostSixTimesGreaterThanChunkSize.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsAlmostSixTimesGreaterThanChunkSize.cs index 445ef84b9..a869f48f8 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsAlmostSixTimesGreaterThanChunkSize.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsAlmostSixTimesGreaterThanChunkSize.cs @@ -30,12 +30,12 @@ private void SetupData() { var random = new Random(); - _bufferSize = (uint) random.Next(1, int.MaxValue); + _bufferSize = (uint)random.Next(1, int.MaxValue); _openAsyncResult = new SftpOpenAsyncResult(null, null); _handle = CryptoAbstraction.GenerateRandom(random.Next(1, 10)); _statAsyncResult = new SFtpStatAsyncResult(null, null); _fileName = random.Next().ToString(); - _chunkSize = (uint) random.Next(1000, 5000); + _chunkSize = (uint)random.Next(1000, 5000); _fileSize = (_chunkSize * 6) - 10; _fileAttributes = new SftpFileAttributesBuilder().WithSize(_fileSize).Build(); } diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsEqualToChunkSize.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsEqualToChunkSize.cs index ddd318f12..29a0c9c71 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsEqualToChunkSize.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsEqualToChunkSize.cs @@ -30,12 +30,12 @@ private void SetupData() { var random = new Random(); - _bufferSize = (uint) random.Next(1, int.MaxValue); + _bufferSize = (uint)random.Next(1, int.MaxValue); _openAsyncResult = new SftpOpenAsyncResult(null, null); _handle = CryptoAbstraction.GenerateRandom(random.Next(1, 10)); _statAsyncResult = new SFtpStatAsyncResult(null, null); _fileName = random.Next().ToString(); - _chunkSize = (uint) random.Next(1000, int.MaxValue); + _chunkSize = (uint)random.Next(1000, int.MaxValue); _fileSize = _chunkSize; _fileAttributes = new SftpFileAttributesBuilder().WithSize(_fileSize).Build(); } diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsExactlyFiveTimesGreaterThanChunkSize.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsExactlyFiveTimesGreaterThanChunkSize.cs index 3310205bc..47a446c17 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsExactlyFiveTimesGreaterThanChunkSize.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsExactlyFiveTimesGreaterThanChunkSize.cs @@ -30,12 +30,12 @@ private void SetupData() { var random = new Random(); - _bufferSize = (uint) random.Next(1, int.MaxValue); + _bufferSize = (uint)random.Next(1, int.MaxValue); _openAsyncResult = new SftpOpenAsyncResult(null, null); _handle = CryptoAbstraction.GenerateRandom(random.Next(1, 10)); _statAsyncResult = new SFtpStatAsyncResult(null, null); _fileName = random.Next().ToString(); - _chunkSize = (uint) random.Next(1000, 5000); + _chunkSize = (uint)random.Next(1000, 5000); _fileSize = _chunkSize * 5; _fileAttributes = new SftpFileAttributesBuilder().WithSize(_fileSize).Build(); } diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsLessThanChunkSize.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsLessThanChunkSize.cs index 94f04901e..b2202b183 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsLessThanChunkSize.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsLessThanChunkSize.cs @@ -30,12 +30,12 @@ private void SetupData() { var random = new Random(); - _bufferSize = (uint) random.Next(1, int.MaxValue); + _bufferSize = (uint)random.Next(1, int.MaxValue); _openAsyncResult = new SftpOpenAsyncResult(null, null); _handle = CryptoAbstraction.GenerateRandom(random.Next(1, 10)); _statAsyncResult = new SFtpStatAsyncResult(null, null); _fileName = random.Next().ToString(); - _chunkSize = (uint) random.Next(1000, int.MaxValue); + _chunkSize = (uint)random.Next(1000, int.MaxValue); _fileSize = _chunkSize - random.Next(1, 10); _fileAttributes = new SftpFileAttributesBuilder().WithSize(_fileSize).Build(); } diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsLittleMoreThanFiveTimesGreaterThanChunkSize.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsLittleMoreThanFiveTimesGreaterThanChunkSize.cs index 7d9e14926..c0439cba9 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsLittleMoreThanFiveTimesGreaterThanChunkSize.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsLittleMoreThanFiveTimesGreaterThanChunkSize.cs @@ -30,12 +30,12 @@ private void SetupData() { var random = new Random(); - _bufferSize = (uint) random.Next(1, int.MaxValue); + _bufferSize = (uint)random.Next(1, int.MaxValue); _openAsyncResult = new SftpOpenAsyncResult(null, null); _handle = CryptoAbstraction.GenerateRandom(random.Next(1, 10)); _statAsyncResult = new SFtpStatAsyncResult(null, null); _fileName = random.Next().ToString(); - _chunkSize = (uint) random.Next(1000, 5000); + _chunkSize = (uint)random.Next(1000, 5000); _fileSize = (_chunkSize * 5) + 10; _fileAttributes = new SftpFileAttributesBuilder().WithSize(_fileSize).Build(); } diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanMaxPendingReadsTimesChunkSize.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanMaxPendingReadsTimesChunkSize.cs index 1d034a4a5..105085a25 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanMaxPendingReadsTimesChunkSize.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsMoreThanMaxPendingReadsTimesChunkSize.cs @@ -32,12 +32,12 @@ private void SetupData() var random = new Random(); _maxPendingReads = 100; - _bufferSize = (uint) random.Next(1, int.MaxValue); + _bufferSize = (uint)random.Next(1, int.MaxValue); _openAsyncResult = new SftpOpenAsyncResult(null, null); _handle = CryptoAbstraction.GenerateRandom(random.Next(1, 10)); _statAsyncResult = new SFtpStatAsyncResult(null, null); _fileName = random.Next().ToString(); - _chunkSize = (uint) random.Next(1000, 5000); + _chunkSize = (uint)random.Next(1000, 5000); _fileSize = _chunkSize * random.Next(_maxPendingReads + 1, _maxPendingReads * 2); _fileAttributes = new SftpFileAttributesBuilder().WithSize(_fileSize).Build(); } diff --git a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsZero.cs b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsZero.cs index eba0e9d36..068865800 100644 --- a/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsZero.cs +++ b/test/Renci.SshNet.Tests/Classes/ServiceFactoryTest_CreateSftpFileReader_FileSizeIsZero.cs @@ -30,12 +30,12 @@ private void SetupData() { var random = new Random(); - _bufferSize = (uint) random.Next(1, int.MaxValue); + _bufferSize = (uint)random.Next(1, int.MaxValue); _openAsyncResult = new SftpOpenAsyncResult(null, null); _handle = CryptoAbstraction.GenerateRandom(random.Next(1, 10)); _statAsyncResult = new SFtpStatAsyncResult(null, null); _fileName = random.Next().ToString(); - _chunkSize = (uint) random.Next(1, int.MaxValue); + _chunkSize = (uint)random.Next(1, int.MaxValue); _fileSize = 0L; _fileAttributes = new SftpFileAttributesBuilder().WithSize(_fileSize).Build(); } diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectToServerFails.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectToServerFails.cs index bc671ddb5..873275325 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectToServerFails.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectToServerFails.cs @@ -152,7 +152,7 @@ public void WaitOnHandle_WaitOnHandle_WaitHandleAndTimeout_ShouldThrowArgumentNu [TestMethod] public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnDisconnected() { - var session = (ISession) _session; + var session = (ISession)_session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, Timeout.InfiniteTimeSpan); @@ -163,7 +163,7 @@ public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnDisconnected() [TestMethod] public void ISession_TryWait_WaitHandleAndTimeoutAndException_ShouldReturnDisconnected() { - var session = (ISession) _session; + var session = (ISession)_session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, Timeout.InfiniteTimeSpan, out var exception); @@ -175,14 +175,14 @@ public void ISession_TryWait_WaitHandleAndTimeoutAndException_ShouldReturnDiscon [TestMethod] public void ISession_ConnectionInfoShouldReturnConnectionInfoPassedThroughConstructor() { - var session = (ISession) _session; + var session = (ISession)_session; Assert.AreSame(_connectionInfo, session.ConnectionInfo); } [TestMethod] public void ISession_MessageListenerCompletedShouldBeSignaled() { - var session = (ISession) _session; + var session = (ISession)_session; Assert.IsNotNull(session.MessageListenerCompleted); Assert.IsTrue(session.MessageListenerCompleted.WaitOne(0)); @@ -191,7 +191,7 @@ public void ISession_MessageListenerCompletedShouldBeSignaled() [TestMethod] public void ISession_SendMessageShouldThrowSshConnectionException() { - var session = (ISession) _session; + var session = (ISession)_session; try { @@ -209,7 +209,7 @@ public void ISession_SendMessageShouldThrowSshConnectionException() [TestMethod] public void ISession_TrySendMessageShouldReturnFalse() { - var session = (ISession) _session; + var session = (ISession)_session; var actual = session.TrySendMessage(new IgnoreMessage()); @@ -220,7 +220,7 @@ public void ISession_TrySendMessageShouldReturnFalse() public void ISession_WaitOnHandle_WaitHandle_ShouldThrowArgumentNullExceptionWhenWaitHandleIsNull() { const WaitHandle waitHandle = null; - var session = (ISession) _session; + var session = (ISession)_session; try { @@ -238,7 +238,7 @@ public void ISession_WaitOnHandle_WaitHandle_ShouldThrowArgumentNullExceptionWhe public void ISession_WaitOnHandle_WaitHandleAndTimeout_ShouldThrowArgumentNullExceptionWhenWaitHandleIsNull() { const WaitHandle waitHandle = null; - var session = (ISession) _session; + var session = (ISession)_session; try { diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected.cs index 7264233ec..d872ff183 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected.cs @@ -138,14 +138,14 @@ public void WaitOnHandle_WaitHandleAndTimeout_ShouldThrowArgumentNullExceptionWh [TestMethod] public void ISession_ConnectionInfoShouldReturnConnectionInfoPassedThroughConstructor() { - var session = (ISession) Session; + var session = (ISession)Session; Assert.AreSame(ConnectionInfo, session.ConnectionInfo); } [TestMethod] public void ISession_MessageListenerCompletedShouldNotBeSignaled() { - var session = (ISession) Session; + var session = (ISession)Session; Assert.IsNotNull(session.MessageListenerCompleted); Assert.IsFalse(session.MessageListenerCompleted.WaitOne(0)); @@ -156,7 +156,7 @@ public void ISession_SendMessageShouldSendPacketToServer() { Thread.Sleep(100); - var session = (ISession) Session; + var session = (ISession)Session; ServerBytesReceivedRegister.Clear(); session.SendMessage(_ignoreMessage); @@ -172,7 +172,7 @@ public void ISession_TrySendMessageShouldSendPacketToServerAndReturnTrue() { Thread.Sleep(100); - var session = (ISession) Session; + var session = (ISession)Session; ServerBytesReceivedRegister.Clear(); var actual = session.TrySendMessage(new IgnoreMessage()); @@ -188,7 +188,7 @@ public void ISession_TrySendMessageShouldSendPacketToServerAndReturnTrue() public void ISession_WaitOnHandleShouldThrowArgumentNullExceptionWhenWaitHandleIsNull() { const WaitHandle waitHandle = null; - var session = (ISession) Session; + var session = (ISession)Session; try { @@ -205,7 +205,7 @@ public void ISession_WaitOnHandleShouldThrowArgumentNullExceptionWhenWaitHandleI [TestMethod] public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnSuccessIfWaitHandleIsSignaled() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(true); var result = session.TryWait(waitHandle, TimeSpan.FromMilliseconds(0)); @@ -216,7 +216,7 @@ public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnSuccessIfWaitHandl [TestMethod] public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnTimedOutIfWaitHandleIsNotSignaled() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, TimeSpan.FromMilliseconds(0)); @@ -227,7 +227,7 @@ public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnTimedOutIfWaitHand [TestMethod] public void ISession_TryWait_WaitHandleAndTimeout_ShouldThrowArgumentNullExceptionWhenWaitHandleIsNull() { - var session = (ISession) Session; + var session = (ISession)Session; const WaitHandle waitHandle = null; try @@ -245,7 +245,7 @@ public void ISession_TryWait_WaitHandleAndTimeout_ShouldThrowArgumentNullExcepti [TestMethod] public void ISession_TryWait_WaitHandleAndTimeoutAndException_ShouldReturnSuccessIfWaitHandleIsSignaled() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(true); var result = session.TryWait(waitHandle, TimeSpan.FromMilliseconds(0), out var exception); @@ -257,7 +257,7 @@ public void ISession_TryWait_WaitHandleAndTimeoutAndException_ShouldReturnSucces [TestMethod] public void ISession_TryWait_WaitHandleAndTimeoutAndException_ShouldReturnTimedOutIfWaitHandleIsNotSignaled() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, TimeSpan.FromMilliseconds(0), out var exception); @@ -269,7 +269,7 @@ public void ISession_TryWait_WaitHandleAndTimeoutAndException_ShouldReturnTimedO [TestMethod] public void ISession_TryWait_WaitHandleAndTimeoutAndException_ShouldThrowArgumentNullExceptionWhenWaitHandleIsNull() { - var session = (ISession) Session; + var session = (ISession)Session; const WaitHandle waitHandle = null; Exception exception = null; diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectedBase.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectedBase.cs index db38a46b2..b507aac9f 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectedBase.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectedBase.cs @@ -212,30 +212,30 @@ private void SetupMocks() .Returns((ref bool serverAead) => { serverAead = false; - return (Cipher) null; + return (Cipher)null; }); _ = _keyExchangeMock.Setup(p => p.CreateClientCipher(out It.Ref.IsAny)) .Returns((ref bool clientAead) => { clientAead = false; - return (Cipher) null; + return (Cipher)null; }); _ = _keyExchangeMock.Setup(p => p.CreateServerHash(out It.Ref.IsAny)) .Returns((ref bool serverEtm) => { serverEtm = false; - return (HashAlgorithm) null; + return (HashAlgorithm)null; }); _ = _keyExchangeMock.Setup(p => p.CreateClientHash(out It.Ref.IsAny)) .Returns((ref bool clientEtm) => { clientEtm = false; - return (HashAlgorithm) null; + return (HashAlgorithm)null; }); _ = _keyExchangeMock.Setup(p => p.CreateCompressor()) - .Returns((Compressor) null); + .Returns((Compressor)null); _ = _keyExchangeMock.Setup(p => p.CreateDecompressor()) - .Returns((Compressor) null); + .Returns((Compressor)null); _ = _keyExchangeMock.Setup(p => p.Dispose()); _ = ServiceFactoryMock.Setup(p => p.CreateClientAuthentication()) .Callback(ClientAuthentication_Callback) @@ -278,7 +278,7 @@ public byte[] Build() var target = new ServiceAcceptMessage(); var sshDataStream = new SshDataStream(4 + 1 + 1 + 4 + serviceName.Length); - sshDataStream.Write((uint) (sshDataStream.Capacity - 4)); // packet length + sshDataStream.Write((uint)(sshDataStream.Capacity - 4)); // packet length sshDataStream.WriteByte(0); // padding length sshDataStream.WriteByte(target.MessageNumber); sshDataStream.WriteBinary(serviceName); diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ConnectionReset.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ConnectionReset.cs index 59f9d4aac..1b11e702d 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ConnectionReset.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ConnectionReset.cs @@ -62,7 +62,7 @@ public void ErrorOccurredIsRaisedOnce() Assert.IsNotNull(exception); Assert.AreEqual(typeof(SshConnectionException), exception.GetType()); - var connectionException = (SshConnectionException) exception; + var connectionException = (SshConnectionException)exception; Assert.AreEqual(DisconnectReason.ConnectionLost, connectionException.DisconnectReason); Assert.IsNull(connectionException.InnerException); Assert.AreEqual("An established connection was aborted by the server.", connectionException.Message); @@ -99,7 +99,7 @@ public void SendMessageShouldThrowSshConnectionException() [TestMethod] public void ISession_MessageListenerCompletedShouldBeSignaled() { - var session = (ISession) Session; + var session = (ISession)Session; Assert.IsNotNull(session.MessageListenerCompleted); Assert.IsTrue(session.MessageListenerCompleted.WaitOne()); @@ -108,7 +108,7 @@ public void ISession_MessageListenerCompletedShouldBeSignaled() [TestMethod] public void ISession_SendMessageShouldThrowSshConnectionException() { - var session = (ISession) Session; + var session = (ISession)Session; try { @@ -126,7 +126,7 @@ public void ISession_SendMessageShouldThrowSshConnectionException() [TestMethod] public void ISession_TrySendMessageShouldReturnFalse() { - var session = (ISession) Session; + var session = (ISession)Session; var actual = session.TrySendMessage(new IgnoreMessage()); @@ -136,7 +136,7 @@ public void ISession_TrySendMessageShouldReturnFalse() [TestMethod] public void ISession_WaitOnHandle_WaitHandle_ShouldThrowSshConnectionException() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); try @@ -155,7 +155,7 @@ public void ISession_WaitOnHandle_WaitHandle_ShouldThrowSshConnectionException() [TestMethod] public void ISession_WaitOnHandle_WaitHandleAndTimeout_ShouldThrowSshConnectionException() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); try @@ -174,7 +174,7 @@ public void ISession_WaitOnHandle_WaitHandleAndTimeout_ShouldThrowSshConnectionE [TestMethod] public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnDisconnected() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, Timeout.InfiniteTimeSpan); @@ -185,7 +185,7 @@ public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnDisconnected() [TestMethod] public void ISession_TryWait_WaitHandleAndTimeoutAndException_ShouldReturnDisconnected() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, Timeout.InfiniteTimeSpan, out var exception); diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_Disconnect.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_Disconnect.cs index 444a8d51a..462055e37 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_Disconnect.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_Disconnect.cs @@ -95,7 +95,7 @@ public void SendMessageShouldThrowSshConnectionException() [TestMethod] public void ISession_MessageListenerCompletedShouldBeSignaled() { - var session = (ISession) Session; + var session = (ISession)Session; Assert.IsNotNull(session.MessageListenerCompleted); Assert.IsTrue(session.MessageListenerCompleted.WaitOne()); @@ -104,7 +104,7 @@ public void ISession_MessageListenerCompletedShouldBeSignaled() [TestMethod] public void ISession_SendMessageShouldThrowSshConnectionException() { - var session = (ISession) Session; + var session = (ISession)Session; try { @@ -122,7 +122,7 @@ public void ISession_SendMessageShouldThrowSshConnectionException() [TestMethod] public void ISession_TrySendMessageShouldReturnFalse() { - var session = (ISession) Session; + var session = (ISession)Session; var actual = session.TrySendMessage(new IgnoreMessage()); @@ -132,7 +132,7 @@ public void ISession_TrySendMessageShouldReturnFalse() [TestMethod] public void ISession_WaitOnHandle_WaitHandle_ShouldThrowSshConnectionExceptionDetailingBadPacket() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); try @@ -151,7 +151,7 @@ public void ISession_WaitOnHandle_WaitHandle_ShouldThrowSshConnectionExceptionDe [TestMethod] public void ISession_WaitOnHandle_WaitHandleAndTimeout_ShouldThrowSshConnectionExceptionDetailingBadPacket() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); try @@ -170,7 +170,7 @@ public void ISession_WaitOnHandle_WaitHandleAndTimeout_ShouldThrowSshConnectionE [TestMethod] public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnDisconnected() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, Timeout.InfiniteTimeSpan); @@ -181,7 +181,7 @@ public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnDisconnected() [TestMethod] public void ISession_TryWait_WaitHandleAndTimeoutAndException_ShouldReturnDisconnected() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, Timeout.InfiniteTimeSpan, out var exception); diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerAndClientDisconnectRace.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerAndClientDisconnectRace.cs index 3681bb6bf..5bb6c1511 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerAndClientDisconnectRace.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerAndClientDisconnectRace.cs @@ -166,30 +166,30 @@ private void SetupMocks() .Returns((ref bool serverAead) => { serverAead = false; - return (Cipher) null; + return (Cipher)null; }); _ = _keyExchangeMock.Setup(p => p.CreateClientCipher(out It.Ref.IsAny)) .Returns((ref bool clientAead) => { clientAead = false; - return (Cipher) null; + return (Cipher)null; }); _ = _keyExchangeMock.Setup(p => p.CreateServerHash(out It.Ref.IsAny)) .Returns((ref bool serverEtm) => { serverEtm = false; - return (HashAlgorithm) null; + return (HashAlgorithm)null; }); _ = _keyExchangeMock.Setup(p => p.CreateClientHash(out It.Ref.IsAny)) .Returns((ref bool clientEtm) => { clientEtm = false; - return (HashAlgorithm) null; + return (HashAlgorithm)null; }); _ = _keyExchangeMock.Setup(p => p.CreateCompressor()) - .Returns((Compressor) null); + .Returns((Compressor)null); _ = _keyExchangeMock.Setup(p => p.CreateDecompressor()) - .Returns((Compressor) null); + .Returns((Compressor)null); _ = _keyExchangeMock.Setup(p => p.Dispose()); _ = _serviceFactoryMock.Setup(p => p.CreateClientAuthentication()) .Returns(_clientAuthenticationMock.Object); @@ -244,7 +244,7 @@ public byte[] Build() var target = new ServiceAcceptMessage(); var sshDataStream = new SshDataStream(4 + 1 + 1 + 4 + serviceName.Length); - sshDataStream.Write((uint) (sshDataStream.Capacity - 4)); // packet length + sshDataStream.Write((uint)(sshDataStream.Capacity - 4)); // packet length sshDataStream.WriteByte(0); // padding length sshDataStream.WriteByte(target.MessageNumber); sshDataStream.WriteBinary(serviceName); diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsBadPacket.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsBadPacket.cs index 40ac16508..5dd53a292 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsBadPacket.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsBadPacket.cs @@ -72,7 +72,7 @@ public void ErrorOccurredIsRaisedOnce() Assert.IsNotNull(exception); Assert.AreEqual(typeof(SshConnectionException), exception.GetType()); - var connectionException = (SshConnectionException) exception; + var connectionException = (SshConnectionException)exception; Assert.AreEqual(DisconnectReason.ProtocolError, connectionException.DisconnectReason); Assert.IsNull(connectionException.InnerException); Assert.AreEqual("Bad packet length: 168101125.", connectionException.Message); @@ -119,7 +119,7 @@ public void SendMessageShouldThrowSshConnectionException() [TestMethod] public void ISession_MessageListenerCompletedShouldBeSignaled() { - var session = (ISession) Session; + var session = (ISession)Session; Assert.IsNotNull(session.MessageListenerCompleted); Assert.IsTrue(session.MessageListenerCompleted.WaitOne()); @@ -128,7 +128,7 @@ public void ISession_MessageListenerCompletedShouldBeSignaled() [TestMethod] public void ISession_SendMessageShouldThrowSshConnectionException() { - var session = (ISession) Session; + var session = (ISession)Session; try { @@ -146,7 +146,7 @@ public void ISession_SendMessageShouldThrowSshConnectionException() [TestMethod] public void ISession_TrySendMessageShouldReturnFalse() { - var session = (ISession) Session; + var session = (ISession)Session; var actual = session.TrySendMessage(new IgnoreMessage()); @@ -156,7 +156,7 @@ public void ISession_TrySendMessageShouldReturnFalse() [TestMethod] public void ISession_WaitOnHandle_WaitHandle_ShouldThrowSshConnectionExceptionDetailingBadPacket() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); try @@ -175,7 +175,7 @@ public void ISession_WaitOnHandle_WaitHandle_ShouldThrowSshConnectionExceptionDe [TestMethod] public void ISession_WaitOnHandleAndTimeout_WaitHandle_ShouldThrowSshConnectionExceptionDetailingBadPacket() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); try @@ -194,7 +194,7 @@ public void ISession_WaitOnHandleAndTimeout_WaitHandle_ShouldThrowSshConnectionE [TestMethod] public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnDisconnected() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, Timeout.InfiniteTimeSpan); @@ -205,7 +205,7 @@ public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnDisconnected() [TestMethod] public void ISession_TryWait_WaitHandleAndTimeoutAndException_ShouldReturnDisconnected() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, Timeout.InfiniteTimeSpan, out var exception); diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsDisconnectMessage.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsDisconnectMessage.cs index 440e5879b..1ae6737d4 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsDisconnectMessage.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsDisconnectMessage.cs @@ -116,7 +116,7 @@ public void SendMessageShouldThrowSshConnectionException() [TestMethod] public void ISession_MessageListenerCompletedShouldBeSignaled() { - var session = (ISession) Session; + var session = (ISession)Session; Assert.IsNotNull(session.MessageListenerCompleted); Assert.IsTrue(session.MessageListenerCompleted.WaitOne()); @@ -125,7 +125,7 @@ public void ISession_MessageListenerCompletedShouldBeSignaled() [TestMethod] public void ISession_SendMessageShouldThrowSshConnectionException() { - var session = (ISession) Session; + var session = (ISession)Session; try { @@ -143,7 +143,7 @@ public void ISession_SendMessageShouldThrowSshConnectionException() [TestMethod] public void ISession_TrySendMessageShouldReturnFalse() { - var session = (ISession) Session; + var session = (ISession)Session; var actual = session.TrySendMessage(new IgnoreMessage()); @@ -153,7 +153,7 @@ public void ISession_TrySendMessageShouldReturnFalse() [TestMethod] public void ISession_WaitOnHandle_WaitHandle_ShouldThrowSshConnectionExceptionDetailingDisconnectReason() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); try @@ -176,7 +176,7 @@ public void ISession_WaitOnHandle_WaitHandle_ShouldThrowSshConnectionExceptionDe [TestMethod] public void ISession_WaitOnHandle_WaitHandleAndTimeout_ShouldThrowSshConnectionExceptionDetailingDisconnectReason() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); try @@ -199,7 +199,7 @@ public void ISession_WaitOnHandle_WaitHandleAndTimeout_ShouldThrowSshConnectionE [TestMethod] public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnDisconnected() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, Timeout.InfiniteTimeSpan); @@ -210,7 +210,7 @@ public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnDisconnected() [TestMethod] public void ISession_TryWait_WaitHandleAndTimeoutAndException_ShouldReturnDisconnected() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, Timeout.InfiniteTimeSpan, out var exception); diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsDisconnectMessageAndShutsDownSocket.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsDisconnectMessageAndShutsDownSocket.cs index 0a040bbd1..220c1bbe2 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsDisconnectMessageAndShutsDownSocket.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsDisconnectMessageAndShutsDownSocket.cs @@ -120,7 +120,7 @@ public void SendMessageShouldThrowSshConnectionException() [TestMethod] public void ISession_MessageListenerCompletedShouldBeSignaled() { - var session = (ISession) Session; + var session = (ISession)Session; Assert.IsNotNull(session.MessageListenerCompleted); Assert.IsTrue(session.MessageListenerCompleted.WaitOne()); @@ -129,7 +129,7 @@ public void ISession_MessageListenerCompletedShouldBeSignaled() [TestMethod] public void ISession_SendMessageShouldThrowSshConnectionException() { - var session = (ISession) Session; + var session = (ISession)Session; try { @@ -147,7 +147,7 @@ public void ISession_SendMessageShouldThrowSshConnectionException() [TestMethod] public void ISession_TrySendMessageShouldReturnFalse() { - var session = (ISession) Session; + var session = (ISession)Session; var actual = session.TrySendMessage(new IgnoreMessage()); @@ -157,7 +157,7 @@ public void ISession_TrySendMessageShouldReturnFalse() [TestMethod] public void ISession_WaitOnHandle_WaitHandle_ShouldThrowSshConnectionExceptionDetailingDisconnectReason() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); try @@ -180,7 +180,7 @@ public void ISession_WaitOnHandle_WaitHandle_ShouldThrowSshConnectionExceptionDe [TestMethod] public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnDisconnected() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, Timeout.InfiniteTimeSpan); @@ -191,7 +191,7 @@ public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnDisconnected() [TestMethod] public void ISession_TryWait_WaitHandleAndTimeoutAndException_ShouldReturnDisconnected() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, Timeout.InfiniteTimeSpan, out var exception); diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsUnsupportedMessageType.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsUnsupportedMessageType.cs index b69f61df0..b92d0acbe 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsUnsupportedMessageType.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsUnsupportedMessageType.cs @@ -77,7 +77,7 @@ public void ErrorOccurredIsRaisedOnce() Assert.IsNotNull(exception); Assert.AreEqual(typeof(SshException), exception.GetType()); - var sshException = (SshException) exception; + var sshException = (SshException)exception; Assert.IsNull(sshException.InnerException); Assert.AreEqual("Message type 255 is not supported.", sshException.Message); } @@ -129,7 +129,7 @@ public void SendMessageShouldSendMessageToServer() [TestMethod] public void ISession_MessageListenerCompletedShouldBeSignaled() { - var session = (ISession) Session; + var session = (ISession)Session; Assert.IsNotNull(session.MessageListenerCompleted); Assert.IsTrue(session.MessageListenerCompleted.WaitOne()); @@ -138,7 +138,7 @@ public void ISession_MessageListenerCompletedShouldBeSignaled() [TestMethod] public void ISession_SendMessageShouldSendMessageToServer() { - var session = (ISession) Session; + var session = (ISession)Session; byte[] bytesReceivedByServer = null; ServerListener.BytesReceived += (received, socket) => bytesReceivedByServer = received; @@ -155,7 +155,7 @@ public void ISession_SendMessageShouldSendMessageToServer() [TestMethod] public void ISession_TrySendMessageShouldReturnTrueAndSendMessageToServer() { - var session = (ISession) Session; + var session = (ISession)Session; byte[] bytesReceivedByServer = null; ServerListener.BytesReceived += (received, socket) => bytesReceivedByServer = received; @@ -174,7 +174,7 @@ public void ISession_TrySendMessageShouldReturnTrueAndSendMessageToServer() [TestMethod] public void ISession_WaitOnHandleShouldThrowSshExceptionDetailingError() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); try @@ -192,7 +192,7 @@ public void ISession_WaitOnHandleShouldThrowSshExceptionDetailingError() [TestMethod] public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnFailed() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, Timeout.InfiniteTimeSpan); @@ -203,7 +203,7 @@ public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnFailed() [TestMethod] public void ISession_TryWait_WaitHandleAndTimeoutAndException_ShouldReturnFailed() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, Timeout.InfiniteTimeSpan, out var exception); @@ -223,7 +223,7 @@ private static byte[] CreatePacketForUnsupportedMessageType() byte messageType = 255; byte messageLength = 1; byte paddingLength = 10; - var packetDataLength = (uint) messageLength + paddingLength + 1; + var packetDataLength = (uint)messageLength + paddingLength + 1; var sshDataStream = new SshDataStream(4 + 1 + messageLength + paddingLength); sshDataStream.Write(packetDataLength); diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSendAfterSendingIncompletePacket.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSendAfterSendingIncompletePacket.cs index df8bfbf00..81eccac38 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSendAfterSendingIncompletePacket.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSendAfterSendingIncompletePacket.cs @@ -70,7 +70,7 @@ public void ErrorOccurredIsRaisedOnce() Assert.IsNotNull(exception); Assert.AreEqual(typeof(SshConnectionException), exception.GetType()); - var connectionException = (SshConnectionException) exception; + var connectionException = (SshConnectionException)exception; Assert.AreEqual(DisconnectReason.ConnectionLost, connectionException.DisconnectReason); Assert.IsNull(connectionException.InnerException); Assert.AreEqual("An established connection was aborted by the server.", connectionException.Message); @@ -116,7 +116,7 @@ public void SendMessageShouldSucceed() [TestMethod] public void ISession_MessageListenerCompletedShouldBeSignaled() { - var session = (ISession) Session; + var session = (ISession)Session; Assert.IsNotNull(session.MessageListenerCompleted); Assert.IsTrue(session.MessageListenerCompleted.WaitOne()); @@ -125,7 +125,7 @@ public void ISession_MessageListenerCompletedShouldBeSignaled() [TestMethod] public void ISession_SendMessageShouldSucceed() { - var session = (ISession) Session; + var session = (ISession)Session; try { @@ -142,7 +142,7 @@ public void ISession_SendMessageShouldSucceed() [TestMethod] public void ISession_TrySendMessageShouldReturnTrue() { - var session = (ISession) Session; + var session = (ISession)Session; Assert.IsFalse(session.TrySendMessage(new IgnoreMessage())); } @@ -150,7 +150,7 @@ public void ISession_TrySendMessageShouldReturnTrue() [TestMethod] public void ISession_WaitOnHandle_WaitHandle_ShouldThrowSshConnectionExceptionDetailingBadPacket() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); try @@ -169,7 +169,7 @@ public void ISession_WaitOnHandle_WaitHandle_ShouldThrowSshConnectionExceptionDe [TestMethod] public void ISession_WaitOnHandle_WaitHandleAndTimeout_ShouldThrowSshConnectionExceptionDetailingBadPacket() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); try @@ -188,7 +188,7 @@ public void ISession_WaitOnHandle_WaitHandleAndTimeout_ShouldThrowSshConnectionE [TestMethod] public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnDisconnected() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, Timeout.InfiniteTimeSpan); @@ -199,7 +199,7 @@ public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnDisconnected() [TestMethod] public void ISession_TryWait_WaitHandleAndTimeoutAndException_ShouldReturnDisconnected() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, Timeout.InfiniteTimeSpan, out var exception); diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSocket.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSocket.cs index a4f760d3a..d41f270a2 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSocket.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSocket.cs @@ -64,7 +64,7 @@ public void ErrorOccurredIsRaisedOnce() Assert.IsNotNull(exception); Assert.AreEqual(typeof(SshConnectionException), exception.GetType()); - var connectionException = (SshConnectionException) exception; + var connectionException = (SshConnectionException)exception; Assert.AreEqual(DisconnectReason.ConnectionLost, connectionException.DisconnectReason); Assert.IsNull(connectionException.InnerException); Assert.AreEqual("An established connection was aborted by the server.", connectionException.Message); @@ -110,7 +110,7 @@ public void SendMessageShouldThrowSshConnectionException() [TestMethod] public void ISession_MessageListenerCompletedShouldBeSignaled() { - var session = (ISession) Session; + var session = (ISession)Session; Assert.IsNotNull(session.MessageListenerCompleted); Assert.IsTrue(session.MessageListenerCompleted.WaitOne()); @@ -119,7 +119,7 @@ public void ISession_MessageListenerCompletedShouldBeSignaled() [TestMethod] public void ISession_SendMessageShouldThrowSshConnectionException() { - var session = (ISession) Session; + var session = (ISession)Session; try { @@ -136,7 +136,7 @@ public void ISession_SendMessageShouldThrowSshConnectionException() [TestMethod] public void ISession_TrySendMessageShouldReturnFalse() { - var session = (ISession) Session; + var session = (ISession)Session; var actual = session.TrySendMessage(new IgnoreMessage()); @@ -146,7 +146,7 @@ public void ISession_TrySendMessageShouldReturnFalse() [TestMethod] public void ISession_WaitOnHandle_WaitHandle_ShouldThrowSshConnectionExceptionDetailingAbortedConnection() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); try @@ -164,7 +164,7 @@ public void ISession_WaitOnHandle_WaitHandle_ShouldThrowSshConnectionExceptionDe [TestMethod] public void ISession_WaitOnHandle_WaitHandleAndTimeout_ShouldThrowSshConnectionExceptionDetailingAbortedConnection() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); try @@ -182,7 +182,7 @@ public void ISession_WaitOnHandle_WaitHandleAndTimeout_ShouldThrowSshConnectionE [TestMethod] public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnDisconnected() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, Timeout.InfiniteTimeSpan); @@ -193,7 +193,7 @@ public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnDisconnected() [TestMethod] public void ISession_TryWait_WaitHandleAndTimeout_ShouldThrowArgumentNullExceptionWhenWaitHandleIsNull() { - var session = (ISession) Session; + var session = (ISession)Session; const WaitHandle waitHandle = null; var timeout = TimeSpan.FromMinutes(5); @@ -212,7 +212,7 @@ public void ISession_TryWait_WaitHandleAndTimeout_ShouldThrowArgumentNullExcepti [TestMethod] public void ISession_TryWait_WaitHandleAndTimeoutAndException_ShouldReturnDisconnected() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, Timeout.InfiniteTimeSpan, out var exception); @@ -224,7 +224,7 @@ public void ISession_TryWait_WaitHandleAndTimeoutAndException_ShouldReturnDiscon [TestMethod] public void ISession_TryWait_WaitHandleAndTimeoutAndException_ShouldThrowArgumentNullExceptionWhenWaitHandleIsNull() { - var session = (ISession) Session; + var session = (ISession)Session; const WaitHandle waitHandle = null; var timeout = TimeSpan.FromMinutes(5); Exception exception = null; diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectingBase.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectingBase.cs index f34634d7b..05ce88754 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectingBase.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectingBase.cs @@ -232,13 +232,13 @@ private void SetupMocks() .Returns((ref bool serverAead) => { serverAead = false; - return (Cipher) null; + return (Cipher)null; }); _ = _keyExchangeMock.Setup(p => p.CreateClientCipher(out It.Ref.IsAny)) .Returns((ref bool clientAead) => { clientAead = false; - return (Cipher) null; + return (Cipher)null; }); _ = _keyExchangeMock.Setup(p => p.CreateServerHash(out It.Ref.IsAny)) .Returns((ref bool serverEtm) => @@ -250,12 +250,12 @@ private void SetupMocks() .Returns((ref bool clientEtm) => { clientEtm = false; - return (HashAlgorithm) null; + return (HashAlgorithm)null; }); _ = _keyExchangeMock.Setup(p => p.CreateCompressor()) - .Returns((Compressor) null); + .Returns((Compressor)null); _ = _keyExchangeMock.Setup(p => p.CreateDecompressor()) - .Returns((Compressor) null); + .Returns((Compressor)null); _ = _keyExchangeMock.Setup(p => p.Dispose()); _ = ServiceFactoryMock.Setup(p => p.CreateClientAuthentication()) .Returns(_clientAuthenticationMock.Object); @@ -283,7 +283,7 @@ public byte[] Build(uint sequence) var sshDataStream = new SshDataStream(4 + 4 + 1 + 1 + 4 + serviceName.Length); sshDataStream.Write(sequence); - sshDataStream.Write((uint) (sshDataStream.Capacity - 8)); //sequence and packet length + sshDataStream.Write((uint)(sshDataStream.Capacity - 8)); //sequence and packet length sshDataStream.WriteByte(0); // padding length sshDataStream.WriteByte(target.MessageNumber); sshDataStream.WriteBinary(serviceName); diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_NotConnected.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_NotConnected.cs index 937922b46..d54f9f4a3 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_NotConnected.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_NotConnected.cs @@ -122,7 +122,7 @@ public void WaitOnHandle_WaitOnHandle_WaitHandleAndTimeout_ShouldThrowArgumentNu [TestMethod] public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnDisconnected() { - var session = (ISession) _session; + var session = (ISession)_session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, Timeout.InfiniteTimeSpan); @@ -133,7 +133,7 @@ public void ISession_TryWait_WaitHandleAndTimeout_ShouldReturnDisconnected() [TestMethod] public void ISession_TryWait_WaitHandleAndTimeoutAndException_ShouldReturnDisconnected() { - var session = (ISession) _session; + var session = (ISession)_session; var waitHandle = new ManualResetEvent(false); var result = session.TryWait(waitHandle, Timeout.InfiniteTimeSpan, out var exception); @@ -145,14 +145,14 @@ public void ISession_TryWait_WaitHandleAndTimeoutAndException_ShouldReturnDiscon [TestMethod] public void ISession_ConnectionInfoShouldReturnConnectionInfoPassedThroughConstructor() { - var session = (ISession) _session; + var session = (ISession)_session; Assert.AreSame(_connectionInfo, session.ConnectionInfo); } [TestMethod] public void ISession_MessageListenerCompletedShouldBeSignaled() { - var session = (ISession) _session; + var session = (ISession)_session; Assert.IsNotNull(session.MessageListenerCompleted); Assert.IsTrue(session.MessageListenerCompleted.WaitOne(0)); @@ -161,7 +161,7 @@ public void ISession_MessageListenerCompletedShouldBeSignaled() [TestMethod] public void ISession_SendMessageShouldThrowSshConnectionException() { - var session = (ISession) _session; + var session = (ISession)_session; try { @@ -179,7 +179,7 @@ public void ISession_SendMessageShouldThrowSshConnectionException() [TestMethod] public void ISession_TrySendMessageShouldReturnFalse() { - var session = (ISession) _session; + var session = (ISession)_session; var actual = session.TrySendMessage(new IgnoreMessage()); @@ -190,7 +190,7 @@ public void ISession_TrySendMessageShouldReturnFalse() public void ISession_WaitOnHandle_WaitHandle_ShouldThrowArgumentNullExceptionWhenWaitHandleIsNull() { const WaitHandle waitHandle = null; - var session = (ISession) _session; + var session = (ISession)_session; try { @@ -208,7 +208,7 @@ public void ISession_WaitOnHandle_WaitHandle_ShouldThrowArgumentNullExceptionWhe public void ISession_WaitOnHandle_WaitHandleAndTimeout_ShouldThrowArgumentNullExceptionWhenWaitHandleIsNull() { const WaitHandle waitHandle = null; - var session = (ISession) _session; + var session = (ISession)_session; try { 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 2d4ad67ac..817875dcc 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/FStatVfsRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/FStatVfsRequestTest.cs @@ -25,8 +25,8 @@ public class FStatVfsRequestTest public void Init() { var random = new Random(); - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _handle = new byte[random.Next(1, 10)]; random.NextBytes(_handle); @@ -104,16 +104,16 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.Extended, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.Extended, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _nameBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_nameBytes.Length, sshDataStream.ReadUInt32()); var actualNameBytes = new byte[_nameBytes.Length]; sshDataStream.Read(actualNameBytes, 0, actualNameBytes.Length); Assert.IsTrue(_nameBytes.SequenceEqual(actualNameBytes)); - Assert.AreEqual((uint) _handle.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_handle.Length, sshDataStream.ReadUInt32()); var actualHandle = new byte[_handle.Length]; sshDataStream.Read(actualHandle, 0, actualHandle.Length); 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 2dc65bb1c..ece3b3cd5 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/HardLinkRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/HardLinkRequestTest.cs @@ -29,8 +29,8 @@ public class HardLinkRequestTest public void Init() { var random = new Random(); - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _oldPath = random.Next().ToString(CultureInfo.InvariantCulture); _oldPathBytes = Encoding.UTF8.GetBytes(_oldPath); _newPath = random.Next().ToString(CultureInfo.InvariantCulture); @@ -91,22 +91,22 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.Extended, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.Extended, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _nameBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_nameBytes.Length, sshDataStream.ReadUInt32()); var actualNameBytes = new byte[_nameBytes.Length]; sshDataStream.Read(actualNameBytes, 0, actualNameBytes.Length); Assert.IsTrue(_nameBytes.SequenceEqual(actualNameBytes)); - Assert.AreEqual((uint) _oldPathBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_oldPathBytes.Length, sshDataStream.ReadUInt32()); var actualOldPath = new byte[_oldPathBytes.Length]; sshDataStream.Read(actualOldPath, 0, actualOldPath.Length); Assert.IsTrue(_oldPathBytes.SequenceEqual(actualOldPath)); - Assert.AreEqual((uint) _newPathBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_newPathBytes.Length, sshDataStream.ReadUInt32()); var actualNewPath = new byte[_newPathBytes.Length]; sshDataStream.Read(actualNewPath, 0, actualNewPath.Length); 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 cb62095fd..a5ec0a3e7 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/PosixRenameRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/PosixRenameRequestTest.cs @@ -32,8 +32,8 @@ public void Init() var random = new Random(); _encoding = Encoding.Unicode; - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _oldPath = random.Next().ToString(CultureInfo.InvariantCulture); _oldPathBytes = _encoding.GetBytes(_oldPath); _newPath = random.Next().ToString(CultureInfo.InvariantCulture); @@ -95,22 +95,22 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.Extended, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.Extended, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _nameBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_nameBytes.Length, sshDataStream.ReadUInt32()); var actualNameBytes = new byte[_nameBytes.Length]; sshDataStream.Read(actualNameBytes, 0, actualNameBytes.Length); Assert.IsTrue(_nameBytes.SequenceEqual(actualNameBytes)); - Assert.AreEqual((uint) _oldPathBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_oldPathBytes.Length, sshDataStream.ReadUInt32()); var actualOldPath = new byte[_oldPathBytes.Length]; sshDataStream.Read(actualOldPath, 0, actualOldPath.Length); Assert.IsTrue(_oldPathBytes.SequenceEqual(actualOldPath)); - Assert.AreEqual((uint) _newPathBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_newPathBytes.Length, sshDataStream.ReadUInt32()); var actualNewPath = new byte[_newPathBytes.Length]; sshDataStream.Read(actualNewPath, 0, actualNewPath.Length); 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 5cacdc76e..4d7789496 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/StatVfsRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/StatVfsRequestTest.cs @@ -30,8 +30,8 @@ public void Init() var random = new Random(); _encoding = Encoding.Unicode; - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _path = random.Next().ToString(CultureInfo.InvariantCulture); _pathBytes = _encoding.GetBytes(_path); @@ -110,16 +110,16 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.Extended, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.Extended, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _nameBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_nameBytes.Length, sshDataStream.ReadUInt32()); var actualNameBytes = new byte[_nameBytes.Length]; sshDataStream.Read(actualNameBytes, 0, actualNameBytes.Length); Assert.IsTrue(_nameBytes.SequenceEqual(actualNameBytes)); - Assert.AreEqual((uint) _pathBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_pathBytes.Length, sshDataStream.ReadUInt32()); var actualPath = new byte[_pathBytes.Length]; sshDataStream.Read(actualPath, 0, actualPath.Length); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpBlockRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpBlockRequestTest.cs index 97803c9d5..8b30b77d8 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpBlockRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpBlockRequestTest.cs @@ -26,13 +26,13 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _handle = new byte[random.Next(1, 10)]; random.NextBytes(_handle); - _offset = (ulong) random.Next(0, int.MaxValue); - _length = (ulong) random.Next(0, int.MaxValue); - _lockMask = (uint) random.Next(0, int.MaxValue); + _offset = (ulong)random.Next(0, int.MaxValue); + _length = (ulong)random.Next(0, int.MaxValue); + _lockMask = (uint)random.Next(0, int.MaxValue); } [TestMethod] @@ -86,11 +86,11 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.Block, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.Block, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _handle.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_handle.Length, sshDataStream.ReadUInt32()); var actualHandle = new byte[_handle.Length]; sshDataStream.Read(actualHandle, 0, actualHandle.Length); Assert.IsTrue(_handle.SequenceEqual(actualHandle)); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpCloseRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpCloseRequestTest.cs index 603bf68a7..09dddbeba 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpCloseRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpCloseRequestTest.cs @@ -23,8 +23,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _handle = new byte[random.Next(1, 10)]; random.NextBytes(_handle); } @@ -74,11 +74,11 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.Close, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.Close, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _handle.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_handle.Length, sshDataStream.ReadUInt32()); var actualHandle = new byte[_handle.Length]; sshDataStream.Read(actualHandle, 0, actualHandle.Length); Assert.IsTrue(_handle.SequenceEqual(actualHandle)); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFSetStatRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFSetStatRequestTest.cs index a562f2002..01a9fc42e 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFSetStatRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFSetStatRequestTest.cs @@ -25,8 +25,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _handle = new byte[random.Next(1, 10)]; random.NextBytes(_handle); _attributes = SftpFileAttributes.Empty; @@ -79,11 +79,11 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.FSetStat, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.FSetStat, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _handle.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_handle.Length, sshDataStream.ReadUInt32()); var actualHandle = new byte[_handle.Length]; sshDataStream.Read(actualHandle, 0, actualHandle.Length); Assert.IsTrue(_handle.SequenceEqual(actualHandle)); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFStatRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFStatRequestTest.cs index a547281a9..987aa4e93 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFStatRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFStatRequestTest.cs @@ -23,8 +23,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _handle = new byte[random.Next(1, 10)]; random.NextBytes(_handle); } @@ -96,11 +96,11 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.FStat, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.FStat, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _handle.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_handle.Length, sshDataStream.ReadUInt32()); var actualHandle = new byte[_handle.Length]; sshDataStream.Read(actualHandle, 0, actualHandle.Length); Assert.IsTrue(_handle.SequenceEqual(actualHandle)); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLStatRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLStatRequestTest.cs index 8eb1cea99..fb8d526c6 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLStatRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLStatRequestTest.cs @@ -28,8 +28,8 @@ public void Init() var random = new Random(); _encoding = Encoding.Unicode; - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _path = random.Next().ToString(CultureInfo.InvariantCulture); _pathBytes = _encoding.GetBytes(_path); } @@ -102,11 +102,11 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.LStat, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.LStat, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _pathBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_pathBytes.Length, sshDataStream.ReadUInt32()); var actualPath = new byte[_pathBytes.Length]; sshDataStream.Read(actualPath, 0, actualPath.Length); Assert.IsTrue(_pathBytes.SequenceEqual(actualPath)); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLinkRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLinkRequestTest.cs index 00639b9e3..9c62b4119 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLinkRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLinkRequestTest.cs @@ -28,8 +28,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _newLinkPath = random.Next().ToString(CultureInfo.InvariantCulture); _newLinkPathBytes = Encoding.UTF8.GetBytes(_newLinkPath); _existingPath = random.Next().ToString(CultureInfo.InvariantCulture); @@ -90,16 +90,16 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.Link, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.Link, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _newLinkPathBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_newLinkPathBytes.Length, sshDataStream.ReadUInt32()); var actualNewLinkPath = new byte[_newLinkPathBytes.Length]; sshDataStream.Read(actualNewLinkPath, 0, actualNewLinkPath.Length); Assert.IsTrue(_newLinkPathBytes.SequenceEqual(actualNewLinkPath)); - Assert.AreEqual((uint) _existingPathBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_existingPathBytes.Length, sshDataStream.ReadUInt32()); var actualExistingPath = new byte[_existingPathBytes.Length]; sshDataStream.Read(actualExistingPath, 0, actualExistingPath.Length); Assert.IsTrue(_existingPathBytes.SequenceEqual(actualExistingPath)); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpMkDirRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpMkDirRequestTest.cs index 628256454..a8d28bb66 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpMkDirRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpMkDirRequestTest.cs @@ -29,8 +29,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _encoding = Encoding.Unicode; _path = random.Next().ToString(CultureInfo.InvariantCulture); _pathBytes = _encoding.GetBytes(_path); @@ -85,11 +85,11 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.MkDir, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.MkDir, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _pathBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_pathBytes.Length, sshDataStream.ReadUInt32()); var actualPath = new byte[_pathBytes.Length]; sshDataStream.Read(actualPath, 0, actualPath.Length); Assert.IsTrue(_pathBytes.SequenceEqual(actualPath)); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenDirRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenDirRequestTest.cs index 0bf486e8c..8ed3a8e37 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenDirRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenDirRequestTest.cs @@ -27,8 +27,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _encoding = Encoding.Unicode; _path = random.Next().ToString(CultureInfo.InvariantCulture); _pathBytes = _encoding.GetBytes(_path); @@ -102,11 +102,11 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.OpenDir, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.OpenDir, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _pathBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_pathBytes.Length, sshDataStream.ReadUInt32()); var actualPath = new byte[_pathBytes.Length]; sshDataStream.Read(actualPath, 0, actualPath.Length); Assert.IsTrue(_pathBytes.SequenceEqual(actualPath)); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenRequestTest.cs index 5a1a9d4a3..ea77982f2 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenRequestTest.cs @@ -30,8 +30,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _encoding = Encoding.Unicode; _filename = random.Next().ToString(CultureInfo.InvariantCulture); _filenameBytes = _encoding.GetBytes(_filename); @@ -124,16 +124,16 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.Open, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.Open, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _filenameBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_filenameBytes.Length, sshDataStream.ReadUInt32()); var actualPath = new byte[_filenameBytes.Length]; sshDataStream.Read(actualPath, 0, actualPath.Length); Assert.IsTrue(_filenameBytes.SequenceEqual(actualPath)); - Assert.AreEqual((uint) _flags, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_flags, sshDataStream.ReadUInt32()); var actualAttributes = new byte[_attributesBytes.Length]; sshDataStream.Read(actualAttributes, 0, actualAttributes.Length); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadDirRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadDirRequestTest.cs index 4ac390978..3948b2923 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadDirRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadDirRequestTest.cs @@ -24,8 +24,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _handle = new byte[random.Next(1, 10)]; random.NextBytes(_handle); } @@ -97,11 +97,11 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.ReadDir, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.ReadDir, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _handle.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_handle.Length, sshDataStream.ReadUInt32()); var actualHandle = new byte[_handle.Length]; sshDataStream.Read(actualHandle, 0, actualHandle.Length); Assert.IsTrue(_handle.SequenceEqual(actualHandle)); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadLinkRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadLinkRequestTest.cs index e15a0f4c8..d19ac530f 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadLinkRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadLinkRequestTest.cs @@ -27,8 +27,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _encoding = Encoding.Unicode; _path = random.Next().ToString(CultureInfo.InvariantCulture); _pathBytes = _encoding.GetBytes(_path); @@ -114,11 +114,11 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.ReadLink, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.ReadLink, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _pathBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_pathBytes.Length, sshDataStream.ReadUInt32()); var actualPath = new byte[_pathBytes.Length]; sshDataStream.Read(actualPath, 0, actualPath.Length); Assert.IsTrue(_pathBytes.SequenceEqual(actualPath)); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadRequestTest.cs index 6c8fd46ca..157655046 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadRequestTest.cs @@ -25,12 +25,12 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _handle = new byte[random.Next(1, 10)]; random.NextBytes(_handle); - _offset = (ulong) random.Next(0, int.MaxValue); - _length = (uint) random.Next(0, int.MaxValue); + _offset = (ulong)random.Next(0, int.MaxValue); + _length = (uint)random.Next(0, int.MaxValue); } [TestMethod] @@ -118,11 +118,11 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.Read, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.Read, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _handle.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_handle.Length, sshDataStream.ReadUInt32()); var actualHandle = new byte[_handle.Length]; sshDataStream.Read(actualHandle, 0, actualHandle.Length); Assert.IsTrue(_handle.SequenceEqual(actualHandle)); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRealPathRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRealPathRequestTest.cs index fa6403ab2..423ff9047 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRealPathRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRealPathRequestTest.cs @@ -27,8 +27,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _encoding = Encoding.Unicode; _path = random.Next().ToString(CultureInfo.InvariantCulture); _pathBytes = _encoding.GetBytes(_path); @@ -130,11 +130,11 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.RealPath, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.RealPath, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _pathBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_pathBytes.Length, sshDataStream.ReadUInt32()); var actualPath = new byte[_pathBytes.Length]; sshDataStream.Read(actualPath, 0, actualPath.Length); Assert.IsTrue(_pathBytes.SequenceEqual(actualPath)); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRemoveRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRemoveRequestTest.cs index a7d150421..6d9dc367e 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRemoveRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRemoveRequestTest.cs @@ -27,8 +27,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _encoding = Encoding.Unicode; _filename = random.Next().ToString(CultureInfo.InvariantCulture); _filenameBytes = _encoding.GetBytes(_filename); @@ -80,11 +80,11 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.Remove, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.Remove, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _filenameBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_filenameBytes.Length, sshDataStream.ReadUInt32()); var actualFilename = new byte[_filenameBytes.Length]; sshDataStream.Read(actualFilename, 0, actualFilename.Length); Assert.IsTrue(_filenameBytes.SequenceEqual(actualFilename)); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRenameRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRenameRequestTest.cs index 211dab62e..da95feb9d 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRenameRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRenameRequestTest.cs @@ -29,8 +29,8 @@ protected override void OnInit() { var random = new Random(); - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _encoding = Encoding.Unicode; _oldPath = random.Next().ToString(CultureInfo.InvariantCulture); _oldPathBytes = _encoding.GetBytes(_oldPath); @@ -87,16 +87,16 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.Rename, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.Rename, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _oldPathBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_oldPathBytes.Length, sshDataStream.ReadUInt32()); var actualOldPath = new byte[_oldPathBytes.Length]; sshDataStream.Read(actualOldPath, 0, actualOldPath.Length); Assert.IsTrue(_oldPathBytes.SequenceEqual(actualOldPath)); - Assert.AreEqual((uint) _newPathBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_newPathBytes.Length, sshDataStream.ReadUInt32()); var actualNewPath = new byte[_newPathBytes.Length]; sshDataStream.Read(actualNewPath, 0, actualNewPath.Length); Assert.IsTrue(_newPathBytes.SequenceEqual(actualNewPath)); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRmDirRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRmDirRequestTest.cs index 3527e4967..97a7964b7 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRmDirRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRmDirRequestTest.cs @@ -27,8 +27,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _encoding = Encoding.Unicode; _path = random.Next().ToString(CultureInfo.InvariantCulture); _pathBytes = _encoding.GetBytes(_path); @@ -82,11 +82,11 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.RmDir, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.RmDir, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _pathBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_pathBytes.Length, sshDataStream.ReadUInt32()); var actualPath = new byte[_pathBytes.Length]; _ = sshDataStream.Read(actualPath, 0, actualPath.Length); Assert.IsTrue(_pathBytes.SequenceEqual(actualPath)); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSetStatRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSetStatRequestTest.cs index 541458adc..4201391a9 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSetStatRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSetStatRequestTest.cs @@ -29,8 +29,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _encoding = Encoding.Unicode; _path = random.Next().ToString(CultureInfo.InvariantCulture); _pathBytes = _encoding.GetBytes(_path); @@ -90,11 +90,11 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.SetStat, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.SetStat, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _pathBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_pathBytes.Length, sshDataStream.ReadUInt32()); var actualPath = new byte[_pathBytes.Length]; sshDataStream.Read(actualPath, 0, actualPath.Length); Assert.IsTrue(_pathBytes.SequenceEqual(actualPath)); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpStatRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpStatRequestTest.cs index da0c12f4d..a1b47c407 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpStatRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpStatRequestTest.cs @@ -27,8 +27,8 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _encoding = Encoding.Unicode; _path = random.Next().ToString(CultureInfo.InvariantCulture); _pathBytes = _encoding.GetBytes(_path); @@ -100,11 +100,11 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.Stat, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.Stat, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _pathBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_pathBytes.Length, sshDataStream.ReadUInt32()); var actualPath = new byte[_pathBytes.Length]; sshDataStream.Read(actualPath, 0, actualPath.Length); Assert.IsTrue(_pathBytes.SequenceEqual(actualPath)); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSymLinkRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSymLinkRequestTest.cs index d54222c3e..b1774426a 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSymLinkRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSymLinkRequestTest.cs @@ -29,8 +29,8 @@ protected override void OnInit() { var random = new Random(); - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _encoding = Encoding.Unicode; _newLinkPath = random.Next().ToString(CultureInfo.InvariantCulture); _newLinkPathBytes = _encoding.GetBytes(_newLinkPath); @@ -105,16 +105,16 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.SymLink, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.SymLink, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _newLinkPathBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_newLinkPathBytes.Length, sshDataStream.ReadUInt32()); var actualNewLinkPath = new byte[_newLinkPathBytes.Length]; sshDataStream.Read(actualNewLinkPath, 0, actualNewLinkPath.Length); Assert.IsTrue(_newLinkPathBytes.SequenceEqual(actualNewLinkPath)); - Assert.AreEqual((uint) _existingPathBytes.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_existingPathBytes.Length, sshDataStream.ReadUInt32()); var actualExistingPath = new byte[_existingPathBytes.Length]; sshDataStream.Read(actualExistingPath, 0, actualExistingPath.Length); Assert.IsTrue(_existingPathBytes.SequenceEqual(actualExistingPath)); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpUnblockRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpUnblockRequestTest.cs index b6c0a0699..6e1ec406e 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpUnblockRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpUnblockRequestTest.cs @@ -25,12 +25,12 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _handle = new byte[random.Next(1, 10)]; random.NextBytes(_handle); - _offset = (ulong) random.Next(0, int.MaxValue); - _length = (ulong) random.Next(0, int.MaxValue); + _offset = (ulong)random.Next(0, int.MaxValue); + _length = (ulong)random.Next(0, int.MaxValue); } [TestMethod] @@ -79,11 +79,11 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.Unblock, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.Unblock, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _handle.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_handle.Length, sshDataStream.ReadUInt32()); var actualHandle = new byte[_handle.Length]; _ = sshDataStream.Read(actualHandle, 0, actualHandle.Length); Assert.IsTrue(_handle.SequenceEqual(actualHandle)); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpWriteRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpWriteRequestTest.cs index 9bf226f41..64feeceed 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpWriteRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpWriteRequestTest.cs @@ -27,11 +27,11 @@ public void Init() { var random = new Random(); - _protocolVersion = (uint) random.Next(0, int.MaxValue); - _requestId = (uint) random.Next(0, int.MaxValue); + _protocolVersion = (uint)random.Next(0, int.MaxValue); + _requestId = (uint)random.Next(0, int.MaxValue); _handle = new byte[random.Next(1, 10)]; random.NextBytes(_handle); - _serverFileOffset = (ulong) random.Next(0, int.MaxValue); + _serverFileOffset = (ulong)random.Next(0, int.MaxValue); _data = new byte[random.Next(10, 15)]; random.NextBytes(_data); _offset = random.Next(0, _data.Length - 1); @@ -97,18 +97,18 @@ public void GetBytes() var sshDataStream = new SshDataStream(bytes); - Assert.AreEqual((uint) bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.Write, sshDataStream.ReadByte()); + Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); + Assert.AreEqual((byte)SftpMessageTypes.Write, sshDataStream.ReadByte()); Assert.AreEqual(_requestId, sshDataStream.ReadUInt32()); - Assert.AreEqual((uint) _handle.Length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_handle.Length, sshDataStream.ReadUInt32()); var actualHandle = new byte[_handle.Length]; sshDataStream.Read(actualHandle, 0, actualHandle.Length); Assert.IsTrue(_handle.SequenceEqual(actualHandle)); Assert.AreEqual(_serverFileOffset, sshDataStream.ReadUInt64()); - Assert.AreEqual((uint) _length, sshDataStream.ReadUInt32()); + Assert.AreEqual((uint)_length, sshDataStream.ReadUInt32()); var actualData = new byte[_length]; sshDataStream.Read(actualData, 0, actualData.Length); Assert.IsTrue(_data.Take(_offset, _length).SequenceEqual(actualData)); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/ExtendedReplies/StatVfsReplyInfoTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/ExtendedReplies/StatVfsReplyInfoTest.cs index 83b4a87a2..e64a6e93b 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/ExtendedReplies/StatVfsReplyInfoTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/ExtendedReplies/StatVfsReplyInfoTest.cs @@ -28,17 +28,17 @@ public class StatVfsReplyInfoTest public void Init() { _random = new Random(); - _responseId = (uint) _random.Next(0, int.MaxValue); - _bsize = (ulong) _random.Next(0, int.MaxValue); - _frsize = (ulong) _random.Next(0, int.MaxValue); - _blocks = (ulong) _random.Next(0, int.MaxValue); - _bfree = (ulong) _random.Next(0, int.MaxValue); - _bavail = (ulong) _random.Next(0, int.MaxValue); - _files = (ulong) _random.Next(0, int.MaxValue); - _ffree = (ulong) _random.Next(0, int.MaxValue); - _favail = (ulong) _random.Next(0, int.MaxValue); - _sid = (ulong) _random.Next(0, int.MaxValue); - _namemax = (ulong) _random.Next(0, int.MaxValue); + _responseId = (uint)_random.Next(0, int.MaxValue); + _bsize = (ulong)_random.Next(0, int.MaxValue); + _frsize = (ulong)_random.Next(0, int.MaxValue); + _blocks = (ulong)_random.Next(0, int.MaxValue); + _bfree = (ulong)_random.Next(0, int.MaxValue); + _bavail = (ulong)_random.Next(0, int.MaxValue); + _files = (ulong)_random.Next(0, int.MaxValue); + _ffree = (ulong)_random.Next(0, int.MaxValue); + _favail = (ulong)_random.Next(0, int.MaxValue); + _sid = (ulong)_random.Next(0, int.MaxValue); + _namemax = (ulong)_random.Next(0, int.MaxValue); } [TestMethod] @@ -63,7 +63,7 @@ public void Load() sshDataStream.Write(_ffree); sshDataStream.Write(_favail); sshDataStream.Write(_sid); - sshDataStream.Write((ulong) 0x1); + sshDataStream.Write((ulong)0x1); sshDataStream.Write(_namemax); var extendedReplyResponse = new SftpExtendedReplyResponse(SftpSession.MaximumSupportedVersion); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpAttrsResponseTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpAttrsResponseTest.cs index d0267b4a0..ed8996512 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpAttrsResponseTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpAttrsResponseTest.cs @@ -19,8 +19,8 @@ public class SftpAttrsResponseTest public void Init() { _random = new Random(); - _protocolVersion = (uint) _random.Next(0, int.MaxValue); - _responseId = (uint) _random.Next(0, int.MaxValue); + _protocolVersion = (uint)_random.Next(0, int.MaxValue); + _responseId = (uint)_random.Next(0, int.MaxValue); } [TestMethod] @@ -30,7 +30,7 @@ public void Constructor() Assert.IsNull(target.Attributes); Assert.AreEqual(_protocolVersion, target.ProtocolVersion); - Assert.AreEqual((uint) 0, target.ResponseId); + Assert.AreEqual((uint)0, target.ResponseId); Assert.AreEqual(SftpMessageTypes.Attrs, target.SftpMessageType); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpDataResponseTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpDataResponseTest.cs index 662e93dec..99431d647 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpDataResponseTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpDataResponseTest.cs @@ -21,8 +21,8 @@ public class SftpDataResponseTest public void Init() { _random = new Random(); - _protocolVersion = (uint) _random.Next(0, int.MaxValue); - _responseId = (uint) _random.Next(0, int.MaxValue); + _protocolVersion = (uint)_random.Next(0, int.MaxValue); + _responseId = (uint)_random.Next(0, int.MaxValue); _data = new byte[_random.Next(10, 100)]; _random.NextBytes(_data); } @@ -34,7 +34,7 @@ public void Constructor() Assert.IsNull(target.Data); Assert.AreEqual(_protocolVersion, target.ProtocolVersion); - Assert.AreEqual((uint) 0, target.ResponseId); + Assert.AreEqual((uint)0, target.ResponseId); Assert.AreEqual(SftpMessageTypes.Data, target.SftpMessageType); } @@ -45,7 +45,7 @@ public void Load() var sshDataStream = new SshDataStream(4 + _data.Length); sshDataStream.Write(_responseId); - sshDataStream.Write((uint) _data.Length); + sshDataStream.Write((uint)_data.Length); sshDataStream.Write(_data, 0, _data.Length); var sshData = sshDataStream.ToArray(); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpExtendedReplyResponseTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpExtendedReplyResponseTest.cs index 80cd27e93..ee3f18c44 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpExtendedReplyResponseTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpExtendedReplyResponseTest.cs @@ -19,8 +19,8 @@ public class SftpExtendedReplyResponseTest public void Init() { _random = new Random(); - _protocolVersion = (uint) _random.Next(0, int.MaxValue); - _responseId = (uint) _random.Next(0, int.MaxValue); + _protocolVersion = (uint)_random.Next(0, int.MaxValue); + _responseId = (uint)_random.Next(0, int.MaxValue); } [TestMethod] @@ -29,7 +29,7 @@ public void Constructor() var target = new SftpExtendedReplyResponse(_protocolVersion); Assert.AreEqual(_protocolVersion, target.ProtocolVersion); - Assert.AreEqual((uint) 0, target.ResponseId); + Assert.AreEqual((uint)0, target.ResponseId); Assert.AreEqual(SftpMessageTypes.ExtendedReply, target.SftpMessageType); } @@ -51,22 +51,22 @@ public void Load() [TestMethod] public void GetReply_StatVfsReplyInfo() { - var bsize = (ulong) _random.Next(0, int.MaxValue); - var frsize = (ulong) _random.Next(0, int.MaxValue); - var blocks = (ulong) _random.Next(0, int.MaxValue); - var bfree = (ulong) _random.Next(0, int.MaxValue); - var bavail = (ulong) _random.Next(0, int.MaxValue); - var files = (ulong) _random.Next(0, int.MaxValue); - var ffree = (ulong) _random.Next(0, int.MaxValue); - var favail = (ulong) _random.Next(0, int.MaxValue); - var sid = (ulong) _random.Next(0, int.MaxValue); - var namemax = (ulong) _random.Next(0, int.MaxValue); + var bsize = (ulong)_random.Next(0, int.MaxValue); + var frsize = (ulong)_random.Next(0, int.MaxValue); + var blocks = (ulong)_random.Next(0, int.MaxValue); + var bfree = (ulong)_random.Next(0, int.MaxValue); + var bavail = (ulong)_random.Next(0, int.MaxValue); + var files = (ulong)_random.Next(0, int.MaxValue); + var ffree = (ulong)_random.Next(0, int.MaxValue); + var favail = (ulong)_random.Next(0, int.MaxValue); + var sid = (ulong)_random.Next(0, int.MaxValue); + var namemax = (ulong)_random.Next(0, int.MaxValue); var sshDataStream = new SshDataStream(4 + 1 + 4 + 88) { Position = 4 // skip 4 bytes for SSH packet length }; - sshDataStream.WriteByte((byte) SftpMessageTypes.Attrs); + sshDataStream.WriteByte((byte)SftpMessageTypes.Attrs); sshDataStream.Write(_responseId); sshDataStream.Write(bsize); sshDataStream.Write(frsize); @@ -77,7 +77,7 @@ public void GetReply_StatVfsReplyInfo() sshDataStream.Write(ffree); sshDataStream.Write(favail); sshDataStream.Write(sid); - sshDataStream.Write((ulong) 0x2); + sshDataStream.Write((ulong)0x2); sshDataStream.Write(namemax); var sshData = sshDataStream.ToArray(); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpHandleResponseTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpHandleResponseTest.cs index a75da1564..a81dcbc53 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpHandleResponseTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpHandleResponseTest.cs @@ -21,8 +21,8 @@ public class SftpHandleResponseTest public void Init() { _random = new Random(); - _protocolVersion = (uint) _random.Next(0, int.MaxValue); - _responseId = (uint) _random.Next(0, int.MaxValue); + _protocolVersion = (uint)_random.Next(0, int.MaxValue); + _responseId = (uint)_random.Next(0, int.MaxValue); _handle = new byte[_random.Next(1, 10)]; _random.NextBytes(_handle); } @@ -34,7 +34,7 @@ public void Constructor() Assert.IsNull(target.Handle); Assert.AreEqual(_protocolVersion, target.ProtocolVersion); - Assert.AreEqual((uint) 0, target.ResponseId); + Assert.AreEqual((uint)0, target.ResponseId); Assert.AreEqual(SftpMessageTypes.Handle, target.SftpMessageType); } @@ -45,7 +45,7 @@ public void Load() var sshDataStream = new SshDataStream(4 + _handle.Length); sshDataStream.Write(_responseId); - sshDataStream.Write((uint) _handle.Length); + sshDataStream.Write((uint)_handle.Length); sshDataStream.Write(_handle, 0, _handle.Length); target.Load(sshDataStream.ToArray()); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_LastChunkBeforeEofIsComplete.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_LastChunkBeforeEofIsComplete.cs index f2a661c5c..7acd13fa0 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_LastChunkBeforeEofIsComplete.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_LastChunkBeforeEofIsComplete.cs @@ -72,7 +72,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk1, false); }) - .Returns((SftpReadAsyncResult) null); + .Returns((SftpReadAsyncResult)null); SftpSessionMock.InSequence(_seq).Setup(p => p.OperationTimeout).Returns(_operationTimeout); SftpSessionMock.InSequence(_seq) .Setup(p => p.WaitAny(_waitHandleArray, _operationTimeout)) @@ -84,7 +84,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk2, false); }) - .Returns((SftpReadAsyncResult) null); + .Returns((SftpReadAsyncResult)null); SftpSessionMock.InSequence(_seq).Setup(p => p.OperationTimeout).Returns(_operationTimeout); SftpSessionMock.InSequence(_seq) .Setup(p => p.WaitAny(_waitHandleArray, _operationTimeout)) diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_LastChunkBeforeEofIsPartial.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_LastChunkBeforeEofIsPartial.cs index b3fa7f4ef..2c42ee226 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_LastChunkBeforeEofIsPartial.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_LastChunkBeforeEofIsPartial.cs @@ -69,7 +69,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk1, false); }) - .Returns((SftpReadAsyncResult) null); + .Returns((SftpReadAsyncResult)null); SftpSessionMock.InSequence(_seq).Setup(p => p.OperationTimeout).Returns(_operationTimeout); SftpSessionMock.InSequence(_seq) .Setup(p => p.WaitAny(_waitHandleArray, _operationTimeout)) @@ -81,7 +81,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk2, false); }) - .Returns((SftpReadAsyncResult) null); + .Returns((SftpReadAsyncResult)null); SftpSessionMock.InSequence(_seq).Setup(p => p.OperationTimeout).Returns(_operationTimeout); SftpSessionMock.InSequence(_seq) .Setup(p => p.WaitAny(_waitHandleArray, _operationTimeout)) @@ -93,7 +93,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk3, false); }) - .Returns((SftpReadAsyncResult) null); + .Returns((SftpReadAsyncResult)null); } protected override void Arrange() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_PreviousChunkIsIncompleteAndEofIsNotReached.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_PreviousChunkIsIncompleteAndEofIsNotReached.cs index ddc4aa648..b364f60dd 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_PreviousChunkIsIncompleteAndEofIsNotReached.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_PreviousChunkIsIncompleteAndEofIsNotReached.cs @@ -101,7 +101,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk1, false); }) - .Returns((SftpReadAsyncResult) null); + .Returns((SftpReadAsyncResult)null); _ = SftpSessionMock.InSequence(_seq) .Setup(p => p.OperationTimeout) .Returns(_operationTimeout); @@ -116,7 +116,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk2, false); }) - .Returns((SftpReadAsyncResult) null); + .Returns((SftpReadAsyncResult)null); _ = SftpSessionMock.InSequence(_seq) .Setup(p => p.OperationTimeout) .Returns(_operationTimeout); @@ -131,7 +131,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk3, false); }) - .Returns((SftpReadAsyncResult) null); + .Returns((SftpReadAsyncResult)null); _ = SftpSessionMock.InSequence(_seq) .Setup(p => p.OperationTimeout) .Returns(_operationTimeout); @@ -146,7 +146,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk4, false); }) - .Returns((SftpReadAsyncResult) null); + .Returns((SftpReadAsyncResult)null); _ = SftpSessionMock.InSequence(_seq) .Setup(p => p.OperationTimeout) .Returns(_operationTimeout); @@ -161,7 +161,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk5, false); }) - .Returns((SftpReadAsyncResult) null); + .Returns((SftpReadAsyncResult)null); _ = SftpSessionMock.InSequence(_seq) .Setup(p => p.OperationTimeout) .Returns(_operationTimeout); @@ -183,7 +183,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk6, false); }) - .Returns((SftpReadAsyncResult) null); + .Returns((SftpReadAsyncResult)null); } protected override void Arrange() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_PreviousChunkIsIncompleteAndEofIsReached.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_PreviousChunkIsIncompleteAndEofIsReached.cs index b107b8668..5d1f69121 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_PreviousChunkIsIncompleteAndEofIsReached.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_PreviousChunkIsIncompleteAndEofIsReached.cs @@ -81,7 +81,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk1, false); }) - .Returns((SftpReadAsyncResult) null); + .Returns((SftpReadAsyncResult)null); _ = SftpSessionMock.InSequence(_seq) .Setup(p => p.OperationTimeout) .Returns(_operationTimeout); @@ -96,7 +96,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk2, false); }) - .Returns((SftpReadAsyncResult) null); + .Returns((SftpReadAsyncResult)null); _ = SftpSessionMock.InSequence(_seq) .Setup(p => p.OperationTimeout) .Returns(_operationTimeout); @@ -111,7 +111,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk3, false); }) - .Returns((SftpReadAsyncResult) null); + .Returns((SftpReadAsyncResult)null); _ = SftpSessionMock.InSequence(_seq) .Setup(p => p.RequestRead(_handle, (2 * ChunkLength) - 10, 10)) .Returns(_chunk2CatchUp); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_ReadAheadEndInvokeException_DiscardsFurtherReadAheads.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_ReadAheadEndInvokeException_DiscardsFurtherReadAheads.cs index 72eb580e0..6026e94d0 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_ReadAheadEndInvokeException_DiscardsFurtherReadAheads.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_ReadAheadEndInvokeException_DiscardsFurtherReadAheads.cs @@ -91,7 +91,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk1, false); }) - .Returns((SftpReadAsyncResult) null); + .Returns((SftpReadAsyncResult)null); SftpSessionMock.InSequence(_seq).Setup(p => p.OperationTimeout).Returns(_operationTimeout); SftpSessionMock.InSequence(_seq) .Setup(p => p.WaitAny(_waitHandleArray, _operationTimeout)) @@ -114,7 +114,7 @@ protected override void SetupMocks() _readAheadChunk2Completed.Set(); }); }) - .Returns((SftpReadAsyncResult) null); + .Returns((SftpReadAsyncResult)null); SftpSessionMock.InSequence(_seq).Setup(p => p.OperationTimeout).Returns(_operationTimeout); SftpSessionMock.InSequence(_seq) .Setup(p => p.WaitAny(_waitHandleArray, _operationTimeout)) @@ -128,7 +128,7 @@ protected override void SetupMocks() // signal that we've completed the read-ahead for chunk3 _readAheadChunk3Completed.Set(); }) - .Returns((SftpReadAsyncResult) null); + .Returns((SftpReadAsyncResult)null); SftpSessionMock.InSequence(_seq).Setup(p => p.OperationTimeout).Returns(_operationTimeout); SftpSessionMock.InSequence(_seq) .Setup(p => p.WaitAny(_waitHandleArray, _operationTimeout)) diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_ReadAheadEndInvokeException_PreventsFurtherReadAheads.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_ReadAheadEndInvokeException_PreventsFurtherReadAheads.cs index ed4f6b788..881b52296 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_ReadAheadEndInvokeException_PreventsFurtherReadAheads.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_ReadAheadEndInvokeException_PreventsFurtherReadAheads.cs @@ -74,7 +74,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk1, false); }) - .Returns((SftpReadAsyncResult) null); + .Returns((SftpReadAsyncResult)null); _ = SftpSessionMock.InSequence(_seq) .Setup(p => p.OperationTimeout) .Returns(_operationTimeout); @@ -98,7 +98,7 @@ protected override void SetupMocks() asyncResult.SetAsCompleted(_exception, false); }); }) - .Returns((SftpReadAsyncResult) null); + .Returns((SftpReadAsyncResult)null); _ = SftpSessionMock.InSequence(_seq) .Setup(p => p.OperationTimeout) .Returns(_operationTimeout); diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInBeginRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInBeginRead.cs index 0ea24e11c..c7022a548 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInBeginRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInBeginRead.cs @@ -73,7 +73,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk1, false); }) - .Returns((SftpReadAsyncResult) null); + .Returns((SftpReadAsyncResult)null); SftpSessionMock.InSequence(_seq).Setup(p => p.OperationTimeout).Returns(_operationTimeout); SftpSessionMock.InSequence(_seq) .Setup(p => p.WaitAny(_waitHandleArray, _operationTimeout)) @@ -85,7 +85,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk2, false); }) - .Returns((SftpReadAsyncResult) null); + .Returns((SftpReadAsyncResult)null); SftpSessionMock.InSequence(_seq).Setup(p => p.OperationTimeout).Returns(_operationTimeout); SftpSessionMock.InSequence(_seq) .Setup(p => p.WaitAny(_waitHandleArray, _operationTimeout)) diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInWaitOnHandle_ChunkAvailable.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInWaitOnHandle_ChunkAvailable.cs index 98e9a1229..45ceb7079 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInWaitOnHandle_ChunkAvailable.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInWaitOnHandle_ChunkAvailable.cs @@ -70,7 +70,7 @@ protected override void SetupMocks() var asyncResult = new SftpReadAsyncResult(callback, state); asyncResult.SetAsCompleted(_chunk1, false); }) - .Returns((SftpReadAsyncResult) null); + .Returns((SftpReadAsyncResult)null); SftpSessionMock.InSequence(_seq).Setup(p => p.OperationTimeout).Returns(_operationTimeout); SftpSessionMock.InSequence(_seq) .Setup(p => p.WaitAny(_waitHandleArray, _operationTimeout)) diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInWaitOnHandle_NoChunkAvailable.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInWaitOnHandle_NoChunkAvailable.cs index 6ef4563bc..3456a5f94 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInWaitOnHandle_NoChunkAvailable.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInWaitOnHandle_NoChunkAvailable.cs @@ -59,7 +59,7 @@ protected override void SetupMocks() .Returns(() => WaitAny(_waitHandleArray, _operationTimeout)); SftpSessionMock.InSequence(_seq) .Setup(p => p.BeginRead(_handle, 0, ChunkLength, It.IsNotNull(), It.IsAny())) - .Returns((SftpReadAsyncResult) null); + .Returns((SftpReadAsyncResult)null); SftpSessionMock.InSequence(_seq).Setup(p => p.OperationTimeout).Returns(_operationTimeout); SftpSessionMock.InSequence(_seq) .Setup(p => p.WaitAny(_waitHandleArray, _operationTimeout)) diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessRead.cs index 3671bfbe3..3209d5ee4 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessRead.cs @@ -27,9 +27,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(3, random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); } protected override void SetupMocks() @@ -58,7 +58,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize); + (int)_bufferSize); _target.Close(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessReadWrite.cs index 29ad6bc27..335233d3b 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessReadWrite.cs @@ -27,9 +27,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(3, random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); } protected override void SetupMocks() @@ -58,7 +58,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.ReadWrite, - (int) _bufferSize); + (int)_bufferSize); _target.Close(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessWrite.cs index 656746b70..4a84eaf84 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessWrite.cs @@ -27,9 +27,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(3, random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); } protected override void SetupMocks() @@ -58,7 +58,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Write, - (int) _bufferSize); + (int)_bufferSize); _target.Close(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessRead.cs index a8daf091c..2be256a3a 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessRead.cs @@ -27,9 +27,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(1, random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); } protected override void SetupMocks() @@ -58,7 +58,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize); + (int)_bufferSize); _target.Dispose(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessReadWrite.cs index 7b76093e8..aa618feb4 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessReadWrite.cs @@ -27,9 +27,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(1, random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); } protected override void SetupMocks() @@ -58,7 +58,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.ReadWrite, - (int) _bufferSize); + (int)_bufferSize); _target.Dispose(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessWrite.cs index dfcf89b04..506c42141 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessWrite.cs @@ -27,9 +27,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(1, random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); } protected override void SetupMocks() @@ -58,7 +58,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Write, - (int) _bufferSize); + (int)_bufferSize); _target.Dispose(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessRead.cs index 4326df384..519e7a529 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessRead.cs @@ -27,9 +27,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(1, random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); } protected override void SetupMocks() @@ -58,7 +58,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize); + (int)_bufferSize); _target.Close(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessReadWrite.cs index 2e386c20d..730f95429 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessReadWrite.cs @@ -27,9 +27,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(1, random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); } protected override void SetupMocks() @@ -58,7 +58,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.ReadWrite, - (int) _bufferSize); + (int)_bufferSize); _target.Close(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessWrite.cs index 0760e0358..a187b0d07 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessWrite.cs @@ -27,9 +27,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(1, random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); } protected override void SetupMocks() @@ -58,7 +58,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Write, - (int) _bufferSize); + (int)_bufferSize); _target.Close(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessRead.cs index 32c3323df..669a20a5b 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessRead.cs @@ -27,9 +27,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(1, random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); } protected override void SetupMocks() @@ -58,7 +58,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize); + (int)_bufferSize); _target.Dispose(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessReadWrite.cs index 6298cb7d4..0c3ceb803 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessReadWrite.cs @@ -27,9 +27,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(1, random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); } protected override void SetupMocks() @@ -58,7 +58,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.ReadWrite, - (int) _bufferSize); + (int)_bufferSize); _target.Dispose(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessWrite.cs index 15d854a57..b1bc4e482 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Disposed_FileAccessWrite.cs @@ -27,9 +27,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(1, random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); } protected override void SetupMocks() @@ -58,7 +58,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Write, - (int) _bufferSize); + (int)_bufferSize); _target.Dispose(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_Closed.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_Closed.cs index 5da38e1a9..b52537fb8 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_Closed.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_Closed.cs @@ -32,10 +32,10 @@ protected void Arrange() { var random = new Random(); _path = random.Next().ToString(CultureInfo.InvariantCulture); - _handle = new[] { (byte) random.Next(byte.MinValue, byte.MaxValue) }; - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _handle = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) }; + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(0, 1000); + _writeBufferSize = (uint)random.Next(0, 1000); _sftpSessionMock = new Mock(MockBehavior.Strict); @@ -56,7 +56,7 @@ protected void Arrange() _ = _sftpSessionMock.InSequence(sequence) .Setup(p => p.RequestClose(_handle)); - _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Open, FileAccess.Read, (int) _bufferSize); + _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Open, FileAccess.Read, (int)_bufferSize); _sftpFileStream.Close(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_Disposed.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_Disposed.cs index 451d95324..7625e284c 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_Disposed.cs @@ -26,9 +26,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(2, random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); } protected override void SetupMocks() @@ -57,7 +57,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize); + (int)_bufferSize); _target.Dispose(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_SessionNotOpen.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_SessionNotOpen.cs index 5145a7683..48fc75472 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_SessionNotOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_SessionNotOpen.cs @@ -26,9 +26,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(2, random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); } protected override void SetupMocks() @@ -55,7 +55,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize); + (int)_bufferSize); } protected override void Act() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_SessionOpen.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_SessionOpen.cs index ce7a09a2d..911f1d111 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_SessionOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Close_SessionOpen.cs @@ -26,9 +26,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(2, random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); } protected override void SetupMocks() @@ -57,7 +57,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize); + (int)_bufferSize); } protected override void Act() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeAppend_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeAppend_FileAccessWrite.cs index d221e0e20..63ee0a1ab 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeAppend_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeAppend_FileAccessWrite.cs @@ -34,15 +34,15 @@ protected override void SetupData() _fileMode = FileMode.Append; _fileAccess = FileAccess.Write; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _fileAttributes = new SftpFileAttributesBuilder().WithLastAccessTime(DateTime.UtcNow.AddSeconds(_random.Next())) .WithLastWriteTime(DateTime.UtcNow.AddSeconds(_random.Next())) .WithSize(_random.Next()) .WithUserId(_random.Next()) .WithGroupId(_random.Next()) - .WithPermissions((uint) _random.Next()) + .WithPermissions((uint)_random.Next()) .Build(); } @@ -52,10 +52,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpen(_path, Flags.Write | Flags.Append | Flags.CreateNewOrOpen, false)) .Returns(_handle); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); _ = SftpSessionMock.InSequence(MockSequence) .Setup(p => p.RequestFStat(_handle, false)) @@ -162,12 +162,12 @@ public void WriteShouldStartWritingAtEndOfFile() .Setup(p => p.IsOpen) .Returns(true); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestWrite(_handle, (ulong) _fileAttributes.Size, buffer, 0, buffer.Length, It.IsNotNull(), null)); + .Setup(p => p.RequestWrite(_handle, (ulong)_fileAttributes.Size, buffer, 0, buffer.Length, It.IsNotNull(), null)); _target.Write(buffer, 0, buffer.Length); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(1)); - SftpSessionMock.Verify(p => p.RequestWrite(_handle, (ulong) _fileAttributes.Size, buffer, 0, buffer.Length, It.IsNotNull(), null), Times.Once); + SftpSessionMock.Verify(p => p.RequestWrite(_handle, (ulong)_fileAttributes.Size, buffer, 0, buffer.Length, It.IsNotNull(), null), Times.Once); } [TestMethod] diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreateNew_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreateNew_FileAccessReadWrite.cs index 5af19627c..93721ba50 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreateNew_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreateNew_FileAccessReadWrite.cs @@ -33,8 +33,8 @@ protected override void SetupData() _fileMode = FileMode.CreateNew; _fileAccess = FileAccess.ReadWrite; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); } @@ -44,10 +44,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Write | Flags.CreateNew, false)) .Returns(_handle); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreateNew_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreateNew_FileAccessWrite.cs index 50de48c4f..6d6483f02 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreateNew_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreateNew_FileAccessWrite.cs @@ -32,8 +32,8 @@ protected override void SetupData() _fileMode = FileMode.CreateNew; _fileAccess = FileAccess.Write; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); } @@ -43,10 +43,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpen(_path, Flags.Write | Flags.CreateNew, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessReadWrite_FileDoesNotExist.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessReadWrite_FileDoesNotExist.cs index 7bd303f62..c226dfd9e 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessReadWrite_FileDoesNotExist.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessReadWrite_FileDoesNotExist.cs @@ -33,8 +33,8 @@ protected override void SetupData() _fileMode = FileMode.Create; _fileAccess = FileAccess.ReadWrite; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); } @@ -42,15 +42,15 @@ protected override void SetupMocks() { _ = SftpSessionMock.InSequence(MockSequence) .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Write | Flags.Truncate, true)) - .Returns((byte[]) null); + .Returns((byte[])null); _ = SftpSessionMock.InSequence(MockSequence) .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Write | Flags.CreateNew, false)) .Returns(_handle); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessReadWrite_FileExists.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessReadWrite_FileExists.cs index b66fd1e82..4c39283e3 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessReadWrite_FileExists.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessReadWrite_FileExists.cs @@ -33,8 +33,8 @@ protected override void SetupData() _fileMode = FileMode.Create; _fileAccess = FileAccess.ReadWrite; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); } @@ -44,10 +44,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Write | Flags.Truncate, true)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessWrite_FileDoesNotExist.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessWrite_FileDoesNotExist.cs index 78e1a8255..ff42941f0 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessWrite_FileDoesNotExist.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessWrite_FileDoesNotExist.cs @@ -32,8 +32,8 @@ protected override void SetupData() _fileMode = FileMode.Create; _fileAccess = FileAccess.Write; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); } @@ -41,15 +41,15 @@ protected override void SetupMocks() { SftpSessionMock.InSequence(MockSequence) .Setup(p => p.RequestOpen(_path, Flags.Write | Flags.Truncate, true)) - .Returns((byte[]) null); + .Returns((byte[])null); SftpSessionMock.InSequence(MockSequence) .Setup(p => p.RequestOpen(_path, Flags.Write | Flags.CreateNew, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessWrite_FileExists.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessWrite_FileExists.cs index 3dfa943e1..d4206069e 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessWrite_FileExists.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessWrite_FileExists.cs @@ -32,8 +32,8 @@ protected override void SetupData() _fileMode = FileMode.Create; _fileAccess = FileAccess.Write; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); } @@ -43,10 +43,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpen(_path, Flags.Write | Flags.Truncate, true)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessRead.cs index 4f66e8e69..b845c6b47 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessRead.cs @@ -32,8 +32,8 @@ protected override void SetupData() _fileMode = FileMode.OpenOrCreate; _fileAccess = FileAccess.Read; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); } @@ -43,10 +43,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.CreateNewOrOpen, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessReadWrite.cs index 2ff93f9af..d99593d52 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessReadWrite.cs @@ -33,8 +33,8 @@ protected override void SetupData() _fileMode = FileMode.OpenOrCreate; _fileAccess = FileAccess.ReadWrite; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); } @@ -44,10 +44,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Write | Flags.CreateNewOrOpen, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessWrite.cs index ae14e4589..4f14a7271 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpenOrCreate_FileAccessWrite.cs @@ -32,8 +32,8 @@ protected override void SetupData() _fileMode = FileMode.OpenOrCreate; _fileAccess = FileAccess.Write; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); } @@ -43,10 +43,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpen(_path, Flags.Write | Flags.CreateNewOrOpen, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessRead.cs index 4e71d19f4..f80dcc740 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessRead.cs @@ -32,8 +32,8 @@ protected override void SetupData() _fileMode = FileMode.Open; _fileAccess = FileAccess.Read; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); } @@ -43,10 +43,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpen(_path, Flags.Read, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessReadWrite.cs index 6ffc8c517..f56d64521 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessReadWrite.cs @@ -33,8 +33,8 @@ protected override void SetupData() _fileMode = FileMode.Open; _fileAccess = FileAccess.ReadWrite; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); } @@ -44,10 +44,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Write, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessWrite.cs index fd3904100..84bfae7b0 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeOpen_FileAccessWrite.cs @@ -32,8 +32,8 @@ protected override void SetupData() _fileMode = FileMode.Open; _fileAccess = FileAccess.Write; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); } @@ -43,10 +43,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpen(_path, Flags.Write, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeTruncate_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeTruncate_FileAccessReadWrite.cs index 59e669c55..4a7445b9a 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeTruncate_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeTruncate_FileAccessReadWrite.cs @@ -33,8 +33,8 @@ protected override void SetupData() _fileMode = FileMode.Truncate; _fileAccess = FileAccess.ReadWrite; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); } @@ -44,10 +44,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Write | Flags.Truncate, false)) .Returns(_handle); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeTruncate_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeTruncate_FileAccessWrite.cs index 49294444c..36f265cd2 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeTruncate_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeTruncate_FileAccessWrite.cs @@ -32,8 +32,8 @@ protected override void SetupData() _fileMode = FileMode.Truncate; _fileAccess = FileAccess.Write; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); } @@ -43,10 +43,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpen(_path, Flags.Write | Flags.Truncate, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_Closed.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_Closed.cs index b194338f1..4abdfbe75 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_Closed.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_Closed.cs @@ -26,9 +26,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(random.Next(1, 5), random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); } protected override void SetupMocks() @@ -57,7 +57,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize); + (int)_bufferSize); _target.Close(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_Disposed.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_Disposed.cs index ce41c8734..d4aef3322 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_Disposed.cs @@ -26,9 +26,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(1, random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); } protected override void SetupMocks() @@ -54,7 +54,7 @@ protected override void Arrange() _path, FileMode.OpenOrCreate, FileAccess.Write, - (int) _bufferSize); + (int)_bufferSize); _target.Dispose(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_SessionNotOpen.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_SessionNotOpen.cs index 27858090c..d1e967f23 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_SessionNotOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_SessionNotOpen.cs @@ -26,9 +26,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(2, random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); } protected override void SetupMocks() @@ -57,7 +57,7 @@ protected override void Arrange() _path, FileMode.CreateNew, FileAccess.Write, - (int) _bufferSize); + (int)_bufferSize); } protected override void Act() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_SessionOpen.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_SessionOpen.cs index 09fec553a..2d4ca4762 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_SessionOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Dispose_SessionOpen.cs @@ -27,9 +27,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(CultureInfo.InvariantCulture); _handle = GenerateRandom(2, random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); } protected override void SetupMocks() @@ -57,7 +57,7 @@ protected override void Arrange() _path, FileMode.Truncate, FileAccess.Write, - (int) _bufferSize); + (int)_bufferSize); } protected override void Act() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Finalize_SessionOpen.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Finalize_SessionOpen.cs index 0674c75fe..c0d3be899 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Finalize_SessionOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Finalize_SessionOpen.cs @@ -27,9 +27,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(CultureInfo.InvariantCulture); _handle = GenerateRandom(7, random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); } protected override void SetupMocks() @@ -87,7 +87,7 @@ private WeakReference CreateWeakSftpFileStream() _path, FileMode.OpenOrCreate, FileAccess.ReadWrite, - (int) _bufferSize); + (int)_bufferSize); return new WeakReference(sftpFileStream); } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_DataInBuffer_NotReadFromBuffer.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_DataInBuffer_NotReadFromBuffer.cs index 639122aad..c6ce946ca 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_DataInBuffer_NotReadFromBuffer.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_DataInBuffer_NotReadFromBuffer.cs @@ -30,10 +30,10 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(5, random); - _bufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); _readBufferSize = 100; _writeBufferSize = 500; - _readBytes = new byte[random.Next(1, (int) _readBufferSize - 10)]; + _readBytes = new byte[random.Next(1, (int)_readBufferSize - 10)]; _serverBytes = GenerateRandom(_readBytes.Length + 5); // store 5 bytes in read buffer } @@ -67,7 +67,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize); + (int)_bufferSize); _ = _target.Read(_readBytes, 0, _readBytes.Length); } @@ -101,7 +101,7 @@ public void ReadShouldReadFromServer() .Setup(p => p.IsOpen) .Returns(true); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestRead(_handle, (ulong) _readBytes.Length, _readBufferSize)) + .Setup(p => p.RequestRead(_handle, (ulong)_readBytes.Length, _readBufferSize)) .Returns(serverBytes2); var bytesRead = _target.Read(readBytes2, 2, 3); @@ -109,7 +109,7 @@ public void ReadShouldReadFromServer() Assert.AreEqual(3, bytesRead); CollectionAssert.AreEqual(expectedReadBytes, readBytes2); - SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong) _readBytes.Length, _readBufferSize), Times.Once); + SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong)_readBytes.Length, _readBufferSize), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(3)); } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_DataInBuffer_ReadFromBuffer.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_DataInBuffer_ReadFromBuffer.cs index 5d513b1a7..6f2d12dca 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_DataInBuffer_ReadFromBuffer.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_DataInBuffer_ReadFromBuffer.cs @@ -32,10 +32,10 @@ protected override void SetupData() _path = random.Next().ToString(); _handle = GenerateRandom(5, random); - _bufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); _readBufferSize = 100; _writeBufferSize = 500; - _readBytes1 = new byte[random.Next(1, (int) _readBufferSize - 10)]; + _readBytes1 = new byte[random.Next(1, (int)_readBufferSize - 10)]; _readBytes2 = new byte[random.Next(1, 3)]; _serverBytes = GenerateRandom(_readBytes1.Length + 10); // store 5 bytes in read buffer } @@ -73,7 +73,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize); + (int)_bufferSize); _ = _target.Read(_readBytes1, 0, _readBytes1.Length); _ = _target.Read(_readBytes2, 0, _readBytes2.Length); } @@ -108,7 +108,7 @@ public void ReadShouldReadFromServer() .Setup(p => p.IsOpen) .Returns(true); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestRead(_handle, (ulong) (_readBytes1.Length + _readBytes2.Length), _readBufferSize)) + .Setup(p => p.RequestRead(_handle, (ulong)(_readBytes1.Length + _readBytes2.Length), _readBufferSize)) .Returns(serverBytes3); var bytesRead = _target.Read(readBytes3, 1, 2); @@ -116,7 +116,7 @@ public void ReadShouldReadFromServer() Assert.AreEqual(2, bytesRead); CollectionAssert.AreEqual(expectedReadBytes, readBytes3); - SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong) (_readBytes1.Length + _readBytes2.Length), _readBufferSize), Times.Once); + SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong)(_readBytes1.Length + _readBytes2.Length), _readBufferSize), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(4)); } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_NoDataInBuffer.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_NoDataInBuffer.cs index 7d6b28b31..8463a3133 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_NoDataInBuffer.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_ReadMode_NoDataInBuffer.cs @@ -30,10 +30,10 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(5, random); - _bufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); _readBufferSize = 100; _writeBufferSize = 500; - _readBytes = new byte[random.Next(1, (int) _readBufferSize)]; + _readBytes = new byte[random.Next(1, (int)_readBufferSize)]; _serverBytes = GenerateRandom(_readBytes.Length); } @@ -67,7 +67,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize); + (int)_bufferSize); _ = _target.Read(_readBytes, 0, _readBytes.Length); } @@ -101,7 +101,7 @@ public void ReadShouldReadFromServer() .Setup(p => p.IsOpen) .Returns(true); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestRead(_handle, (ulong) _readBytes.Length, _readBufferSize)) + .Setup(p => p.RequestRead(_handle, (ulong)_readBytes.Length, _readBufferSize)) .Returns(serverBytes2); var bytesRead = _target.Read(readBytes2, 2, 3); @@ -109,7 +109,7 @@ public void ReadShouldReadFromServer() Assert.AreEqual(3, bytesRead); CollectionAssert.AreEqual(expectedReadBytes, readBytes2); - SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong) _readBytes.Length, _readBufferSize), Times.Once); + SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong)_readBytes.Length, _readBufferSize), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(3)); } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_SessionNotOpen.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_SessionNotOpen.cs index 12075a479..a8de06427 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_SessionNotOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_SessionNotOpen.cs @@ -27,7 +27,7 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(5, random); - _bufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); _readBufferSize = 20; _writeBufferSize = 500; } @@ -56,7 +56,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize); + (int)_bufferSize); } protected override void Act() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_WriteMode_DataInBuffer.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_WriteMode_DataInBuffer.cs index a5bfc5940..e2c381cd1 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_WriteMode_DataInBuffer.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_WriteMode_DataInBuffer.cs @@ -35,7 +35,7 @@ protected override void SetupData() _path = random.Next().ToString(); _handle = GenerateRandom(5, random); - _bufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); _readBufferSize = 100; _writeBufferSize = 500; _writeBytes1 = GenerateRandom(_writeBufferSize); @@ -74,7 +74,7 @@ protected override void SetupMocks() .Setup(p => p.IsOpen) .Returns(true); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestWrite(_handle, (ulong) _writeBytes1.Length, It.IsAny(), 0, _writeBytes2.Length + _writeBytes3.Length, It.IsAny(), null)) + .Setup(p => p.RequestWrite(_handle, (ulong)_writeBytes1.Length, It.IsAny(), 0, _writeBytes2.Length + _writeBytes3.Length, It.IsAny(), null)) .Callback>((handle, serverOffset, data, offset, length, wait, writeCompleted) => { _flushedBytes = data.Take(offset, length); @@ -90,7 +90,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.ReadWrite, - (int) _bufferSize); + (int)_bufferSize); _target.Write(_writeBytes1, 0, _writeBytes1.Length); _target.Write(_writeBytes2, 0, _writeBytes2.Length); _target.Write(_writeBytes3, 0, _writeBytes3.Length); @@ -137,7 +137,7 @@ public void ReadShouldReadFromServer() .Setup(p => p.IsOpen) .Returns(true); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestRead(_handle, (ulong) (_writeBytes1.Length + _writeBytes2.Length + _writeBytes3.Length), _readBufferSize)) + .Setup(p => p.RequestRead(_handle, (ulong)(_writeBytes1.Length + _writeBytes2.Length + _writeBytes3.Length), _readBufferSize)) .Returns(serverBytes); var bytesRead = _target.Read(readBytes, 2, 3); @@ -145,7 +145,7 @@ public void ReadShouldReadFromServer() Assert.AreEqual(3, bytesRead); CollectionAssert.AreEqual(expectedReadBytes, readBytes); - SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong) (_writeBytes1.Length + _writeBytes2.Length + _writeBytes3.Length), _readBufferSize), Times.Once); + SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong)(_writeBytes1.Length + _writeBytes2.Length + _writeBytes3.Length), _readBufferSize), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(5)); } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_WriteMode_NoDataInBuffer.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_WriteMode_NoDataInBuffer.cs index 58bc643fc..27ed3abca 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_WriteMode_NoDataInBuffer.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_WriteMode_NoDataInBuffer.cs @@ -31,7 +31,7 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(5, random); - _bufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); _readBufferSize = 100; _writeBufferSize = 500; _writeBytes = GenerateRandom(_writeBufferSize); @@ -71,7 +71,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.ReadWrite, - (int) _bufferSize); + (int)_bufferSize); _target.Write(_writeBytes, 0, _writeBytes.Length); } @@ -105,7 +105,7 @@ public void ReadShouldReadFromServer() .Setup(p => p.IsOpen) .Returns(true); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestRead(_handle, (ulong) _writeBytes.Length, _readBufferSize)) + .Setup(p => p.RequestRead(_handle, (ulong)_writeBytes.Length, _readBufferSize)) .Returns(serverBytes); var bytesRead = _target.Read(readBytes, 2, 3); @@ -113,7 +113,7 @@ public void ReadShouldReadFromServer() Assert.AreEqual(3, bytesRead); CollectionAssert.AreEqual(expectedReadBytes, readBytes); - SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong) _writeBytes.Length, _readBufferSize), Times.Once); + SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong)_writeBytes.Length, _readBufferSize), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(3)); } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeAppend_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeAppend_FileAccessWrite.cs index 77af44043..3e86b59fc 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeAppend_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeAppend_FileAccessWrite.cs @@ -36,15 +36,15 @@ protected override void SetupData() _fileMode = FileMode.Append; _fileAccess = FileAccess.Write; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _fileAttributes = new SftpFileAttributesBuilder().WithLastAccessTime(DateTime.UtcNow.AddSeconds(_random.Next())) .WithLastWriteTime(DateTime.UtcNow.AddSeconds(_random.Next())) .WithSize(_random.Next()) .WithUserId(_random.Next()) .WithGroupId(_random.Next()) - .WithPermissions((uint) _random.Next()) + .WithPermissions((uint)_random.Next()) .Build(); _cancellationToken = new CancellationToken(); } @@ -58,10 +58,10 @@ protected override void SetupMocks() .Setup(p => p.RequestFStatAsync(_handle, _cancellationToken)) .ReturnsAsync(_fileAttributes); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } @@ -140,13 +140,13 @@ public async Task WriteShouldStartWritingAtEndOfFile() .Setup(p => p.IsOpen) .Returns(true); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestWriteAsync(_handle, (ulong) _fileAttributes.Size, buffer, 0, buffer.Length, _cancellationToken)) + .Setup(p => p.RequestWriteAsync(_handle, (ulong)_fileAttributes.Size, buffer, 0, buffer.Length, _cancellationToken)) .Returns(Task.CompletedTask); await _target.WriteAsync(buffer, 0, buffer.Length, _cancellationToken); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(1)); - SftpSessionMock.Verify(p => p.RequestWriteAsync(_handle, (ulong) _fileAttributes.Size, buffer, 0, buffer.Length, _cancellationToken), Times.Once); + SftpSessionMock.Verify(p => p.RequestWriteAsync(_handle, (ulong)_fileAttributes.Size, buffer, 0, buffer.Length, _cancellationToken), Times.Once); } [TestMethod] diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreateNew_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreateNew_FileAccessReadWrite.cs index 1b05fac3a..30d00439c 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreateNew_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreateNew_FileAccessReadWrite.cs @@ -35,8 +35,8 @@ protected override void SetupData() _fileMode = FileMode.CreateNew; _fileAccess = FileAccess.ReadWrite; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _cancellationToken = new CancellationToken(); } @@ -47,10 +47,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpenAsync(_path, Flags.Read | Flags.Write | Flags.CreateNew, _cancellationToken)) .ReturnsAsync(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreateNew_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreateNew_FileAccessWrite.cs index 98ba5c91f..82eaf0455 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreateNew_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreateNew_FileAccessWrite.cs @@ -34,8 +34,8 @@ protected override void SetupData() _fileMode = FileMode.CreateNew; _fileAccess = FileAccess.Write; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _cancellationToken = new CancellationToken(); } @@ -46,10 +46,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpenAsync(_path, Flags.Write | Flags.CreateNew, _cancellationToken)) .ReturnsAsync(_handle); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessReadWrite_FileDoesNotExist.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessReadWrite_FileDoesNotExist.cs index 66569af15..0fd6b8d69 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessReadWrite_FileDoesNotExist.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessReadWrite_FileDoesNotExist.cs @@ -35,8 +35,8 @@ protected override void SetupData() _fileMode = FileMode.Create; _fileAccess = FileAccess.ReadWrite; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _cancellationToken = new CancellationToken(); } @@ -47,10 +47,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpenAsync(_path, Flags.Read | Flags.Write | Flags.CreateNewOrOpen | Flags.Truncate, _cancellationToken)) .ReturnsAsync(_handle); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessReadWrite_FileExists.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessReadWrite_FileExists.cs index 28cfabae1..3a773ac63 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessReadWrite_FileExists.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessReadWrite_FileExists.cs @@ -35,8 +35,8 @@ protected override void SetupData() _fileMode = FileMode.Create; _fileAccess = FileAccess.ReadWrite; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _cancellationToken = new CancellationToken(); } @@ -47,10 +47,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpenAsync(_path, Flags.Read | Flags.Write | Flags.CreateNewOrOpen | Flags.Truncate, _cancellationToken)) .ReturnsAsync(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessWrite_FileDoesNotExist.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessWrite_FileDoesNotExist.cs index 4a66b9247..9602f8b82 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessWrite_FileDoesNotExist.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessWrite_FileDoesNotExist.cs @@ -34,8 +34,8 @@ protected override void SetupData() _fileMode = FileMode.Create; _fileAccess = FileAccess.Write; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _cancellationToken = new CancellationToken(); } @@ -46,10 +46,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpenAsync(_path, Flags.Write | Flags.CreateNewOrOpen | Flags.Truncate, _cancellationToken)) .ReturnsAsync(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessWrite_FileExists.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessWrite_FileExists.cs index ceb387637..605aad7a5 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessWrite_FileExists.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessWrite_FileExists.cs @@ -34,8 +34,8 @@ protected override void SetupData() _fileMode = FileMode.Create; _fileAccess = FileAccess.Write; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _cancellationToken = new CancellationToken(); } @@ -46,10 +46,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpenAsync(_path, Flags.Write | Flags.CreateNewOrOpen | Flags.Truncate, _cancellationToken)) .ReturnsAsync(_handle); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessRead.cs index b0bfe7fac..a015281e6 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessRead.cs @@ -35,8 +35,8 @@ protected override void SetupData() _fileMode = FileMode.OpenOrCreate; _fileAccess = FileAccess.Read; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _cancellationToken = new CancellationToken(); } @@ -47,10 +47,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpenAsync(_path, Flags.Read | Flags.CreateNewOrOpen, _cancellationToken)) .ReturnsAsync(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessReadWrite.cs index ed1a36a91..486b16ee9 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessReadWrite.cs @@ -35,8 +35,8 @@ protected override void SetupData() _fileMode = FileMode.OpenOrCreate; _fileAccess = FileAccess.ReadWrite; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _cancellationToken = new CancellationToken(); } @@ -47,10 +47,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpenAsync(_path, Flags.Read | Flags.Write | Flags.CreateNewOrOpen, _cancellationToken)) .ReturnsAsync(_handle); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessWrite.cs index 656409e7e..b6d67957a 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpenOrCreate_FileAccessWrite.cs @@ -34,8 +34,8 @@ protected override void SetupData() _fileMode = FileMode.OpenOrCreate; _fileAccess = FileAccess.Write; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _cancellationToken = new CancellationToken(); } @@ -46,10 +46,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpenAsync(_path, Flags.Write | Flags.CreateNewOrOpen, _cancellationToken)) .ReturnsAsync(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessRead.cs index c6ad82aa9..b45a78df2 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessRead.cs @@ -35,8 +35,8 @@ protected override void SetupData() _fileMode = FileMode.Open; _fileAccess = FileAccess.Read; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _cancellationToken = new CancellationToken(); } @@ -47,10 +47,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpenAsync(_path, Flags.Read, _cancellationToken)) .ReturnsAsync(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessReadWrite.cs index 7a653cb29..331b0e61d 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessReadWrite.cs @@ -35,8 +35,8 @@ protected override void SetupData() _fileMode = FileMode.Open; _fileAccess = FileAccess.ReadWrite; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _cancellationToken = new CancellationToken(); } @@ -47,10 +47,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpenAsync(_path, Flags.Read | Flags.Write, _cancellationToken)) .ReturnsAsync(_handle); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); _ = SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessWrite.cs index 9726eb683..202f6fcdd 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeOpen_FileAccessWrite.cs @@ -34,8 +34,8 @@ protected override void SetupData() _fileMode = FileMode.Open; _fileAccess = FileAccess.Write; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _cancellationToken = new CancellationToken(); } @@ -46,10 +46,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpenAsync(_path, Flags.Write, _cancellationToken)) .ReturnsAsync(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeTruncate_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeTruncate_FileAccessReadWrite.cs index 59598ac51..f5e78c0c4 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeTruncate_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeTruncate_FileAccessReadWrite.cs @@ -35,8 +35,8 @@ protected override void SetupData() _fileMode = FileMode.Truncate; _fileAccess = FileAccess.ReadWrite; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _cancellationToken = new CancellationToken(); } @@ -47,10 +47,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpenAsync(_path, Flags.Read | Flags.Write | Flags.Truncate, _cancellationToken)) .ReturnsAsync(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeTruncate_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeTruncate_FileAccessWrite.cs index 0caf13773..8539e21b3 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeTruncate_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeTruncate_FileAccessWrite.cs @@ -34,8 +34,8 @@ protected override void SetupData() _fileMode = FileMode.Truncate; _fileAccess = FileAccess.Write; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _cancellationToken = new CancellationToken(); } @@ -46,10 +46,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpenAsync(_path, Flags.Write | Flags.Truncate, _cancellationToken)) .ReturnsAsync(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndEqualToBufferSize.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndEqualToBufferSize.cs index 2849db04e..dbc891cbf 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndEqualToBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndEqualToBufferSize.cs @@ -35,15 +35,15 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(5, random); - _bufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); _readBufferSize = 20; _writeBufferSize = 500; - _numberOfBytesToRead = (int) _readBufferSize + 5; // greather than read buffer size + _numberOfBytesToRead = (int)_readBufferSize + 5; // greather than read buffer size _buffer = new byte[_numberOfBytesToRead]; - _serverData1Length = (int) _readBufferSize; // equal to read buffer size + _serverData1Length = (int)_readBufferSize; // equal to read buffer size _serverData1 = GenerateRandom(_serverData1Length, random); - _serverData2Length = (int) _readBufferSize; // equal to read buffer size + _serverData2Length = (int)_readBufferSize; // equal to read buffer size _serverData2 = GenerateRandom(_serverData2Length, random); Assert.IsTrue(_serverData1Length < _numberOfBytesToRead && _serverData1Length == _readBufferSize); @@ -67,7 +67,7 @@ protected override void SetupMocks() .Setup(p => p.RequestReadAsync(_handle, 0UL, _readBufferSize, default)) .ReturnsAsync(_serverData1); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestReadAsync(_handle, (ulong) _serverData1.Length, _readBufferSize, default)) + .Setup(p => p.RequestReadAsync(_handle, (ulong)_serverData1.Length, _readBufferSize, default)) .ReturnsAsync(_serverData2); } @@ -86,7 +86,7 @@ protected override async Task ArrangeAsync() _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize, + (int)_bufferSize, default); } @@ -141,7 +141,7 @@ public async Task ReadShouldReturnAllRemaningBytesFromReadBufferWhenCountIsEqual public async Task ReadShouldReturnAllRemaningBytesFromReadBufferAndReadAgainWhenCountIsGreaterThanNumberOfRemainingBytesAndNewReadReturnsZeroBytes() { SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); - SftpSessionMock.InSequence(MockSequence).Setup(p => p.RequestReadAsync(_handle, (ulong) (_serverData1Length + _serverData2Length), _readBufferSize, default)).ReturnsAsync(Array.Empty()); + SftpSessionMock.InSequence(MockSequence).Setup(p => p.RequestReadAsync(_handle, (ulong)(_serverData1Length + _serverData2Length), _readBufferSize, default)).ReturnsAsync(Array.Empty()); var numberOfBytesRemainingInReadBuffer = _serverData1Length + _serverData2Length - _numberOfBytesToRead; @@ -154,7 +154,7 @@ public async Task ReadShouldReturnAllRemaningBytesFromReadBufferAndReadAgainWhen Assert.AreEqual(0, _buffer[numberOfBytesRemainingInReadBuffer]); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(2)); - SftpSessionMock.Verify(p => p.RequestReadAsync(_handle, (ulong) (_serverData1Length + _serverData2Length), _readBufferSize, default)); + SftpSessionMock.Verify(p => p.RequestReadAsync(_handle, (ulong)(_serverData1Length + _serverData2Length), _readBufferSize, default)); } } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndLessThanBufferSize.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndLessThanBufferSize.cs index ada78150d..af24ecad5 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndLessThanBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndLessThanBufferSize.cs @@ -35,15 +35,15 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(5, random); - _bufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); _readBufferSize = 20; _writeBufferSize = 500; - _numberOfBytesToRead = (int) _readBufferSize + 2; // greater than read buffer size + _numberOfBytesToRead = (int)_readBufferSize + 2; // greater than read buffer size _originalBuffer = GenerateRandom(_numberOfBytesToRead, random); _buffer = _originalBuffer.Copy(); - _serverDataLength = (int) _readBufferSize - 1; // less than read buffer size + _serverDataLength = (int)_readBufferSize - 1; // less than read buffer size _serverData = GenerateRandom(_serverDataLength, random); Assert.IsTrue(_serverDataLength < _numberOfBytesToRead && _serverDataLength < _readBufferSize); @@ -83,7 +83,7 @@ protected override async Task ArrangeAsync() _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize, + (int)_bufferSize, default); } @@ -120,7 +120,7 @@ public async Task SubsequentReadShouldReadAgainFromCurrentPositionFromServerAndR { SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestReadAsync(_handle, (ulong) _actual, _readBufferSize, default)) + .Setup(p => p.RequestReadAsync(_handle, (ulong)_actual, _readBufferSize, default)) .ReturnsAsync(Array.Empty()); var buffer = _originalBuffer.Copy(); @@ -129,7 +129,7 @@ public async Task SubsequentReadShouldReadAgainFromCurrentPositionFromServerAndR Assert.AreEqual(0, actual); Assert.IsTrue(_originalBuffer.IsEqualTo(buffer)); - SftpSessionMock.Verify(p => p.RequestReadAsync(_handle, (ulong) _actual, _readBufferSize, default), Times.Once); + SftpSessionMock.Verify(p => p.RequestReadAsync(_handle, (ulong)_actual, _readBufferSize, default), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(2)); } @@ -138,7 +138,7 @@ public async Task SubsequentReadShouldReadAgainFromCurrentPositionFromServerAndN { SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestReadAsync(_handle, (ulong) _actual, _readBufferSize, default)) + .Setup(p => p.RequestReadAsync(_handle, (ulong)_actual, _readBufferSize, default)) .ReturnsAsync(Array.Empty()); SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); @@ -146,7 +146,7 @@ public async Task SubsequentReadShouldReadAgainFromCurrentPositionFromServerAndN Assert.AreEqual(_actual, _target.Position); - SftpSessionMock.Verify(p => p.RequestReadAsync(_handle, (ulong) _actual, _readBufferSize, default), Times.Once); + SftpSessionMock.Verify(p => p.RequestReadAsync(_handle, (ulong)_actual, _readBufferSize, default), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(3)); } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadMoreBytesFromServerThanCount.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadMoreBytesFromServerThanCount.cs index cf87df7cf..183f66e33 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadMoreBytesFromServerThanCount.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadAsync_ReadMode_NoDataInReaderBufferAndReadMoreBytesFromServerThanCount.cs @@ -33,7 +33,7 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(5, random); - _bufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); _readBufferSize = 20; _writeBufferSize = 500; @@ -77,7 +77,7 @@ protected override async Task ArrangeAsync() _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize, + (int)_bufferSize, default); } @@ -127,7 +127,7 @@ public async Task SubsequentReadShouldReturnAllRemaningBytesFromReadBufferWhenCo public async Task SubsequentReadShouldReturnAllRemaningBytesFromReadBufferAndReadAgainWhenCountIsGreaterThanNumberOfRemainingBytesAndNewReadReturnsZeroBytes() { SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); - SftpSessionMock.InSequence(MockSequence).Setup(p => p.RequestReadAsync(_handle, (ulong) (_serverData.Length), _readBufferSize, default)).ReturnsAsync(Array.Empty()); + SftpSessionMock.InSequence(MockSequence).Setup(p => p.RequestReadAsync(_handle, (ulong)(_serverData.Length), _readBufferSize, default)).ReturnsAsync(Array.Empty()); var buffer = new byte[_numberOfBytesToWriteToReadBuffer + 1]; @@ -138,7 +138,7 @@ public async Task SubsequentReadShouldReturnAllRemaningBytesFromReadBufferAndRea Assert.AreEqual(0, buffer[_numberOfBytesToWriteToReadBuffer]); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(2)); - SftpSessionMock.Verify(p => p.RequestReadAsync(_handle, (ulong) (_serverData.Length), _readBufferSize, default)); + SftpSessionMock.Verify(p => p.RequestReadAsync(_handle, (ulong)(_serverData.Length), _readBufferSize, default)); } } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadByte_ReadMode_NoDataInWriteBufferAndNoDataInReadBuffer_Eof.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadByte_ReadMode_NoDataInWriteBufferAndNoDataInReadBuffer_Eof.cs index 75cb1df3a..50d56a5a9 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadByte_ReadMode_NoDataInWriteBufferAndNoDataInReadBuffer_Eof.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadByte_ReadMode_NoDataInWriteBufferAndNoDataInReadBuffer_Eof.cs @@ -27,9 +27,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(1, random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); } protected override void SetupMocks() @@ -63,7 +63,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize); + (int)_bufferSize); } protected override void Act() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadByte_ReadMode_NoDataInWriteBufferAndNoDataInReadBuffer_LessDataThanReadBufferSizeAvailable.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadByte_ReadMode_NoDataInWriteBufferAndNoDataInReadBuffer_LessDataThanReadBufferSizeAvailable.cs index 01ebe7b5f..d48cac258 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadByte_ReadMode_NoDataInWriteBufferAndNoDataInReadBuffer_LessDataThanReadBufferSizeAvailable.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_ReadByte_ReadMode_NoDataInWriteBufferAndNoDataInReadBuffer_LessDataThanReadBufferSizeAvailable.cs @@ -31,10 +31,10 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(5, random); - _bufferSize = (uint) random.Next(5, 1000); - _readBufferSize = (uint) random.Next(10, 100); - _writeBufferSize = (uint) random.Next(10, 100); - _data = GenerateRandom((int) _readBufferSize - 2, random); + _bufferSize = (uint)random.Next(5, 1000); + _readBufferSize = (uint)random.Next(10, 100); + _writeBufferSize = (uint)random.Next(10, 100); + _data = GenerateRandom((int)_readBufferSize - 2, random); } protected override void SetupMocks() @@ -68,7 +68,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize); + (int)_bufferSize); } protected override void Act() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndEqualToBufferSize.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndEqualToBufferSize.cs index 9103f7448..8ae2138a3 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndEqualToBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndEqualToBufferSize.cs @@ -34,15 +34,15 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(5, random); - _bufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); _readBufferSize = 20; _writeBufferSize = 500; - _numberOfBytesToRead = (int) _readBufferSize + 5; // greather than read buffer size + _numberOfBytesToRead = (int)_readBufferSize + 5; // greather than read buffer size _buffer = new byte[_numberOfBytesToRead]; - _serverData1Length = (int) _readBufferSize; // equal to read buffer size + _serverData1Length = (int)_readBufferSize; // equal to read buffer size _serverData1 = GenerateRandom(_serverData1Length, random); - _serverData2Length = (int) _readBufferSize; // equal to read buffer size + _serverData2Length = (int)_readBufferSize; // equal to read buffer size _serverData2 = GenerateRandom(_serverData2Length, random); Assert.IsTrue(_serverData1Length < _numberOfBytesToRead && _serverData1Length == _readBufferSize); @@ -66,7 +66,7 @@ protected override void SetupMocks() .Setup(p => p.RequestRead(_handle, 0UL, _readBufferSize)) .Returns(_serverData1); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestRead(_handle, (ulong) _serverData1.Length, _readBufferSize)) + .Setup(p => p.RequestRead(_handle, (ulong)_serverData1.Length, _readBufferSize)) .Returns(_serverData2); } @@ -85,7 +85,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize); + (int)_bufferSize); } protected override void Act() @@ -139,7 +139,7 @@ public void ReadShouldReturnAllRemaningBytesFromReadBufferWhenCountIsEqualToNumb public void ReadShouldReturnAllRemaningBytesFromReadBufferAndReadAgainWhenCountIsGreaterThanNumberOfRemainingBytesAndNewReadReturnsZeroBytes() { SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); - SftpSessionMock.InSequence(MockSequence).Setup(p => p.RequestRead(_handle, (ulong) (_serverData1Length + _serverData2Length), _readBufferSize)).Returns(Array.Empty()); + SftpSessionMock.InSequence(MockSequence).Setup(p => p.RequestRead(_handle, (ulong)(_serverData1Length + _serverData2Length), _readBufferSize)).Returns(Array.Empty()); var numberOfBytesRemainingInReadBuffer = _serverData1Length + _serverData2Length - _numberOfBytesToRead; @@ -152,7 +152,7 @@ public void ReadShouldReturnAllRemaningBytesFromReadBufferAndReadAgainWhenCountI Assert.AreEqual(0, _buffer[numberOfBytesRemainingInReadBuffer]); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(2)); - SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong) (_serverData1Length + _serverData2Length), _readBufferSize)); + SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong)(_serverData1Length + _serverData2Length), _readBufferSize)); } } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndLessThanBufferSize.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndLessThanBufferSize.cs index 833f5fce1..c8a57a406 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndLessThanBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadLessBytesFromServerThanCountAndLessThanBufferSize.cs @@ -34,15 +34,15 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(5, random); - _bufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); _readBufferSize = 20; _writeBufferSize = 500; - _numberOfBytesToRead = (int) _readBufferSize + 2; // greater than read buffer size + _numberOfBytesToRead = (int)_readBufferSize + 2; // greater than read buffer size _originalBuffer = GenerateRandom(_numberOfBytesToRead, random); _buffer = _originalBuffer.Copy(); - _serverDataLength = (int) _readBufferSize - 1; // less than read buffer size + _serverDataLength = (int)_readBufferSize - 1; // less than read buffer size _serverData = GenerateRandom(_serverDataLength, random); Assert.IsTrue(_serverDataLength < _numberOfBytesToRead && _serverDataLength < _readBufferSize); @@ -82,7 +82,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize); + (int)_bufferSize); } protected override void Act() @@ -118,7 +118,7 @@ public void SubsequentReadShouldReadAgainFromCurrentPositionFromServerAndReturnZ { SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestRead(_handle, (ulong) _actual, _readBufferSize)) + .Setup(p => p.RequestRead(_handle, (ulong)_actual, _readBufferSize)) .Returns(Array.Empty()); var buffer = _originalBuffer.Copy(); @@ -127,7 +127,7 @@ public void SubsequentReadShouldReadAgainFromCurrentPositionFromServerAndReturnZ Assert.AreEqual(0, actual); Assert.IsTrue(_originalBuffer.IsEqualTo(buffer)); - SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong) _actual, _readBufferSize), Times.Once); + SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong)_actual, _readBufferSize), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(2)); } @@ -136,7 +136,7 @@ public void SubsequentReadShouldReadAgainFromCurrentPositionFromServerAndNotUpda { SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestRead(_handle, (ulong) _actual, _readBufferSize)) + .Setup(p => p.RequestRead(_handle, (ulong)_actual, _readBufferSize)) .Returns(Array.Empty()); SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); @@ -144,7 +144,7 @@ public void SubsequentReadShouldReadAgainFromCurrentPositionFromServerAndNotUpda Assert.AreEqual(_actual, _target.Position); - SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong) _actual, _readBufferSize), Times.Once); + SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong)_actual, _readBufferSize), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(3)); } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadMoreBytesFromServerThanCount.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadMoreBytesFromServerThanCount.cs index 42cf319f1..258975ada 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadMoreBytesFromServerThanCount.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Read_ReadMode_NoDataInReaderBufferAndReadMoreBytesFromServerThanCount.cs @@ -32,7 +32,7 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(5, random); - _bufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); _readBufferSize = 20; _writeBufferSize = 500; @@ -76,7 +76,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize); + (int)_bufferSize); } protected override void Act() @@ -125,7 +125,7 @@ public void SubsequentReadShouldReturnAllRemaningBytesFromReadBufferWhenCountIsE public void SubsequentReadShouldReturnAllRemaningBytesFromReadBufferAndReadAgainWhenCountIsGreaterThanNumberOfRemainingBytesAndNewReadReturnsZeroBytes() { SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); - SftpSessionMock.InSequence(MockSequence).Setup(p => p.RequestRead(_handle, (ulong) (_serverData.Length), _readBufferSize)).Returns(Array.Empty()); + SftpSessionMock.InSequence(MockSequence).Setup(p => p.RequestRead(_handle, (ulong)(_serverData.Length), _readBufferSize)).Returns(Array.Empty()); var buffer = new byte[_numberOfBytesToWriteToReadBuffer + 1]; @@ -136,7 +136,7 @@ public void SubsequentReadShouldReturnAllRemaningBytesFromReadBufferAndReadAgain Assert.AreEqual(0, buffer[_numberOfBytesToWriteToReadBuffer]); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(2)); - SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong) (_serverData.Length), _readBufferSize)); + SftpSessionMock.Verify(p => p.RequestRead(_handle, (ulong)(_serverData.Length), _readBufferSize)); } } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetNegative.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetNegative.cs index dd901a4e6..1a94e7174 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetNegative.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetNegative.cs @@ -33,8 +33,8 @@ protected override void SetupData() _fileMode = FileMode.OpenOrCreate; _fileAccess = FileAccess.Read; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _offset = _random.Next(int.MinValue, -1); } @@ -45,10 +45,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.CreateNewOrOpen, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetPositive.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetPositive.cs index 74f474cbd..5be4026fb 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetPositive.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetPositive.cs @@ -33,8 +33,8 @@ protected override void SetupData() _fileMode = FileMode.OpenOrCreate; _fileAccess = FileAccess.Read; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _offset = _random.Next(1, int.MaxValue); } @@ -45,10 +45,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.CreateNewOrOpen, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetZero.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetZero.cs index 8adefbb3a..3370a44de 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetZero.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginBeginAndOffsetZero.cs @@ -32,8 +32,8 @@ protected override void SetupData() _fileMode = FileMode.OpenOrCreate; _fileAccess = FileAccess.Read; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); } @@ -43,10 +43,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.CreateNewOrOpen, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetNegative.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetNegative.cs index c7b7b9ee2..0c6bdfd35 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetNegative.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetNegative.cs @@ -35,8 +35,8 @@ protected override void SetupData() _fileMode = FileMode.OpenOrCreate; _fileAccess = FileAccess.Write; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _length = _random.Next(5, 10000); _handle = GenerateRandom(_random.Next(1, 10), _random); _offset = _random.Next(-_length, -1); @@ -49,10 +49,10 @@ protected override void SetupMocks() .Setup(session => session.RequestOpen(_path, Flags.Write | Flags.CreateNewOrOpen, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(session => session.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(session => session.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(session => session.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(session => session.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); SftpSessionMock.InSequence(MockSequence) .Setup(session => session.IsOpen) diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetPositive.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetPositive.cs index 044fa5612..c7e2cf46f 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetPositive.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetPositive.cs @@ -35,8 +35,8 @@ protected override void SetupData() _fileMode = FileMode.OpenOrCreate; _fileAccess = FileAccess.Write; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _length = _random.Next(5, 10000); _handle = GenerateRandom(_random.Next(1, 10), _random); _offset = _random.Next(1, int.MaxValue); @@ -49,10 +49,10 @@ protected override void SetupMocks() .Setup(session => session.RequestOpen(_path, Flags.Write | Flags.CreateNewOrOpen, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(session => session.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(session => session.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(session => session.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(session => session.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); SftpSessionMock.InSequence(MockSequence) .Setup(session => session.IsOpen) diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetZero.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetZero.cs index 1f06a5262..c171bb525 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetZero.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtBeginningOfStream_OriginEndAndOffsetZero.cs @@ -35,8 +35,8 @@ protected override void SetupData() _fileMode = FileMode.OpenOrCreate; _fileAccess = FileAccess.Write; _bufferSize = _random.Next(5, 1000); - _readBufferSize = (uint) _random.Next(5, 1000); - _writeBufferSize = (uint) _random.Next(5, 1000); + _readBufferSize = (uint)_random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _length = _random.Next(5, 10000); _handle = GenerateRandom(_random.Next(1, 10), _random); _offset = 0; @@ -49,10 +49,10 @@ protected override void SetupMocks() .Setup(session => session.RequestOpen(_path, Flags.Write | Flags.CreateNewOrOpen, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(session => session.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(session => session.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(session => session.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(session => session.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); SftpSessionMock.InSequence(MockSequence) .Setup(session => session.IsOpen) diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtMiddleOfStream_OriginBeginAndOffsetZero_NoBuffering.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtMiddleOfStream_OriginBeginAndOffsetZero_NoBuffering.cs index f75203edc..df5c0c9ea 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtMiddleOfStream_OriginBeginAndOffsetZero_NoBuffering.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtMiddleOfStream_OriginBeginAndOffsetZero_NoBuffering.cs @@ -35,7 +35,7 @@ protected override void SetupData() _fileAccess = FileAccess.Read; _bufferSize = _random.Next(5, 1000); _readBufferSize = 20; - _writeBufferSize = (uint) _random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _buffer = new byte[_readBufferSize]; _serverData = GenerateRandom(_buffer.Length, _random); @@ -47,10 +47,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.CreateNewOrOpen, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); SftpSessionMock.InSequence(MockSequence) .Setup(p => p.IsOpen) diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtMiddleOfStream_OriginBeginAndOffsetZero_ReadBuffer.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtMiddleOfStream_OriginBeginAndOffsetZero_ReadBuffer.cs index f7201aece..08411eae1 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtMiddleOfStream_OriginBeginAndOffsetZero_ReadBuffer.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Seek_PositionedAtMiddleOfStream_OriginBeginAndOffsetZero_ReadBuffer.cs @@ -37,11 +37,11 @@ protected override void SetupData() _fileAccess = FileAccess.Read; _bufferSize = _random.Next(5, 1000); _readBufferSize = 20; - _writeBufferSize = (uint) _random.Next(5, 1000); + _writeBufferSize = (uint)_random.Next(5, 1000); _handle = GenerateRandom(_random.Next(1, 10), _random); _buffer = new byte[2]; // should be less than size of read buffer - _serverData1 = GenerateRandom((int) _readBufferSize, _random); - _serverData2 = GenerateRandom((int) _readBufferSize, _random); + _serverData1 = GenerateRandom((int)_readBufferSize, _random); + _serverData2 = GenerateRandom((int)_readBufferSize, _random); } protected override void SetupMocks() @@ -50,10 +50,10 @@ protected override void SetupMocks() .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.CreateNewOrOpen, false)) .Returns(_handle); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalReadLength((uint) _bufferSize)) + .Setup(p => p.CalculateOptimalReadLength((uint)_bufferSize)) .Returns(_readBufferSize); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.CalculateOptimalWriteLength((uint) _bufferSize, _handle)) + .Setup(p => p.CalculateOptimalWriteLength((uint)_bufferSize, _handle)) .Returns(_writeBufferSize); SftpSessionMock.InSequence(MockSequence) .Setup(p => p.IsOpen) diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_Closed.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_Closed.cs index 5268af499..e87586788 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_Closed.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_Closed.cs @@ -33,10 +33,10 @@ protected void Arrange() { var random = new Random(); _path = random.Next().ToString(CultureInfo.InvariantCulture); - _handle = new[] { (byte) random.Next(byte.MinValue, byte.MaxValue) }; - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(0, 1000); - _writeBufferSize = (uint) random.Next(0, 1000); + _handle = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) }; + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(0, 1000); + _writeBufferSize = (uint)random.Next(0, 1000); _sftpSessionMock = new Mock(MockBehavior.Strict); @@ -56,7 +56,7 @@ protected void Arrange() _sftpSessionMock.InSequence(sequence) .Setup(p => p.RequestClose(_handle)); - _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Write, (int) _bufferSize); + _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Write, (int)_bufferSize); _sftpFileStream.Close(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInReadBuffer_NewLengthGreatherThanPosition.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInReadBuffer_NewLengthGreatherThanPosition.cs index 7795af3a0..211a86707 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInReadBuffer_NewLengthGreatherThanPosition.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInReadBuffer_NewLengthGreatherThanPosition.cs @@ -45,12 +45,12 @@ protected override void SetupData() _path = random.Next().ToString(CultureInfo.InvariantCulture); _handle = GenerateRandom(random.Next(2, 6), random); - _bufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); _readBytes1 = new byte[5]; _readBytes2 = new byte[random.Next(1, 3)]; _actualReadBytes = GenerateRandom(_readBytes1.Length + _readBytes2.Length + 2, random); // server returns more bytes than the caller requested - _readBufferSize = (uint) random.Next(_actualReadBytes.Length, _actualReadBytes.Length * 2); - _writeBufferSize = (uint) random.Next(100, 1000); + _readBufferSize = (uint)random.Next(_actualReadBytes.Length, _actualReadBytes.Length * 2); + _writeBufferSize = (uint)random.Next(100, 1000); _length = _readBytes1.Length + _readBytes2.Length + 5; _fileAttributes = new SftpFileAttributesBuilder().WithExtension("X", "ABC") @@ -58,7 +58,7 @@ protected override void SetupData() .WithGroupId(random.Next()) .WithLastAccessTime(DateTime.UtcNow.AddSeconds(random.Next())) .WithLastWriteTime(DateTime.UtcNow.AddSeconds(random.Next())) - .WithPermissions((uint) random.Next()) + .WithPermissions((uint)random.Next()) .WithSize(_length + 100) .WithUserId(random.Next()) .Build(); @@ -106,7 +106,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.ReadWrite, - (int) _bufferSize); + (int)_bufferSize); _sftpFileStream.Read(_readBytes1, 0, _readBytes1.Length); _sftpFileStream.Read(_readBytes2, 0, _readBytes2.Length); // this will return bytes from the buffer } @@ -151,7 +151,7 @@ public void ReadShouldReadStartFromSamePositionAsBeforeSetLength() SftpSessionMock.InSequence(_sequence).Setup(p => p.IsOpen).Returns(true); SftpSessionMock.InSequence(_sequence) .Setup(p => p.RequestRead(_handle, - (uint) (_readBytes1.Length + _readBytes2.Length), + (uint)(_readBytes1.Length + _readBytes2.Length), _readBufferSize)) .Returns(new byte[] { 0x0f }); @@ -160,7 +160,7 @@ public void ReadShouldReadStartFromSamePositionAsBeforeSetLength() Assert.AreEqual(0x0f, byteRead); SftpSessionMock.Verify(p => p.RequestRead(_handle, - (uint) (_readBytes1.Length + _readBytes2.Length), + (uint)(_readBytes1.Length + _readBytes2.Length), _readBufferSize), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(4)); @@ -175,7 +175,7 @@ public void WriteShouldStartFromSamePositionAsBeforeSetLength() SftpSessionMock.InSequence(_sequence).Setup(p => p.IsOpen).Returns(true); SftpSessionMock.InSequence(_sequence) .Setup(p => p.RequestWrite(_handle, - (uint) (_readBytes1.Length + _readBytes2.Length), + (uint)(_readBytes1.Length + _readBytes2.Length), It.IsAny(), 0, bytesToWrite.Length, @@ -194,7 +194,7 @@ public void WriteShouldStartFromSamePositionAsBeforeSetLength() CollectionAssert.AreEqual(bytesToWrite, bytesWritten); SftpSessionMock.Verify(p => p.RequestWrite(_handle, - (uint) (_readBytes1.Length + _readBytes2.Length), + (uint)(_readBytes1.Length + _readBytes2.Length), It.IsAny(), 0, bytesToWrite.Length, diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInReadBuffer_NewLengthLessThanPosition.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInReadBuffer_NewLengthLessThanPosition.cs index 0fe6cb6df..82b66fd88 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInReadBuffer_NewLengthLessThanPosition.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInReadBuffer_NewLengthLessThanPosition.cs @@ -43,9 +43,9 @@ protected override void SetupData() _path = random.Next().ToString(CultureInfo.InvariantCulture); _handle = GenerateRandom(random.Next(2, 6), random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(100, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(100, 1000); _readBytes = new byte[5]; _actualReadBytes = GenerateRandom(_readBytes.Length + 2, random); // add 2 bytes in read buffer _length = _readBytes.Length - 2; @@ -55,7 +55,7 @@ protected override void SetupData() .WithGroupId(random.Next()) .WithLastAccessTime(DateTime.UtcNow.AddSeconds(random.Next())) .WithLastWriteTime(DateTime.UtcNow.AddSeconds(random.Next())) - .WithPermissions((uint) random.Next()) + .WithPermissions((uint)random.Next()) .WithSize(_length + 100) .WithUserId(random.Next()) .Build(); @@ -96,7 +96,7 @@ protected override void Arrange() { base.Arrange(); - _sftpFileStream = new SftpFileStream(SftpSessionMock.Object, _path, FileMode.Open, FileAccess.ReadWrite, (int) _bufferSize); + _sftpFileStream = new SftpFileStream(SftpSessionMock.Object, _path, FileMode.Open, FileAccess.ReadWrite, (int)_bufferSize); _sftpFileStream.Read(_readBytes, 0, _readBytes.Length); } @@ -139,14 +139,14 @@ public void ReadShouldStartFromEndOfStream() { SftpSessionMock.InSequence(_sequence).Setup(p => p.IsOpen).Returns(true); SftpSessionMock.InSequence(_sequence) - .Setup(p => p.RequestRead(_handle, (uint) _length, _readBufferSize)) + .Setup(p => p.RequestRead(_handle, (uint)_length, _readBufferSize)) .Returns(Array.Empty()); var byteRead = _sftpFileStream.ReadByte(); Assert.AreEqual(-1, byteRead); - SftpSessionMock.Verify(p => p.RequestRead(_handle, (uint) _length, _readBufferSize), Times.Once); + SftpSessionMock.Verify(p => p.RequestRead(_handle, (uint)_length, _readBufferSize), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(3)); } @@ -158,7 +158,7 @@ public void WriteShouldStartFromEndOfStream() SftpSessionMock.InSequence(_sequence).Setup(p => p.IsOpen).Returns(true); SftpSessionMock.InSequence(_sequence) - .Setup(p => p.RequestWrite(_handle, (uint) _length, It.IsAny(), 0, bytesToWrite.Length, It.IsAny(), null)) + .Setup(p => p.RequestWrite(_handle, (uint)_length, It.IsAny(), 0, bytesToWrite.Length, It.IsAny(), null)) .Callback>((handle, serverOffset, data, offset, length, wait, writeCompleted) => { bytesWritten = data.Take(offset, length); @@ -170,7 +170,7 @@ public void WriteShouldStartFromEndOfStream() Assert.IsNotNull(bytesWritten); CollectionAssert.AreEqual(bytesToWrite, bytesWritten); - SftpSessionMock.Verify(p => p.RequestWrite(_handle, (uint) _length, It.IsAny(), 0, bytesToWrite.Length, It.IsAny(), null), Times.Once); + SftpSessionMock.Verify(p => p.RequestWrite(_handle, (uint)_length, It.IsAny(), 0, bytesToWrite.Length, It.IsAny(), null), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(3)); } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInWriteBuffer_NewLengthGreatherThanPosition.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInWriteBuffer_NewLengthGreatherThanPosition.cs index 3038ec445..feac868b2 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInWriteBuffer_NewLengthGreatherThanPosition.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInWriteBuffer_NewLengthGreatherThanPosition.cs @@ -45,9 +45,9 @@ protected override void SetupData() _path = random.Next().ToString(CultureInfo.InvariantCulture); _handle = GenerateRandom(random.Next(2, 6), random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(100, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(100, 1000); _readBytes = new byte[5]; _actualReadBytes = GenerateRandom(_readBytes.Length, random); _writeBytes = new byte[] { 0x01, 0x02, 0x03, 0x04 }; @@ -59,7 +59,7 @@ protected override void SetupData() .WithGroupId(random.Next()) .WithLastAccessTime(DateTime.UtcNow.AddSeconds(random.Next())) .WithLastWriteTime(DateTime.UtcNow.AddSeconds(random.Next())) - .WithPermissions((uint) random.Next()) + .WithPermissions((uint)random.Next()) .WithSize(_length + 100) .WithUserId(random.Next()) .Build(); @@ -92,7 +92,7 @@ protected override void SetupMocks() .Setup(p => p.IsOpen) .Returns(true); SftpSessionMock.InSequence(_sequence) - .Setup(p => p.RequestWrite(_handle, (uint) _readBytes.Length, It.IsAny(), 0, _writeBytes.Length, It.IsAny(), null)) + .Setup(p => p.RequestWrite(_handle, (uint)_readBytes.Length, It.IsAny(), 0, _writeBytes.Length, It.IsAny(), null)) .Callback>((handle, serverOffset, data, offset, length, wait, writeCompleted) => { @@ -111,7 +111,7 @@ protected override void Arrange() { base.Arrange(); - _sftpFileStream = new SftpFileStream(SftpSessionMock.Object, _path, FileMode.Open, FileAccess.ReadWrite, (int) _bufferSize); + _sftpFileStream = new SftpFileStream(SftpSessionMock.Object, _path, FileMode.Open, FileAccess.ReadWrite, (int)_bufferSize); _sftpFileStream.Read(_readBytes, 0, _readBytes.Length); _sftpFileStream.Write(new byte[] { 0x01, 0x02, 0x03, 0x04 }, 0, 4); } @@ -162,14 +162,14 @@ public void ReadShouldReadStartFromSamePositionAsBeforeSetLength() { SftpSessionMock.InSequence(_sequence).Setup(p => p.IsOpen).Returns(true); SftpSessionMock.InSequence(_sequence) - .Setup(p => p.RequestRead(_handle, (uint) (_readBytes.Length + _writeBytes.Length), _readBufferSize)) + .Setup(p => p.RequestRead(_handle, (uint)(_readBytes.Length + _writeBytes.Length), _readBufferSize)) .Returns(new byte[] { 0x0f }); var byteRead = _sftpFileStream.ReadByte(); Assert.AreEqual(0x0f, byteRead); - SftpSessionMock.Verify(p => p.RequestRead(_handle, (uint) (_readBytes.Length + _writeBytes.Length), _readBufferSize), Times.Once); + SftpSessionMock.Verify(p => p.RequestRead(_handle, (uint)(_readBytes.Length + _writeBytes.Length), _readBufferSize), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(4)); } @@ -181,7 +181,7 @@ public void WriteShouldStartFromSamePositionAsBeforeSetLength() SftpSessionMock.InSequence(_sequence).Setup(p => p.IsOpen).Returns(true); SftpSessionMock.InSequence(_sequence) - .Setup(p => p.RequestWrite(_handle, (uint) (_readBytes.Length + _writeBytes.Length), It.IsAny(), 0, bytesToWrite.Length, It.IsAny(), null)) + .Setup(p => p.RequestWrite(_handle, (uint)(_readBytes.Length + _writeBytes.Length), It.IsAny(), 0, bytesToWrite.Length, It.IsAny(), null)) .Callback>((handle, serverOffset, data, offset, length, wait, writeCompleted) => { bytesWritten = data.Take(offset, length); @@ -193,7 +193,7 @@ public void WriteShouldStartFromSamePositionAsBeforeSetLength() Assert.IsNotNull(bytesWritten); CollectionAssert.AreEqual(bytesToWrite, bytesWritten); - SftpSessionMock.Verify(p => p.RequestWrite(_handle, (uint) (_readBytes.Length + _writeBytes.Length), It.IsAny(), 0, bytesToWrite.Length, It.IsAny(), null), Times.Once); + SftpSessionMock.Verify(p => p.RequestWrite(_handle, (uint)(_readBytes.Length + _writeBytes.Length), It.IsAny(), 0, bytesToWrite.Length, It.IsAny(), null), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(4)); } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInWriteBuffer_NewLengthLessThanPosition.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInWriteBuffer_NewLengthLessThanPosition.cs index 27df355c1..4bbe24dae 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInWriteBuffer_NewLengthLessThanPosition.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_DataInWriteBuffer_NewLengthLessThanPosition.cs @@ -45,9 +45,9 @@ protected override void SetupData() _path = random.Next().ToString(CultureInfo.InvariantCulture); _handle = GenerateRandom(random.Next(2, 6), random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(100, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(100, 1000); _readBytes = new byte[5]; _actualReadBytes = GenerateRandom(_readBytes.Length, random); _writeBytes = new byte[] { 0x01, 0x02, 0x03, 0x04 }; @@ -59,7 +59,7 @@ protected override void SetupData() .WithGroupId(random.Next()) .WithLastAccessTime(DateTime.UtcNow.AddSeconds(random.Next())) .WithLastWriteTime(DateTime.UtcNow.AddSeconds(random.Next())) - .WithPermissions((uint) random.Next()) + .WithPermissions((uint)random.Next()) .WithSize(_length + 100) .WithUserId(random.Next()) .Build(); @@ -92,7 +92,7 @@ protected override void SetupMocks() .Setup(p => p.IsOpen) .Returns(true); SftpSessionMock.InSequence(_sequence) - .Setup(p => p.RequestWrite(_handle, (uint) _readBytes.Length, It.IsAny(), 0, _writeBytes.Length, It.IsAny(), null)) + .Setup(p => p.RequestWrite(_handle, (uint)_readBytes.Length, It.IsAny(), 0, _writeBytes.Length, It.IsAny(), null)) .Callback>((handle, serverOffset, data, offset, length, wait, writeCompleted) => { @@ -111,7 +111,7 @@ protected override void Arrange() { base.Arrange(); - _sftpFileStream = new SftpFileStream(SftpSessionMock.Object, _path, FileMode.Open, FileAccess.ReadWrite, (int) _bufferSize); + _sftpFileStream = new SftpFileStream(SftpSessionMock.Object, _path, FileMode.Open, FileAccess.ReadWrite, (int)_bufferSize); _sftpFileStream.Read(_readBytes, 0, _readBytes.Length); _sftpFileStream.Write(new byte[] { 0x01, 0x02, 0x03, 0x04 }, 0, 4); } @@ -162,14 +162,14 @@ public void ReadShouldStartFromEndOfStream() { SftpSessionMock.InSequence(_sequence).Setup(p => p.IsOpen).Returns(true); SftpSessionMock.InSequence(_sequence) - .Setup(p => p.RequestRead(_handle, (uint) _length, _readBufferSize)) + .Setup(p => p.RequestRead(_handle, (uint)_length, _readBufferSize)) .Returns(Array.Empty()); var byteRead = _sftpFileStream.ReadByte(); Assert.AreEqual(-1, byteRead); - SftpSessionMock.Verify(p => p.RequestRead(_handle, (uint) _length, _readBufferSize), Times.Once); + SftpSessionMock.Verify(p => p.RequestRead(_handle, (uint)_length, _readBufferSize), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(4)); } @@ -181,7 +181,7 @@ public void WriteShouldStartFromEndOfStream() SftpSessionMock.InSequence(_sequence).Setup(p => p.IsOpen).Returns(true); SftpSessionMock.InSequence(_sequence) - .Setup(p => p.RequestWrite(_handle, (uint) _length, It.IsAny(), 0, bytesToWrite.Length, It.IsAny(), null)) + .Setup(p => p.RequestWrite(_handle, (uint)_length, It.IsAny(), 0, bytesToWrite.Length, It.IsAny(), null)) .Callback>((handle, serverOffset, data, offset, length, wait, writeCompleted) => { bytesWritten = data.Take(offset, length); @@ -193,7 +193,7 @@ public void WriteShouldStartFromEndOfStream() Assert.IsNotNull(bytesWritten); CollectionAssert.AreEqual(bytesToWrite, bytesWritten); - SftpSessionMock.Verify(p => p.RequestWrite(_handle, (uint) _length, It.IsAny(), 0, bytesToWrite.Length, It.IsAny(), null), Times.Once); + SftpSessionMock.Verify(p => p.RequestWrite(_handle, (uint)_length, It.IsAny(), 0, bytesToWrite.Length, It.IsAny(), null), Times.Once); SftpSessionMock.Verify(p => p.IsOpen, Times.Exactly(4)); } } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_Disposed.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_Disposed.cs index 86dc6f020..8b588b1e5 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_Disposed.cs @@ -32,10 +32,10 @@ protected void Arrange() { var random = new Random(); _path = random.Next().ToString(); - _handle = new[] { (byte) random.Next(byte.MinValue, byte.MaxValue) }; - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _handle = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) }; + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); _sftpSessionMock = new Mock(MockBehavior.Strict); @@ -55,7 +55,7 @@ protected void Arrange() _sftpSessionMock.InSequence(sequence) .Setup(p => p.RequestClose(_handle)); - _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Write, (int) _bufferSize); + _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Write, (int)_bufferSize); _sftpFileStream.Dispose(); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionNotOpen.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionNotOpen.cs index 8daf5aba7..626509ea5 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionNotOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionNotOpen.cs @@ -28,9 +28,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(4, random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); _length = 5555; } @@ -56,7 +56,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize); + (int)_bufferSize); } protected override void Act() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessRead.cs index d1459811c..993c15b6b 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessRead.cs @@ -28,9 +28,9 @@ protected override void SetupData() var random = new Random(); _path = random.Next().ToString(); _handle = GenerateRandom(5, random); - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); _length = 6666; } @@ -56,7 +56,7 @@ protected override void Arrange() _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize); + (int)_bufferSize); } protected override void Act() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessReadWrite.cs index 3adef51f0..0e65bf453 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessReadWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessReadWrite.cs @@ -45,10 +45,10 @@ protected void Arrange() { var random = new Random(); _path = random.Next().ToString(CultureInfo.InvariantCulture); - _handle = new[] { (byte) random.Next(byte.MinValue, byte.MaxValue) }; - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _handle = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) }; + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); _length = 7777; _fileAttributesLastAccessTime = DateTime.UtcNow.AddSeconds(random.Next()); @@ -56,7 +56,7 @@ protected void Arrange() _fileAttributesSize = random.Next(); _fileAttributesUserId = random.Next(); _fileAttributesGroupId = random.Next(); - _fileAttributesPermissions = (uint) random.Next(); + _fileAttributesPermissions = (uint)random.Next(); _fileAttributesExtensions = new Dictionary(); _fileAttributes = new SftpFileAttributes(_fileAttributesLastAccessTime, _fileAttributesLastWriteTime, @@ -88,7 +88,7 @@ protected void Arrange() .Setup(p => p.RequestFSetStat(_handle, _fileAttributes)) .Callback((bytes, attributes) => _lengthPassedToRequestFSetStat = attributes.Size); - _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.ReadWrite, (int) _bufferSize); + _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.ReadWrite, (int)_bufferSize); } protected void Act() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessWrite.cs index 5f82dbfc0..ec896d273 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessWrite.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessWrite.cs @@ -45,10 +45,10 @@ protected void Arrange() { var random = new Random(); _path = random.Next().ToString(CultureInfo.InvariantCulture); - _handle = new[] { (byte) random.Next(byte.MinValue, byte.MaxValue) }; - _bufferSize = (uint) random.Next(1, 1000); - _readBufferSize = (uint) random.Next(1, 1000); - _writeBufferSize = (uint) random.Next(1, 1000); + _handle = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) }; + _bufferSize = (uint)random.Next(1, 1000); + _readBufferSize = (uint)random.Next(1, 1000); + _writeBufferSize = (uint)random.Next(1, 1000); _length = 8888; _fileAttributesLastAccessTime = DateTime.UtcNow.AddSeconds(random.Next()); @@ -56,7 +56,7 @@ protected void Arrange() _fileAttributesSize = random.Next(); _fileAttributesUserId = random.Next(); _fileAttributesGroupId = random.Next(); - _fileAttributesPermissions = (uint) random.Next(); + _fileAttributesPermissions = (uint)random.Next(); _fileAttributesExtensions = new Dictionary(); _fileAttributes = new SftpFileAttributes(_fileAttributesLastAccessTime, _fileAttributesLastWriteTime, @@ -88,7 +88,7 @@ protected void Arrange() .Setup(p => p.RequestFSetStat(_handle, _fileAttributes)) .Callback((bytes, attributes) => _lengthPassedToRequestFSetStat = attributes.Size); - _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Write, (int) _bufferSize); + _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Write, (int)_bufferSize); } protected void Act() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_WriteAsync_SessionOpen_CountGreatherThanTwoTimesTheWriteBufferSize.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_WriteAsync_SessionOpen_CountGreatherThanTwoTimesTheWriteBufferSize.cs index f27e68685..8da36ddc2 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_WriteAsync_SessionOpen_CountGreatherThanTwoTimesTheWriteBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_WriteAsync_SessionOpen_CountGreatherThanTwoTimesTheWriteBufferSize.cs @@ -38,9 +38,9 @@ protected override void SetupData() _random = new Random(); _path = _random.Next().ToString(CultureInfo.InvariantCulture); _handle = GenerateRandom(5, _random); - _bufferSize = (uint) _random.Next(1, 1000); - _readBufferSize = (uint) _random.Next(0, 1000); - _writeBufferSize = (uint) _random.Next(500, 1000); + _bufferSize = (uint)_random.Next(1, 1000); + _readBufferSize = (uint)_random.Next(0, 1000); + _writeBufferSize = (uint)_random.Next(500, 1000); _data = new byte[(_writeBufferSize * 2) + 15]; _random.NextBytes(_data); _offset = _random.Next(1, 5); @@ -48,11 +48,11 @@ protected override void SetupData() // the number of bytes to write is at least two times the write buffer size; we write a few extra bytes to // ensure the buffer is not empty after the writes so we can verify whether Length, Dispose and Flush // flush the buffer - _count = ((int) _writeBufferSize * 2) + _random.Next(1, 5); + _count = ((int)_writeBufferSize * 2) + _random.Next(1, 5); _expectedWrittenByteCount = (2 * _writeBufferSize); - _expectedBufferedByteCount = (int) (_count - _expectedWrittenByteCount); - _expectedBufferedBytes = _data.Take(_offset + (int) _expectedWrittenByteCount, _expectedBufferedByteCount); + _expectedBufferedByteCount = (int)(_count - _expectedWrittenByteCount); + _expectedBufferedBytes = _data.Take(_offset + (int)_expectedWrittenByteCount, _expectedBufferedByteCount); _cancellationToken = new CancellationToken(); } @@ -69,10 +69,10 @@ protected override void SetupMocks() .Returns(_writeBufferSize); SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestWriteAsync(_handle, 0, _data, _offset, (int) _writeBufferSize, _cancellationToken)) + .Setup(p => p.RequestWriteAsync(_handle, 0, _data, _offset, (int)_writeBufferSize, _cancellationToken)) .Returns(Task.CompletedTask); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestWriteAsync(_handle, _writeBufferSize, _data, _offset + (int) _writeBufferSize, (int) _writeBufferSize, _cancellationToken)) + .Setup(p => p.RequestWriteAsync(_handle, _writeBufferSize, _data, _offset + (int)_writeBufferSize, (int)_writeBufferSize, _cancellationToken)) .Returns(Task.CompletedTask); } @@ -97,7 +97,7 @@ protected override async Task ArrangeAsync() { await base.ArrangeAsync(); - _target = await SftpFileStream.OpenAsync(SftpSessionMock.Object, _path, FileMode.Create, FileAccess.Write, (int) _bufferSize, _cancellationToken); + _target = await SftpFileStream.OpenAsync(SftpSessionMock.Object, _path, FileMode.Create, FileAccess.Write, (int)_bufferSize, _cancellationToken); } protected override Task ActAsync() @@ -108,8 +108,8 @@ protected override Task ActAsync() [TestMethod] public void RequestWriteOnSftpSessionShouldBeInvokedTwice() { - SftpSessionMock.Verify(p => p.RequestWriteAsync(_handle, 0, _data, _offset, (int) _writeBufferSize, _cancellationToken), Times.Once); - SftpSessionMock.Verify(p => p.RequestWriteAsync(_handle, _writeBufferSize, _data, _offset + (int) _writeBufferSize, (int) _writeBufferSize, _cancellationToken), Times.Once); + SftpSessionMock.Verify(p => p.RequestWriteAsync(_handle, 0, _data, _offset, (int)_writeBufferSize, _cancellationToken), Times.Once); + SftpSessionMock.Verify(p => p.RequestWriteAsync(_handle, _writeBufferSize, _data, _offset + (int)_writeBufferSize, (int)_writeBufferSize, _cancellationToken), Times.Once); } [TestMethod] diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Write_SessionOpen_CountGreatherThanTwoTimesTheWriteBufferSize.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Write_SessionOpen_CountGreatherThanTwoTimesTheWriteBufferSize.cs index ae669fe2f..0bb710193 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Write_SessionOpen_CountGreatherThanTwoTimesTheWriteBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Write_SessionOpen_CountGreatherThanTwoTimesTheWriteBufferSize.cs @@ -37,9 +37,9 @@ protected override void SetupData() _random = new Random(); _path = _random.Next().ToString(CultureInfo.InvariantCulture); _handle = GenerateRandom(5, _random); - _bufferSize = (uint) _random.Next(1, 1000); - _readBufferSize = (uint) _random.Next(0, 1000); - _writeBufferSize = (uint) _random.Next(500, 1000); + _bufferSize = (uint)_random.Next(1, 1000); + _readBufferSize = (uint)_random.Next(0, 1000); + _writeBufferSize = (uint)_random.Next(500, 1000); _data = new byte[(_writeBufferSize * 2) + 15]; _random.NextBytes(_data); _offset = _random.Next(1, 5); @@ -47,11 +47,11 @@ protected override void SetupData() // the number of bytes to write is at least two times the write buffer size; we write a few extra bytes to // ensure the buffer is not empty after the writes so we can verify whether Length, Dispose and Flush // flush the buffer - _count = ((int) _writeBufferSize * 2) + _random.Next(1, 5); + _count = ((int)_writeBufferSize * 2) + _random.Next(1, 5); _expectedWrittenByteCount = (2 * _writeBufferSize); - _expectedBufferedByteCount = (int) (_count - _expectedWrittenByteCount); - _expectedBufferedBytes = _data.Take(_offset + (int) _expectedWrittenByteCount, _expectedBufferedByteCount); + _expectedBufferedByteCount = (int)(_count - _expectedWrittenByteCount); + _expectedBufferedBytes = _data.Take(_offset + (int)_expectedWrittenByteCount, _expectedBufferedByteCount); } protected override void SetupMocks() @@ -67,9 +67,9 @@ protected override void SetupMocks() .Returns(_writeBufferSize); SftpSessionMock.InSequence(MockSequence).Setup(p => p.IsOpen).Returns(true); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestWrite(_handle, 0, _data, _offset, (int) _writeBufferSize, It.IsAny(), null)); + .Setup(p => p.RequestWrite(_handle, 0, _data, _offset, (int)_writeBufferSize, It.IsAny(), null)); SftpSessionMock.InSequence(MockSequence) - .Setup(p => p.RequestWrite(_handle, _writeBufferSize, _data, _offset + (int) _writeBufferSize, (int) _writeBufferSize, It.IsAny(), null)); + .Setup(p => p.RequestWrite(_handle, _writeBufferSize, _data, _offset + (int)_writeBufferSize, (int)_writeBufferSize, It.IsAny(), null)); } [TestCleanup] @@ -96,7 +96,7 @@ protected override void Arrange() _path, FileMode.Create, FileAccess.Write, - (int) _bufferSize); + (int)_bufferSize); } protected override void Act() @@ -107,8 +107,8 @@ protected override void Act() [TestMethod] public void RequestWriteOnSftpSessionShouldBeInvokedTwice() { - SftpSessionMock.Verify(p => p.RequestWrite(_handle, 0, _data, _offset, (int) _writeBufferSize, It.IsAny(), null), Times.Once); - SftpSessionMock.Verify(p => p.RequestWrite(_handle, _writeBufferSize, _data, _offset + (int) _writeBufferSize, (int) _writeBufferSize, It.IsAny(), null), Times.Once); + SftpSessionMock.Verify(p => p.RequestWrite(_handle, 0, _data, _offset, (int)_writeBufferSize, It.IsAny(), null), Times.Once); + SftpSessionMock.Verify(p => p.RequestWrite(_handle, _writeBufferSize, _data, _offset + (int)_writeBufferSize, (int)_writeBufferSize, It.IsAny(), null), Times.Once); } [TestMethod] diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestRead.cs index 609e39620..fea017d0b 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestRead.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestRead.cs @@ -55,7 +55,7 @@ private void SetupData() #region SftpSession.Connect() _operationTimeout = random.Next(100, 500); - _protocolVersion = (uint) random.Next(0, 3); + _protocolVersion = (uint)random.Next(0, 3); _encoding = Encoding.UTF8; _sftpResponseFactory = new SftpResponseFactory(); _sftpInitRequestBytes = new SftpInitRequestBuilder().WithVersion(SftpSession.MaximumSupportedVersion) @@ -78,9 +78,9 @@ private void SetupData() #endregion SftpSession.Connect() _handle = CryptoAbstraction.GenerateRandom(random.Next(1, 10)); - _offset = (uint) random.Next(1, 5); - _length = (uint) random.Next(30, 50); - _data = CryptoAbstraction.GenerateRandom((int) _length); + _offset = (uint)random.Next(1, 5); + _length = (uint)random.Next(30, 50); + _data = CryptoAbstraction.GenerateRandom((int)_length); _sftpReadRequestBytes = new SftpReadRequestBuilder().WithProtocolVersion(_protocolVersion) .WithRequestId(2) .WithHandle(_handle) diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestStatVfs.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestStatVfs.cs index 233504aa0..85243dfd1 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestStatVfs.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_Connected_RequestStatVfs.cs @@ -75,7 +75,7 @@ private void SetupData() #endregion SftpSession.Connect() _path = random.Next().ToString(); - _bAvail = (ulong) random.Next(0, int.MaxValue); + _bAvail = (ulong)random.Next(0, int.MaxValue); _sftpStatVfsRequestBytes = new SftpStatVfsRequestBuilder().WithProtocolVersion(_protocolVersion) .WithRequestId(2) .WithPath(_path) diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesInSingleSshDataMessage.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesInSingleSshDataMessage.cs index 79814e3a9..eda2fc79f 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesInSingleSshDataMessage.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesInSingleSshDataMessage.cs @@ -57,7 +57,7 @@ private void SetupData() #region SftpSession.Connect() _operationTimeout = random.Next(100, 500); - _protocolVersion = (uint) random.Next(0, 3); + _protocolVersion = (uint)random.Next(0, 3); _encoding = Encoding.UTF8; _sftpInitRequestBytes = new SftpInitRequestBuilder().WithVersion(SftpSession.MaximumSupportedVersion) @@ -81,8 +81,8 @@ private void SetupData() _path = random.Next().ToString(); _handle = CryptoAbstraction.GenerateRandom(4); - _offset = (uint) random.Next(1, 5); - _length = (uint) random.Next(30, 50); + _offset = (uint)random.Next(1, 5); + _length = (uint)random.Next(30, 50); _data = CryptoAbstraction.GenerateRandom(200); _sftpOpenRequestBytes = new SftpOpenRequestBuilder().WithProtocolVersion(_protocolVersion) .WithRequestId(2) @@ -134,7 +134,7 @@ private void SetupMocks() new ChannelDataEventArgs(0, _sftpVersionResponse.GetBytes())); }); _sftpResponseFactoryMock.InSequence(sequence) - .Setup(p => p.Create(0U, (byte) SftpMessageTypes.Version, _encoding)) + .Setup(p => p.Create(0U, (byte)SftpMessageTypes.Version, _encoding)) .Returns(_sftpVersionResponse); _channelSessionMock.InSequence(sequence).Setup(p => p.IsOpen).Returns(true); _channelSessionMock.InSequence(sequence).Setup(p => p.SendData(_sftpRealPathRequestBytes)) @@ -144,7 +144,7 @@ private void SetupMocks() new ChannelDataEventArgs(0, _sftpNameResponse.GetBytes())); }); _sftpResponseFactoryMock.InSequence(sequence) - .Setup(p => p.Create(_protocolVersion, (byte) SftpMessageTypes.Name, _encoding)) + .Setup(p => p.Create(_protocolVersion, (byte)SftpMessageTypes.Name, _encoding)) .Returns(_sftpNameResponse); #endregion SftpSession.Connect() @@ -162,10 +162,10 @@ private void SetupMocks() new ChannelDataEventArgs(0, sshMessagePayload)); }); _sftpResponseFactoryMock.InSequence(sequence) - .Setup(p => p.Create(_protocolVersion, (byte) SftpMessageTypes.Handle, _encoding)) + .Setup(p => p.Create(_protocolVersion, (byte)SftpMessageTypes.Handle, _encoding)) .Returns(new SftpHandleResponse(_protocolVersion)); _sftpResponseFactoryMock.InSequence(sequence) - .Setup(p => p.Create(_protocolVersion, (byte) SftpMessageTypes.Data, _encoding)) + .Setup(p => p.Create(_protocolVersion, (byte)SftpMessageTypes.Data, _encoding)) .Returns(new SftpDataResponse(_protocolVersion)); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesSplitOverMultipleSshDataMessages.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesSplitOverMultipleSshDataMessages.cs index bf455910c..77b0c42ec 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesSplitOverMultipleSshDataMessages.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_MultipleSftpMessagesSplitOverMultipleSshDataMessages.cs @@ -57,7 +57,7 @@ private void SetupData() #region SftpSession.Connect() _operationTimeout = random.Next(100, 500); - _protocolVersion = (uint) random.Next(0, 3); + _protocolVersion = (uint)random.Next(0, 3); _encoding = Encoding.UTF8; _sftpInitRequestBytes = new SftpInitRequestBuilder().WithVersion(SftpSession.MaximumSupportedVersion) @@ -81,8 +81,8 @@ private void SetupData() _path = random.Next().ToString(); _handle = CryptoAbstraction.GenerateRandom(4); - _offset = (uint) random.Next(1, 5); - _length = (uint) random.Next(30, 50); + _offset = (uint)random.Next(1, 5); + _length = (uint)random.Next(30, 50); _data = CryptoAbstraction.GenerateRandom(200); _sftpOpenRequestBytes = new SftpOpenRequestBuilder().WithProtocolVersion(_protocolVersion) .WithRequestId(2) @@ -134,7 +134,7 @@ private void SetupMocks() new ChannelDataEventArgs(0, _sftpVersionResponse.GetBytes())); }); _sftpResponseFactoryMock.InSequence(sequence) - .Setup(p => p.Create(0U, (byte) SftpMessageTypes.Version, _encoding)) + .Setup(p => p.Create(0U, (byte)SftpMessageTypes.Version, _encoding)) .Returns(_sftpVersionResponse); _channelSessionMock.InSequence(sequence).Setup(p => p.IsOpen).Returns(true); _channelSessionMock.InSequence(sequence).Setup(p => p.SendData(_sftpRealPathRequestBytes)) @@ -144,7 +144,7 @@ private void SetupMocks() new ChannelDataEventArgs(0, _sftpNameResponse.GetBytes())); }); _sftpResponseFactoryMock.InSequence(sequence) - .Setup(p => p.Create(_protocolVersion, (byte) SftpMessageTypes.Name, _encoding)) + .Setup(p => p.Create(_protocolVersion, (byte)SftpMessageTypes.Name, _encoding)) .Returns(_sftpNameResponse); #endregion SftpSession.Connect() @@ -160,7 +160,7 @@ private void SetupMocks() new ChannelDataEventArgs(0, sshMessagePayload)); }); _sftpResponseFactoryMock.InSequence(sequence) - .Setup(p => p.Create(_protocolVersion, (byte) SftpMessageTypes.Handle, _encoding)) + .Setup(p => p.Create(_protocolVersion, (byte)SftpMessageTypes.Handle, _encoding)) .Returns(new SftpHandleResponse(_protocolVersion)); _channelSessionMock.InSequence(sequence).Setup(p => p.IsOpen).Returns(true); _channelSessionMock.InSequence(sequence).Setup(p => p.SendData(_sftpReadRequestBytes)).Callback(() => @@ -172,7 +172,7 @@ private void SetupMocks() new ChannelDataEventArgs(0, sshMessagePayload)); }); _sftpResponseFactoryMock.InSequence(sequence) - .Setup(p => p.Create(_protocolVersion, (byte) SftpMessageTypes.Data, _encoding)) + .Setup(p => p.Create(_protocolVersion, (byte)SftpMessageTypes.Data, _encoding)) .Returns(new SftpDataResponse(_protocolVersion)); } diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_SingleSftpMessageInSshDataMessage.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_SingleSftpMessageInSshDataMessage.cs index dae1ca72f..46dca30a4 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_SingleSftpMessageInSshDataMessage.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpSessionTest_DataReceived_SingleSftpMessageInSshDataMessage.cs @@ -53,7 +53,7 @@ private void SetupData() #region SftpSession.Connect() _operationTimeout = random.Next(100, 500); - _protocolVersion = (uint) random.Next(0, 3); + _protocolVersion = (uint)random.Next(0, 3); _encoding = Encoding.UTF8; _sftpInitRequestBytes = new SftpInitRequestBuilder().WithVersion(SftpSession.MaximumSupportedVersion) @@ -76,8 +76,8 @@ private void SetupData() #endregion SftpSession.Connect() _handle = CryptoAbstraction.GenerateRandom(4); - _offset = (uint) random.Next(1, 5); - _length = (uint) random.Next(30, 50); + _offset = (uint)random.Next(1, 5); + _length = (uint)random.Next(30, 50); _data = CryptoAbstraction.GenerateRandom(200); _sftpReadRequestBytes = new SftpReadRequestBuilder().WithProtocolVersion(_protocolVersion) .WithRequestId(2) @@ -117,7 +117,7 @@ private void SetupMocks() new ChannelDataEventArgs(0, _sftpVersionResponse.GetBytes())); }); _sftpResponseFactoryMock.InSequence(sequence) - .Setup(p => p.Create(0U, (byte) SftpMessageTypes.Version, _encoding)) + .Setup(p => p.Create(0U, (byte)SftpMessageTypes.Version, _encoding)) .Returns(_sftpVersionResponse); _channelSessionMock.InSequence(sequence).Setup(p => p.IsOpen).Returns(true); _channelSessionMock.InSequence(sequence).Setup(p => p.SendData(_sftpRealPathRequestBytes)) @@ -127,7 +127,7 @@ private void SetupMocks() new ChannelDataEventArgs(0, _sftpNameResponse.GetBytes())); }); _sftpResponseFactoryMock.InSequence(sequence) - .Setup(p => p.Create(_protocolVersion, (byte) SftpMessageTypes.Name, _encoding)) + .Setup(p => p.Create(_protocolVersion, (byte)SftpMessageTypes.Name, _encoding)) .Returns(_sftpNameResponse); #endregion SftpSession.Connect() @@ -140,7 +140,7 @@ private void SetupMocks() new ChannelDataEventArgs(0, _sftpDataResponseBytes)); }); _sftpResponseFactoryMock.InSequence(sequence) - .Setup(p => p.Create(_protocolVersion, (byte) SftpMessageTypes.Data, _encoding)) + .Setup(p => p.Create(_protocolVersion, (byte)SftpMessageTypes.Data, _encoding)) .Returns(new SftpDataResponse(_protocolVersion)); } diff --git a/test/Renci.SshNet.Tests/Classes/SftpClientTest_Connect_SftpSessionConnectFailure.cs b/test/Renci.SshNet.Tests/Classes/SftpClientTest_Connect_SftpSessionConnectFailure.cs index b8d85e0af..1b2a068c1 100644 --- a/test/Renci.SshNet.Tests/Classes/SftpClientTest_Connect_SftpSessionConnectFailure.cs +++ b/test/Renci.SshNet.Tests/Classes/SftpClientTest_Connect_SftpSessionConnectFailure.cs @@ -121,7 +121,7 @@ private static KeyHostAlgorithm GetKeyHostAlgorithm() using (var s = TestBase.GetData("Key.RSA.txt")) { var privateKey = new PrivateKeyFile(s); - return (KeyHostAlgorithm) privateKey.HostKeyAlgorithms.First(); + return (KeyHostAlgorithm)privateKey.HostKeyAlgorithms.First(); } } } diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs index a7fb08247..813300fc4 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs @@ -38,10 +38,10 @@ protected override void OnInit() var random = new Random(); _terminalName = random.Next().ToString(CultureInfo.InvariantCulture); - _widthColumns = (uint) random.Next(); - _heightRows = (uint) random.Next(); - _widthPixels = (uint) random.Next(); - _heightPixels = (uint) random.Next(); + _widthColumns = (uint)random.Next(); + _heightRows = (uint)random.Next(); + _widthPixels = (uint)random.Next(); + _heightPixels = (uint)random.Next(); _terminalModes = new Dictionary(); _bufferSize = random.Next(100, 500); diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteLessBytesThanBufferSize.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteLessBytesThanBufferSize.cs index 6df25acfc..54e97d594 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteLessBytesThanBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteLessBytesThanBufferSize.cs @@ -44,10 +44,10 @@ private void SetupData() var random = new Random(); _terminalName = random.Next().ToString(); - _widthColumns = (uint) random.Next(); - _heightRows = (uint) random.Next(); - _widthPixels = (uint) random.Next(); - _heightPixels = (uint) random.Next(); + _widthColumns = (uint)random.Next(); + _heightRows = (uint)random.Next(); + _widthPixels = (uint)random.Next(); + _heightPixels = (uint)random.Next(); _terminalModes = new Dictionary(); _bufferSize = random.Next(100, 1000); diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteMoreBytesThanBufferSize.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteMoreBytesThanBufferSize.cs index f29cfc5e0..d52e55c00 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteMoreBytesThanBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteMoreBytesThanBufferSize.cs @@ -47,10 +47,10 @@ private void SetupData() var random = new Random(); _terminalName = random.Next().ToString(); - _widthColumns = (uint) random.Next(); - _heightRows = (uint) random.Next(); - _widthPixels = (uint) random.Next(); - _heightPixels = (uint) random.Next(); + _widthColumns = (uint)random.Next(); + _heightRows = (uint)random.Next(); + _widthPixels = (uint)random.Next(); + _heightPixels = (uint)random.Next(); _terminalModes = new Dictionary(); _bufferSize = random.Next(100, 1000); diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteNumberOfBytesEqualToBufferSize.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteNumberOfBytesEqualToBufferSize.cs index 4727a3146..20968486a 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteNumberOfBytesEqualToBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteNumberOfBytesEqualToBufferSize.cs @@ -44,10 +44,10 @@ private void SetupData() var random = new Random(); _terminalName = random.Next().ToString(); - _widthColumns = (uint) random.Next(); - _heightRows = (uint) random.Next(); - _widthPixels = (uint) random.Next(); - _heightPixels = (uint) random.Next(); + _widthColumns = (uint)random.Next(); + _heightRows = (uint)random.Next(); + _widthPixels = (uint)random.Next(); + _heightPixels = (uint)random.Next(); _terminalModes = new Dictionary(); _bufferSize = random.Next(100, 1000); diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteZeroBytes.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteZeroBytes.cs index 2355f758d..94d55ca87 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteZeroBytes.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteZeroBytes.cs @@ -43,10 +43,10 @@ private void SetupData() var random = new Random(); _terminalName = random.Next().ToString(); - _widthColumns = (uint) random.Next(); - _heightRows = (uint) random.Next(); - _widthPixels = (uint) random.Next(); - _heightPixels = (uint) random.Next(); + _widthColumns = (uint)random.Next(); + _heightRows = (uint)random.Next(); + _widthPixels = (uint)random.Next(); + _heightPixels = (uint)random.Next(); _terminalModes = new Dictionary(); _bufferSize = random.Next(100, 1000); diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteLessBytesThanBufferSize.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteLessBytesThanBufferSize.cs index 4da481227..680c4140a 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteLessBytesThanBufferSize.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteLessBytesThanBufferSize.cs @@ -45,10 +45,10 @@ private void SetupData() var random = new Random(); _terminalName = random.Next().ToString(); - _widthColumns = (uint) random.Next(); - _heightRows = (uint) random.Next(); - _widthPixels = (uint) random.Next(); - _heightPixels = (uint) random.Next(); + _widthColumns = (uint)random.Next(); + _heightRows = (uint)random.Next(); + _widthPixels = (uint)random.Next(); + _heightPixels = (uint)random.Next(); _terminalModes = new Dictionary(); _bufferSize = random.Next(100, 1000); diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteZeroBytes.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteZeroBytes.cs index fe20b4fc9..194af3c69 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteZeroBytes.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteZeroBytes.cs @@ -45,10 +45,10 @@ private void SetupData() var random = new Random(); _terminalName = random.Next().ToString(); - _widthColumns = (uint) random.Next(); - _heightRows = (uint) random.Next(); - _widthPixels = (uint) random.Next(); - _heightPixels = (uint) random.Next(); + _widthColumns = (uint)random.Next(); + _heightRows = (uint)random.Next(); + _widthPixels = (uint)random.Next(); + _heightPixels = (uint)random.Next(); _terminalModes = new Dictionary(); _bufferSize = random.Next(100, 1000); diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteLessBytesThanBufferCanContain.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteLessBytesThanBufferCanContain.cs index afa0346fe..ac8c38477 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteLessBytesThanBufferCanContain.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteLessBytesThanBufferCanContain.cs @@ -45,10 +45,10 @@ private void SetupData() var random = new Random(); _terminalName = random.Next().ToString(); - _widthColumns = (uint) random.Next(); - _heightRows = (uint) random.Next(); - _widthPixels = (uint) random.Next(); - _heightPixels = (uint) random.Next(); + _widthColumns = (uint)random.Next(); + _heightRows = (uint)random.Next(); + _widthPixels = (uint)random.Next(); + _heightPixels = (uint)random.Next(); _terminalModes = new Dictionary(); _bufferSize = random.Next(100, 1000); diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteMoreBytesThanBufferCanContain.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteMoreBytesThanBufferCanContain.cs index fa938b863..f0622ccf3 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteMoreBytesThanBufferCanContain.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteMoreBytesThanBufferCanContain.cs @@ -47,10 +47,10 @@ private void SetupData() var random = new Random(); _terminalName = random.Next().ToString(); - _widthColumns = (uint) random.Next(); - _heightRows = (uint) random.Next(); - _widthPixels = (uint) random.Next(); - _heightPixels = (uint) random.Next(); + _widthColumns = (uint)random.Next(); + _heightRows = (uint)random.Next(); + _widthPixels = (uint)random.Next(); + _heightPixels = (uint)random.Next(); _terminalModes = new Dictionary(); _bufferSize = random.Next(100, 1000); diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteZeroBytes.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteZeroBytes.cs index cd7be2ede..bc094dc57 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteZeroBytes.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferNotEmptyAndWriteZeroBytes.cs @@ -45,10 +45,10 @@ private void SetupData() var random = new Random(); _terminalName = random.Next().ToString(); - _widthColumns = (uint) random.Next(); - _heightRows = (uint) random.Next(); - _widthPixels = (uint) random.Next(); - _heightPixels = (uint) random.Next(); + _widthColumns = (uint)random.Next(); + _heightRows = (uint)random.Next(); + _widthPixels = (uint)random.Next(); + _heightPixels = (uint)random.Next(); _terminalModes = new Dictionary(); _bufferSize = random.Next(100, 1000); diff --git a/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSizeAndTerminalModes_Connected.cs b/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSizeAndTerminalModes_Connected.cs index 113c9cd76..a65716514 100644 --- a/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSizeAndTerminalModes_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSizeAndTerminalModes_Connected.cs @@ -32,10 +32,10 @@ protected override void SetupData() _connectionInfo = new ConnectionInfo("host", "user", new NoneAuthenticationMethod("userauth")); _terminalName = random.Next().ToString(); - _widthColumns = (uint) random.Next(); - _heightRows = (uint) random.Next(); - _widthPixels = (uint) random.Next(); - _heightPixels = (uint) random.Next(); + _widthColumns = (uint)random.Next(); + _heightRows = (uint)random.Next(); + _widthPixels = (uint)random.Next(); + _heightPixels = (uint)random.Next(); _terminalModes = new Dictionary(); _bufferSize = random.Next(100, 1000); diff --git a/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSize_Connected.cs b/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSize_Connected.cs index 41111de5c..861c8c725 100644 --- a/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSize_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SshClientTest_CreateShellStream_TerminalNameAndColumnsAndRowsAndWidthAndHeightAndBufferSize_Connected.cs @@ -29,10 +29,10 @@ protected override void SetupData() _connectionInfo = new ConnectionInfo("host", "user", new NoneAuthenticationMethod("userauth")); _terminalName = random.Next().ToString(); - _widthColumns = (uint) random.Next(); - _heightRows = (uint) random.Next(); - _widthPixels = (uint) random.Next(); - _heightPixels = (uint) random.Next(); + _widthColumns = (uint)random.Next(); + _heightRows = (uint)random.Next(); + _widthPixels = (uint)random.Next(); + _heightPixels = (uint)random.Next(); _bufferSize = random.Next(100, 1000); _expected = CreateShellStream(); diff --git a/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_ChannelOpen.cs b/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_ChannelOpen.cs index f535f6d97..417219ae4 100644 --- a/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_ChannelOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/SshCommandTest_EndExecute_ChannelOpen.cs @@ -72,7 +72,7 @@ private void Arrange() _channelSessionMock.Raise(c => c.ExtendedDataReceived += null, new ChannelExtendedDataEventArgs(0, _encoding.GetBytes(_extendedDataB), 0)); _channelSessionMock.Raise(c => c.RequestReceived += null, - new ChannelRequestEventArgs(new ExitStatusRequestInfo((uint) _expectedExitStatus))); + new ChannelRequestEventArgs(new ExitStatusRequestInfo((uint)_expectedExitStatus))); } private void Act() diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Connected.cs index 81f5519e3..54adb93d9 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Connected.cs @@ -39,8 +39,8 @@ protected void Arrange() _disconnectedRegister = new List(); _errorOccurredRegister = new List(); _channelDataEventArgs = new ChannelDataEventArgs( - (uint) random.Next(0, int.MaxValue), - new[] { (byte) random.Next(byte.MinValue, byte.MaxValue) }); + (uint)random.Next(0, int.MaxValue), + new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) }); _sessionMock = new Mock(MockBehavior.Strict); _channelMock = new Mock(MockBehavior.Strict); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Disposed.cs index dd74ada28..e34294f9b 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Disposed.cs @@ -38,8 +38,8 @@ protected void Arrange() _disconnectedRegister = new List(); _errorOccurredRegister = new List(); _channelDataEventArgs = new ChannelDataEventArgs( - (uint) random.Next(0, int.MaxValue), - new[] { (byte) random.Next(byte.MinValue, byte.MaxValue) }); + (uint)random.Next(0, int.MaxValue), + new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) }); _sessionMock = new Mock(MockBehavior.Strict); _channelMock = new Mock(MockBehavior.Strict); 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 c3fe6cf33..bd083f515 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_OnDataReceived_Exception.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_OnDataReceived_Exception.cs @@ -40,8 +40,8 @@ protected void Arrange() _disconnectedRegister = new List(); _errorOccurredRegister = new List(); _channelDataEventArgs = new ChannelDataEventArgs( - (uint) random.Next(0, int.MaxValue), - new[] { (byte) random.Next(byte.MinValue, byte.MaxValue) }); + (uint)random.Next(0, int.MaxValue), + new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) }); _onDataReceivedException = new SystemException(); _sessionMock = new Mock(MockBehavior.Strict); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Connected.cs index 7e3b5a74e..72b95ef87 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_Connected.cs @@ -38,7 +38,7 @@ protected void Arrange() _operationTimeout = 30000; _disconnectedRegister = new List(); _errorOccurredRegister = new List(); - _data = new[] { (byte) random.Next(byte.MinValue, byte.MaxValue) }; + _data = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) }; _sessionMock = new Mock(MockBehavior.Strict); _channelMock = new Mock(MockBehavior.Strict); diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_NeverConnected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_NeverConnected.cs index b76436415..93af67cb7 100644 --- a/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_NeverConnected.cs +++ b/test/Renci.SshNet.Tests/Classes/SubsystemSession_SendData_NeverConnected.cs @@ -39,7 +39,7 @@ protected void Arrange() _operationTimeout = 30000; _disconnectedRegister = new List(); _errorOccurredRegister = new List(); - _data = new[] { (byte) random.Next(byte.MinValue, byte.MaxValue) }; + _data = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) }; _sessionMock = new Mock(MockBehavior.Strict); _channelMock = new Mock(MockBehavior.Strict); diff --git a/test/Renci.SshNet.Tests/Common/AsyncSocketListener.cs b/test/Renci.SshNet.Tests/Common/AsyncSocketListener.cs index 5e48b74d5..e162c9ef6 100644 --- a/test/Renci.SshNet.Tests/Common/AsyncSocketListener.cs +++ b/test/Renci.SshNet.Tests/Common/AsyncSocketListener.cs @@ -105,7 +105,7 @@ private void StartListener(object state) { try { - var listener = (Socket) state; + var listener = (Socket)state; while (_started) { _ = _acceptCallbackDone.Reset(); @@ -130,7 +130,7 @@ private void AcceptCallback(IAsyncResult ar) _ = _acceptCallbackDone.Set(); // Get the socket that listens for inbound connections - var listener = (Socket) ar.AsyncState; + var listener = (Socket)ar.AsyncState; // Get the socket that handles the client request Socket handler; @@ -227,7 +227,7 @@ private void ReadCallback(IAsyncResult ar) { // Retrieve the state object and the handler socket // from the asynchronous state object - var state = (SocketStateObject) ar.AsyncState; + var state = (SocketStateObject)ar.AsyncState; var handler = state.Socket; int bytesRead; From 248dbd6ef9702e9e335f5dd10747fa29853953b9 Mon Sep 17 00:00:00 2001 From: Robert Hague Date: Fri, 17 May 2024 22:13:16 +0200 Subject: [PATCH 9/9] Revert SA1021 suppression --- .editorconfig | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.editorconfig b/.editorconfig index e45c85b25..3577f7db4 100644 --- a/.editorconfig +++ b/.editorconfig @@ -345,10 +345,6 @@ dotnet_diagnostic.SA1008.severity = none # var x = (int) z; dotnet_diagnostic.SA1009.severity = none -# SA1021: A negative sign within a C# element is not spaced correctly. -# disabled, because it conflicts with csharp_space_after_cast -dotnet_diagnostic.SA1021.severity = none - # SA1025: Code should not contain multiple whitespace in a row # https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1025.md # duplicate of IDE0055