From c0a353a4de7791b8274d6f7089687fb6fbfa58ae Mon Sep 17 00:00:00 2001 From: mus65 Date: Fri, 17 May 2024 22:34:27 +0200 Subject: [PATCH] Cleanup formatting and style and enforce it in CI (#1380) * 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 * 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" * new formatting fixes after merge * appveyor: set git autocrlf as suggested by sharwell to hopefully fix Windows CI. * use autocrlf input to hopefully fix Linux tests * fix formatting * use autocrlf input for Linux only * set csharp_space_after_cast to false * Revert SA1021 suppression --------- Co-authored-by: Robert Hague --- .editorconfig | 25 +- appveyor.yml | 6 + .../Abstractions/CryptoAbstraction.cs | 1 + .../Abstractions/SocketAbstraction.cs | 12 +- .../Abstractions/SocketExtensions.cs | 6 +- src/Renci.SshNet/AuthenticationMethod.cs | 2 +- src/Renci.SshNet/Channels/Channel.cs | 6 +- .../Channels/ChannelDirectTcpip.cs | 5 +- .../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 | 134 +++-- src/Renci.SshNet/Common/DerData.cs | 2 +- src/Renci.SshNet/Common/Extensions.cs | 1 + src/Renci.SshNet/Common/Pack.cs | 100 ++-- src/Renci.SshNet/Common/PacketDump.cs | 2 +- .../Common/SshConnectionException.cs | 1 + src/Renci.SshNet/Common/SshData.cs | 6 +- src/Renci.SshNet/Common/SshDataStream.cs | 8 +- 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 | 2 +- .../Connection/Socks5Connector.cs | 10 +- src/Renci.SshNet/ForwardedPortDynamic.cs | 4 +- src/Renci.SshNet/ForwardedPortLocal.cs | 8 +- src/Renci.SshNet/ForwardedPortRemote.cs | 2 +- src/Renci.SshNet/ForwardedPortStatus.cs | 2 +- src/Renci.SshNet/ISubsystemSession.cs | 1 + .../KeyboardInteractiveConnectionInfo.cs | 1 + .../InformationRequestMessage.cs | 1 + .../InformationResponseMessage.cs | 2 +- .../Messages/Authentication/RequestMessage.cs | 1 + .../PseudoTerminalRequestInfo.cs | 6 +- src/Renci.SshNet/Messages/Message.cs | 4 +- .../Messages/Transport/DisconnectMessage.cs | 4 +- .../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 | 18 +- src/Renci.SshNet/ScpClient.cs | 8 +- .../Security/Cryptography/BlockCipher.cs | 1 + .../Cryptography/Ciphers/AesCipher.CtrImpl.cs | 2 +- .../Cryptography/Ciphers/AesCipher.cs | 2 +- .../Cryptography/Ciphers/Arc4Cipher.cs | 2 +- .../Cryptography/Ciphers/BlowfishCipher.cs | 1 + .../Cryptography/Ciphers/CastCipher.cs | 11 +- .../Cryptography/Ciphers/DesCipher.cs | 21 +- .../Ciphers/Modes/OfbCipherMode.cs | 2 +- .../Ciphers/Paddings/PKCS5Padding.cs | 2 +- .../Ciphers/Paddings/PKCS7Padding.cs | 2 +- .../Cryptography/Ciphers/SerpentCipher.cs | 12 +- .../Cryptography/Ciphers/TwofishCipher.cs | 14 +- .../Cryptography/ED25519DigitalSignature.cs | 1 + .../Cryptography/EcdsaDigitalSignature.cs | 2 +- .../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 | 24 +- ...changeDiffieHellmanGroupExchangeShaBase.cs | 30 +- src/Renci.SshNet/Security/KeyExchangeEC.cs | 22 +- src/Renci.SshNet/Security/KeyExchangeECDH.cs | 1 + src/Renci.SshNet/ServiceFactory.cs | 6 +- src/Renci.SshNet/Session.cs | 14 +- .../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 | 3 +- .../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/Responses/SftpNameResponse.cs | 2 +- .../Sftp/Responses/SftpStatusResponse.cs | 2 +- .../Sftp/SftpDownloadAsyncResult.cs | 1 + src/Renci.SshNet/Sftp/SftpFile.cs | 1 + src/Renci.SshNet/Sftp/SftpFileAttributes.cs | 18 +- src/Renci.SshNet/Sftp/SftpFileReader.cs | 16 +- src/Renci.SshNet/Sftp/SftpFileStream.cs | 22 +- 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 +- .../Ciphers/AesCipherBenchmarks.cs | 1 + .../ED25519DigitalSignatureBenchmarks.cs | 2 +- .../RsaDigitalSignatureBenchmarks.cs | 2 +- .../ScpClientBenchmark.cs | 1 + .../Common/Socks5Handler.cs | 6 +- .../ConnectivityTests.cs | 14 +- .../HostConfig.cs | 2 +- .../HostKeyFile.cs | 2 +- .../LinuxVMConnectionFactory.cs | 2 +- .../ForwardedPortLocalTest.cs | 8 +- .../SftpClientTest.ListDirectory.cs | 2 +- .../SftpClientTest.Upload.cs | 18 +- .../ScpClientTests.cs | 2 +- .../Renci.SshNet.IntegrationTests/ScpTests.cs | 16 +- .../SftpClientTests.cs | 2 +- .../SftpTests.cs | 22 +- .../SshConnectionDisruptor.cs | 4 +- .../Renci.SshNet.IntegrationTests/SshTests.cs | 18 +- test/Renci.SshNet.Tests/.editorconfig | 4 - .../Classes/BaseClientTestBase.cs | 1 + ...Test_Connect_OnConnectedThrowsException.cs | 11 +- ...nected_KeepAliveInterval_NotNegativeOne.cs | 3 + ...Connected_KeepAlivesNotSentConcurrently.cs | 9 +- .../BaseClientTest_Disconnected_Connect.cs | 2 + ...nected_KeepAliveInterval_NotNegativeOne.cs | 3 + ...nected_KeepAliveInterval_NotNegativeOne.cs | 3 + .../Channels/ChannelDirectTcpipTest.cs | 20 +- ...pose_SessionIsConnectedAndChannelIsOpen.cs | 11 +- ...pose_SessionIsConnectedAndChannelIsOpen.cs | 12 +- .../Channels/ChannelSessionTestBase.cs | 1 + .../ChannelSessionTest_Dispose_Disposed.cs | 4 +- ...hannelEofReceived_DisposeInEventHandler.cs | 17 +- ...Received_SendChannelCloseMessageFailure.cs | 15 +- ...Received_SendChannelCloseMessageSuccess.cs | 15 +- ...Received_SendChannelCloseMessageFailure.cs | 17 +- ...Received_SendChannelCloseMessageSuccess.cs | 15 +- ...Received_SendChannelCloseMessageFailure.cs | 17 +- ...Received_SendChannelCloseMessageSuccess.cs | 15 +- ...Open_NoChannelCloseOrChannelEofReceived.cs | 15 +- ...ofReceived_SendChannelEofMessageFailure.cs | 17 +- ...sOpen_ChannelCloseAndChannelEofReceived.cs | 17 +- ...edAndChannelIsOpen_ChannelCloseReceived.cs | 17 +- ...Open_NoChannelCloseOrChannelEofReceived.cs | 17 +- ...ived_SessionIsConnectedAndChannelIsOpen.cs | 15 +- ...Open_ExceptionWaitingOnOpenConfirmation.cs | 11 +- ...nOpenFailureReceived_NoRetriesAvailable.cs | 17 +- ...n_OnOpenFailureReceived_RetriesAvalable.cs | 17 +- .../Classes/Channels/ChannelStub.cs | 3 +- .../Classes/Channels/ChannelTestBase.cs | 1 + ...e_SessionIsConnectedAndChannelIsNotOpen.cs | 11 +- ...onnectedAndChannelIsOpen_EofNotReceived.cs | 17 +- ...nelIsOpen_EofNotReceived_SendEofInvoked.cs | 17 +- ...IsConnectedAndChannelIsOpen_EofReceived.cs | 15 +- ...DisconnectWaitingForChannelCloseMessage.cs | 17 +- ...ed_TimeoutWaitingForChannelCloseMessage.cs | 17 +- ...essionIsNotConnectedAndChannelIsNotOpen.cs | 11 +- ...e_SessionIsNotConnectedAndChannelIsOpen.cs | 11 +- ...nChannelCloseReceived_OnClose_Exception.cs | 4 +- ...Open_DisposeChannelInClosedEventHandler.cs | 17 +- ...onnectedAndChannelIsOpen_EofNotReceived.cs | 15 +- ...IsConnectedAndChannelIsOpen_EofReceived.cs | 17 +- ...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 | 8 +- .../ChannelTest_SendEof_ChannelIsNotOpen.cs | 11 +- .../ChannelTest_SendEof_ChannelIsOpen.cs | 17 +- .../Classes/Channels/ClientChannelStub.cs | 2 +- ...onReceived_OnOpenConfirmation_Exception.cs | 9 +- ...FailureReceived_OnOpenFailure_Exception.cs | 3 + .../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 | 139 +++--- .../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 | 6 +- .../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 + .../Classes/Common/SshDataTest.cs | 4 +- .../Classes/Common/TimeSpanExtensionsTest.cs | 8 +- .../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 | 14 +- ...ct_NoAuthentication_ConnectionSucceeded.cs | 13 +- ...Connect_ProxySocksVersionIsNotSupported.cs | 2 +- ...ctorTest_Connect_TimeoutConnectionReply.cs | 15 +- ...wordAuthentication_AuthenticationFailed.cs | 17 +- ...entication_PasswordExceedsMaximumLength.cs | 13 +- .../Connection/SshIdentificationTest.cs | 6 +- .../Classes/ConnectionInfoTest.cs | 11 +- ...ConnectionInfoTest_Authenticate_Failure.cs | 2 + ...ConnectionInfoTest_Authenticate_Success.cs | 2 + .../Classes/ExpectActionTest.cs | 12 +- .../Classes/ForwardedPortDynamicTest.cs | 6 +- ...dedPortDynamicTest_Dispose_PortDisposed.cs | 2 + ...icTest_Dispose_PortStarted_ChannelBound.cs | 5 +- ...est_Dispose_PortStarted_ChannelNotBound.cs | 12 +- ...rdedPortDynamicTest_Dispose_PortStopped.cs | 5 +- ...cTest_SessionErrorOccurred_ChannelBound.cs | 15 +- ...ardedPortDynamicTest_Start_PortDisposed.cs | 2 + ...dPortDynamicTest_Start_PortNeverStarted.cs | 3 + ...wardedPortDynamicTest_Start_PortStarted.cs | 3 + ...wardedPortDynamicTest_Start_PortStopped.cs | 3 + ...rtDynamicTest_Start_SessionNotConnected.cs | 3 + ...wardedPortDynamicTest_Start_SessionNull.cs | 2 + ...t_Started_SocketSendShutdownImmediately.cs | 2 +- ...cTest_Started_SocketVersionNotSupported.cs | 2 +- ...wardedPortDynamicTest_Stop_PortDisposed.cs | 2 + ...edPortDynamicTest_Stop_PortNeverStarted.cs | 2 + ...namicTest_Stop_PortStarted_ChannelBound.cs | 13 +- ...icTest_Stop_PortStarted_ChannelNotBound.cs | 12 +- ...rwardedPortDynamicTest_Stop_PortStopped.cs | 5 +- ...ardedPortLocalTest_Dispose_PortDisposed.cs | 3 + ...lTest_Dispose_PortDisposed_NeverStarted.cs | 2 + ...dPortLocalTest_Dispose_PortNeverStarted.cs | 7 +- ...alTest_Dispose_PortStarted_ChannelBound.cs | 15 +- ...est_Dispose_PortStarted_ChannelNotBound.cs | 7 +- ...wardedPortLocalTest_Dispose_PortStopped.cs | 3 + ...rwardedPortLocalTest_Start_PortDisposed.cs | 2 + ...dedPortLocalTest_Start_PortNeverStarted.cs | 7 +- ...orwardedPortLocalTest_Start_PortStopped.cs | 4 +- ...PortLocalTest_Start_SessionNotConnected.cs | 3 + ...orwardedPortLocalTest_Start_SessionNull.cs | 3 + ...orwardedPortLocalTest_Stop_PortDisposed.cs | 2 + ...rdedPortLocalTest_Stop_PortNeverStarted.cs | 3 + ...LocalTest_Stop_PortStarted_ChannelBound.cs | 15 +- ...alTest_Stop_PortStarted_ChannelNotBound.cs | 7 +- ...ForwardedPortLocalTest_Stop_PortStopped.cs | 3 + ...rdedPortRemoteTest_Dispose_PortDisposed.cs | 6 +- ...PortRemoteTest_Dispose_PortNeverStarted.cs | 3 + ...teTest_Dispose_PortStarted_ChannelBound.cs | 17 +- ...ardedPortRemoteTest_Dispose_PortStopped.cs | 3 + ...wardedPortRemoteTest_Start_PortDisposed.cs | 2 + ...edPortRemoteTest_Start_PortNeverStarted.cs | 3 + ...rwardedPortRemoteTest_Start_PortStarted.cs | 3 + ...rwardedPortRemoteTest_Start_PortStopped.cs | 3 + ...ortRemoteTest_Start_SessionNotConnected.cs | 12 +- .../ForwardedPortRemoteTest_Started.cs | 11 +- ...rwardedPortRemoteTest_Stop_PortDisposed.cs | 2 + ...dedPortRemoteTest_Stop_PortNeverStarted.cs | 3 + ...oardInteractiveAuthenticationMethodTest.cs | 6 +- .../Connection/ChannelDataMessageTest.cs | 22 +- .../ChannelOpen/ChannelOpenMessageTest.cs | 26 +- .../ChannelRequest/PseudoTerminalInfoTest.cs | 22 +- .../Connection/GlobalRequestMessageTest.cs | 8 +- .../Messages/Transport/IgnoreMessageTest.cs | 6 +- .../KeyExchangeDhGroupExchangeInitTest.cs | 3 +- .../KeyExchangeDhGroupExchangeReplyBuilder.cs | 3 +- .../KeyExchangeDhGroupExchangeReplyTest.cs | 8 +- .../KeyExchangeDhGroupExchangeRequestTest.cs | 6 +- .../Transport/KeyExchangeInitMessageTest.cs | 6 +- .../Classes/NetConfClientTest.cs | 22 +- .../Classes/NetConfClientTestBase.cs | 1 + .../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 | 6 +- .../Classes/PasswordConnectionInfoTest.cs | 8 +- .../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 | 13 +- .../Security/Cryptography/BlockCipherTest.cs | 36 +- .../Cryptography/Ciphers/AesCipherTest.cs | 459 +++++++++--------- .../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 + .../Cryptography/RsaDigitalSignatureTest.cs | 2 +- .../Security/Cryptography/RsaKeyTest.cs | 6 +- .../Classes/Security/KeyAlgorithmTest.cs | 4 +- ...KeyExchangeDiffieHellmanGroup14Sha1Test.cs | 3 +- ...yExchangeDiffieHellmanGroup16Sha512Test.cs | 3 +- .../KeyExchangeDiffieHellmanGroup1Sha1Test.cs | 3 +- .../ServiceFactoryTest_CreateConnector.cs | 17 +- ...tpFileReader_EndLStatThrowsSshException.cs | 5 +- ...izeIsAlmostSixTimesGreaterThanChunkSize.cs | 9 +- ...tpFileReader_FileSizeIsEqualToChunkSize.cs | 5 +- ...eIsExactlyFiveTimesGreaterThanChunkSize.cs | 9 +- ...pFileReader_FileSizeIsLessThanChunkSize.cs | 5 +- ...leMoreThanFiveTimesGreaterThanChunkSize.cs | 5 +- ...IsMoreThanMaxPendingReadsTimesChunkSize.cs | 7 +- ...est_CreateSftpFileReader_FileSizeIsZero.cs | 9 +- ...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 | 10 +- .../Classes/SessionTest_Connected.cs | 25 +- .../Classes/SessionTest_ConnectedBase.cs | 20 +- .../SessionTest_Connected_ConnectionReset.cs | 16 +- .../SessionTest_Connected_Disconnect.cs | 14 +- ...alRequestMessageAfterAuthenticationRace.cs | 2 + ...Connected_ServerAndClientDisconnectRace.cs | 40 +- ...sionTest_Connected_ServerSendsBadPacket.cs | 18 +- ..._Connected_ServerSendsDisconnectMessage.cs | 14 +- ...endsDisconnectMessageAndShutsDownSocket.cs | 12 +- ...ected_ServerSendsUnsupportedMessageType.cs | 16 +- ...utsDownSendAfterSendingIncompletePacket.cs | 18 +- ...ionTest_Connected_ServerShutsDownSocket.cs | 22 +- .../Classes/SessionTest_ConnectingBase.cs | 12 +- .../Classes/SessionTest_NotConnected.cs | 22 +- ...est_SocketConnected_BadPacketAndDispose.cs | 6 +- .../ExtendedRequests/FStatVfsRequestTest.cs | 12 +- .../ExtendedRequests/HardLinkRequestTest.cs | 14 +- .../PosixRenameRequestTest.cs | 12 +- .../ExtendedRequests/StatVfsRequestTest.cs | 12 +- .../Sftp/Requests/SftpBlockRequestTest.cs | 16 +- .../Sftp/Requests/SftpCloseRequestTest.cs | 8 +- .../Sftp/Requests/SftpFSetStatRequestTest.cs | 10 +- .../Sftp/Requests/SftpFStatRequestTest.cs | 10 +- .../Sftp/Requests/SftpInitRequestTest.cs | 3 +- .../Sftp/Requests/SftpLStatRequestTest.cs | 14 +- .../Sftp/Requests/SftpLinkRequestTest.cs | 12 +- .../Sftp/Requests/SftpMkDirRequestTest.cs | 14 +- .../Sftp/Requests/SftpOpenDirRequestTest.cs | 10 +- .../Sftp/Requests/SftpOpenRequestTest.cs | 12 +- .../Sftp/Requests/SftpReadDirRequestTest.cs | 14 +- .../Sftp/Requests/SftpReadLinkRequestTest.cs | 14 +- .../Sftp/Requests/SftpReadRequestTest.cs | 16 +- .../Sftp/Requests/SftpRealPathRequestTest.cs | 14 +- .../Sftp/Requests/SftpRemoveRequestTest.cs | 14 +- .../Sftp/Requests/SftpRenameRequestTest.cs | 16 +- .../Sftp/Requests/SftpRmDirRequestTest.cs | 6 +- .../Sftp/Requests/SftpSetStatRequestTest.cs | 10 +- .../Sftp/Requests/SftpStatRequestTest.cs | 12 +- .../Sftp/Requests/SftpSymLinkRequestTest.cs | 16 +- .../Sftp/Requests/SftpUnblockRequestTest.cs | 10 +- .../Sftp/Requests/SftpWriteRequestTest.cs | 16 +- .../ExtendedReplies/StatVfsReplyInfoTest.cs | 6 +- .../Sftp/Responses/SftpAttrsResponseTest.cs | 6 +- .../Sftp/Responses/SftpDataResponseTest.cs | 10 +- .../SftpExtendedReplyResponseTest.cs | 34 +- .../Sftp/Responses/SftpHandleResponseTest.cs | 12 +- .../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 | 16 +- ...eReaderTest_LastChunkBeforeEofIsPartial.cs | 14 +- ...iousChunkIsIncompleteAndEofIsNotReached.cs | 24 +- ...reviousChunkIsIncompleteAndEofIsReached.cs | 20 +- ...vokeException_DiscardsFurtherReadAheads.cs | 12 +- ...vokeException_PreventsFurtherReadAheads.cs | 2 +- ...Test_Read_ReadAheadExceptionInBeginRead.cs | 14 +- ...dExceptionInWaitOnHandle_ChunkAvailable.cs | 14 +- ...xceptionInWaitOnHandle_NoChunkAvailable.cs | 14 +- .../Sftp/SftpFileStreamAsyncTestBase.cs | 3 + .../Classes/Sftp/SftpFileStreamTestBase.cs | 3 + ...treamTest_CanRead_Closed_FileAccessRead.cs | 11 +- ...Test_CanRead_Closed_FileAccessReadWrite.cs | 11 +- ...reamTest_CanRead_Closed_FileAccessWrite.cs | 11 +- ...eamTest_CanRead_Disposed_FileAccessRead.cs | 11 +- ...st_CanRead_Disposed_FileAccessReadWrite.cs | 11 +- ...amTest_CanRead_Disposed_FileAccessWrite.cs | 11 +- ...reamTest_CanWrite_Closed_FileAccessRead.cs | 11 +- ...est_CanWrite_Closed_FileAccessReadWrite.cs | 11 +- ...eamTest_CanWrite_Closed_FileAccessWrite.cs | 11 +- ...amTest_CanWrite_Disposed_FileAccessRead.cs | 11 +- ...t_CanWrite_Disposed_FileAccessReadWrite.cs | 13 +- ...mTest_CanWrite_Disposed_FileAccessWrite.cs | 11 +- .../Sftp/SftpFileStreamTest_Close_Disposed.cs | 11 +- ...SftpFileStreamTest_Close_SessionNotOpen.cs | 11 +- .../SftpFileStreamTest_Close_SessionOpen.cs | 8 +- ...tpFileStreamTest_Ctor_FileAccessInvalid.cs | 2 + ...Test_Ctor_FileModeAppend_FileAccessRead.cs | 2 + ...Ctor_FileModeAppend_FileAccessReadWrite.cs | 2 + ...est_Ctor_FileModeAppend_FileAccessWrite.cs | 15 +- ...r_FileModeCreateNew_FileAccessReadWrite.cs | 7 +- ..._Ctor_FileModeCreateNew_FileAccessWrite.cs | 11 +- ...Test_Ctor_FileModeCreate_FileAccessRead.cs | 2 +- ...te_FileAccessReadWrite_FileDoesNotExist.cs | 9 +- ...deCreate_FileAccessReadWrite_FileExists.cs | 7 +- ...Create_FileAccessWrite_FileDoesNotExist.cs | 9 +- ...leModeCreate_FileAccessWrite_FileExists.cs | 11 +- ...SftpFileStreamTest_Ctor_FileModeInvalid.cs | 2 + ...tor_FileModeOpenOrCreate_FileAccessRead.cs | 11 +- ...ileModeOpenOrCreate_FileAccessReadWrite.cs | 7 +- ...or_FileModeOpenOrCreate_FileAccessWrite.cs | 11 +- ...amTest_Ctor_FileModeOpen_FileAccessRead.cs | 7 +- ...t_Ctor_FileModeOpen_FileAccessReadWrite.cs | 11 +- ...mTest_Ctor_FileModeOpen_FileAccessWrite.cs | 11 +- ...st_Ctor_FileModeTruncate_FileAccessRead.cs | 2 + ...or_FileModeTruncate_FileAccessReadWrite.cs | 8 +- ...t_Ctor_FileModeTruncate_FileAccessWrite.cs | 11 +- .../Sftp/SftpFileStreamTest_Dispose_Closed.cs | 8 +- .../SftpFileStreamTest_Dispose_Disposed.cs | 11 +- ...tpFileStreamTest_Dispose_SessionNotOpen.cs | 8 +- .../SftpFileStreamTest_Dispose_SessionOpen.cs | 8 +- ...SftpFileStreamTest_Finalize_SessionOpen.cs | 11 +- ...ReadMode_DataInBuffer_NotReadFromBuffer.cs | 4 +- ...sh_ReadMode_DataInBuffer_ReadFromBuffer.cs | 13 +- ...treamTest_Flush_ReadMode_NoDataInBuffer.cs | 8 +- ...SftpFileStreamTest_Flush_SessionNotOpen.cs | 15 +- ...StreamTest_Flush_WriteMode_DataInBuffer.cs | 4 +- ...reamTest_Flush_WriteMode_NoDataInBuffer.cs | 17 +- ...eStreamTest_OpenAsync_FileAccessInvalid.cs | 2 + ...OpenAsync_FileModeAppend_FileAccessRead.cs | 2 + ...sync_FileModeAppend_FileAccessReadWrite.cs | 2 + ...penAsync_FileModeAppend_FileAccessWrite.cs | 6 +- ...c_FileModeCreateNew_FileAccessReadWrite.cs | 7 +- ...Async_FileModeCreateNew_FileAccessWrite.cs | 8 +- ...te_FileAccessReadWrite_FileDoesNotExist.cs | 4 +- ...deCreate_FileAccessReadWrite_FileExists.cs | 7 +- ...Create_FileAccessWrite_FileDoesNotExist.cs | 9 +- ...leModeCreate_FileAccessWrite_FileExists.cs | 8 +- ...ileStreamTest_OpenAsync_FileModeInvalid.cs | 2 + ...ync_FileModeOpenOrCreate_FileAccessRead.cs | 13 +- ...ileModeOpenOrCreate_FileAccessReadWrite.cs | 4 +- ...nc_FileModeOpenOrCreate_FileAccessWrite.cs | 11 +- ...t_OpenAsync_FileModeOpen_FileAccessRead.cs | 7 +- ...nAsync_FileModeOpen_FileAccessReadWrite.cs | 8 +- ..._OpenAsync_FileModeOpen_FileAccessWrite.cs | 11 +- ...nc_FileModeTruncate_FileAccessReadWrite.cs | 11 +- ...nAsync_FileModeTruncate_FileAccessWrite.cs | 13 +- ...FromServerThanCountAndEqualToBufferSize.cs | 11 +- ...romServerThanCountAndLessThanBufferSize.cs | 9 +- ...fferAndReadMoreBytesFromServerThanCount.cs | 13 +- ...aInWriteBufferAndNoDataInReadBuffer_Eof.cs | 9 +- ...fer_LessDataThanReadBufferSizeAvailable.cs | 11 +- ...FromServerThanCountAndEqualToBufferSize.cs | 9 +- ...romServerThanCountAndLessThanBufferSize.cs | 9 +- ...fferAndReadMoreBytesFromServerThanCount.cs | 9 +- ...ngOfStream_OriginBeginAndOffsetNegative.cs | 3 + ...ngOfStream_OriginBeginAndOffsetPositive.cs | 3 + ...inningOfStream_OriginBeginAndOffsetZero.cs | 3 + ...ningOfStream_OriginEndAndOffsetNegative.cs | 3 + ...ningOfStream_OriginEndAndOffsetPositive.cs | 3 + ...eginningOfStream_OriginEndAndOffsetZero.cs | 3 + ...am_OriginBeginAndOffsetZero_NoBuffering.cs | 5 +- ...eam_OriginBeginAndOffsetZero_ReadBuffer.cs | 13 +- .../SftpFileStreamTest_SetLength_Closed.cs | 3 + ...eadBuffer_NewLengthGreatherThanPosition.cs | 27 +- ...aInReadBuffer_NewLengthLessThanPosition.cs | 19 +- ...iteBuffer_NewLengthGreatherThanPosition.cs | 29 +- ...InWriteBuffer_NewLengthLessThanPosition.cs | 31 +- .../SftpFileStreamTest_SetLength_Disposed.cs | 11 +- ...FileStreamTest_SetLength_SessionNotOpen.cs | 11 +- ...st_SetLength_SessionOpen_FileAccessRead.cs | 11 +- ...tLength_SessionOpen_FileAccessReadWrite.cs | 13 +- ...t_SetLength_SessionOpen_FileAccessWrite.cs | 13 +- ...tGreatherThanTwoTimesTheWriteBufferSize.cs | 8 +- ...tGreatherThanTwoTimesTheWriteBufferSize.cs | 11 +- .../Classes/Sftp/SftpHandleResponseBuilder.cs | 8 +- .../Classes/Sftp/SftpNameResponseBuilder.cs | 15 +- .../Classes/Sftp/SftpReadRequestBuilder.cs | 5 +- .../Sftp/SftpRealPathRequestBuilder.cs | 7 +- .../SftpSessionTest_Connected_RequestRead.cs | 15 +- ...ftpSessionTest_Connected_RequestStatVfs.cs | 8 +- ...tipleSftpMessagesInSingleSshDataMessage.cs | 15 +- ...essagesSplitOverMultipleSshDataMessages.cs | 15 +- ...eived_SingleSftpMessageInSshDataMessage.cs | 19 +- .../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 + .../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 | 11 +- ...ferEmptyAndWriteMoreBytesThanBufferSize.cs | 3 + ...yAndWriteNumberOfBytesEqualToBufferSize.cs | 3 + ...fferFullAndWriteLessBytesThanBufferSize.cs | 3 + ..._Write_WriteBufferFullAndWriteZeroBytes.cs | 11 +- ...tyAndWriteLessBytesThanBufferCanContain.cs | 11 +- ...tyAndWriteMoreBytesThanBufferCanContain.cs | 11 +- ...te_WriteBufferNotEmptyAndWriteZeroBytes.cs | 3 + .../Classes/SshClientTest.cs | 11 +- ...AndBufferSizeAndTerminalModes_Connected.cs | 13 +- ...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 | 7 +- .../SubsystemSession_Connect_Connected.cs | 3 + .../SubsystemSession_Connect_Disposed.cs | 2 +- ...ssion_Connect_SendSubsystemRequestFails.cs | 3 + ...Session_OnChannelDataReceived_Connected.cs | 3 + ...mSession_OnChannelDataReceived_Disposed.cs | 3 + ...elDataReceived_OnDataReceived_Exception.cs | 9 +- ...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 | 2 +- .../Common/DictionaryAssert.cs | 5 +- test/Renci.SshNet.Tests/Common/Extensions.cs | 5 +- .../Common/SftpFileAttributesBuilder.cs | 1 + test/Renci.SshNet.Tests/Common/TestBase.cs | 5 +- 594 files changed, 3301 insertions(+), 2326 deletions(-) diff --git a/.editorconfig b/.editorconfig index d3d940a8..3577f7db 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,11 @@ dotnet_diagnostic.SA1008.severity = none # var x = (int) z; dotnet_diagnostic.SA1009.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 +754,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 # @@ -925,7 +924,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/appveyor.yml b/appveyor.yml index 53e5a05f..0b3ea9af 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,6 +10,9 @@ for: matrix: only: - image: Ubuntu2204 + + init: + - git config --global core.autocrlf input before_build: - sh: mkdir artifacts -p @@ -30,6 +33,9 @@ for: only: - image: Visual Studio 2022 + init: + - git config --global core.autocrlf true + before_build: - ps: mkdir artifacts -f diff --git a/src/Renci.SshNet/Abstractions/CryptoAbstraction.cs b/src/Renci.SshNet/Abstractions/CryptoAbstraction.cs index bc53905d..1f98712b 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 e1a12362..0997a32f 100644 --- a/src/Renci.SshNet/Abstractions/SocketAbstraction.cs +++ b/src/Renci.SshNet/Abstractions/SocketAbstraction.cs @@ -61,10 +61,10 @@ namespace Renci.SshNet.Abstractions { 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)) @@ -96,7 +96,7 @@ namespace Renci.SshNet.Abstractions if (args.SocketError != SocketError.Success) { - var socketError = (int) args.SocketError; + var socketError = (int)args.SocketError; if (ownsSocket) { @@ -374,7 +374,7 @@ namespace Renci.SshNet.Abstractions 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 eef7c1f6..03c9b050 100644 --- a/src/Renci.SshNet/Abstractions/SocketExtensions.cs +++ b/src/Renci.SshNet/Abstractions/SocketExtensions.cs @@ -96,7 +96,7 @@ namespace Renci.SshNet.Abstractions #if NET || NETSTANDARD2_1_OR_GREATER 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 @@ namespace Renci.SshNet.Abstractions 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 16783f1b..e8ab026d 100644 --- a/src/Renci.SshNet/AuthenticationMethod.cs +++ b/src/Renci.SshNet/AuthenticationMethod.cs @@ -60,7 +60,7 @@ namespace Renci.SshNet /// 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 8ab9736d..e1e154ff 100644 --- a/src/Renci.SshNet/Channels/Channel.cs +++ b/src/Renci.SshNet/Channels/Channel.cs @@ -763,7 +763,7 @@ namespace Renci.SshNet.Channels private void AdjustDataWindow(byte[] messageData) { - LocalWindowSize -= (uint) messageData.Length; + LocalWindowSize -= (uint)messageData.Length; // Adjust window if window size is too low if (LocalWindowSize < LocalPacketSize) @@ -794,10 +794,10 @@ namespace Renci.SshNet.Channels } else { - var bytesThatCanBeSent = Math.Min(Math.Min(RemotePacketSize, (uint) messageLength), + var bytesThatCanBeSent = Math.Min(Math.Min(RemotePacketSize, (uint)messageLength), serverWindowSize); RemoteWindowSize -= bytesThatCanBeSent; - return (int) bytesThatCanBeSent; + return (int)bytesThatCanBeSent; } } diff --git a/src/Renci.SshNet/Channels/ChannelDirectTcpip.cs b/src/Renci.SshNet/Channels/ChannelDirectTcpip.cs index 6c521bce..6a07d59b 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; @@ -59,13 +60,13 @@ namespace Renci.SshNet.Channels _forwardedPort = forwardedPort; _forwardedPort.Closing += ForwardedPort_Closing; - var ep = (IPEndPoint) socket.RemoteEndPoint; + var ep = (IPEndPoint)socket.RemoteEndPoint; // Open channel SendMessage(new ChannelOpenMessage(LocalChannelNumber, LocalWindowSize, LocalPacketSize, - new DirectTcpipChannelInfo(remoteHost, port, ep.Address.ToString(), (uint) ep.Port))); + new DirectTcpipChannelInfo(remoteHost, port, ep.Address.ToString(), (uint)ep.Port))); // Wait for channel to open WaitOnHandle(_channelOpen); diff --git a/src/Renci.SshNet/Channels/ChannelForwardedTcpip.cs b/src/Renci.SshNet/Channels/ChannelForwardedTcpip.cs index a8382015..07271c83 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 ea4bfe16..3e746195 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 7ec3eb8e..f89679eb 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 eb71bf3d..e68da32e 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 7bc165a8..ec12cdf2 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 13c2e230..2b18efa6 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 ed38e306..0dd37e9f 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 c9c2ea56..c83ddbad 100644 --- a/src/Renci.SshNet/Common/BigInteger.cs +++ b/src/Renci.SshNet/Common/BigInteger.cs @@ -181,7 +181,7 @@ namespace Renci.SshNet.Common { 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,14 +207,12 @@ namespace Renci.SshNet.Common else if (value > 0) { _sign = 1; - _data = new[] { (uint) value }; + _data = new[] { (uint)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 + _data = new[] { (uint)-value }; } } @@ -292,8 +290,8 @@ namespace Renci.SshNet.Common 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; @@ -341,7 +339,7 @@ namespace Renci.SshNet.Common 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; } } @@ -351,7 +349,7 @@ namespace Renci.SshNet.Common /// /// A single-precision floating-point value. public BigInteger(float value) - : this((double) value) + : this((double)value) { } @@ -377,18 +375,18 @@ namespace Renci.SshNet.Common 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]; } } @@ -448,10 +446,10 @@ namespace Renci.SshNet.Common 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; @@ -460,7 +458,7 @@ namespace Renci.SshNet.Common 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)); } } } @@ -481,14 +479,14 @@ namespace Renci.SshNet.Common for (var i = 0; i < fullWords; ++i) { - word = (uint) value[j++] | - (uint) (value[j++] << 8) | - (uint) (value[j++] << 16) | - (uint) (value[j++] << 24); + 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; + sub = (ulong)word - borrow; + word = (uint)sub; + borrow = (uint)(sub >> 32) & 0x1u; _data[i] = ~word; } @@ -500,13 +498,13 @@ namespace Renci.SshNet.Common 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) { @@ -542,7 +540,7 @@ namespace Renci.SshNet.Common 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); } /// @@ -577,7 +575,7 @@ namespace Renci.SshNet.Common x = (x + (x >> 4)) & 0x0F0F0F0F; x += x >> 8; x += x >> 16; - return (int) (x & 0x0000003F); + return (int)(x & 0x0000003F); } /// @@ -793,7 +791,7 @@ namespace Renci.SshNet.Common if (value._sign == 1) { - if (data > (uint) int.MaxValue) + if (data > (uint)int.MaxValue) { throw new OverflowException(); } @@ -850,13 +848,13 @@ namespace Renci.SshNet.Common 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; } /// @@ -871,13 +869,13 @@ namespace Renci.SshNet.Common 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; } /// @@ -891,13 +889,13 @@ namespace Renci.SshNet.Common 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; } /// @@ -912,13 +910,13 @@ namespace Renci.SshNet.Common 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; } /// @@ -948,7 +946,7 @@ namespace Renci.SshNet.Common { if (value._sign == 1) { - return (long) low; + return (long)low; } var res = (long)low; @@ -1039,7 +1037,7 @@ namespace Renci.SshNet.Common 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]; @@ -1070,7 +1068,7 @@ namespace Renci.SshNet.Common public static explicit operator float(BigInteger value) #pragma warning restore CA2225 // Operator overloads have named alternates { - return (float) (double) value; + return (float)(double)value; } /// @@ -1098,17 +1096,17 @@ namespace Renci.SshNet.Common 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); @@ -1330,9 +1328,7 @@ namespace Renci.SshNet.Common 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 + return new BigInteger((short)-right._sign, right._data); } if (left._sign == right._sign) @@ -1404,7 +1400,7 @@ namespace Renci.SshNet.Common ulong carry = 0; for (var j = 0; j < b.Length; ++j) { - carry = carry + (((ulong) ai) * b[j]) + res[k]; + carry = carry + (((ulong)ai) * b[j]) + res[k]; res[k++] = (uint)carry; carry >>= 32; } @@ -1428,7 +1424,7 @@ namespace Renci.SshNet.Common Array.Resize(ref res, m + 1); } - return new BigInteger((short) (left._sign*right._sign), res); + return new BigInteger((short)(left._sign * right._sign), res); } /// @@ -1528,9 +1524,7 @@ namespace Renci.SshNet.Common 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 + return new BigInteger((short)-value._sign, value._data); } /// @@ -2770,9 +2764,9 @@ namespace Renci.SshNet.Common 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; } @@ -2833,7 +2827,7 @@ namespace Renci.SshNet.Common 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) @@ -3022,7 +3016,7 @@ namespace Renci.SshNet.Common if (fp != null) { var typeNfi = typeof(NumberFormatInfo); - nfi = (NumberFormatInfo) fp.GetFormat(typeNfi); + nfi = (NumberFormatInfo)fp.GetFormat(typeNfi); } nfi ??= NumberFormatInfo.CurrentInfo; @@ -3172,15 +3166,15 @@ namespace Renci.SshNet.Common 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) @@ -3484,7 +3478,7 @@ namespace Renci.SshNet.Common } exc = null; - exponent = (int) exp; + exponent = (int)exp; pos = i; return true; } @@ -3606,7 +3600,7 @@ namespace Renci.SshNet.Common if (c is >= '0' and <= '9') { - var d = (byte) (c - '0'); + var d = (byte)(c - '0'); val = (val * 10) + d; @@ -4080,7 +4074,7 @@ namespace Renci.SshNet.Common /// public override readonly int GetHashCode() { - var hash = (uint) (_sign * 0x01010101u); + var hash = (uint)(_sign * 0x01010101u); if (_data != null) { foreach (var bit in _data) @@ -4089,7 +4083,7 @@ namespace Renci.SshNet.Common } } - return (int) hash; + return (int)hash; } /// @@ -4347,8 +4341,8 @@ namespace Renci.SshNet.Common 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) @@ -4643,14 +4637,14 @@ namespace Renci.SshNet.Common 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; @@ -4876,7 +4870,7 @@ namespace Renci.SshNet.Common q[j] = (uint)div; } - r[0] = (uint) rem; + r[0] = (uint)rem; } else if (m >= n) { diff --git a/src/Renci.SshNet/Common/DerData.cs b/src/Renci.SshNet/Common/DerData.cs index ba0a678d..baf37be6 100644 --- a/src/Renci.SshNet/Common/DerData.cs +++ b/src/Renci.SshNet/Common/DerData.cs @@ -339,7 +339,7 @@ namespace Renci.SshNet.Common return data; } - return new[] { (byte) length }; + return new[] { (byte)length }; } /// diff --git a/src/Renci.SshNet/Common/Extensions.cs b/src/Renci.SshNet/Common/Extensions.cs index 0f9dad1c..92b5ac00 100644 --- a/src/Renci.SshNet/Common/Extensions.cs +++ b/src/Renci.SshNet/Common/Extensions.cs @@ -5,6 +5,7 @@ using System.Globalization; 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/Pack.cs b/src/Renci.SshNet/Common/Pack.cs index d8b39d4e..6662304c 100644 --- a/src/Renci.SshNet/Common/Pack.cs +++ b/src/Renci.SshNet/Common/Pack.cs @@ -21,7 +21,7 @@ namespace Renci.SshNet.Common 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 @@ namespace Renci.SshNet.Common 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 @@ namespace Renci.SshNet.Common 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 @@ namespace Renci.SshNet.Common #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 @@ namespace Renci.SshNet.Common #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 @@ namespace Renci.SshNet.Common #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 @@ namespace Renci.SshNet.Common #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 @@ namespace Renci.SshNet.Common #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 @@ namespace Renci.SshNet.Common #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 @@ namespace Renci.SshNet.Common #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 @@ namespace Renci.SshNet.Common #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 @@ namespace Renci.SshNet.Common #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/PacketDump.cs b/src/Renci.SshNet/Common/PacketDump.cs index 47329f6d..aabcc827 100644 --- a/src/Renci.SshNet/Common/PacketDump.cs +++ b/src/Renci.SshNet/Common/PacketDump.cs @@ -30,7 +30,7 @@ namespace Renci.SshNet.Common 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 d4c46011..6ab36871 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/SshData.cs b/src/Renci.SshNet/Common/SshData.cs index 578edb8c..6f1e3d6d 100644 --- a/src/Renci.SshNet/Common/SshData.cs +++ b/src/Renci.SshNet/Common/SshData.cs @@ -139,7 +139,7 @@ namespace Renci.SshNet.Common /// 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 @@ namespace Renci.SshNet.Common throw new InvalidOperationException("Attempt to read past the end of the SSH data stream."); } - return (byte) byteRead; + return (byte)byteRead; } /// @@ -319,7 +319,7 @@ namespace Renci.SshNet.Common /// 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 5fb40adc..7fd39f9b 100644 --- a/src/Renci.SshNet/Common/SshDataStream.cs +++ b/src/Renci.SshNet/Common/SshDataStream.cs @@ -131,7 +131,7 @@ namespace Renci.SshNet.Common 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); @@ -183,7 +183,7 @@ namespace Renci.SshNet.Common /// 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 @@ namespace Renci.SshNet.Common 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 @@ namespace Renci.SshNet.Common 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 947c9376..df3e904b 100644 --- a/src/Renci.SshNet/Common/TaskToAsyncResult.cs +++ b/src/Renci.SshNet/Common/TaskToAsyncResult.cs @@ -171,7 +171,7 @@ namespace System.Threading.Tasks 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 39470ef4..874db9e6 100644 --- a/src/Renci.SshNet/Common/TimeSpanExtensions.cs +++ b/src/Renci.SshNet/Common/TimeSpanExtensions.cs @@ -23,7 +23,7 @@ namespace Renci.SshNet.Common 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 afbaf0f0..81251800 100644 --- a/src/Renci.SshNet/Connection/HttpConnector.cs +++ b/src/Renci.SshNet/Connection/HttpConnector.cs @@ -75,7 +75,7 @@ namespace Renci.SshNet.Connection 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 d8261e02..a3f947ef 100644 --- a/src/Renci.SshNet/Connection/ProxyConnector.cs +++ b/src/Renci.SshNet/Connection/ProxyConnector.cs @@ -30,7 +30,7 @@ namespace Renci.SshNet.Connection #if NET || NETSTANDARD2_1_OR_GREATER 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/Socks5Connector.cs b/src/Renci.SshNet/Connection/Socks5Connector.cs index ba695624..40ee547b 100644 --- a/src/Renci.SshNet/Connection/Socks5Connector.cs +++ b/src/Renci.SshNet/Connection/Socks5Connector.cs @@ -82,7 +82,7 @@ namespace Renci.SshNet.Connection 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 @@ -133,7 +133,7 @@ namespace Renci.SshNet.Connection break; case 0x04: var ipv6 = new byte[16]; - _ =SocketRead(socket, ipv6, 0, 16, connectionInfo.Timeout); + _ = SocketRead(socket, ipv6, 0, 16, connectionInfo.Timeout); break; default: throw new ProxyException(string.Format("Address type '{0}' is not supported.", addressType)); @@ -181,17 +181,17 @@ namespace Renci.SshNet.Connection 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); + _ = SshData.Ascii.GetBytes(password, 0, password.Length, authenticationRequest, index); return authenticationRequest; } diff --git a/src/Renci.SshNet/ForwardedPortDynamic.cs b/src/Renci.SshNet/ForwardedPortDynamic.cs index 2a2c45f2..e331edec 100644 --- a/src/Renci.SshNet/ForwardedPortDynamic.cs +++ b/src/Renci.SshNet/ForwardedPortDynamic.cs @@ -164,7 +164,7 @@ namespace Renci.SshNet 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 @@ namespace Renci.SshNet 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 2b0d678e..1a34a5d9 100644 --- a/src/Renci.SshNet/ForwardedPortLocal.cs +++ b/src/Renci.SshNet/ForwardedPortLocal.cs @@ -201,14 +201,14 @@ namespace Renci.SshNet 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 @@ namespace Renci.SshNet 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 183b220f..17a1a569 100644 --- a/src/Renci.SshNet/ForwardedPortRemote.cs +++ b/src/Renci.SshNet/ForwardedPortRemote.cs @@ -270,7 +270,7 @@ namespace Renci.SshNet using (var channel = Session.CreateChannelForwardedTcpip(channelOpenMessage.LocalChannelNumber, channelOpenMessage.InitialWindowSize, channelOpenMessage.MaximumPacketSize)) { channel.Exception += Channel_Exception; - channel.Bind(new IPEndPoint(HostAddress, (int) Port), this); + channel.Bind(new IPEndPoint(HostAddress, (int)Port), this); } } catch (Exception exp) diff --git a/src/Renci.SshNet/ForwardedPortStatus.cs b/src/Renci.SshNet/ForwardedPortStatus.cs index 5695e28c..8a00b1c5 100644 --- a/src/Renci.SshNet/ForwardedPortStatus.cs +++ b/src/Renci.SshNet/ForwardedPortStatus.cs @@ -50,7 +50,7 @@ namespace Renci.SshNet 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 f1fe6f91..44e19082 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 a2738796..4828b62b 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 9a45bcf2..22914aaf 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/InformationResponseMessage.cs b/src/Renci.SshNet/Messages/Authentication/InformationResponseMessage.cs index 27e4fe65..ac5abf22 100644 --- a/src/Renci.SshNet/Messages/Authentication/InformationResponseMessage.cs +++ b/src/Renci.SshNet/Messages/Authentication/InformationResponseMessage.cs @@ -64,7 +64,7 @@ namespace Renci.SshNet.Messages.Authentication /// protected override void SaveData() { - Write((uint) Responses.Count); + Write((uint)Responses.Count); foreach (var response in Responses) { diff --git a/src/Renci.SshNet/Messages/Authentication/RequestMessage.cs b/src/Renci.SshNet/Messages/Authentication/RequestMessage.cs index 58daa10f..9fdbfaed 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 82df2712..e90bac45 100644 --- a/src/Renci.SshNet/Messages/Connection/ChannelRequest/PseudoTerminalRequestInfo.cs +++ b/src/Renci.SshNet/Messages/Connection/ChannelRequest/PseudoTerminalRequestInfo.cs @@ -141,15 +141,15 @@ namespace Renci.SshNet.Messages.Connection // 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 b5c43aca..07b74747 100644 --- a/src/Renci.SshNet/Messages/Message.cs +++ b/src/Renci.SshNet/Messages/Message.cs @@ -73,7 +73,7 @@ namespace Renci.SshNet.Messages WriteBytes(sshDataStream); } - messageLength = (int) sshDataStream.Length - (outboundPacketSequenceSize + 4 + 1); + messageLength = (int)sshDataStream.Length - (outboundPacketSequenceSize + 4 + 1); var packetLength = messageLength + 4 + 1; @@ -139,7 +139,7 @@ namespace Renci.SshNet.Messages 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) diff --git a/src/Renci.SshNet/Messages/Transport/DisconnectMessage.cs b/src/Renci.SshNet/Messages/Transport/DisconnectMessage.cs index 88ad5a01..d873a813 100644 --- a/src/Renci.SshNet/Messages/Transport/DisconnectMessage.cs +++ b/src/Renci.SshNet/Messages/Transport/DisconnectMessage.cs @@ -93,7 +93,7 @@ /// protected override void LoadData() { - ReasonCode = (DisconnectReason) ReadUInt32(); + ReasonCode = (DisconnectReason)ReadUInt32(); _description = ReadBinary(); _language = ReadBinary(); } @@ -103,7 +103,7 @@ /// protected override void SaveData() { - Write((uint) ReasonCode); + Write((uint)ReasonCode); WriteBinaryString(_description); WriteBinaryString(_language); } diff --git a/src/Renci.SshNet/Messages/Transport/KeyExchangeEcdhInitMessage.cs b/src/Renci.SshNet/Messages/Transport/KeyExchangeEcdhInitMessage.cs index ab5bc1c8..8f3ecee5 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 ce16d9fd..6afa5569 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 c7b6a6cb..aaf451e6 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 072b3214..8953a0c2 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 dadc7025..d7149042 100644 --- a/src/Renci.SshNet/PrivateKeyAuthenticationMethod.cs +++ b/src/Renci.SshNet/PrivateKeyAuthenticationMethod.cs @@ -246,7 +246,7 @@ namespace Renci.SshNet protected override void SaveData() { WriteBinaryString(_sessionId); - Write((byte) RequestMessage.AuthenticationMessageCode); + Write((byte)RequestMessage.AuthenticationMessageCode); WriteBinaryString(_message.Username); WriteBinaryString(_serviceName); WriteBinaryString(_authenticationMethod); diff --git a/src/Renci.SshNet/PrivateKeyFile.cs b/src/Renci.SshNet/PrivateKeyFile.cs index 68408536..8cf4da8b 100644 --- a/src/Renci.SshNet/PrivateKeyFile.cs +++ b/src/Renci.SshNet/PrivateKeyFile.cs @@ -473,9 +473,9 @@ namespace Renci.SshNet 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 @@ -489,7 +489,7 @@ namespace Renci.SshNet _ = 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 @@ namespace Renci.SshNet 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 @@ namespace Renci.SshNet 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 @@ namespace Renci.SshNet 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 @@ namespace Renci.SshNet var key = _key; if (key != null) { - ((IDisposable) key).Dispose(); + ((IDisposable)key).Dispose(); _key = null; } @@ -697,7 +697,7 @@ namespace Renci.SshNet /// mpint read. public BigInteger ReadBigIntWithBits() { - var length = (int) base.ReadUInt32(); + var length = (int)base.ReadUInt32(); length = (length + 7) / 8; diff --git a/src/Renci.SshNet/ScpClient.cs b/src/Renci.SshNet/ScpClient.cs index 7aa57c62..1c624681 100644 --- a/src/Renci.SshNet/ScpClient.cs +++ b/src/Renci.SshNet/ScpClient.cs @@ -623,7 +623,7 @@ namespace Renci.SshNet while (b != SshNet.Session.LineFeed) { - buffer.Add((byte) b); + buffer.Add((byte)b); b = ReadByte(stream); } @@ -651,8 +651,8 @@ namespace Renci.SshNet #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 @@ namespace Renci.SshNet 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/BlockCipher.cs b/src/Renci.SshNet/Security/Cryptography/BlockCipher.cs index 26aa6d1b..7b1f9511 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/Ciphers/AesCipher.CtrImpl.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/AesCipher.CtrImpl.cs index dacaf4a7..773736c9 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 @@ namespace Renci.SshNet.Security.Cryptography.Ciphers #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/AesCipher.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/AesCipher.cs index 447e1aee..a7c16f72 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/AesCipher.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/AesCipher.cs @@ -47,7 +47,7 @@ namespace Renci.SshNet.Security.Cryptography.Ciphers _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 aed9683b..43805d65 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/Arc4Cipher.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/Arc4Cipher.cs @@ -119,7 +119,7 @@ namespace Renci.SshNet.Security.Cryptography.Ciphers // 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/BlowfishCipher.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/BlowfishCipher.cs index 6e04c999..598a8621 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 d2388785..00f3b42d 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 @@ -708,15 +709,15 @@ namespace Renci.SshNet.Security.Cryptography.Ciphers 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 f2d2e403..d1b282e4 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 @@ -300,7 +301,7 @@ namespace Renci.SshNet.Security.Cryptography.Ciphers { 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++) @@ -368,15 +369,15 @@ namespace Renci.SshNet.Security.Cryptography.Ciphers 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; @@ -434,7 +435,7 @@ namespace Renci.SshNet.Security.Cryptography.Ciphers 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]; diff --git a/src/Renci.SshNet/Security/Cryptography/Ciphers/Modes/OfbCipherMode.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/Modes/OfbCipherMode.cs index 70b6473d..df2ce60b 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 @@ namespace Renci.SshNet.Security.Cryptography.Ciphers.Modes 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 18e85c59..131719b1 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 @@ namespace Renci.SshNet.Security.Cryptography.Ciphers.Paddings 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 eb950abf..7234a4f5 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 @@ namespace Renci.SshNet.Security.Cryptography.Ciphers.Paddings 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 6f19e176..bbe163fd 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/SerpentCipher.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/SerpentCipher.cs @@ -669,12 +669,12 @@ namespace Renci.SshNet.Security.Cryptography.Ciphers 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 @@ namespace Renci.SshNet.Security.Cryptography.Ciphers 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 7ef039cc..e977f51d 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/TwofishCipher.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/TwofishCipher.cs @@ -187,14 +187,14 @@ namespace Renci.SshNet.Security.Cryptography.Ciphers 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); @@ -430,9 +430,9 @@ namespace Renci.SshNet.Security.Cryptography.Ciphers */ 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; } @@ -494,7 +494,7 @@ namespace Renci.SshNet.Security.Cryptography.Ciphers 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))]; diff --git a/src/Renci.SshNet/Security/Cryptography/ED25519DigitalSignature.cs b/src/Renci.SshNet/Security/Cryptography/ED25519DigitalSignature.cs index 2d3cdb95..5b39b09f 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/EcdsaDigitalSignature.cs b/src/Renci.SshNet/Security/Cryptography/EcdsaDigitalSignature.cs index 840eed49..fd44b41d 100644 --- a/src/Renci.SshNet/Security/Cryptography/EcdsaDigitalSignature.cs +++ b/src/Renci.SshNet/Security/Cryptography/EcdsaDigitalSignature.cs @@ -164,7 +164,7 @@ namespace Renci.SshNet.Security.Cryptography 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/HMACMD5.cs b/src/Renci.SshNet/Security/Cryptography/HMACMD5.cs index 83bb31f3..b0c1e143 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 20f752a8..e0f230a1 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 e13d720c..cbdcdf73 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 8d756efe..45cca6a1 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 92184109..57fe2e83 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 4ce98833..d87b5f08 100644 --- a/src/Renci.SshNet/Security/KeyExchange.cs +++ b/src/Renci.SshNet/Security/KeyExchange.cs @@ -427,11 +427,11 @@ namespace Renci.SshNet.Security 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 @@ namespace Renci.SshNet.Security 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(); } @@ -500,7 +500,7 @@ namespace Renci.SshNet.Security { WriteBinaryString(SharedKey); Write(ExchangeHash); - Write((byte) Char); + Write((byte)Char); Write(SessionId); } } diff --git a/src/Renci.SshNet/Security/KeyExchangeDiffieHellmanGroupExchangeShaBase.cs b/src/Renci.SshNet/Security/KeyExchangeDiffieHellmanGroupExchangeShaBase.cs index 5774f2c3..d3598388 100644 --- a/src/Renci.SshNet/Security/KeyExchangeDiffieHellmanGroupExchangeShaBase.cs +++ b/src/Renci.SshNet/Security/KeyExchangeDiffieHellmanGroupExchangeShaBase.cs @@ -20,21 +20,21 @@ namespace Renci.SshNet.Security 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 8bc61e7f..a0b41538 100644 --- a/src/Renci.SshNet/Security/KeyExchangeEC.cs +++ b/src/Renci.SshNet/Security/KeyExchangeEC.cs @@ -53,16 +53,16 @@ namespace Renci.SshNet.Security 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 @@ namespace Renci.SshNet.Security _serverPayload = message.GetBytes(); _clientPayload = Session.ClientInitMessage.GetBytes(); } - } + } } diff --git a/src/Renci.SshNet/Security/KeyExchangeECDH.cs b/src/Renci.SshNet/Security/KeyExchangeECDH.cs index c756fb6c..f5bd46a1 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; diff --git a/src/Renci.SshNet/ServiceFactory.cs b/src/Renci.SshNet/ServiceFactory.cs index 0e279873..0cc9a601 100644 --- a/src/Renci.SshNet/ServiceFactory.cs +++ b/src/Renci.SshNet/ServiceFactory.cs @@ -94,9 +94,9 @@ namespace Renci.SshNet // 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) { diff --git a/src/Renci.SshNet/Session.cs b/src/Renci.SshNet/Session.cs index 6a2c81a4..6607b6bd 100644 --- a/src/Renci.SshNet/Session.cs +++ b/src/Renci.SshNet/Session.cs @@ -1036,7 +1036,7 @@ namespace Renci.SshNet 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 @@ namespace Renci.SshNet // 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 @@ namespace Renci.SshNet 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 @@ namespace Renci.SshNet // 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 @@ namespace Renci.SshNet } 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/SftpCloseRequest.cs b/src/Renci.SshNet/Sftp/Requests/SftpCloseRequest.cs index f17673f9..b91c31ee 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 59da98af..84a81bb9 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 d24f757b..3063c129 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 950ef8f4..fa8c2c14 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 126925b9..fafd481f 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 780552fb..6a86b4da 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 @@ -77,7 +78,7 @@ namespace Renci.SshNet.Sftp.Requests base.SaveData(); WriteBinaryString(_fileName); - Write((uint) Flags); + Write((uint)Flags); Write(_attributes); } diff --git a/src/Renci.SshNet/Sftp/Requests/SftpRemoveRequest.cs b/src/Renci.SshNet/Sftp/Requests/SftpRemoveRequest.cs index 99d072f5..a1b3ed78 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 8d7fc91a..71dc8302 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 a3e4d059..e099d1c2 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 003198af..dd19c669 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 8731b9fc..e517acef 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 09657bff..fe703065 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 63127cdd..1b1ec3e8 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 6dff3836..e456f98c 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 be7f6da9..6627513a 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/Responses/SftpNameResponse.cs b/src/Renci.SshNet/Sftp/Responses/SftpNameResponse.cs index 2bdf6789..0e6c9f46 100644 --- a/src/Renci.SshNet/Sftp/Responses/SftpNameResponse.cs +++ b/src/Renci.SshNet/Sftp/Responses/SftpNameResponse.cs @@ -47,7 +47,7 @@ namespace Renci.SshNet.Sftp.Responses { 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 2f43cdc3..4e31154b 100644 --- a/src/Renci.SshNet/Sftp/Responses/SftpStatusResponse.cs +++ b/src/Renci.SshNet/Sftp/Responses/SftpStatusResponse.cs @@ -22,7 +22,7 @@ { base.LoadData(); - StatusCode = (StatusCodes) ReadUInt32(); + StatusCode = (StatusCodes)ReadUInt32(); if (ProtocolVersion < 3) { diff --git a/src/Renci.SshNet/Sftp/SftpDownloadAsyncResult.cs b/src/Renci.SshNet/Sftp/SftpDownloadAsyncResult.cs index 9e706d9e..cdb46cf7 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 2122220b..f8b770e1 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/SftpFileAttributes.cs b/src/Renci.SshNet/Sftp/SftpFileAttributes.cs index 2f32b479..11d2fd8a 100644 --- a/src/Renci.SshNet/Sftp/SftpFileAttributes.cs +++ b/src/Renci.SshNet/Sftp/SftpFileAttributes.cs @@ -535,13 +535,13 @@ namespace Renci.SshNet.Sftp 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 @@ namespace Renci.SshNet.Sftp 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 @@ namespace Renci.SshNet.Sftp 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 @@ namespace Renci.SshNet.Sftp 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 8d3ef211..f47a941d 100644 --- a/src/Renci.SshNet/Sftp/SftpFileReader.cs +++ b/src/Renci.SshNet/Sftp/SftpFileReader.cs @@ -101,7 +101,7 @@ namespace Renci.SshNet.Sftp // 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 @@ -126,7 +126,7 @@ namespace Renci.SshNet.Sftp _ = _queue.Remove(_nextChunkIndex); // update offset - _offset += (ulong) data.Length; + _offset += (ulong)data.Length; // move to next chunk _nextChunkIndex++; @@ -141,7 +141,7 @@ namespace Renci.SshNet.Sftp // 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 @@ namespace Renci.SshNet.Sftp * 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 @@ namespace Renci.SshNet.Sftp } } - _offset += (uint) read.Length; + _offset += (uint)read.Length; return read; } @@ -334,7 +334,7 @@ namespace Renci.SshNet.Sftp // 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 @@ namespace Renci.SshNet.Sftp return; } - var readAsyncResult = (SftpReadAsyncResult) result; + var readAsyncResult = (SftpReadAsyncResult)result; byte[] data; @@ -415,7 +415,7 @@ namespace Renci.SshNet.Sftp // 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 f0086c7d..2494e210 100644 --- a/src/Renci.SshNet/Sftp/SftpFileStream.cs +++ b/src/Renci.SshNet/Sftp/SftpFileStream.cs @@ -209,8 +209,8 @@ namespace Renci.SshNet.Sftp * 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 @@ namespace Renci.SshNet.Sftp * 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 @@ namespace Renci.SshNet.Sftp 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) { @@ -824,7 +824,7 @@ namespace Renci.SshNet.Sftp // 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. @@ -911,7 +911,7 @@ namespace Renci.SshNet.Sftp 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 @@ namespace Renci.SshNet.Sftp { 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 @@ namespace Renci.SshNet.Sftp { 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; @@ -1228,7 +1228,7 @@ namespace Renci.SshNet.Sftp { 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 @@ namespace Renci.SshNet.Sftp { 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; diff --git a/src/Renci.SshNet/Sftp/SftpMessage.cs b/src/Renci.SshNet/Sftp/SftpMessage.cs index 5ecb69bc..81110012 100644 --- a/src/Renci.SshNet/Sftp/SftpMessage.cs +++ b/src/Renci.SshNet/Sftp/SftpMessage.cs @@ -31,7 +31,7 @@ namespace Renci.SshNet.Sftp protected override void SaveData() { - Write((byte) SftpMessageType); + Write((byte)SftpMessageType); } /// @@ -59,7 +59,7 @@ namespace Renci.SshNet.Sftp // 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 1d5b4ad5..8e28b790 100644 --- a/src/Renci.SshNet/Sftp/SftpResponseFactory.cs +++ b/src/Renci.SshNet/Sftp/SftpResponseFactory.cs @@ -10,7 +10,7 @@ namespace Renci.SshNet.Sftp { 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 0e8e89f3..457ccaae 100644 --- a/src/Renci.SshNet/Sftp/SftpSession.cs +++ b/src/Renci.SshNet/Sftp/SftpSession.cs @@ -51,7 +51,7 @@ namespace Renci.SshNet.Sftp { get { - return (uint) Interlocked.Increment(ref _requestId); + return (uint)Interlocked.Increment(ref _requestId); } } @@ -512,9 +512,9 @@ namespace Renci.SshNet.Sftp 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 @@ namespace Renci.SshNet.Sftp 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 @@ namespace Renci.SshNet.Sftp 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 @@ namespace Renci.SshNet.Sftp 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 @@ namespace Renci.SshNet.Sftp 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 @@ namespace Renci.SshNet.Sftp 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 @@ namespace Renci.SshNet.Sftp 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 @@ namespace Renci.SshNet.Sftp 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 @@ namespace Renci.SshNet.Sftp 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 @@ namespace Renci.SshNet.Sftp 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 @@ namespace Renci.SshNet.Sftp 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 @@ namespace Renci.SshNet.Sftp * 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 932ed862..fb599220 100644 --- a/src/Renci.SshNet/SftpClient.cs +++ b/src/Renci.SshNet/SftpClient.cs @@ -161,7 +161,7 @@ namespace Renci.SshNet throw new SshConnectionException("Client not connected."); } - return (int) _sftpSession.ProtocolVersion; + return (int)_sftpSession.ProtocolVersion; } } @@ -1364,7 +1364,7 @@ namespace Renci.SshNet 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 @@ namespace Renci.SshNet { 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 @@ namespace Renci.SshNet { CheckDisposed(); - return new SftpFileStream(_sftpSession, path, mode, access, (int) _bufferSize); + return new SftpFileStream(_sftpSession, path, mode, access, (int)_bufferSize); } /// @@ -1609,7 +1609,7 @@ namespace Renci.SshNet 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 @@ namespace Renci.SshNet { 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 @@ namespace Renci.SshNet output.Write(data, 0, data.Length); - totalBytesRead += (ulong) data.Length; + totalBytesRead += (ulong)data.Length; asyncResult?.Update(totalBytesRead); @@ -2451,7 +2451,7 @@ namespace Renci.SshNet 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 @@ namespace Renci.SshNet _ = 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 4a73e58f..213d1a40 100644 --- a/src/Renci.SshNet/Shell.cs +++ b/src/Renci.SshNet/Shell.cs @@ -128,7 +128,7 @@ namespace Renci.SshNet 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 df61cda7..bbdd349c 100644 --- a/src/Renci.SshNet/SshCommand.cs +++ b/src/Renci.SshNet/SshCommand.cs @@ -448,7 +448,7 @@ namespace Renci.SshNet ThreadAbstraction.ExecuteThread(() => _callback(_asyncResult)); } - _ = ((EventWaitHandle) _asyncResult.AsyncWaitHandle).Set(); + _ = ((EventWaitHandle)_asyncResult.AsyncWaitHandle).Set(); } private void Channel_Closed(object sender, ChannelEventArgs e) @@ -460,7 +460,7 @@ namespace Renci.SshNet { 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 c3b07088..3109ea26 100644 --- a/test/Renci.SshNet.Benchmarks/Common/HostKeyEventArgsBenchmarks.cs +++ b/test/Renci.SshNet.Benchmarks/Common/HostKeyEventArgsBenchmarks.cs @@ -20,7 +20,7 @@ namespace Renci.SshNet.Benchmarks.Common 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/Ciphers/AesCipherBenchmarks.cs b/test/Renci.SshNet.Benchmarks/Security/Cryptography/Ciphers/AesCipherBenchmarks.cs index f24559c5..9cecc085 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.Benchmarks/Security/Cryptography/ED25519DigitalSignatureBenchmarks.cs b/test/Renci.SshNet.Benchmarks/Security/Cryptography/ED25519DigitalSignatureBenchmarks.cs index 44b2da8a..eb390155 100644 --- a/test/Renci.SshNet.Benchmarks/Security/Cryptography/ED25519DigitalSignatureBenchmarks.cs +++ b/test/Renci.SshNet.Benchmarks/Security/Cryptography/ED25519DigitalSignatureBenchmarks.cs @@ -21,7 +21,7 @@ namespace Renci.SshNet.Benchmarks.Security.Cryptography 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 38671e93..9f535669 100644 --- a/test/Renci.SshNet.Benchmarks/Security/Cryptography/RsaDigitalSignatureBenchmarks.cs +++ b/test/Renci.SshNet.Benchmarks/Security/Cryptography/RsaDigitalSignatureBenchmarks.cs @@ -23,7 +23,7 @@ namespace Renci.SshNet.Benchmarks.Security.Cryptography 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.IntegrationBenchmarks/ScpClientBenchmark.cs b/test/Renci.SshNet.IntegrationBenchmarks/ScpClientBenchmark.cs index 1e7b9368..f73643a9 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 e50858c3..1a571d8e 100644 --- a/test/Renci.SshNet.IntegrationTests/Common/Socks5Handler.cs +++ b/test/Renci.SshNet.IntegrationTests/Common/Socks5Handler.cs @@ -45,7 +45,7 @@ namespace Renci.SshNet.IntegrationTests.Common 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 @@ namespace Renci.SshNet.IntegrationTests.Common } // Send username length - SocketWriteByte(socket, (byte) username.Length); + SocketWriteByte(socket, (byte)username.Length); // Send username SocketAbstraction.Send(socket, username); @@ -100,7 +100,7 @@ namespace Renci.SshNet.IntegrationTests.Common } // Send username length - SocketWriteByte(socket, (byte) password.Length); + SocketWriteByte(socket, (byte)password.Length); // Send username SocketAbstraction.Send(socket, password); diff --git a/test/Renci.SshNet.IntegrationTests/ConnectivityTests.cs b/test/Renci.SshNet.IntegrationTests/ConnectivityTests.cs index a6ff3465..15451b1e 100644 --- a/test/Renci.SshNet.IntegrationTests/ConnectivityTests.cs +++ b/test/Renci.SshNet.IntegrationTests/ConnectivityTests.cs @@ -76,11 +76,11 @@ namespace Renci.SshNet.IntegrationTests hostNetworkConnectionDisabled = true; WaitForConnectionInterruption(client); } - + 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); @@ -104,7 +104,7 @@ namespace Renci.SshNet.IntegrationTests int count = 0; client.ErrorOccurred += (sender, args) => { - Console.WriteLine("Exception "+ count++); + Console.WriteLine("Exception " + count++); Console.WriteLine(args.Exception); errorOccurred = args.Exception; }; @@ -122,7 +122,7 @@ namespace Renci.SshNet.IntegrationTests 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 @@ namespace Renci.SshNet.IntegrationTests 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 @@ namespace Renci.SshNet.IntegrationTests 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 @@ namespace Renci.SshNet.IntegrationTests 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/HostConfig.cs b/test/Renci.SshNet.IntegrationTests/HostConfig.cs index fd3c3f13..19d78e70 100644 --- a/test/Renci.SshNet.IntegrationTests/HostConfig.cs +++ b/test/Renci.SshNet.IntegrationTests/HostConfig.cs @@ -73,7 +73,7 @@ namespace Renci.SshNet.IntegrationTests { // 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 66d09fd2..10dfb294 100644 --- a/test/Renci.SshNet.IntegrationTests/HostKeyFile.cs +++ b/test/Renci.SshNet.IntegrationTests/HostKeyFile.cs @@ -14,7 +14,7 @@ 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 f2f04dbf..fe24ceac 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/ForwardedPortLocalTest.cs b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/ForwardedPortLocalTest.cs index 09ce7cd7..f9734517 100644 --- a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/ForwardedPortLocalTest.cs +++ b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/ForwardedPortLocalTest.cs @@ -49,8 +49,8 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests .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 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests { 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/OldIntegrationTests/SftpClientTest.ListDirectory.cs b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.ListDirectory.cs index e37e937f..86e02b2c 100644 --- a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.ListDirectory.cs +++ b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.ListDirectory.cs @@ -79,7 +79,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests 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 91c248bd..ab6f9da2 100644 --- a/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.Upload.cs +++ b/test/Renci.SshNet.IntegrationTests/OldIntegrationTests/SftpClientTest.Upload.cs @@ -93,11 +93,11 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests 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 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests 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 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests { asyncResult = sftp.BeginUploadFile(fileStream, remoteFileName, - delegate(IAsyncResult ar) + delegate (IAsyncResult ar) { sftp.EndUploadFile(ar); uploadDelegateCalled = true; @@ -285,7 +285,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests { asyncResult = sftp.BeginDownloadFile(remoteFileName, fileStream, - delegate(IAsyncResult ar) + delegate (IAsyncResult ar) { sftp.EndDownloadFile(ar); downloadDelegateCalled = true; @@ -306,7 +306,7 @@ namespace Renci.SshNet.IntegrationTests.OldIntegrationTests 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 fc90554a..ba424a24 100644 --- a/test/Renci.SshNet.IntegrationTests/ScpClientTests.cs +++ b/test/Renci.SshNet.IntegrationTests/ScpClientTests.cs @@ -20,7 +20,7 @@ namespace Renci.SshNet.IntegrationTests { 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 c244b86a..5a131865 100644 --- a/test/Renci.SshNet.IntegrationTests/ScpTests.cs +++ b/test/Renci.SshNet.IntegrationTests/ScpTests.cs @@ -1368,10 +1368,10 @@ namespace Renci.SshNet.IntegrationTests } 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 @@ namespace Renci.SshNet.IntegrationTests } 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 535b07bc..a1276e80 100644 --- a/test/Renci.SshNet.IntegrationTests/SftpClientTests.cs +++ b/test/Renci.SshNet.IntegrationTests/SftpClientTests.cs @@ -20,7 +20,7 @@ namespace Renci.SshNet.IntegrationTests 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 87b59c7a..689a2c3b 100644 --- a/test/Renci.SshNet.IntegrationTests/SftpTests.cs +++ b/test/Renci.SshNet.IntegrationTests/SftpTests.cs @@ -114,7 +114,7 @@ namespace Renci.SshNet.IntegrationTests { 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())) { @@ -1389,8 +1389,8 @@ namespace Renci.SshNet.IntegrationTests finally { if (client.Exists(remoteFile)) - { - client.DeleteFile(remoteFile); + { + client.DeleteFile(remoteFile); } } } @@ -1464,8 +1464,8 @@ namespace Renci.SshNet.IntegrationTests finally { if (client.Exists(remoteFile)) - { - client.DeleteFile(remoteFile); + { + client.DeleteFile(remoteFile); } } } @@ -4775,7 +4775,7 @@ namespace Renci.SshNet.IntegrationTests 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 @@ namespace Renci.SshNet.IntegrationTests 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 @@ namespace Renci.SshNet.IntegrationTests 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,7 +4878,7 @@ namespace Renci.SshNet.IntegrationTests 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))); @@ -6186,7 +6186,7 @@ namespace Renci.SshNet.IntegrationTests } finally { - client.DeleteFile(testFilePath); + client.DeleteFile(testFilePath); } } @@ -6230,7 +6230,7 @@ namespace Renci.SshNet.IntegrationTests 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 74113411..4116daad 100644 --- a/test/Renci.SshNet.IntegrationTests/SshConnectionDisruptor.cs +++ b/test/Renci.SshNet.IntegrationTests/SshConnectionDisruptor.cs @@ -12,11 +12,11 @@ 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 3cf4a9a1..ea11818e 100644 --- a/test/Renci.SshNet.IntegrationTests/SshTests.cs +++ b/test/Renci.SshNet.IntegrationTests/SshTests.cs @@ -87,12 +87,12 @@ namespace Renci.SshNet.IntegrationTests 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"); @@ -492,7 +492,7 @@ namespace Renci.SshNet.IntegrationTests try { - var httpRequest = (HttpWebRequest) WebRequest.Create("http://" + localEndPoint); + var httpRequest = (HttpWebRequest)WebRequest.Create("http://" + localEndPoint); httpRequest.Host = hostName; httpRequest.Method = "GET"; httpRequest.AllowAutoRedirect = false; @@ -561,7 +561,7 @@ namespace Renci.SshNet.IntegrationTests 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"; @@ -941,7 +941,7 @@ namespace Renci.SshNet.IntegrationTests 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.Tests/.editorconfig b/test/Renci.SshNet.Tests/.editorconfig index 2e0c2747..496a8321 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 diff --git a/test/Renci.SshNet.Tests/Classes/BaseClientTestBase.cs b/test/Renci.SshNet.Tests/Classes/BaseClientTestBase.cs index 7c6c5838..d22bfd17 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 543a5089..caeb7f23 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 @@ namespace Renci.SshNet.Tests.Classes base.Arrange(); _client = new MyClient(_connectionInfo, false, ServiceFactoryMock.Object) - { - OnConnectedException = _onConnectException - }; + { + OnConnectedException = _onConnectException + }; } protected override void Act() @@ -139,7 +142,7 @@ namespace Renci.SshNet.Tests.Classes 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/BaseClientTest_Connected_KeepAliveInterval_NotNegativeOne.cs b/test/Renci.SshNet.Tests/Classes/BaseClientTest_Connected_KeepAliveInterval_NotNegativeOne.cs index f3650976..cbc740b0 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 c0325102..1fd6766d 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 @@ namespace Renci.SshNet.Tests.Classes 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 ebde0c20..db2cac1c 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 e026d09b..c94dcb1a 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 e0720e42..b6276479 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.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest.cs index e3daf22f..0b67b917 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest.cs @@ -38,14 +38,14 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 @@ namespace Renci.SshNet.Tests.Classes.Channels _ = _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 @@ namespace Renci.SshNet.Tests.Classes.Channels _ = _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 @@ namespace Renci.SshNet.Tests.Classes.Channels .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 cf6d17bb..ba0e4445 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.Globalization; 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; @@ -60,12 +63,12 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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; 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 393eae09..b92ebfeb 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 @@ namespace Renci.SshNet.Tests.Classes.Channels 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/ChannelSessionTestBase.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTestBase.cs index 52dfabb9..302f5d39 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 da5ce0d1..42ef9874 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ChannelSessionTest_Dispose_Disposed.cs @@ -72,8 +72,8 @@ namespace Renci.SshNet.Tests.Classes.Channels _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 626a6519..da7438b9 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; @@ -31,12 +34,12 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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(); @@ -136,4 +139,4 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 dca9c0ec..80fc2e03 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; @@ -29,12 +32,12 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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 7a68ff17..1684b364 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; @@ -30,12 +33,12 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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 6948fded..3fbba4e9 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; @@ -29,12 +32,12 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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); @@ -123,4 +126,4 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 b07bf3d2..075b02a5 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; @@ -30,12 +33,12 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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 d8294bf1..44e66170 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; @@ -29,12 +32,12 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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); @@ -121,4 +124,4 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 3b340bd4..3d6a4407 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; @@ -29,12 +32,12 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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 ce2bc096..0824ace2 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; @@ -28,12 +31,12 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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 b547af77..d7a14aa2 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; @@ -28,12 +31,12 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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(); @@ -141,4 +144,4 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 e2ded594..3c3b30bb 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; @@ -29,12 +32,12 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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); @@ -122,4 +125,4 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 62f5ab4a..b584fa2d 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; @@ -29,12 +32,12 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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); @@ -119,4 +122,4 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 08f00b90..23a619c5 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; @@ -29,12 +32,12 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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); @@ -113,4 +116,4 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 5771f4e1..22bb7dda 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; @@ -31,12 +34,12 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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 44b9800a..43a19936 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; @@ -27,9 +30,9 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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(); @@ -110,4 +113,4 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 37cf3ac0..5ff15cec 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; @@ -30,9 +33,9 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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(); @@ -74,8 +77,8 @@ namespace Renci.SshNet.Tests.Classes.Channels _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 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 9934c071..2ecc4092 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; @@ -32,18 +35,18 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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/ChannelStub.cs b/test/Renci.SshNet.Tests/Classes/Channels/ChannelStub.cs index 6476ec91..d89ec98c 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 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 f92810cc..e8f1aba2 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 8847ff7a..a6fa8418 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; @@ -22,9 +25,9 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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(); } @@ -72,4 +75,4 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 679e1b8a..e6af7394 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; @@ -29,12 +32,12 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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(); @@ -152,4 +155,4 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 e59e95df..89dc6c98 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; @@ -39,12 +42,12 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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(); @@ -158,4 +161,4 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 23a00ca8..4f11009b 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; @@ -30,12 +33,12 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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 7519c5db..a9ea7782 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; @@ -27,12 +30,12 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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(); @@ -118,4 +121,4 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 a5131338..cc3f8547 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; @@ -27,12 +30,12 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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(); @@ -118,4 +121,4 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 d7709464..2cd62244 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; @@ -22,9 +25,9 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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(); } @@ -72,4 +75,4 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 d837c734..f0553cce 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; @@ -21,9 +24,9 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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(); } @@ -72,4 +75,4 @@ namespace Renci.SshNet.Tests.Classes.Channels Assert.AreEqual(0, _channelExceptionRegister.Count); } } -} \ No newline at end of file +} 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 8a736849..af4936e1 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 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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 e8aa9752..27a1929e 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; @@ -29,12 +32,12 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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(); @@ -140,4 +143,4 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 b1d633b5..c9227791 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; @@ -28,12 +31,12 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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 9f37a40a..101c169d 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; @@ -28,12 +31,12 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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(); @@ -126,4 +129,4 @@ namespace Renci.SshNet.Tests.Classes.Channels Assert.IsTrue(_channelClosedEventHandlerCompleted.WaitOne(0)); } } -} \ No newline at end of file +} 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 bdb3cadf..0703ca60 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 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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 69a5adb4..a97031bf 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 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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 c27f7339..f07e0198 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 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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 360628ca..3709b2de 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 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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 426b2463..fa02dc49 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 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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 407480de..62fe98ad 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 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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 09a9e1ea..b49b0b7b 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 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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 1019204b..afad6eb8 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 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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 989ea952..693adbd7 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 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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 327aa126..d7f04dab 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 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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 ddbae080..1dd45bbe 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 @@ -20,9 +22,9 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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(); @@ -60,4 +62,4 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 83d4ac3f..4a922ad3 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; @@ -22,9 +25,9 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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; @@ -88,4 +91,4 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 ff843491..fe809225 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; @@ -24,12 +27,12 @@ namespace Renci.SshNet.Tests.Classes.Channels { 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(); } @@ -81,4 +84,4 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 05c52f2a..66113f60 100644 --- a/test/Renci.SshNet.Tests/Classes/Channels/ClientChannelStub.cs +++ b/test/Renci.SshNet.Tests/Classes/Channels/ClientChannelStub.cs @@ -34,7 +34,7 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 4f0b3cfa..9fcdc6d4 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; @@ -29,10 +32,10 @@ namespace Renci.SshNet.Tests.Classes.Channels 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 a7ccde35..ad2b6ad1 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; diff --git a/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest.cs b/test/Renci.SshNet.Tests/Classes/ClientAuthenticationTest.cs index e2bb4d8c..1bf0b8d8 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 @@ namespace Renci.SshNet.Tests.Classes [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 853114af..9a4707b1 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 bcf93a91..e538dcca 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 @@ namespace Renci.SshNet.Tests.Classes }); 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 @@ namespace Renci.SshNet.Tests.Classes .Returns(AuthenticationResult.PartialSuccess); PublicKeyAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -95,7 +98,7 @@ namespace Renci.SshNet.Tests.Classes .Returns(AuthenticationResult.PartialSuccess); PasswordAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -109,7 +112,7 @@ namespace Renci.SshNet.Tests.Classes .Returns(AuthenticationResult.PartialSuccess); PasswordAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"publickey"}); + .Returns(new[] { "publickey" }); /* Enumerate supported authentication methods */ @@ -123,7 +126,7 @@ namespace Renci.SshNet.Tests.Classes .Returns(AuthenticationResult.PartialSuccess); PublicKeyAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"publickey"}); + .Returns(new[] { "publickey" }); /* Enumerate supported authentication methods */ @@ -141,7 +144,7 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes 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 66e931f8..8b8f3824 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 72a9da49..eb94ca00 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 @@ namespace Renci.SshNet.Tests.Classes }); 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 0f21f0bf..b69121f0 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 @@ namespace Renci.SshNet.Tests.Classes }); NoneAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"publickey", "password"}); + .Returns(new[] { "publickey", "password" }); /* Enumerate supported authentication methods */ @@ -71,7 +73,7 @@ namespace Renci.SshNet.Tests.Classes 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 f4c49023..6d59884f 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 @@ namespace Renci.SshNet.Tests.Classes }); 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 @@ namespace Renci.SshNet.Tests.Classes .Returns(AuthenticationResult.PartialSuccess); PublicKeyAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -97,7 +100,7 @@ namespace Renci.SshNet.Tests.Classes .Returns(AuthenticationResult.PartialSuccess); PasswordAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -112,7 +115,7 @@ namespace Renci.SshNet.Tests.Classes .Returns(AuthenticationResult.PartialSuccess); PasswordAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -172,4 +175,4 @@ namespace Renci.SshNet.Tests.Classes 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 e8c0e474..775b8b73 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 @@ namespace Renci.SshNet.Tests.Classes .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 @@ namespace Renci.SshNet.Tests.Classes 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 be985a70..b2500e8b 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 @@ namespace Renci.SshNet.Tests.Classes }); NoneAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -78,7 +81,7 @@ namespace Renci.SshNet.Tests.Classes .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 @@ namespace Renci.SshNet.Tests.Classes .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 87787414..88d0d75e 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 @@ namespace Renci.SshNet.Tests.Classes }); 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 @@ namespace Renci.SshNet.Tests.Classes .Returns(AuthenticationResult.PartialSuccess); PublicKeyAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -97,7 +97,7 @@ namespace Renci.SshNet.Tests.Classes .Returns(AuthenticationResult.PartialSuccess); PasswordAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -112,7 +112,7 @@ namespace Renci.SshNet.Tests.Classes .Returns(AuthenticationResult.PartialSuccess); PasswordAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -133,7 +133,7 @@ namespace Renci.SshNet.Tests.Classes .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 228ad23f..4d095c07 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 @@ namespace Renci.SshNet.Tests.Classes }); NoneAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -76,7 +78,7 @@ namespace Renci.SshNet.Tests.Classes .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 @@ namespace Renci.SshNet.Tests.Classes .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 4a0d5fc2..2a481e31 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 @@ namespace Renci.SshNet.Tests.Classes .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 7cfd76ee..2a531436 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 @@ namespace Renci.SshNet.Tests.Classes 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 4ca447d6..3a9578f0 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 e3f8ff3f..be87fc9f 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 @@ namespace Renci.SshNet.Tests.Classes }); NoneAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -69,7 +71,7 @@ namespace Renci.SshNet.Tests.Classes .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 74261dc1..e98de6ec 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 @@ namespace Renci.SshNet.Tests.Classes .Returns(AuthenticationResult.PartialSuccess); PasswordAuthenticationMethodMock.InSequence(seq) .Setup(p => p.AllowedAuthentications) - .Returns(new[] {"password"}); + .Returns(new[] { "password" }); /* Enumerate supported authentication methods */ @@ -144,7 +147,7 @@ namespace Renci.SshNet.Tests.Classes { 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 c340f40f..f8066bd0 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 af5613e8..f3786ece 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 @@ namespace Renci.SshNet.Tests.Classes.Common 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 @@ namespace Renci.SshNet.Tests.Classes.Common 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] @@ -367,7 +370,7 @@ namespace Renci.SshNet.Tests.Classes.Common 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); } } } @@ -385,7 +388,7 @@ namespace Renci.SshNet.Tests.Classes.Common 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); } } } @@ -400,7 +403,7 @@ namespace Renci.SshNet.Tests.Classes.Common 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); } } @@ -415,8 +418,8 @@ namespace Renci.SshNet.Tests.Classes.Common 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); } } @@ -444,7 +447,7 @@ namespace Renci.SshNet.Tests.Classes.Common var a = new BigInteger(values[i]); var b = --a; - Assert.AreEqual(--values[i], (long) b, "#_" + i); + Assert.AreEqual(--values[i], (long)b, "#_" + i); } } @@ -460,10 +463,10 @@ namespace Renci.SshNet.Tests.Classes.Common 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); } } } @@ -631,9 +634,9 @@ namespace Renci.SshNet.Tests.Classes.Common [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] @@ -673,8 +676,8 @@ namespace Renci.SshNet.Tests.Classes.Common 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) @@ -786,10 +789,10 @@ namespace Renci.SshNet.Tests.Classes.Common 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 @@ namespace Renci.SshNet.Tests.Classes.Common 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"); @@ -821,21 +824,21 @@ namespace Renci.SshNet.Tests.Classes.Common { 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) { } @@ -850,7 +853,7 @@ namespace Renci.SshNet.Tests.Classes.Common { try { - _ = (long) new BigInteger(Huge_a); + _ = (long)new BigInteger(Huge_a); Assert.Fail("#1"); } catch (OverflowException) { } @@ -858,7 +861,7 @@ namespace Renci.SshNet.Tests.Classes.Common //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) { } @@ -866,7 +869,7 @@ namespace Renci.SshNet.Tests.Classes.Common //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) { } @@ -936,14 +939,14 @@ namespace Renci.SshNet.Tests.Classes.Common 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) { } @@ -1047,7 +1050,7 @@ namespace Renci.SshNet.Tests.Classes.Common try { - var x = (decimal) BigInteger.Pow(2, 1024); + var x = (decimal)BigInteger.Pow(2, 1024); Assert.Fail("#2: " + x); } catch (OverflowException) @@ -1056,7 +1059,7 @@ namespace Renci.SshNet.Tests.Classes.Common try { - var x = (decimal) BigInteger.Pow(-2, 1025); + var x = (decimal)BigInteger.Pow(-2, 1025); Assert.Fail("#3: " + x); } catch (OverflowException) @@ -1187,13 +1190,13 @@ namespace Renci.SshNet.Tests.Classes.Common 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] @@ -1215,16 +1218,16 @@ namespace Renci.SshNet.Tests.Classes.Common 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); @@ -1239,10 +1242,10 @@ namespace Renci.SshNet.Tests.Classes.Common 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); @@ -1267,7 +1270,7 @@ namespace Renci.SshNet.Tests.Classes.Common 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"); @@ -1282,20 +1285,20 @@ namespace Renci.SshNet.Tests.Classes.Common var old = Thread.CurrentThread.CurrentCulture; var cur = (CultureInfo)old.Clone(); cur.NumberFormat = new NumberFormatInfo - { - NegativeSign = ">", - PositiveSign = "%" - }; + { + NegativeSign = ">", + PositiveSign = "%" + }; Thread.CurrentThread.CurrentCulture = cur; 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,10 +1523,10 @@ namespace Renci.SshNet.Tests.Classes.Common 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"); diff --git a/test/Renci.SshNet.Tests/Classes/Common/ChannelDataEventArgsTest.cs b/test/Renci.SshNet.Tests/Classes/Common/ChannelDataEventArgsTest.cs index 3c68163f..cc7e5488 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 4e411de9..b741c897 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 2265a5f7..2d42c570 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 093a59c9..6b5eeca9 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 a2badf97..c85115f6 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 df5f5b97..511ace48 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 13b1d8ee..bbae3afa 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 2513aebf..3a780b25 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 @@ namespace Renci.SshNet.Tests.Classes.Common [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 1b933af0..3a7bb32f 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 @@ namespace Renci.SshNet.Tests.Classes.Common [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 019924a1..585df1aa 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 @@ namespace Renci.SshNet.Tests.Classes.Common [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 ea43330d..0f30c0ae 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 16527bf1..f455915d 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 814f8039..dee706b0 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 @@ namespace Renci.SshNet.Tests.Classes.Common [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 @@ namespace Renci.SshNet.Tests.Classes.Common [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 84d899f8..4c67be7b 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 { diff --git a/test/Renci.SshNet.Tests/Classes/Common/ObjectIdentifierTest.cs b/test/Renci.SshNet.Tests/Classes/Common/ObjectIdentifierTest.cs index 60815942..c0b74098 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 a5ff500f..443b749e 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 @@ namespace Renci.SshNet.Tests.Classes.Common [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 13c649bd..be6ad48e 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 @@ namespace Renci.SshNet.Tests.Classes.Common 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 6d56807f..56738dff 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/PipeStreamTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/PipeStreamTest.cs @@ -73,7 +73,7 @@ namespace Renci.SshNet.Tests.Classes.Common () => { 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 @@ namespace Renci.SshNet.Tests.Classes.Common { 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 ed25b260..41a5f07b 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 eb314d4d..b0e3c3c2 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 @@ namespace Renci.SshNet.Tests.Classes.Common protected override void Arrange() { - _pipeStream = new PipeStream {MaxBufferLength = 3}; + _pipeStream = new PipeStream { MaxBufferLength = 3 }; _writehread = new Thread(() => { @@ -58,7 +60,7 @@ namespace Renci.SshNet.Tests.Classes.Common 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 415466af..d765e2fc 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 @@ namespace Renci.SshNet.Tests.Classes.Common // 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 f306edf1..0926f2e6 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 c1f41dd7..16f3f2c5 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 @@ using Renci.SshNet.Tests.Properties; 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 519c9543..d04dbb43 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 0767c11e..e4b168dc 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 d81a13d2..3997dca2 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/Common/SshDataTest.cs b/test/Renci.SshNet.Tests/Classes/Common/SshDataTest.cs index 03b48912..1518dda1 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/SshDataTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/SshDataTest.cs @@ -16,7 +16,7 @@ namespace Renci.SshNet.Tests.Classes.Common var bytes = sshData.GetBytes(); - Assert.AreEqual((byte) 0, bytes[0]); + Assert.AreEqual((byte)0, bytes[0]); } [TestMethod] @@ -26,7 +26,7 @@ namespace Renci.SshNet.Tests.Classes.Common 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 71f91c8e..87e30daf 100644 --- a/test/Renci.SshNet.Tests/Classes/Common/TimeSpanExtensionsTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Common/TimeSpanExtensionsTest.cs @@ -33,7 +33,7 @@ namespace Renci.SshNet.Tests.Classes.Common [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 @@ namespace Renci.SshNet.Tests.Classes.Common try { - var timeSpan = TimeSpan.FromMilliseconds((double) int.MaxValue + 1); + var timeSpan = TimeSpan.FromMilliseconds((double)int.MaxValue + 1); timeSpan.AsTimeout("TestMethodName"); } @@ -77,7 +77,7 @@ namespace Renci.SshNet.Tests.Classes.Common [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 @@ namespace Renci.SshNet.Tests.Classes.Common 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/HttpConnectorTestBase.cs b/test/Renci.SshNet.Tests/Classes/Connection/HttpConnectorTestBase.cs index 1ed56ecd..7023901f 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 @@ namespace Renci.SshNet.Tests.Classes.Connection 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 51830332..5cc4e8d2 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 @@ namespace Renci.SshNet.Tests.Classes.Connection "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 ece0aa9e..c6b7939b 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 @@ namespace Renci.SshNet.Tests.Classes.Connection "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 7a87e9d6..8384e4d9 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 9a7e876a..e8bf537b 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 @@ namespace Renci.SshNet.Tests.Classes.Connection "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 @@ namespace Renci.SshNet.Tests.Classes.Connection 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 ccbf2b75..85008204 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.Net.Sockets; 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 @@ namespace Renci.SshNet.Tests.Classes.Connection "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 eebb70fa..cca8544a 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 @@ namespace Renci.SshNet.Tests.Classes.Connection "proxyUser", "proxyPwd", new KeyboardInteractiveAuthenticationMethod("user")) - { - Timeout = TimeSpan.FromMilliseconds(100) - }; + { + Timeout = TimeSpan.FromMilliseconds(100) + }; _bytesReceivedByProxy = new List(); _actualException = null; @@ -85,7 +85,7 @@ namespace Renci.SshNet.Tests.Classes.Connection { _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 f2287807..f729c616 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 @@ namespace Renci.SshNet.Tests.Classes.Connection "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 @@ namespace Renci.SshNet.Tests.Classes.Connection 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 765e7f81..955e701a 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 @@ namespace Renci.SshNet.Tests.Classes.Connection "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 @@ namespace Renci.SshNet.Tests.Classes.Connection _ = 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 @@ namespace Renci.SshNet.Tests.Classes.Connection 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 17da268c..7a41263c 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.Net.Sockets; 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 @@ namespace Renci.SshNet.Tests.Classes.Connection "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 @@ namespace Renci.SshNet.Tests.Classes.Connection 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 b2cdc5fd..fb7f7f9d 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 @@ namespace Renci.SshNet.Tests.Classes.Connection "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 455a41a9..453a3f71 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 @@ namespace Renci.SshNet.Tests.Classes.Connection 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 b49d1b12..de78270f 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 @@ namespace Renci.SshNet.Tests.Classes.Connection "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 59a022bc..4d9b0267 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 @@ namespace Renci.SshNet.Tests.Classes.Connection 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 de333290..fbdfeb2c 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 @@ namespace Renci.SshNet.Tests.Classes.Connection "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 6808bfb5..c2c56eed 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 @@ namespace Renci.SshNet.Tests.Classes.Connection "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 38f65634..1cd27be5 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 @@ namespace Renci.SshNet.Tests.Classes.Connection "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 2b3245ee..164cb6a7 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.Net.Sockets; 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 4108c7c0..2af8062b 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.Net.Sockets; 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 f3ce9ccf..36596720 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.Net.Sockets; 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 91891252..ced3e155 100644 --- a/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTestBase.cs +++ b/test/Renci.SshNet.Tests/Classes/Connection/Socks4ConnectorTestBase.cs @@ -34,7 +34,7 @@ namespace Renci.SshNet.Tests.Classes.Connection 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 f8793bd6..64976c7d 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 4ca6e0c5..c6d4c65d 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 @@ namespace Renci.SshNet.Tests.Classes.Connection { _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 8ce9537c..24809f61 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 @@ namespace Renci.SshNet.Tests.Classes.Connection 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); @@ -60,7 +60,7 @@ namespace Renci.SshNet.Tests.Classes.Connection 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_NoAuthentication_ConnectionSucceeded.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_NoAuthentication_ConnectionSucceeded.cs index 65ec1a20..58bfa2bb 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_ProxySocksVersionIsNotSupported.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_ProxySocksVersionIsNotSupported.cs index 76cd2568..1c26de2f 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 @@ namespace Renci.SshNet.Tests.Classes.Connection 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_TimeoutConnectionReply.cs b/test/Renci.SshNet.Tests/Classes/Connection/Socks5ConnectorTest_Connect_TimeoutConnectionReply.cs index a2013738..907f4ab6 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 @@ namespace Renci.SshNet.Tests.Classes.Connection _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 @@ namespace Renci.SshNet.Tests.Classes.Connection _ = 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 @@ namespace Renci.SshNet.Tests.Classes.Connection } [TestMethod] - public void ConnectShouldHaveThrownSshOperationTimeoutException() { + public void ConnectShouldHaveThrownSshOperationTimeoutException() + { Assert.IsNull(_actualException.InnerException); Assert.IsInstanceOfType(_actualException); } 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 e6bcf5ab..74d31196 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.Net.Sockets; 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] @@ -129,11 +132,11 @@ namespace Renci.SshNet.Tests.Classes.Connection // 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 b36a7eff..bb300489 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 3d18cfa5..c5a9fffe 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 130b4b53..4e143bbc 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 { @@ -427,7 +430,7 @@ namespace Renci.SshNet.Tests.Classes } 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 @@ namespace Renci.SshNet.Tests.Classes 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 597b400f..a06350f7 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 7b6ce1c2..f2309785 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 777875f0..c87ac2f1 100644 --- a/test/Renci.SshNet.Tests/Classes/ExpectActionTest.cs +++ b/test/Renci.SshNet.Tests/Classes/ExpectActionTest.cs @@ -1,9 +1,11 @@ -using System.Globalization; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Renci.SshNet.Tests.Common; -using System; +using System; +using System.Globalization; using System.Text.RegularExpressions; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Renci.SshNet.Tests.Common; + namespace Renci.SshNet.Tests.Classes { [TestClass] @@ -34,4 +36,4 @@ namespace Renci.SshNet.Tests.Classes 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 a836cebd..3055b6ee 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 @@ -12,7 +14,7 @@ namespace Renci.SshNet.Tests.Classes 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); @@ -31,4 +33,4 @@ namespace Renci.SshNet.Tests.Classes 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 36fc91dd..d39a91fa 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_PortStarted_ChannelBound.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelBound.cs index 441250a0..64f2ab37 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; 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; @@ -198,7 +201,7 @@ namespace Renci.SshNet.Tests.Classes { _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); } 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 b3e32553..fb148f66 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelNotBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Dispose_PortStarted_ChannelNotBound.cs @@ -65,18 +65,18 @@ namespace Renci.SshNet.Tests.Classes _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; _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 9eeca0de..5e8d9c3e 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 @@ -48,7 +51,7 @@ namespace Renci.SshNet.Tests.Classes _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 db778a08..af699acc 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; 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; @@ -82,7 +85,7 @@ namespace Renci.SshNet.Tests.Classes _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); @@ -92,11 +95,11 @@ namespace Renci.SshNet.Tests.Classes _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() diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortDisposed.cs index ba758f79..2ceac31e 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 cb97c1ec..0bdb35cd 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; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStarted.cs index 4978ea79..0124a8db 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; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_PortStopped.cs index 3c5eb998..ea869931 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; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNotConnected.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNotConnected.cs index f35a6582..b873df28 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 diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNull.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Start_SessionNull.cs index a3b717e5..c326c00d 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 diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketSendShutdownImmediately.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketSendShutdownImmediately.cs index 9859be49..a5e1b796 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 @@ namespace Renci.SshNet.Tests.Classes _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_Started_SocketVersionNotSupported.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Started_SocketVersionNotSupported.cs index e3dc264b..9c15f079 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 @@ namespace Renci.SshNet.Tests.Classes 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 f84657b7..58b02032 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 diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortNeverStarted.cs index 92999ab7..118b075e 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 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 80f7877e..2ade89d8 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; 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; @@ -89,11 +92,11 @@ namespace Renci.SshNet.Tests.Classes _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() 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 b0059f45..ed6301e7 100644 --- a/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelNotBound.cs +++ b/test/Renci.SshNet.Tests/Classes/ForwardedPortDynamicTest_Stop_PortStarted_ChannelNotBound.cs @@ -69,18 +69,18 @@ namespace Renci.SshNet.Tests.Classes .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; _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 3fc61917..2c5c5097 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 @@ -48,7 +51,7 @@ namespace Renci.SshNet.Tests.Classes _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_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Dispose_PortDisposed.cs index 2ca34f41..8b4a837d 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 dd4e73f9..fb74e217 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 6ba24a87..c45f2661 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 @@ -53,8 +56,8 @@ namespace Renci.SshNet.Tests.Classes _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 9677734a..3b28f538 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.Collections.Generic; 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; @@ -66,7 +69,7 @@ namespace Renci.SshNet.Tests.Classes _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); @@ -93,11 +96,11 @@ namespace Renci.SshNet.Tests.Classes _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 f7dadf62..d25ba1f7 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; @@ -56,8 +59,8 @@ namespace Renci.SshNet.Tests.Classes _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 3e8e6321..5975536b 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 diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortDisposed.cs index 78d5ba52..6d841b9c 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 diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_PortNeverStarted.cs index c286bd88..361c7e75 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; @@ -58,8 +61,8 @@ namespace Renci.SshNet.Tests.Classes _ = _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 7998ea99..0c169b1b 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 @@ namespace Renci.SshNet.Tests.Classes .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 fda16ba8..0f8462e0 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 diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNull.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Start_SessionNull.cs index 01caca5b..d6e9ca4b 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 diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortLocalTest_Stop_PortDisposed.cs index b84a9339..2806ec54 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 a6c1ef5f..17b6c11b 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 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 b07bb933..47d1acd8 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.Collections.Generic; 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; @@ -77,17 +80,17 @@ namespace Renci.SshNet.Tests.Classes _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; _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 d43ee28f..10fa7158 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; @@ -56,8 +59,8 @@ namespace Renci.SshNet.Tests.Classes _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 ff55acb3..31b383a1 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 diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortDisposed.cs index 03d14da6..2cedfbe5 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,9 +40,9 @@ namespace Renci.SshNet.Tests.Classes _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 = 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 1454ce2a..3f6c7edf 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; 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 69787c82..07f09220 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.Collections.Generic; 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; @@ -80,14 +83,14 @@ namespace Renci.SshNet.Tests.Classes _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); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Dispose_PortStopped.cs index 0c1de603..6a12103f 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.Collections.Generic; 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; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortDisposed.cs index bb33584b..8b0b0511 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 diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortNeverStarted.cs index a090f289..8fecf98c 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.Collections.Generic; 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; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStarted.cs index 0cd8a6ad..c6cf0850 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.Collections.Generic; 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; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStopped.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_PortStopped.cs index 92caa7ac..9e056da7 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.Collections.Generic; 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; diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNotConnected.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Start_SessionNotConnected.cs index af38f057..21202686 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 @@ namespace Renci.SshNet.Tests.Classes _ = _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,15 +96,15 @@ namespace Renci.SshNet.Tests.Classes [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); - + _sessionMock.Raise(p => p.ChannelOpenReceived += null, new MessageEventArgs(new ChannelOpenMessage(channelNumber, initialWindowSize, maximumPacketSize, diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Started.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Started.cs index dd7537a3..649848ba 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.Collections.Generic; 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; @@ -90,11 +93,11 @@ namespace Renci.SshNet.Tests.Classes [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); diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortDisposed.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortDisposed.cs index 5c905c3d..796bdda4 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 diff --git a/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortNeverStarted.cs b/test/Renci.SshNet.Tests/Classes/ForwardedPortRemoteTest_Stop_PortNeverStarted.cs index d3fce85f..97943190 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.Collections.Generic; 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; diff --git a/test/Renci.SshNet.Tests/Classes/KeyboardInteractiveAuthenticationMethodTest.cs b/test/Renci.SshNet.Tests/Classes/KeyboardInteractiveAuthenticationMethodTest.cs index 2940388d..e96bcae4 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 31002433..071b48c0 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 System; +using System.Linq; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Renci.SshNet.Abstractions; using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; -using Renci.SshNet.Abstractions; using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes.Messages.Connection @@ -43,7 +45,7 @@ namespace Renci.SshNet.Tests.Classes.Messages.Connection [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 @@ -61,7 +63,7 @@ namespace Renci.SshNet.Tests.Classes.Messages.Connection [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; @@ -76,7 +78,7 @@ namespace Renci.SshNet.Tests.Classes.Messages.Connection [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; @@ -98,7 +100,7 @@ namespace Renci.SshNet.Tests.Classes.Messages.Connection { 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); @@ -118,7 +120,7 @@ namespace Renci.SshNet.Tests.Classes.Messages.Connection 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); @@ -132,7 +134,7 @@ namespace Renci.SshNet.Tests.Classes.Messages.Connection { 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 d53568a8..75fca950 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 { @@ -36,9 +38,9 @@ namespace Renci.SshNet.Tests.Classes.Messages.Connection [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); @@ -53,9 +55,9 @@ namespace Renci.SshNet.Tests.Classes.Messages.Connection [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 @@ -97,10 +99,10 @@ namespace Renci.SshNet.Tests.Classes.Messages.Connection 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()); @@ -229,7 +231,7 @@ namespace Renci.SshNet.Tests.Classes.Messages.Connection 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 fedbdb7f..a03feef3 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; using System.Collections.Generic; using System.Globalization; using System.Text; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Renci.SshNet.Common; using Renci.SshNet.Messages.Connection; @@ -29,10 +31,10 @@ namespace Renci.SshNet.Tests.Classes.Messages.Connection _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}, @@ -67,12 +69,12 @@ namespace Renci.SshNet.Tests.Classes.Messages.Connection 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); } @@ -103,7 +105,7 @@ namespace Renci.SshNet.Tests.Classes.Messages.Connection 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); } @@ -139,7 +141,7 @@ namespace Renci.SshNet.Tests.Classes.Messages.Connection 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/Connection/GlobalRequestMessageTest.cs b/test/Renci.SshNet.Tests/Classes/Messages/Connection/GlobalRequestMessageTest.cs index 156a17d9..3da4d105 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 ff8fd86d..8b493f89 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 { @@ -69,7 +71,7 @@ namespace Renci.SshNet.Tests.Classes.Messages.Transport 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/KeyExchangeDhGroupExchangeInitTest.cs b/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeInitTest.cs index 0cd39a0e..0ffc4ba0 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 f257e6de..f36106f2 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; @@ -44,7 +45,7 @@ namespace Renci.SshNet.Tests.Classes.Messages.Transport var target = new KeyExchangeDhGroupExchangeReply(); sshDataStream.WriteByte(target.MessageNumber); sshDataStream.Write((uint)(4 + _hostKeyAlgorithm.Length + _hostKeys.Length)); - sshDataStream.Write((uint) _hostKeyAlgorithm.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/KeyExchangeDhGroupExchangeReplyTest.cs b/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeReplyTest.cs index 2e424b50..6d0650af 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 @@ namespace Renci.SshNet.Tests.Classes.Messages.Transport 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/KeyExchangeDhGroupExchangeRequestTest.cs b/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeDhGroupExchangeRequestTest.cs index da1d0497..35e401c6 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 @@ namespace Renci.SshNet.Tests.Classes.Messages.Transport 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/Messages/Transport/KeyExchangeInitMessageTest.cs b/test/Renci.SshNet.Tests/Classes/Messages/Transport/KeyExchangeInitMessageTest.cs index e7116dc8..e60d56b0 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 b6764458..4917442a 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 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes 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 4c6cbe7f..66e3c25a 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_Dispose_Connected.cs b/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Dispose_Connected.cs index ed010383..d67b43af 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 @@ namespace Renci.SshNet.Tests.Classes _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 efbfe7ff..e3f15628 100644 --- a/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Dispose_Disconnected.cs +++ b/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Dispose_Disconnected.cs @@ -1,9 +1,9 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; + +using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; -using System; - namespace Renci.SshNet.Tests.Classes { [TestClass] @@ -25,9 +25,9 @@ namespace Renci.SshNet.Tests.Classes _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 cc5f704f..7294033a 100644 --- a/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Dispose_Disposed.cs +++ b/test/Renci.SshNet.Tests/Classes/NetConfClientTest_Dispose_Disposed.cs @@ -1,9 +1,9 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; +using System; + +using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; -using System; - namespace Renci.SshNet.Tests.Classes { [TestClass] @@ -18,9 +18,9 @@ namespace Renci.SshNet.Tests.Classes _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 ec827b1e..0d826643 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 @@ namespace Renci.SshNet.Tests.Classes _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 377ff89a..81b74c0e 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 7ad141ad..8eac9825 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 { diff --git a/test/Renci.SshNet.Tests/Classes/PasswordConnectionInfoTest.cs b/test/Renci.SshNet.Tests/Classes/PasswordConnectionInfoTest.cs index dbaa340f..8de23b54 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 { diff --git a/test/Renci.SshNet.Tests/Classes/PipeStreamTest_Dispose.cs b/test/Renci.SshNet.Tests/Classes/PipeStreamTest_Dispose.cs index 6ce5e73f..8ccf52d0 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 aa713dc9..e28a505f 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 bcf0d478..d07c3867 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 dd7c3a32..f5f4925f 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 a20fc518..b15ba890 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 786e408d..d44afb78 100644 --- a/test/Renci.SshNet.Tests/Classes/ScpClientTest.cs +++ b/test/Renci.SshNet.Tests/Classes/ScpClientTest.cs @@ -121,7 +121,7 @@ namespace Renci.SshNet.Tests.Classes 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 26aa22e3..fdbe123c 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 f64e039e..c3aba4b2 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 08eba4ff..0d8815fb 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 143938c3..0be4c962 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 71c1c0cd..75b1071c 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 288790d2..9fda3056 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 1df8d6ac..5a562fe3 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.Collections.Generic; 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 @@ namespace Renci.SshNet.Tests.Classes _ = _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 @@ namespace Renci.SshNet.Tests.Classes base.Arrange(); _scpClient = new ScpClient(_connectionInfo, false, ServiceFactoryMock.Object) - { - BufferSize = (uint) _bufferSize - }; + { + BufferSize = (uint)_bufferSize + }; _scpClient.Uploading += (sender, args) => _uploadingRegister.Add(args); _scpClient.Connect(); } @@ -175,7 +178,7 @@ namespace Renci.SshNet.Tests.Classes 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/BlockCipherTest.cs b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/BlockCipherTest.cs index 49546d61..39250ae2 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 @@ using Renci.SshNet.Tests.Common; namespace Renci.SshNet.Tests.Classes.Security.Cryptography { [TestClass] - public class BlockCipherTest : TestBase + public class BlockCipherTest : TestBase { [TestMethod] public void EncryptShouldTakeIntoAccountPaddingForLengthOfOutputBufferPassedToEncryptBlock() @@ -18,14 +20,14 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography 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 e1a0e974..ee186826 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; @@ -41,7 +42,7 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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)); @@ -77,7 +78,7 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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)); @@ -114,11 +115,11 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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); } @@ -194,19 +195,19 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -503,20 +504,20 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -538,7 +539,7 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -573,19 +574,19 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -606,20 +607,20 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -642,7 +643,7 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -677,19 +678,19 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -710,20 +711,20 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -746,7 +747,7 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CBC, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -780,19 +781,19 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -812,20 +813,20 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -847,7 +848,7 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -882,19 +883,19 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -915,20 +916,20 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -951,7 +952,7 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -986,19 +987,19 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -1019,20 +1020,20 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -1055,7 +1056,7 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CFB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -1089,19 +1090,19 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -1121,20 +1122,20 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -1156,7 +1157,7 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -1191,19 +1192,19 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -1224,20 +1225,20 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -1260,7 +1261,7 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -1295,19 +1296,19 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -1328,20 +1329,20 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -1364,7 +1365,7 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.CTR, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -1398,19 +1399,19 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -1430,20 +1431,20 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -1465,7 +1466,7 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -1500,19 +1501,19 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -1533,20 +1534,20 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -1569,7 +1570,7 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -1604,19 +1605,19 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -1637,20 +1638,20 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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); - + CollectionAssert.AreEqual(expected, actual); - + var decrypted = new AesCipher(key, (byte[])iv.Clone(), AesCipherMode.OFB, pkcs7Padding: false).Decrypt(actual); - + CollectionAssert.AreEqual(input, decrypted); } @@ -1673,7 +1674,7 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers { 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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); - + CollectionAssert.AreEqual(expected, 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 144524ed..7a95f707 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 bb31dbc9..828d1c5c 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 74aaec9b..a01dde95 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 1c7bd3a2..73ba7c97 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers }; 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers 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 dd7c2022..80a0d9c6 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers.Paddings [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 80e5d47f..801cf5e3 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/Cryptography/RsaDigitalSignatureTest.cs b/test/Renci.SshNet.Tests/Classes/Security/Cryptography/RsaDigitalSignatureTest.cs index a438ce1a..17901523 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography { 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 ce222a8e..a58af279 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 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography { using (var stream = GetData(fileName)) { - return (RsaKey) new PrivateKeyFile(stream, passPhrase).Key; + return (RsaKey)new PrivateKeyFile(stream, passPhrase).Key; } } @@ -35,7 +35,7 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography // 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); @@ -266,7 +266,7 @@ namespace Renci.SshNet.Tests.Classes.Security.Cryptography 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 d4119981..ae857573 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; @@ -176,7 +176,7 @@ namespace Renci.SshNet.Tests.Classes.Security { 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/KeyExchangeDiffieHellmanGroup14Sha1Test.cs b/test/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanGroup14Sha1Test.cs index 4f0ef37a..d541f819 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 @@ namespace Renci.SshNet.Tests.Classes.Security 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 45d6f295..73fd55ce 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 @@ namespace Renci.SshNet.Tests.Classes.Security 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 9cbaaba2..c5dcbd2c 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 @@ namespace Renci.SshNet.Tests.Classes.Security 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 22d2d4c0..56c5eeb0 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 { @@ -64,7 +67,7 @@ namespace Renci.SshNet.Tests.Classes 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); @@ -80,7 +83,7 @@ namespace Renci.SshNet.Tests.Classes 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); @@ -96,7 +99,7 @@ namespace Renci.SshNet.Tests.Classes 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); @@ -112,7 +115,7 @@ namespace Renci.SshNet.Tests.Classes 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); @@ -121,7 +124,7 @@ namespace Renci.SshNet.Tests.Classes [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 6184a05d..ce5c7b04 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; @@ -30,7 +33,7 @@ namespace Renci.SshNet.Tests.Classes _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 c89bfb0f..a869f48f 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; @@ -27,12 +30,12 @@ namespace Renci.SshNet.Tests.Classes { 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(); } @@ -95,4 +98,4 @@ namespace Renci.SshNet.Tests.Classes 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 dcab293c..29a0c9c7 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; @@ -95,4 +98,4 @@ namespace Renci.SshNet.Tests.Classes 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 affac00a..47a446c1 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; @@ -27,12 +30,12 @@ namespace Renci.SshNet.Tests.Classes { 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(); } @@ -95,4 +98,4 @@ namespace Renci.SshNet.Tests.Classes 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 2c822a9c..b2202b18 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; @@ -95,4 +98,4 @@ namespace Renci.SshNet.Tests.Classes 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 e1229298..c0439cba 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; @@ -95,4 +98,4 @@ namespace Renci.SshNet.Tests.Classes 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 8fe220c8..105085a2 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; @@ -34,7 +37,7 @@ namespace Renci.SshNet.Tests.Classes _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(); } @@ -97,4 +100,4 @@ namespace Renci.SshNet.Tests.Classes 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 c34b9ccc..06886580 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; @@ -27,12 +30,12 @@ namespace Renci.SshNet.Tests.Classes { 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(); } @@ -95,4 +98,4 @@ namespace Renci.SshNet.Tests.Classes 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 e39991b5..04135931 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 c3147d56..c9a97829 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 c94b8029..fb3a8f3c 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 97d44a93..269eb28b 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 b2ea49d3..8f959541 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 7cf0c62c..de06ca46 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 bfb9a428..05c7f342 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest.cs @@ -85,9 +85,9 @@ namespace Renci.SshNet.Tests.Classes 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 8b3cce37..e51c95cf 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 326bae64..87327532 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectToServerFails.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectToServerFails.cs @@ -33,8 +33,8 @@ namespace Renci.SshNet.Tests.Classes _ = 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() @@ -255,9 +255,9 @@ namespace Renci.SshNet.Tests.Classes 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 de7a89d6..d872ff18 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected.cs @@ -1,8 +1,11 @@ using System; using System.Linq; using System.Threading; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Moq; + using Renci.SshNet.Messages.Transport; namespace Renci.SshNet.Tests.Classes @@ -135,14 +138,14 @@ namespace Renci.SshNet.Tests.Classes [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)); @@ -153,7 +156,7 @@ namespace Renci.SshNet.Tests.Classes { Thread.Sleep(100); - var session = (ISession) Session; + var session = (ISession)Session; ServerBytesReceivedRegister.Clear(); session.SendMessage(_ignoreMessage); @@ -169,7 +172,7 @@ namespace Renci.SshNet.Tests.Classes { Thread.Sleep(100); - var session = (ISession) Session; + var session = (ISession)Session; ServerBytesReceivedRegister.Clear(); var actual = session.TrySendMessage(new IgnoreMessage()); @@ -185,7 +188,7 @@ namespace Renci.SshNet.Tests.Classes public void ISession_WaitOnHandleShouldThrowArgumentNullExceptionWhenWaitHandleIsNull() { const WaitHandle waitHandle = null; - var session = (ISession) Session; + var session = (ISession)Session; try { @@ -202,7 +205,7 @@ namespace Renci.SshNet.Tests.Classes [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)); @@ -213,7 +216,7 @@ namespace Renci.SshNet.Tests.Classes [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)); @@ -224,7 +227,7 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ISession_TryWait_WaitHandleAndTimeout_ShouldThrowArgumentNullExceptionWhenWaitHandleIsNull() { - var session = (ISession) Session; + var session = (ISession)Session; const WaitHandle waitHandle = null; try @@ -242,7 +245,7 @@ namespace Renci.SshNet.Tests.Classes [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); @@ -254,7 +257,7 @@ namespace Renci.SshNet.Tests.Classes [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); @@ -266,7 +269,7 @@ namespace Renci.SshNet.Tests.Classes [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 64df26b5..b507aac9 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectedBase.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectedBase.cs @@ -99,7 +99,7 @@ namespace Renci.SshNet.Tests.Classes _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); @@ -132,9 +132,9 @@ namespace Renci.SshNet.Tests.Classes }; ServerListener = new AsyncSocketListener(_serverEndPoint) - { - ShutdownRemoteCommunicationSocket = false - }; + { + ShutdownRemoteCommunicationSocket = false + }; ServerListener.Connected += socket => { ServerSocket = socket; @@ -212,30 +212,30 @@ namespace Renci.SshNet.Tests.Classes .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) diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ConnectionReset.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ConnectionReset.cs index 59f9d4aa..1b11e702 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 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ISession_SendMessageShouldThrowSshConnectionException() { - var session = (ISession) Session; + var session = (ISession)Session; try { @@ -126,7 +126,7 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ISession_TrySendMessageShouldReturnFalse() { - var session = (ISession) Session; + var session = (ISession)Session; var actual = session.TrySendMessage(new IgnoreMessage()); @@ -136,7 +136,7 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [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 444a8d51..462055e3 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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ISession_SendMessageShouldThrowSshConnectionException() { - var session = (ISession) Session; + var session = (ISession)Session; try { @@ -122,7 +122,7 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ISession_TrySendMessageShouldReturnFalse() { - var session = (ISession) Session; + var session = (ISession)Session; var actual = session.TrySendMessage(new IgnoreMessage()); @@ -132,7 +132,7 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [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_GlobalRequestMessageAfterAuthenticationRace.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_GlobalRequestMessageAfterAuthenticationRace.cs index a8ce5c96..64ea76d7 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 b0e71481..5bb6c151 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.Net.Sockets; 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 @@ namespace Renci.SshNet.Tests.Classes // 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); }; @@ -164,30 +166,30 @@ namespace Renci.SshNet.Tests.Classes .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); @@ -204,7 +206,7 @@ namespace Renci.SshNet.Tests.Classes } [TestMethod] - public void Act() + public void Act() { for (var i = 0; i < 50; i++) { diff --git a/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsBadPacket.cs b/test/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsBadPacket.cs index b7c49b8b..5dd53a29 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 @@ namespace Renci.SshNet.Tests.Classes { 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() @@ -72,7 +72,7 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ISession_SendMessageShouldThrowSshConnectionException() { - var session = (ISession) Session; + var session = (ISession)Session; try { @@ -146,7 +146,7 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ISession_TrySendMessageShouldReturnFalse() { - var session = (ISession) Session; + var session = (ISession)Session; var actual = session.TrySendMessage(new IgnoreMessage()); @@ -156,7 +156,7 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [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 440e5879..1ae6737d 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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ISession_SendMessageShouldThrowSshConnectionException() { - var session = (ISession) Session; + var session = (ISession)Session; try { @@ -143,7 +143,7 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ISession_TrySendMessageShouldReturnFalse() { - var session = (ISession) Session; + var session = (ISession)Session; var actual = session.TrySendMessage(new IgnoreMessage()); @@ -153,7 +153,7 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [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 0a040bbd..220c1bbe 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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ISession_SendMessageShouldThrowSshConnectionException() { - var session = (ISession) Session; + var session = (ISession)Session; try { @@ -147,7 +147,7 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ISession_TrySendMessageShouldReturnFalse() { - var session = (ISession) Session; + var session = (ISession)Session; var actual = session.TrySendMessage(new IgnoreMessage()); @@ -157,7 +157,7 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [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 b69f61df..b92d0acb 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 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ISession_WaitOnHandleShouldThrowSshExceptionDetailingError() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); try @@ -192,7 +192,7 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes 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 0e4e0a91..81eccac3 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 @@ namespace Renci.SshNet.Tests.Classes { 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); @@ -70,7 +70,7 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ISession_SendMessageShouldSucceed() { - var session = (ISession) Session; + var session = (ISession)Session; try { @@ -142,7 +142,7 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ISession_TrySendMessageShouldReturnTrue() { - var session = (ISession) Session; + var session = (ISession)Session; Assert.IsFalse(session.TrySendMessage(new IgnoreMessage())); } @@ -150,7 +150,7 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [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 a2abe735..d41f270a 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; @@ -62,7 +64,7 @@ namespace Renci.SshNet.Tests.Classes 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); @@ -108,7 +110,7 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ISession_MessageListenerCompletedShouldBeSignaled() { - var session = (ISession) Session; + var session = (ISession)Session; Assert.IsNotNull(session.MessageListenerCompleted); Assert.IsTrue(session.MessageListenerCompleted.WaitOne()); @@ -117,7 +119,7 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ISession_SendMessageShouldThrowSshConnectionException() { - var session = (ISession) Session; + var session = (ISession)Session; try { @@ -134,7 +136,7 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ISession_TrySendMessageShouldReturnFalse() { - var session = (ISession) Session; + var session = (ISession)Session; var actual = session.TrySendMessage(new IgnoreMessage()); @@ -144,7 +146,7 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ISession_WaitOnHandle_WaitHandle_ShouldThrowSshConnectionExceptionDetailingAbortedConnection() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); try @@ -162,7 +164,7 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ISession_WaitOnHandle_WaitHandleAndTimeout_ShouldThrowSshConnectionExceptionDetailingAbortedConnection() { - var session = (ISession) Session; + var session = (ISession)Session; var waitHandle = new ManualResetEvent(false); try @@ -180,7 +182,7 @@ namespace Renci.SshNet.Tests.Classes [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 +193,7 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ISession_TryWait_WaitHandleAndTimeout_ShouldThrowArgumentNullExceptionWhenWaitHandleIsNull() { - var session = (ISession) Session; + var session = (ISession)Session; const WaitHandle waitHandle = null; var timeout = TimeSpan.FromMinutes(5); @@ -210,7 +212,7 @@ namespace Renci.SshNet.Tests.Classes [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); @@ -222,7 +224,7 @@ namespace Renci.SshNet.Tests.Classes [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 f34634d7..05ce8875 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectingBase.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_ConnectingBase.cs @@ -232,13 +232,13 @@ namespace Renci.SshNet.Tests.Classes .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 @@ namespace Renci.SshNet.Tests.Classes .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 @@ namespace Renci.SshNet.Tests.Classes 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 c493b6df..d54f9f4a 100644 --- a/test/Renci.SshNet.Tests/Classes/SessionTest_NotConnected.cs +++ b/test/Renci.SshNet.Tests/Classes/SessionTest_NotConnected.cs @@ -122,7 +122,7 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [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 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ISession_SendMessageShouldThrowSshConnectionException() { - var session = (ISession) _session; + var session = (ISession)_session; try { @@ -179,7 +179,7 @@ namespace Renci.SshNet.Tests.Classes [TestMethod] public void ISession_TrySendMessageShouldReturnFalse() { - var session = (ISession) _session; + var session = (ISession)_session; var actual = session.TrySendMessage(new IgnoreMessage()); @@ -190,7 +190,7 @@ namespace Renci.SshNet.Tests.Classes public void ISession_WaitOnHandle_WaitHandle_ShouldThrowArgumentNullExceptionWhenWaitHandleIsNull() { const WaitHandle waitHandle = null; - var session = (ISession) _session; + var session = (ISession)_session; try { @@ -208,7 +208,7 @@ namespace Renci.SshNet.Tests.Classes public void ISession_WaitOnHandle_WaitHandleAndTimeout_ShouldThrowArgumentNullExceptionWhenWaitHandleIsNull() { const WaitHandle waitHandle = null; - var session = (ISession) _session; + var session = (ISession)_session; try { @@ -225,9 +225,9 @@ namespace Renci.SshNet.Tests.Classes 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 a077c774..5afe3bc0 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 @@ namespace Renci.SshNet.Tests.Classes { _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 bad627f2..817875dc 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; @@ -102,16 +104,16 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests 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); @@ -120,4 +122,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests 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 787f9904..ece3b3cd 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.Collections.Generic; 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; @@ -89,22 +91,22 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests 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); @@ -113,4 +115,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests 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 60cc1d03..a5ec0a3e 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.Collections.Generic; 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; @@ -94,21 +96,21 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests var sshDataStream = new SshDataStream(bytes); Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.Extended, sshDataStream.ReadByte()); + 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); @@ -117,4 +119,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests 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 89d315f3..4d778949 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.Collections.Generic; 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; @@ -108,16 +110,16 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests 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); @@ -126,4 +128,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests 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 22100993..8b30b77d 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; @@ -28,9 +30,9 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests _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] @@ -84,11 +86,11 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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)); @@ -99,4 +101,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 3959af33..09dddbeb 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; @@ -73,10 +75,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests var sshDataStream = new SshDataStream(bytes); Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32()); - Assert.AreEqual((byte) SftpMessageTypes.Close, sshDataStream.ReadByte()); + 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)); @@ -84,4 +86,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 a91797ed..01a9fc42 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; @@ -77,11 +79,11 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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)); @@ -93,4 +95,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 03cf64a9..987aa4e9 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; @@ -94,11 +96,11 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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)); @@ -106,4 +108,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 4f039b1f..baaaebf3 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 08313b05..fb8d526c 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.Collections.Generic; 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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); } @@ -100,11 +102,11 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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)); @@ -112,4 +114,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 eba2f249..9c62b411 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.Collections.Generic; 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; @@ -88,16 +90,16 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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)); @@ -107,4 +109,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 d8a3a9eb..a8d28bb6 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.Collections.Generic; 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests { 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); @@ -83,11 +85,11 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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)); @@ -99,4 +101,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 2ee19ad4..8ed3a8e3 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.Collections.Generic; 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; @@ -100,11 +102,11 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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)); @@ -112,4 +114,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 9a82ae8e..ea77982f 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.Collections.Generic; 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; @@ -122,16 +124,16 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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); @@ -140,4 +142,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 01b21ed1..3948b292 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; @@ -22,8 +24,8 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests { 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); } @@ -95,11 +97,11 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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)); @@ -107,4 +109,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 04dccf7b..d19ac530 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.Collections.Generic; 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests { 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,11 +114,11 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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)); @@ -125,4 +127,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests } } -} \ 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 6d4dc882..15765504 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; @@ -23,12 +25,12 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests { 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] @@ -116,11 +118,11 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 1ee8653c..423ff904 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.Collections.Generic; 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests { 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); @@ -128,11 +130,11 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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)); @@ -140,4 +142,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 b0910c56..6d9dc367 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.Collections.Generic; 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests { 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); @@ -78,11 +80,11 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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)); @@ -90,4 +92,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 0225e505..da95feb9 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.Collections.Generic; 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests { 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); @@ -85,16 +87,16 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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)); @@ -102,4 +104,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 f171a127..97a7964b 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRmDirRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRmDirRequestTest.cs @@ -82,11 +82,11 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 7c1bb454..4201391a 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.Collections.Generic; 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; @@ -88,11 +90,11 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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)); @@ -104,4 +106,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 8f6e9a31..a1b47c40 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.Collections.Generic; 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,7 +28,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests var random = new Random(); _protocolVersion = (uint)random.Next(0, int.MaxValue); - _requestId = (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); @@ -98,11 +100,11 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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)); @@ -110,4 +112,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 8b9a6e6c..b1774426 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.Collections.Generic; 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests { 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); @@ -103,16 +105,16 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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)); @@ -120,4 +122,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 aabd4d85..6e1ec406 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpUnblockRequestTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpUnblockRequestTest.cs @@ -29,8 +29,8 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests _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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 608ab78e..64feecee 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; @@ -25,11 +27,11 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests { 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); @@ -95,18 +97,18 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Requests 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 4ea37565..e64a6e93 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/Responses/ExtendedReplies/StatVfsReplyInfoTest.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/ExtendedReplies/StatVfsReplyInfoTest.cs @@ -28,8 +28,8 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Responses public void Init() { _random = new Random(); - _responseId = (uint) _random.Next(0, int.MaxValue); - _bsize = (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); @@ -63,7 +63,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Responses 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 08b4b00e..ed899651 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; @@ -17,7 +19,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Responses public void Init() { _random = new Random(); - _protocolVersion = (uint) _random.Next(0, int.MaxValue); + _protocolVersion = (uint)_random.Next(0, int.MaxValue); _responseId = (uint)_random.Next(0, int.MaxValue); } @@ -28,7 +30,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Responses 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 3f10fc3f..99431d64 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; @@ -19,8 +21,8 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Responses 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); } @@ -32,7 +34,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Responses 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); } @@ -43,7 +45,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Responses 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 ff5f9ac3..ee3f18c4 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Responses 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Responses 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,21 +51,21 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Responses [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 - }; + { + Position = 4 // skip 4 bytes for SSH packet length + }; sshDataStream.WriteByte((byte)SftpMessageTypes.Attrs); sshDataStream.Write(_responseId); sshDataStream.Write(bsize); @@ -77,7 +77,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Responses 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 8b83ed0f..a81dcbc5 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; @@ -19,8 +21,8 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Responses 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); } @@ -32,7 +34,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Responses 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); } @@ -43,7 +45,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp.Responses 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/Responses/SftpNameResponseTest.cs b/test/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpNameResponseTest.cs index 2265e3f5..3f5ca974 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 ca46720d..c9f2bcff 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 4cabe306..90be1646 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 71cfbb67..d3aac429 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpDataResponseBuilder.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpDataResponseBuilder.cs @@ -29,10 +29,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 439fc4c5..f3ba6d4c 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 0e952d33..eed1c71c 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 1f52d93d..7acd13fa 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 Moq; -using Renci.SshNet.Common; -using Renci.SshNet.Sftp; -using System; +using System; using System.Diagnostics; using System.Threading; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Moq; + +using Renci.SshNet.Common; +using Renci.SshNet.Sftp; + using BufferedRead = Renci.SshNet.Sftp.SftpFileReader.BufferedRead; namespace Renci.SshNet.Tests.Classes.Sftp @@ -80,7 +84,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 02ae3f41..2c42ee22 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 Moq; -using Renci.SshNet.Common; -using Renci.SshNet.Sftp; -using System; +using System; using System.Diagnostics; using System.Threading; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Moq; + +using Renci.SshNet.Common; +using Renci.SshNet.Sftp; + using BufferedRead = Renci.SshNet.Sftp.SftpFileReader.BufferedRead; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_PreviousChunkIsIncompleteAndEofIsNotReached.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_PreviousChunkIsIncompleteAndEofIsNotReached.cs index cedcff5c..b364f60d 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 Moq; -using Renci.SshNet.Common; -using Renci.SshNet.Sftp; -using System; +using System; using System.Diagnostics; using System.Threading; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Moq; + +using Renci.SshNet.Common; +using Renci.SshNet.Sftp; + using BufferedRead = Renci.SshNet.Sftp.SftpFileReader.BufferedRead; namespace Renci.SshNet.Tests.Classes.Sftp @@ -112,7 +116,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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); @@ -127,7 +131,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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); @@ -142,7 +146,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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); @@ -157,7 +161,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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); @@ -179,7 +183,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 5d2ed04f..5d1f6912 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 Moq; -using Renci.SshNet.Common; -using Renci.SshNet.Sftp; -using System; +using System; using System.Diagnostics; using System.Threading; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Moq; + +using Renci.SshNet.Common; +using Renci.SshNet.Sftp; + using BufferedRead = Renci.SshNet.Sftp.SftpFileReader.BufferedRead; namespace Renci.SshNet.Tests.Classes.Sftp @@ -77,7 +81,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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); @@ -92,7 +96,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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); @@ -107,7 +111,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 e99a582d..6026e94d 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 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 06f2c543..881b5229 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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_Read_ReadAheadExceptionInBeginRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileReaderTest_Read_ReadAheadExceptionInBeginRead.cs index a35803e6..c7022a54 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 Moq; -using Renci.SshNet.Common; -using Renci.SshNet.Sftp; -using System; +using System; using System.Diagnostics; using System.Threading; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Moq; + +using Renci.SshNet.Common; +using Renci.SshNet.Sftp; + using BufferedRead = Renci.SshNet.Sftp.SftpFileReader.BufferedRead; namespace Renci.SshNet.Tests.Classes.Sftp 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 fd9d601c..45ceb707 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 Moq; -using Renci.SshNet.Common; -using Renci.SshNet.Sftp; -using System; +using System; using System.Diagnostics; using System.Threading; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Moq; + +using Renci.SshNet.Common; +using Renci.SshNet.Sftp; + using BufferedRead = Renci.SshNet.Sftp.SftpFileReader.BufferedRead; namespace Renci.SshNet.Tests.Classes.Sftp 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 12991fb4..3456a5f9 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 Moq; -using Renci.SshNet.Common; -using Renci.SshNet.Sftp; -using System; +using System; using System.Diagnostics; using System.Threading; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Moq; + +using Renci.SshNet.Common; +using Renci.SshNet.Sftp; + using BufferedRead = Renci.SshNet.Sftp.SftpFileReader.BufferedRead; namespace Renci.SshNet.Tests.Classes.Sftp diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamAsyncTestBase.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamAsyncTestBase.cs index 110a20be..950b69ec 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 19497c6d..7fe0b342 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 87ff5fbe..3209d5ee 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 @@ -24,9 +27,9 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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() @@ -55,7 +58,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 2ae877f3..335233d3 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 @@ -24,9 +27,9 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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() @@ -55,7 +58,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 e82b347a..4a84eaf8 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 @@ -24,9 +27,9 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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() @@ -55,7 +58,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 a1ab8bec..2be256a3 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 @@ -24,9 +27,9 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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() @@ -55,7 +58,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 97d7df8f..aa618feb 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 @@ -24,9 +27,9 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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() @@ -55,7 +58,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 d6b4856e..506c4214 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 @@ -24,9 +27,9 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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() @@ -55,7 +58,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 0105a780..519e7a52 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 @@ -24,9 +27,9 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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() @@ -55,7 +58,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 9dffd925..730f9542 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 @@ -24,9 +27,9 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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() @@ -55,7 +58,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 c51af38d..a187b0d0 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 @@ -24,9 +27,9 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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() @@ -55,7 +58,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 8c0f4e14..669a20a5 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 @@ -24,9 +27,9 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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() @@ -55,7 +58,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 b669811d..0c3ceb80 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 @@ -24,15 +27,15 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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() { 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)) @@ -55,7 +58,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 58238385..b1bc4e48 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 @@ -24,9 +27,9 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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() @@ -55,7 +58,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _path, FileMode.Open, FileAccess.Write, - (int) _bufferSize); + (int)_bufferSize); _target.Dispose(); } 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 ee7d6548..7625e284 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 @@ -23,9 +26,9 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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() @@ -54,7 +57,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 2d4c6e42..48fc7547 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 @@ -23,9 +26,9 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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() @@ -52,7 +55,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 ce7a09a2..911f1d11 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize); + (int)_bufferSize); } protected override void Act() 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 29e36fbf..bc1c9e73 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 e366914c..cac46a88 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 d4b311ff..de5e72e4 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 25171b9f..63ee0a1a 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; @@ -31,15 +34,15 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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(); } @@ -49,10 +52,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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)) @@ -159,7 +162,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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); 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 c8e46a2b..93721ba5 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; @@ -41,10 +44,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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 541fb21e..6d6483f0 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 @@ -29,8 +32,8 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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); } @@ -40,10 +43,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeCreate_FileAccessRead.cs index c70b3239..fdc0e9a2 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp { 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 73052060..c226dfd9 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; @@ -39,15 +42,15 @@ namespace Renci.SshNet.Tests.Classes.Sftp { _ = 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 235d6d9e..4c39283e 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; @@ -41,10 +44,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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 846cbe7e..ff42941f 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 @@ -38,15 +41,15 @@ namespace Renci.SshNet.Tests.Classes.Sftp { 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 3fa061f0..d4206069 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 @@ -29,8 +32,8 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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); } @@ -40,10 +43,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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_FileModeInvalid.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeInvalid.cs index ee82ec00..c2606ff0 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 2f186a41..b845c6b4 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; @@ -29,8 +32,8 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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 834ef790..d99593d5 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; @@ -41,10 +44,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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 5c30c376..4f14a727 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 @@ -29,8 +32,8 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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); } @@ -40,10 +43,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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 65232baf..f80dcc74 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; @@ -40,10 +43,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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 63757f08..f56d6452 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; @@ -30,8 +33,8 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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); } @@ -41,10 +44,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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 f48093ac..84bfae7b 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 @@ -29,8 +32,8 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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); } @@ -40,10 +43,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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_FileAccessRead.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeTruncate_FileAccessRead.cs index 9e520a59..dadd6f61 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_FileAccessReadWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Ctor_FileModeTruncate_FileAccessReadWrite.cs index 59e669c5..4a7445b9 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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 8638b26f..36f265cd 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 @@ -29,8 +32,8 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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); } @@ -40,10 +43,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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 b194338f..4abdfbe7 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 31b3e096..d4aef332 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 @@ -23,9 +26,9 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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() @@ -51,7 +54,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 27858090..d1e967f2 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 09fec553..2d4ca476 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 1d55e17f..c0d3be89 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 @@ -24,9 +27,9 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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() @@ -84,7 +87,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 9795c514..c6ce946c 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 } 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 d873f320..6f2d12dc 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 { @@ -32,7 +35,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 } @@ -105,7 +108,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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); 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 5388971e..8463a313 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize); + (int)_bufferSize); _ = _target.Read(_readBytes, 0, _readBytes.Length); } @@ -101,7 +101,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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); 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 6aea777a..a8de0642 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_SessionNotOpen.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_Flush_SessionNotOpen.cs @@ -1,9 +1,12 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Moq; -using Renci.SshNet.Sftp; -using System; +using System; using System.IO; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Moq; + +using Renci.SshNet.Sftp; + namespace Renci.SshNet.Tests.Classes.Sftp { [TestClass] @@ -24,7 +27,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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; } @@ -53,7 +56,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 2bf5c2c6..e2c381cd 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 @@ -74,7 +74,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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); @@ -137,7 +137,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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); 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 32d0b833..27ed3abc 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 { @@ -68,7 +71,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _path, FileMode.Open, FileAccess.ReadWrite, - (int) _bufferSize); + (int)_bufferSize); _target.Write(_writeBytes, 0, _writeBytes.Length); } @@ -102,7 +105,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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); @@ -110,7 +113,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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_FileAccessInvalid.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileAccessInvalid.cs index 4febea07..3a1ea7cb 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 242755a0..c922ab67 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 776cec41..5360ec63 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 14cce04e..3e86b59f 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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(); } 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 c1b271dd..30d00439 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; @@ -44,10 +47,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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 98ba5c91..82eaf045 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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 100f08ac..0fd6b8d6 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 @@ -47,10 +47,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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 e2d5d061..3a773ac6 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; @@ -44,10 +47,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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 aa29b739..9602f8b8 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 @@ -43,10 +46,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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); } @@ -131,4 +134,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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_FileModeCreate_FileAccessWrite_FileExists.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeCreate_FileAccessWrite_FileExists.cs index ceb38763..605aad7a 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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_FileModeInvalid.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_OpenAsync_FileModeInvalid.cs index 075967ac..bdafe81c 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 15a40915..a015281e 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; @@ -32,8 +35,8 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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(); } @@ -44,10 +47,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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); } @@ -136,4 +139,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 5803444e..486b16ee 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 @@ -47,10 +47,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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 0b69f581..b6d67957 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 @@ -31,8 +34,8 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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(); } @@ -43,10 +46,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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 76387888..b45a78df 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; @@ -44,10 +47,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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 7a653cb2..331b0e61 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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 db61a2a6..202f6fcd 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 @@ -31,8 +34,8 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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(); } @@ -43,10 +46,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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 ecde0214..f5e78c0c 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; @@ -32,8 +35,8 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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(); } @@ -44,10 +47,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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 0c06eba6..8539e21b 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 @@ -31,8 +34,8 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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(); } @@ -43,10 +46,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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); } @@ -131,4 +134,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 ef8dbebe..dbc891cb 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; @@ -36,11 +39,11 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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); @@ -154,4 +157,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 9d07681a..af24ecad 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; @@ -36,11 +39,11 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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); @@ -117,7 +120,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp { 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(); 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 83ae8d42..183f66e3 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,11 +1,14 @@ using System; using System.IO; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using Moq; -using Renci.SshNet.Sftp; -using Renci.SshNet.Common; using System.Threading.Tasks; +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Moq; + +using Renci.SshNet.Common; +using Renci.SshNet.Sftp; + namespace Renci.SshNet.Tests.Classes.Sftp { [TestClass] @@ -30,7 +33,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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; 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 d3bd505a..50d56a5a 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 @@ -24,9 +27,9 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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() 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 442c7d3d..d48cac25 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 @@ -28,10 +31,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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() 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 3932c28a..8ae2138a 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; @@ -35,11 +38,11 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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); 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 794f6c7b..c8a57a40 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; @@ -35,11 +38,11 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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); @@ -115,7 +118,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp { 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(); 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 1f6f2cf5..258975ad 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 { @@ -29,7 +32,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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; @@ -73,7 +76,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _path, FileMode.Open, FileAccess.Read, - (int) _bufferSize); + (int)_bufferSize); } protected override void Act() 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 712880d8..1a94e717 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 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 8bf534ee..5be4026f 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 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 27e8d96f..3370a44d 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 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 e47e716e..0c6bdfd3 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 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 506342f1..c7e2cf46 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 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 4791acf8..c171bb52 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 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 87a7df9a..df5c0c9e 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 @@ -32,7 +35,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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); 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 3e4702e1..08411eae 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; @@ -34,11 +37,11 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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() @@ -47,10 +50,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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 5e8cf08c..e8758678 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 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 59a0135f..211a8670 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 @@ -42,12 +45,12 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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") @@ -55,7 +58,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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(); @@ -103,7 +106,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 } @@ -148,16 +151,16 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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}); + .Returns(new byte[] { 0x0f }); var byteRead = _sftpFileStream.ReadByte(); 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)); @@ -172,7 +175,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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, @@ -191,7 +194,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 0709896d..82b66fd8 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 Microsoft.VisualStudio.TestTools.UnitTesting; -using Moq; -using Renci.SshNet.Sftp; -using Renci.SshNet.Tests.Common; using System.Threading; -using Renci.SshNet.Sftp.Responses; + +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; namespace Renci.SshNet.Tests.Classes.Sftp { @@ -136,14 +139,14 @@ namespace Renci.SshNet.Tests.Classes.Sftp { 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)); } @@ -155,7 +158,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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); 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 c71b43c8..feac868b 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 Microsoft.VisualStudio.TestTools.UnitTesting; -using Moq; -using Renci.SshNet.Sftp; -using Renci.SshNet.Tests.Common; using System.Threading; -using Renci.SshNet.Sftp.Responses; + +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; namespace Renci.SshNet.Tests.Classes.Sftp { @@ -42,9 +45,9 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 }; @@ -89,7 +92,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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) => { @@ -159,14 +162,14 @@ namespace Renci.SshNet.Tests.Classes.Sftp { 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)); } @@ -178,7 +181,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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); @@ -190,7 +193,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 42a3ce84..4bbe24da 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 Microsoft.VisualStudio.TestTools.UnitTesting; -using Moq; -using Renci.SshNet.Sftp; -using Renci.SshNet.Tests.Common; using System.Threading; -using Renci.SshNet.Sftp.Responses; + +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; namespace Renci.SshNet.Tests.Classes.Sftp { @@ -42,9 +45,9 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 }; @@ -56,7 +59,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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(); @@ -89,7 +92,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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) => { @@ -108,7 +111,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp { 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); } @@ -159,7 +162,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp { 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(); @@ -178,7 +181,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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); @@ -190,7 +193,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 22db2ac4..8b588b1e 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,10 +32,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp { 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); 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 b4712c71..626509ea 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 @@ -25,9 +28,9 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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; } @@ -53,7 +56,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 9ed80464..993c15b6 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 @@ -25,9 +28,9 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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; } @@ -53,7 +56,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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 a4a96eea..0e65bf45 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,10 +45,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp { 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()); @@ -53,7 +56,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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_SetLength_SessionOpen_FileAccessWrite.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_SetLength_SessionOpen_FileAccessWrite.cs index 1ac2be5f..ec896d27 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,10 +45,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp { 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()); @@ -85,7 +88,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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 8fb74b43..8da36ddc 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 @@ -39,8 +39,8 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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); + _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,7 +48,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp // 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); @@ -97,7 +97,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp { 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() 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 229714c3..0bb71019 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; @@ -35,8 +38,8 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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); + _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); @@ -44,7 +47,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp // 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); @@ -93,7 +96,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp _path, FileMode.Create, FileAccess.Write, - (int) _bufferSize); + (int)_bufferSize); } protected override void Act() diff --git a/test/Renci.SshNet.Tests/Classes/Sftp/SftpHandleResponseBuilder.cs b/test/Renci.SshNet.Tests/Classes/Sftp/SftpHandleResponseBuilder.cs index d9f67f61..5e425e94 100644 --- a/test/Renci.SshNet.Tests/Classes/Sftp/SftpHandleResponseBuilder.cs +++ b/test/Renci.SshNet.Tests/Classes/Sftp/SftpHandleResponseBuilder.cs @@ -29,10 +29,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 268f1c5c..246fd6c9 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 2dc995c0..9186ee99 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 536e07e2..4676bd69 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 49f50ff2..fea017d0 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 @@ -52,7 +55,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp #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) @@ -75,9 +78,9 @@ namespace Renci.SshNet.Tests.Classes.Sftp #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) @@ -160,4 +163,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 2d5e0077..85243dfd 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp #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) @@ -138,8 +138,8 @@ namespace Renci.SshNet.Tests.Classes.Sftp .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 @@ namespace Renci.SshNet.Tests.Classes.Sftp { 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 2b4f14e1..eda2fc79 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 { @@ -78,8 +81,8 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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) @@ -159,10 +162,10 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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)); } @@ -197,4 +200,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 ab5a646b..77b0c42e 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 { @@ -78,8 +81,8 @@ namespace Renci.SshNet.Tests.Classes.Sftp _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) @@ -157,7 +160,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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(() => @@ -169,7 +172,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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)); } @@ -204,4 +207,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 4c55d66f..46dca30a 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 { @@ -50,7 +53,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp #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) @@ -73,8 +76,8 @@ namespace Renci.SshNet.Tests.Classes.Sftp #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) @@ -114,7 +117,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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)) @@ -124,7 +127,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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() @@ -137,7 +140,7 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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)); } @@ -162,4 +165,4 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 d52b208a..a5bd0c4c 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp _extendedAction = extendedAction; return this; } - + public SftpStatVfsRequestBuilder WithStatusAction(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 1e4d55ef..f69af49b 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 @@ namespace Renci.SshNet.Tests.Classes.Sftp 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 db03567b..499fc304 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 88ab436d..170ac63b 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 d25fb37f..c7d02323 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 d3a615d4..b287ed6d 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 @@ namespace Renci.SshNet.Tests.Classes } } } -} \ 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 9d846437..520023df 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 @@ namespace Renci.SshNet.Tests.Classes } } } -} \ 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 f44016ec..c49fa024 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 c800452e..858eadc4 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 37915174..8e8ecd3a 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 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes 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 @@ namespace Renci.SshNet.Tests.Classes 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 e0ca2c91..6a739dd9 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_Dispose_Connected.cs b/test/Renci.SshNet.Tests/Classes/SftpClientTest_Dispose_Connected.cs index fe8ef9f6..ccbe418f 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 @@ namespace Renci.SshNet.Tests.Classes _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 0f8d0a46..693a9aa8 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 @@ namespace Renci.SshNet.Tests.Classes _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 09208b8b..473c29c0 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 @@ namespace Renci.SshNet.Tests.Classes _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 f98f6dad..d096bba0 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 @@ namespace Renci.SshNet.Tests.Classes _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 bc7f10d6..813300fc 100644 --- a/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs +++ b/test/Renci.SshNet.Tests/Classes/ShellStreamTest.cs @@ -3,8 +3,11 @@ using System.Collections.Generic; 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; @@ -35,8 +38,8 @@ namespace Renci.SshNet.Tests.Classes var random = new Random(); _terminalName = random.Next().ToString(CultureInfo.InvariantCulture); - _widthColumns = (uint) random.Next(); - _heightRows = (uint) random.Next(); + _widthColumns = (uint)random.Next(); + _heightRows = (uint)random.Next(); _widthPixels = (uint)random.Next(); _heightPixels = (uint)random.Next(); _terminalModes = new Dictionary(); @@ -95,7 +98,7 @@ namespace Renci.SshNet.Tests.Classes 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 0668177d..54e97d59 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; @@ -41,10 +44,10 @@ namespace Renci.SshNet.Tests.Classes 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 64f95687..d52e55c0 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; diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteNumberOfBytesEqualToBufferSize.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferEmptyAndWriteNumberOfBytesEqualToBufferSize.cs index d3d38003..20968486 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; diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteLessBytesThanBufferSize.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteLessBytesThanBufferSize.cs index 40b09535..680c4140 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; diff --git a/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteZeroBytes.cs b/test/Renci.SshNet.Tests/Classes/ShellStreamTest_Write_WriteBufferFullAndWriteZeroBytes.cs index b58c0e97..194af3c6 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; @@ -42,10 +45,10 @@ namespace Renci.SshNet.Tests.Classes 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 99ed903e..ac8c3847 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; @@ -42,10 +45,10 @@ namespace Renci.SshNet.Tests.Classes 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 de57d051..f0622ccf 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; @@ -44,10 +47,10 @@ namespace Renci.SshNet.Tests.Classes 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 c1c7d39e..bc094dc5 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; diff --git a/test/Renci.SshNet.Tests/Classes/SshClientTest.cs b/test/Renci.SshNet.Tests/Classes/SshClientTest.cs index e0012d7b..06344282 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 4dc5a206..a6571651 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; @@ -29,10 +32,10 @@ namespace Renci.SshNet.Tests.Classes _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); @@ -133,4 +136,4 @@ namespace Renci.SshNet.Tests.Classes 1); } } -} \ No newline at end of file +} diff --git a/test/Renci.SshNet.Tests/Classes/SshClientTest_Disconnect_ForwardedPortStarted.cs b/test/Renci.SshNet.Tests/Classes/SshClientTest_Disconnect_ForwardedPortStarted.cs index 23451264..3f437fa0 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 fd10b893..8a96ed49 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 bae18feb..ff475de9 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 c4dcf868..47b7d007 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 213e11ef..e7badbf3 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 @@ namespace Renci.SshNet.Tests.Classes { 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 13419a0d..a2b6c356 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 7f6be4a2..eff6e30a 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 2d259c01..f968eb00 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 c51f8499..61f67130 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 ac7d0f6f..51d4de49 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 500a7169..9029c3e4 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 0001a918..417219ae 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; @@ -69,7 +72,7 @@ namespace Renci.SshNet.Tests.Classes _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() @@ -99,7 +102,7 @@ namespace Renci.SshNet.Tests.Classes } 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 a8fcb4dd..238b277a 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 2d90ce74..5f538bc3 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 @@ namespace Renci.SshNet.Tests.Classes 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 c3639a40..3df4c98c 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 f8187a90..54adb93d 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; diff --git a/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Disposed.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelDataReceived_Disposed.cs index 33dfac88..e34294f9 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; 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 43b9bbe3..bd083f51 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 @@ namespace Renci.SshNet.Tests.Classes private IList _errorOccurredRegister; private ChannelDataEventArgs _channelDataEventArgs; private Exception _onDataReceivedException; - + [TestInitialize] public void Setup() { @@ -37,8 +40,8 @@ namespace Renci.SshNet.Tests.Classes _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_OnChannelException_Connected.cs b/test/Renci.SshNet.Tests/Classes/SubsystemSession_OnChannelException_Connected.cs index e283c322..5ab10b05 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 9f6f054e..19df7854 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 @@ namespace Renci.SshNet.Tests.Classes 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 177bbff3..cd555b47 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 @@ namespace Renci.SshNet.Tests.Classes 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 32151eb9..ebb5b859 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 df18c042..6a7f4566 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 11a455c7..72b95ef8 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 @@ namespace Renci.SshNet.Tests.Classes _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 b8ebc7fa..121545be 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 3dd9f5cc..93af67cb 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 @@ namespace Renci.SshNet.Tests.Classes _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 5caee457..86f5d924 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 @@ namespace Renci.SshNet.Tests.Common 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 733d7e51..e162c9ef 100644 --- a/test/Renci.SshNet.Tests/Common/AsyncSocketListener.cs +++ b/test/Renci.SshNet.Tests/Common/AsyncSocketListener.cs @@ -187,7 +187,7 @@ namespace Renci.SshNet.Tests.Common 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) { diff --git a/test/Renci.SshNet.Tests/Common/DictionaryAssert.cs b/test/Renci.SshNet.Tests/Common/DictionaryAssert.cs index ec45fb61..6ebc8982 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 2c2e04be..5f8b1e31 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 92521316..ca14b16c 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 fb3768f2..66fe5c8e 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]