Sfoglia il codice sorgente

continued line endings struggle ...

continued line endings struggle ...
drieseng 9 anni fa
parent
commit
451ffb9825
100 ha cambiato i file con 10062 aggiunte e 10062 eliminazioni
  1. 105 105
      src/Renci.SshNet.Tests/Classes/PrivateKeyAuthenticationMethodTest.cs
  2. 216 216
      src/Renci.SshNet.Tests/Classes/PrivateKeyConnectionInfoTest.cs
  3. 503 503
      src/Renci.SshNet.Tests/Classes/PrivateKeyFileTest.cs
  4. 34 34
      src/Renci.SshNet.Tests/Classes/Security/AlgorithmTest.cs
  5. 74 74
      src/Renci.SshNet.Tests/Classes/Security/CertificateHostAlgorithmTest.cs
  6. 77 77
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/BlockCipherTest.cs
  7. 54 54
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/CipherDigitalSignatureTest.cs
  8. 53 53
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/CipherTest.cs
  9. 238 238
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/AesCipherTest.cs
  10. 176 176
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Arc4CipherTest.cs
  11. 107 107
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/BlowfishCipherTest.cs
  12. 105 105
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/CastCipherTest.cs
  13. 61 61
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/CipherModeTest.cs
  14. 38 38
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/CipherPaddingTest.cs
  15. 72 72
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/DesCipherTest.cs
  16. 67 67
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Modes/CbcCipherModeTest.cs
  17. 68 68
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Modes/CfbCipherModeTest.cs
  18. 68 68
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Modes/CtrCipherModeTest.cs
  19. 68 68
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Modes/OfbCipherModeTest.cs
  20. 41 41
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Paddings/PKCS5PaddingTest.cs
  21. 41 41
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Paddings/PKCS7PaddingTest.cs
  22. 59 59
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/RsaCipherTest.cs
  23. 72 72
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/SerpentCipherTest.cs
  24. 105 105
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/TripleDesCipherTest.cs
  25. 72 72
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/TwofishCipherTest.cs
  26. 54 54
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/DigitalSignatureTest.cs
  27. 73 73
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/DsaDigitalSignatureTest.cs
  28. 151 151
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/DsaKeyTest.cs
  29. 135 135
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/HMacTest.cs
  30. 39 39
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/RsaDigitalSignatureTest.cs
  31. 12 12
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/RsaKeyTest.cs
  32. 62 62
      src/Renci.SshNet.Tests/Classes/Security/Cryptography/SymmetricCipherTest.cs
  33. 67 67
      src/Renci.SshNet.Tests/Classes/Security/HostAlgorithmTest.cs
  34. 12 12
      src/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanGroup14Sha1Test.cs
  35. 49 49
      src/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanGroup1Sha1Test.cs
  36. 12 12
      src/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanGroupExchangeSha1Test.cs
  37. 63 63
      src/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanGroupExchangeSha256Test.cs
  38. 62 62
      src/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanGroupSha1Test.cs
  39. 36 36
      src/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanTest.cs
  40. 16 16
      src/Renci.SshNet.Tests/Classes/Security/KeyExchangeTest.cs
  41. 122 122
      src/Renci.SshNet.Tests/Classes/Security/KeyHostAlgorithmTest.cs
  42. 84 84
      src/Renci.SshNet.Tests/Classes/Security/KeyTest.cs
  43. 263 263
      src/Renci.SshNet.Tests/Classes/SessionTest.HttpProxy.cs
  44. 362 362
      src/Renci.SshNet.Tests/Classes/SessionTest.cs
  45. 169 169
      src/Renci.SshNet.Tests/Classes/SessionTest_Connected.cs
  46. 192 192
      src/Renci.SshNet.Tests/Classes/SessionTest_ConnectedBase.cs
  47. 168 168
      src/Renci.SshNet.Tests/Classes/SessionTest_Connected_ConnectionReset.cs
  48. 148 148
      src/Renci.SshNet.Tests/Classes/SessionTest_Connected_Disconnect.cs
  49. 164 164
      src/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsBadPacket.cs
  50. 168 168
      src/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsDisconnectMessage.cs
  51. 172 172
      src/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsDisconnectMessageAndShutsDownSocket.cs
  52. 161 161
      src/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSocket.cs
  53. 191 191
      src/Renci.SshNet.Tests/Classes/SessionTest_NotConnected.cs
  54. 95 95
      src/Renci.SshNet.Tests/Classes/SessionTest_SocketConnected_BadPacketAndDispose.cs
  55. 122 122
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/FStatVfsRequestTest.cs
  56. 115 115
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/HardLinkRequestTest.cs
  57. 119 119
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/PosixRenameRequestTest.cs
  58. 128 128
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/StatVfsRequestTest.cs
  59. 101 101
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpBlockRequestTest.cs
  60. 86 86
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpCloseRequestTest.cs
  61. 95 95
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFSetStatRequestTest.cs
  62. 108 108
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFStatRequestTest.cs
  63. 9 9
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpInitRequestTest.cs
  64. 114 114
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLStatRequestTest.cs
  65. 109 109
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLinkRequestTest.cs
  66. 101 101
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpMkDirRequestTest.cs
  67. 142 142
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenRequestTest.cs
  68. 109 109
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadDirRequestTest.cs
  69. 127 127
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadLinkRequestTest.cs
  70. 134 134
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadRequestTest.cs
  71. 142 142
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRealPathRequestTest.cs
  72. 92 92
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRemoveRequestTest.cs
  73. 104 104
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRenameRequestTest.cs
  74. 95 95
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRmDirRequestTest.cs
  75. 106 106
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSetStatRequestTest.cs
  76. 112 112
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpStatRequestTest.cs
  77. 122 122
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSymLinkRequestTest.cs
  78. 96 96
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpUnblockRequestTest.cs
  79. 112 112
      src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpWriteRequestTest.cs
  80. 89 89
      src/Renci.SshNet.Tests/Classes/Sftp/Responses/ExtendedReplies/StatVfsReplyInfoTest.cs
  81. 73 73
      src/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpAttrsResponseTest.cs
  82. 60 60
      src/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpDataResponseTest.cs
  83. 102 102
      src/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpExtendedReplyResponseTest.cs
  84. 60 60
      src/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpHandleResponseTest.cs
  85. 9 9
      src/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpNameResponseTest.cs
  86. 9 9
      src/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpStatusResponseTest.cs
  87. 9 9
      src/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpVersionResponseTest.cs
  88. 27 27
      src/Renci.SshNet.Tests/Classes/Sftp/SftpDownloadAsyncResultTest.cs
  89. 237 237
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileAttributesTest.cs
  90. 74 74
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessRead.cs
  91. 74 74
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessReadWrite.cs
  92. 74 74
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessWrite.cs
  93. 74 74
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessRead.cs
  94. 74 74
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessReadWrite.cs
  95. 74 74
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessWrite.cs
  96. 73 73
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_SessionOpen_FileAccessRead.cs
  97. 73 73
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_SessionOpen_FileAccessReadWrite.cs
  98. 73 73
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_SessionOpen_FileAccessWrite.cs
  99. 74 74
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessRead.cs
  100. 74 74
      src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessReadWrite.cs

+ 105 - 105
src/Renci.SshNet.Tests/Classes/PrivateKeyAuthenticationMethodTest.cs

@@ -1,106 +1,106 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Tests.Common;
-using System;
-
-namespace Renci.SshNet.Tests.Classes
-{
-    /// <summary>
-    /// Provides functionality to perform private key authentication.
-    /// </summary>
-    [TestClass]
-    public class PrivateKeyAuthenticationMethodTest : TestBase
-    {
-        [TestMethod]
-        [TestCategory("AuthenticationMethod")]
-        [TestCategory("PrivateKeyAuthenticationMethod")]
-        [Owner("Kenneth_aa")]
-        [Description("PrivateKeyAuthenticationMethod: Pass null as username, null as password.")]
-        [ExpectedException(typeof(ArgumentException))]
-        public void PrivateKey_Test_Pass_Null()
-        {
-            new PrivateKeyAuthenticationMethod(null, null);
-        }
-
-        [TestMethod]
-        [TestCategory("AuthenticationMethod")]
-        [TestCategory("PrivateKeyAuthenticationMethod")]
-        [Owner("olegkap")]
-        [Description("PrivateKeyAuthenticationMethod: Pass valid username, null as password.")]
-        [ExpectedException(typeof(ArgumentNullException))]
-        public void PrivateKey_Test_Pass_PrivateKey_Null()
-        {
-            new PrivateKeyAuthenticationMethod("username", null);
-        }
-
-        [TestMethod]
-        [TestCategory("AuthenticationMethod")]
-        [TestCategory("PrivateKeyAuthenticationMethod")]
-        [Owner("Kenneth_aa")]
-        [Description("PrivateKeyAuthenticationMethod: Pass String.Empty as username, null as password.")]
-        [ExpectedException(typeof(ArgumentException))]
-        public void PrivateKey_Test_Pass_Whitespace()
-        {
-            new PrivateKeyAuthenticationMethod(string.Empty, null);
-        }
-
-        /// <summary>
-        ///A test for Name
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void NameTest()
-        {
-            string username = string.Empty; // TODO: Initialize to an appropriate value
-            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
-            PrivateKeyAuthenticationMethod target = new PrivateKeyAuthenticationMethod(username, keyFiles); // TODO: Initialize to an appropriate value
-            string actual;
-            actual = target.Name;
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for Dispose
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DisposeTest()
-        {
-            string username = string.Empty; // TODO: Initialize to an appropriate value
-            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
-            PrivateKeyAuthenticationMethod target = new PrivateKeyAuthenticationMethod(username, keyFiles); // TODO: Initialize to an appropriate value
-            target.Dispose();
-            Assert.Inconclusive("A method that does not return a value cannot be verified.");
-        }
-
-        /// <summary>
-        ///A test for Authenticate
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void AuthenticateTest()
-        {
-            string username = string.Empty; // TODO: Initialize to an appropriate value
-            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
-            PrivateKeyAuthenticationMethod target = new PrivateKeyAuthenticationMethod(username, keyFiles); // TODO: Initialize to an appropriate value
-            Session session = null; // TODO: Initialize to an appropriate value
-            AuthenticationResult expected = new AuthenticationResult(); // TODO: Initialize to an appropriate value
-            AuthenticationResult actual;
-            actual = target.Authenticate(session);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for PrivateKeyAuthenticationMethod Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void PrivateKeyAuthenticationMethodConstructorTest()
-        {
-            string username = string.Empty; // TODO: Initialize to an appropriate value
-            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
-            PrivateKeyAuthenticationMethod target = new PrivateKeyAuthenticationMethod(username, keyFiles);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Tests.Common;
+using System;
+
+namespace Renci.SshNet.Tests.Classes
+{
+    /// <summary>
+    /// Provides functionality to perform private key authentication.
+    /// </summary>
+    [TestClass]
+    public class PrivateKeyAuthenticationMethodTest : TestBase
+    {
+        [TestMethod]
+        [TestCategory("AuthenticationMethod")]
+        [TestCategory("PrivateKeyAuthenticationMethod")]
+        [Owner("Kenneth_aa")]
+        [Description("PrivateKeyAuthenticationMethod: Pass null as username, null as password.")]
+        [ExpectedException(typeof(ArgumentException))]
+        public void PrivateKey_Test_Pass_Null()
+        {
+            new PrivateKeyAuthenticationMethod(null, null);
+        }
+
+        [TestMethod]
+        [TestCategory("AuthenticationMethod")]
+        [TestCategory("PrivateKeyAuthenticationMethod")]
+        [Owner("olegkap")]
+        [Description("PrivateKeyAuthenticationMethod: Pass valid username, null as password.")]
+        [ExpectedException(typeof(ArgumentNullException))]
+        public void PrivateKey_Test_Pass_PrivateKey_Null()
+        {
+            new PrivateKeyAuthenticationMethod("username", null);
+        }
+
+        [TestMethod]
+        [TestCategory("AuthenticationMethod")]
+        [TestCategory("PrivateKeyAuthenticationMethod")]
+        [Owner("Kenneth_aa")]
+        [Description("PrivateKeyAuthenticationMethod: Pass String.Empty as username, null as password.")]
+        [ExpectedException(typeof(ArgumentException))]
+        public void PrivateKey_Test_Pass_Whitespace()
+        {
+            new PrivateKeyAuthenticationMethod(string.Empty, null);
+        }
+
+        /// <summary>
+        ///A test for Name
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void NameTest()
+        {
+            string username = string.Empty; // TODO: Initialize to an appropriate value
+            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
+            PrivateKeyAuthenticationMethod target = new PrivateKeyAuthenticationMethod(username, keyFiles); // TODO: Initialize to an appropriate value
+            string actual;
+            actual = target.Name;
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for Dispose
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DisposeTest()
+        {
+            string username = string.Empty; // TODO: Initialize to an appropriate value
+            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
+            PrivateKeyAuthenticationMethod target = new PrivateKeyAuthenticationMethod(username, keyFiles); // TODO: Initialize to an appropriate value
+            target.Dispose();
+            Assert.Inconclusive("A method that does not return a value cannot be verified.");
+        }
+
+        /// <summary>
+        ///A test for Authenticate
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void AuthenticateTest()
+        {
+            string username = string.Empty; // TODO: Initialize to an appropriate value
+            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
+            PrivateKeyAuthenticationMethod target = new PrivateKeyAuthenticationMethod(username, keyFiles); // TODO: Initialize to an appropriate value
+            Session session = null; // TODO: Initialize to an appropriate value
+            AuthenticationResult expected = new AuthenticationResult(); // TODO: Initialize to an appropriate value
+            AuthenticationResult actual;
+            actual = target.Authenticate(session);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for PrivateKeyAuthenticationMethod Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void PrivateKeyAuthenticationMethodConstructorTest()
+        {
+            string username = string.Empty; // TODO: Initialize to an appropriate value
+            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
+            PrivateKeyAuthenticationMethod target = new PrivateKeyAuthenticationMethod(username, keyFiles);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+    }
 }

+ 216 - 216
src/Renci.SshNet.Tests/Classes/PrivateKeyConnectionInfoTest.cs

@@ -1,217 +1,217 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Tests.Common;
-using Renci.SshNet.Tests.Properties;
-using System.IO;
-using System.Text;
-
-namespace Renci.SshNet.Tests.Classes
-{
-    /// <summary>
-    /// Provides connection information when private key authentication method is used
-    /// </summary>
-    [TestClass]
-    public class PrivateKeyConnectionInfoTest : TestBase
-    {
-        [TestMethod]
-        [TestCategory("PrivateKeyConnectionInfo")]
-        [TestCategory("integration")]
-        public void Test_PrivateKeyConnectionInfo()
-        {
-            var host = Resources.HOST;
-            var username = Resources.USERNAME;
-            MemoryStream keyFileStream = new MemoryStream(Encoding.ASCII.GetBytes(Resources.RSA_KEY_WITHOUT_PASS));
-
-            #region Example PrivateKeyConnectionInfo PrivateKeyFile
-            var connectionInfo = new PrivateKeyConnectionInfo(host, username, new PrivateKeyFile(keyFileStream));
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-            #endregion
-
-            Assert.AreEqual(connectionInfo.Host, Resources.HOST);
-            Assert.AreEqual(connectionInfo.Username, Resources.USERNAME);
-        }
-
-        [TestMethod]
-        [TestCategory("PrivateKeyConnectionInfo")]
-        [TestCategory("integration")]
-        public void Test_PrivateKeyConnectionInfo_MultiplePrivateKey()
-        {
-            var host = Resources.HOST;
-            var username = Resources.USERNAME;
-            MemoryStream keyFileStream1 = new MemoryStream(Encoding.ASCII.GetBytes(Resources.RSA_KEY_WITHOUT_PASS));
-            MemoryStream keyFileStream2 = new MemoryStream(Encoding.ASCII.GetBytes(Resources.RSA_KEY_WITHOUT_PASS));
-
-            #region Example PrivateKeyConnectionInfo PrivateKeyFile Multiple
-            var connectionInfo = new PrivateKeyConnectionInfo(host, username, 
-                new PrivateKeyFile(keyFileStream1), 
-                new PrivateKeyFile(keyFileStream2));
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-            #endregion
-
-            Assert.AreEqual(connectionInfo.Host, Resources.HOST);
-            Assert.AreEqual(connectionInfo.Username, Resources.USERNAME);
-        }
-
-        /// <summary>
-        ///A test for Dispose
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DisposeTest()
-        {
-            string host = string.Empty; // TODO: Initialize to an appropriate value
-            string username = string.Empty; // TODO: Initialize to an appropriate value
-            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
-            PrivateKeyConnectionInfo target = new PrivateKeyConnectionInfo(host, username, keyFiles); // TODO: Initialize to an appropriate value
-            target.Dispose();
-            Assert.Inconclusive("A method that does not return a value cannot be verified.");
-        }
-
-        /// <summary>
-        ///A test for PrivateKeyConnectionInfo Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void PrivateKeyConnectionInfoConstructorTest()
-        {
-            string host = string.Empty; // TODO: Initialize to an appropriate value
-            int port = 0; // TODO: Initialize to an appropriate value
-            string username = string.Empty; // TODO: Initialize to an appropriate value
-            ProxyTypes proxyType = new ProxyTypes(); // TODO: Initialize to an appropriate value
-            string proxyHost = string.Empty; // TODO: Initialize to an appropriate value
-            int proxyPort = 0; // TODO: Initialize to an appropriate value
-            string proxyUsername = string.Empty; // TODO: Initialize to an appropriate value
-            string proxyPassword = string.Empty; // TODO: Initialize to an appropriate value
-            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
-            PrivateKeyConnectionInfo target = new PrivateKeyConnectionInfo(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, keyFiles);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for PrivateKeyConnectionInfo Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void PrivateKeyConnectionInfoConstructorTest1()
-        {
-            string host = string.Empty; // TODO: Initialize to an appropriate value
-            string username = string.Empty; // TODO: Initialize to an appropriate value
-            ProxyTypes proxyType = new ProxyTypes(); // TODO: Initialize to an appropriate value
-            string proxyHost = string.Empty; // TODO: Initialize to an appropriate value
-            int proxyPort = 0; // TODO: Initialize to an appropriate value
-            string proxyUsername = string.Empty; // TODO: Initialize to an appropriate value
-            string proxyPassword = string.Empty; // TODO: Initialize to an appropriate value
-            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
-            PrivateKeyConnectionInfo target = new PrivateKeyConnectionInfo(host, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, keyFiles);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for PrivateKeyConnectionInfo Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void PrivateKeyConnectionInfoConstructorTest2()
-        {
-            string host = string.Empty; // TODO: Initialize to an appropriate value
-            string username = string.Empty; // TODO: Initialize to an appropriate value
-            ProxyTypes proxyType = new ProxyTypes(); // TODO: Initialize to an appropriate value
-            string proxyHost = string.Empty; // TODO: Initialize to an appropriate value
-            int proxyPort = 0; // TODO: Initialize to an appropriate value
-            string proxyUsername = string.Empty; // TODO: Initialize to an appropriate value
-            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
-            PrivateKeyConnectionInfo target = new PrivateKeyConnectionInfo(host, username, proxyType, proxyHost, proxyPort, proxyUsername, keyFiles);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for PrivateKeyConnectionInfo Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void PrivateKeyConnectionInfoConstructorTest3()
-        {
-            string host = string.Empty; // TODO: Initialize to an appropriate value
-            string username = string.Empty; // TODO: Initialize to an appropriate value
-            ProxyTypes proxyType = new ProxyTypes(); // TODO: Initialize to an appropriate value
-            string proxyHost = string.Empty; // TODO: Initialize to an appropriate value
-            int proxyPort = 0; // TODO: Initialize to an appropriate value
-            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
-            PrivateKeyConnectionInfo target = new PrivateKeyConnectionInfo(host, username, proxyType, proxyHost, proxyPort, keyFiles);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for PrivateKeyConnectionInfo Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void PrivateKeyConnectionInfoConstructorTest4()
-        {
-            string host = string.Empty; // TODO: Initialize to an appropriate value
-            int port = 0; // TODO: Initialize to an appropriate value
-            string username = string.Empty; // TODO: Initialize to an appropriate value
-            ProxyTypes proxyType = new ProxyTypes(); // TODO: Initialize to an appropriate value
-            string proxyHost = string.Empty; // TODO: Initialize to an appropriate value
-            int proxyPort = 0; // TODO: Initialize to an appropriate value
-            string proxyUsername = string.Empty; // TODO: Initialize to an appropriate value
-            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
-            PrivateKeyConnectionInfo target = new PrivateKeyConnectionInfo(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, keyFiles);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for PrivateKeyConnectionInfo Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void PrivateKeyConnectionInfoConstructorTest5()
-        {
-            string host = string.Empty; // TODO: Initialize to an appropriate value
-            int port = 0; // TODO: Initialize to an appropriate value
-            string username = string.Empty; // TODO: Initialize to an appropriate value
-            ProxyTypes proxyType = new ProxyTypes(); // TODO: Initialize to an appropriate value
-            string proxyHost = string.Empty; // TODO: Initialize to an appropriate value
-            int proxyPort = 0; // TODO: Initialize to an appropriate value
-            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
-            PrivateKeyConnectionInfo target = new PrivateKeyConnectionInfo(host, port, username, proxyType, proxyHost, proxyPort, keyFiles);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for PrivateKeyConnectionInfo Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void PrivateKeyConnectionInfoConstructorTest6()
-        {
-            string host = string.Empty; // TODO: Initialize to an appropriate value
-            int port = 0; // TODO: Initialize to an appropriate value
-            string username = string.Empty; // TODO: Initialize to an appropriate value
-            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
-            PrivateKeyConnectionInfo target = new PrivateKeyConnectionInfo(host, port, username, keyFiles);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for PrivateKeyConnectionInfo Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void PrivateKeyConnectionInfoConstructorTest7()
-        {
-            string host = string.Empty; // TODO: Initialize to an appropriate value
-            string username = string.Empty; // TODO: Initialize to an appropriate value
-            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
-            PrivateKeyConnectionInfo target = new PrivateKeyConnectionInfo(host, username, keyFiles);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Tests.Common;
+using Renci.SshNet.Tests.Properties;
+using System.IO;
+using System.Text;
+
+namespace Renci.SshNet.Tests.Classes
+{
+    /// <summary>
+    /// Provides connection information when private key authentication method is used
+    /// </summary>
+    [TestClass]
+    public class PrivateKeyConnectionInfoTest : TestBase
+    {
+        [TestMethod]
+        [TestCategory("PrivateKeyConnectionInfo")]
+        [TestCategory("integration")]
+        public void Test_PrivateKeyConnectionInfo()
+        {
+            var host = Resources.HOST;
+            var username = Resources.USERNAME;
+            MemoryStream keyFileStream = new MemoryStream(Encoding.ASCII.GetBytes(Resources.RSA_KEY_WITHOUT_PASS));
+
+            #region Example PrivateKeyConnectionInfo PrivateKeyFile
+            var connectionInfo = new PrivateKeyConnectionInfo(host, username, new PrivateKeyFile(keyFileStream));
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+            #endregion
+
+            Assert.AreEqual(connectionInfo.Host, Resources.HOST);
+            Assert.AreEqual(connectionInfo.Username, Resources.USERNAME);
+        }
+
+        [TestMethod]
+        [TestCategory("PrivateKeyConnectionInfo")]
+        [TestCategory("integration")]
+        public void Test_PrivateKeyConnectionInfo_MultiplePrivateKey()
+        {
+            var host = Resources.HOST;
+            var username = Resources.USERNAME;
+            MemoryStream keyFileStream1 = new MemoryStream(Encoding.ASCII.GetBytes(Resources.RSA_KEY_WITHOUT_PASS));
+            MemoryStream keyFileStream2 = new MemoryStream(Encoding.ASCII.GetBytes(Resources.RSA_KEY_WITHOUT_PASS));
+
+            #region Example PrivateKeyConnectionInfo PrivateKeyFile Multiple
+            var connectionInfo = new PrivateKeyConnectionInfo(host, username, 
+                new PrivateKeyFile(keyFileStream1), 
+                new PrivateKeyFile(keyFileStream2));
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+            #endregion
+
+            Assert.AreEqual(connectionInfo.Host, Resources.HOST);
+            Assert.AreEqual(connectionInfo.Username, Resources.USERNAME);
+        }
+
+        /// <summary>
+        ///A test for Dispose
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DisposeTest()
+        {
+            string host = string.Empty; // TODO: Initialize to an appropriate value
+            string username = string.Empty; // TODO: Initialize to an appropriate value
+            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
+            PrivateKeyConnectionInfo target = new PrivateKeyConnectionInfo(host, username, keyFiles); // TODO: Initialize to an appropriate value
+            target.Dispose();
+            Assert.Inconclusive("A method that does not return a value cannot be verified.");
+        }
+
+        /// <summary>
+        ///A test for PrivateKeyConnectionInfo Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void PrivateKeyConnectionInfoConstructorTest()
+        {
+            string host = string.Empty; // TODO: Initialize to an appropriate value
+            int port = 0; // TODO: Initialize to an appropriate value
+            string username = string.Empty; // TODO: Initialize to an appropriate value
+            ProxyTypes proxyType = new ProxyTypes(); // TODO: Initialize to an appropriate value
+            string proxyHost = string.Empty; // TODO: Initialize to an appropriate value
+            int proxyPort = 0; // TODO: Initialize to an appropriate value
+            string proxyUsername = string.Empty; // TODO: Initialize to an appropriate value
+            string proxyPassword = string.Empty; // TODO: Initialize to an appropriate value
+            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
+            PrivateKeyConnectionInfo target = new PrivateKeyConnectionInfo(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, keyFiles);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for PrivateKeyConnectionInfo Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void PrivateKeyConnectionInfoConstructorTest1()
+        {
+            string host = string.Empty; // TODO: Initialize to an appropriate value
+            string username = string.Empty; // TODO: Initialize to an appropriate value
+            ProxyTypes proxyType = new ProxyTypes(); // TODO: Initialize to an appropriate value
+            string proxyHost = string.Empty; // TODO: Initialize to an appropriate value
+            int proxyPort = 0; // TODO: Initialize to an appropriate value
+            string proxyUsername = string.Empty; // TODO: Initialize to an appropriate value
+            string proxyPassword = string.Empty; // TODO: Initialize to an appropriate value
+            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
+            PrivateKeyConnectionInfo target = new PrivateKeyConnectionInfo(host, username, proxyType, proxyHost, proxyPort, proxyUsername, proxyPassword, keyFiles);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for PrivateKeyConnectionInfo Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void PrivateKeyConnectionInfoConstructorTest2()
+        {
+            string host = string.Empty; // TODO: Initialize to an appropriate value
+            string username = string.Empty; // TODO: Initialize to an appropriate value
+            ProxyTypes proxyType = new ProxyTypes(); // TODO: Initialize to an appropriate value
+            string proxyHost = string.Empty; // TODO: Initialize to an appropriate value
+            int proxyPort = 0; // TODO: Initialize to an appropriate value
+            string proxyUsername = string.Empty; // TODO: Initialize to an appropriate value
+            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
+            PrivateKeyConnectionInfo target = new PrivateKeyConnectionInfo(host, username, proxyType, proxyHost, proxyPort, proxyUsername, keyFiles);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for PrivateKeyConnectionInfo Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void PrivateKeyConnectionInfoConstructorTest3()
+        {
+            string host = string.Empty; // TODO: Initialize to an appropriate value
+            string username = string.Empty; // TODO: Initialize to an appropriate value
+            ProxyTypes proxyType = new ProxyTypes(); // TODO: Initialize to an appropriate value
+            string proxyHost = string.Empty; // TODO: Initialize to an appropriate value
+            int proxyPort = 0; // TODO: Initialize to an appropriate value
+            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
+            PrivateKeyConnectionInfo target = new PrivateKeyConnectionInfo(host, username, proxyType, proxyHost, proxyPort, keyFiles);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for PrivateKeyConnectionInfo Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void PrivateKeyConnectionInfoConstructorTest4()
+        {
+            string host = string.Empty; // TODO: Initialize to an appropriate value
+            int port = 0; // TODO: Initialize to an appropriate value
+            string username = string.Empty; // TODO: Initialize to an appropriate value
+            ProxyTypes proxyType = new ProxyTypes(); // TODO: Initialize to an appropriate value
+            string proxyHost = string.Empty; // TODO: Initialize to an appropriate value
+            int proxyPort = 0; // TODO: Initialize to an appropriate value
+            string proxyUsername = string.Empty; // TODO: Initialize to an appropriate value
+            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
+            PrivateKeyConnectionInfo target = new PrivateKeyConnectionInfo(host, port, username, proxyType, proxyHost, proxyPort, proxyUsername, keyFiles);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for PrivateKeyConnectionInfo Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void PrivateKeyConnectionInfoConstructorTest5()
+        {
+            string host = string.Empty; // TODO: Initialize to an appropriate value
+            int port = 0; // TODO: Initialize to an appropriate value
+            string username = string.Empty; // TODO: Initialize to an appropriate value
+            ProxyTypes proxyType = new ProxyTypes(); // TODO: Initialize to an appropriate value
+            string proxyHost = string.Empty; // TODO: Initialize to an appropriate value
+            int proxyPort = 0; // TODO: Initialize to an appropriate value
+            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
+            PrivateKeyConnectionInfo target = new PrivateKeyConnectionInfo(host, port, username, proxyType, proxyHost, proxyPort, keyFiles);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for PrivateKeyConnectionInfo Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void PrivateKeyConnectionInfoConstructorTest6()
+        {
+            string host = string.Empty; // TODO: Initialize to an appropriate value
+            int port = 0; // TODO: Initialize to an appropriate value
+            string username = string.Empty; // TODO: Initialize to an appropriate value
+            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
+            PrivateKeyConnectionInfo target = new PrivateKeyConnectionInfo(host, port, username, keyFiles);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for PrivateKeyConnectionInfo Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void PrivateKeyConnectionInfoConstructorTest7()
+        {
+            string host = string.Empty; // TODO: Initialize to an appropriate value
+            string username = string.Empty; // TODO: Initialize to an appropriate value
+            PrivateKeyFile[] keyFiles = null; // TODO: Initialize to an appropriate value
+            PrivateKeyConnectionInfo target = new PrivateKeyConnectionInfo(host, username, keyFiles);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+    }
 }

+ 503 - 503
src/Renci.SshNet.Tests/Classes/PrivateKeyFileTest.cs

@@ -1,504 +1,504 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Common;
-using Renci.SshNet.Tests.Common;
-using System;
-using System.IO;
-
-namespace Renci.SshNet.Tests.Classes
-{
-    /// <summary>
-    /// old private key information/
-    /// </summary>
-    [TestClass]
-    public class PrivateKeyFileTest : TestBase
-    {
-        private string _temporaryFile;
-
-        [TestInitialize]
-        public void SetUp()
-        {
-            _temporaryFile = GetTempFileName();
-        }
-
-        [TestCleanup]
-        public void TearDown()
-        {
-            if (_temporaryFile != null)
-                File.Delete(_temporaryFile);
-        }
-
-        /// <summary>
-        /// A test for <see cref="PrivateKeyFile(string)"/> ctor.
-        ///</summary>
-        [WorkItem(703), TestMethod]
-        public void ConstructorWithFileNameShouldThrowArgumentNullExceptionWhenFileNameIsEmpty()
-        {
-            var fileName = string.Empty;
-            try
-            {
-                new PrivateKeyFile(fileName);
-                Assert.Fail();
-            }
-            catch (ArgumentNullException ex)
-            {
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("fileName", ex.ParamName);
-            }
-        }
-
-        /// <summary>
-        /// A test for <see cref="PrivateKeyFile(string)"/> ctor.
-        ///</summary>
-        [WorkItem(703), TestMethod]
-        public void ConstructorWithFileNameShouldThrowArgumentNullExceptionWhenFileNameIsNull()
-        {
-            var fileName = string.Empty;
-            try
-            {
-                new PrivateKeyFile(fileName);
-                Assert.Fail();
-            }
-            catch (ArgumentNullException ex)
-            {
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("fileName", ex.ParamName);
-            }
-        }
-
-        /// <summary>
-        /// A test for <see cref="PrivateKeyFile(string, string)"/> ctor.
-        ///</summary>
-        [WorkItem(703), TestMethod]
-        public void ConstructorWithFileNameAndPassphraseShouldThrowArgumentNullExceptionWhenFileNameIsEmpty()
-        {
-            var fileName = string.Empty;
-            try
-            {
-                new PrivateKeyFile(fileName, "12345");
-                Assert.Fail();
-            }
-            catch (ArgumentNullException ex)
-            {
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("fileName", ex.ParamName);
-            }
-        }
-
-        /// <summary>
-        /// A test for <see cref="PrivateKeyFile(string, string)"/> ctor.
-        ///</summary>
-        [WorkItem(703), TestMethod]
-        public void ConstructorWithFileNameAndPassphraseShouldThrowArgumentNullExceptionWhenFileNameIsNull()
-        {
-            var fileName = string.Empty;
-            try
-            {
-                new PrivateKeyFile(fileName, "12345");
-                Assert.Fail();
-            }
-            catch (ArgumentNullException ex)
-            {
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("fileName", ex.ParamName);
-            }
-        }
-
-        [WorkItem(703), TestMethod]
-        public void ConstructorWithPrivateKeyShouldThrowArgumentNullExceptionWhenPrivateKeyIsNull()
-        {
-            Stream privateKey = null;
-            try
-            {
-                new PrivateKeyFile(privateKey);
-                Assert.Fail();
-            }
-            catch (ArgumentNullException ex)
-            {
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("privateKey", ex.ParamName);
-            }
-        }
-
-        [WorkItem(703), TestMethod]
-        public void ConstructorWithPrivateKeyAndPassphraseShouldThrowArgumentNullExceptionWhenPrivateKeyIsNull()
-        {
-            Stream privateKey = null;
-            try
-            {
-                new PrivateKeyFile(privateKey, "12345");
-                Assert.Fail();
-            }
-            catch (ArgumentNullException ex)
-            {
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("privateKey", ex.ParamName);
-            }
-        }
-
-        [TestMethod]
-        [Owner("olegkap")]
-        [TestCategory("PrivateKey")]
-        public void Test_PrivateKey_RSA()
-        {
-            using (var stream = this.GetData("Key.RSA.txt"))
-            {
-                new PrivateKeyFile(stream);
-            }
-        }
-
-        [TestMethod]
-        [Owner("drieseng")]
-        [TestCategory("PrivateKey")]
-        public void Test_PrivateKey_SSH2_DSA()
-        {
-            using (var stream = this.GetData("Key.SSH2.DSA.txt"))
-            {
-                new PrivateKeyFile(stream);
-            }
-        }
-
-        [TestMethod]
-        [Owner("drieseng")]
-        [TestCategory("PrivateKey")]
-        public void Test_PrivateKey_SSH2_RSA()
-        {
-            using (var stream = this.GetData("Key.SSH2.RSA.txt"))
-            {
-                new PrivateKeyFile(stream);
-            }
-        }
-
-        [TestMethod]
-        [Owner("drieseng")]
-        [TestCategory("PrivateKey")]
-        public void Test_PrivateKey_SSH2_Encrypted_DSA_DES_CBC()
-        {
-            using (var stream = this.GetData("Key.SSH2.DSA.Encrypted.Des.CBC.12345.txt"))
-            {
-                new PrivateKeyFile(stream, "12345");
-            }
-        }
-
-        [TestMethod]
-        [Owner("drieseng")]
-        [TestCategory("PrivateKey")]
-        public void Test_PrivateKey_SSH2_Encrypted_RSA_DES_CBC()
-        {
-            using (var stream = this.GetData("Key.SSH2.RSA.Encrypted.Des.CBC.12345.txt"))
-            {
-                new PrivateKeyFile(stream, "12345");
-            }
-        }
-
-        [TestMethod]
-        [Owner("drieseng")]
-        [TestCategory("PrivateKey")]
-        public void Test_PrivateKey_SSH2_Encrypted_ShouldThrowSshExceptionWhenPassphraseIsWrong()
-        {
-            using (var stream = this.GetData("Key.SSH2.RSA.Encrypted.Des.CBC.12345.txt"))
-            {
-                try
-                {
-                    new PrivateKeyFile(stream, "34567");
-                    Assert.Fail();
-                }
-                catch (SshException ex)
-                {
-                    Assert.IsInstanceOfType(ex, typeof(SshException));
-                    Assert.IsNull(ex.InnerException);
-                    Assert.AreEqual("Invalid passphrase.", ex.Message);
-                }
-            }
-        }
-
-        [TestMethod]
-        [Owner("drieseng")]
-        [TestCategory("PrivateKey")]
-        public void Test_PrivateKey_SSH2_Encrypted_ShouldThrowSshPassPhraseNullOrEmptyExceptionWhenPassphraseIsNull()
-        {
-            using (var stream = this.GetData("Key.SSH2.RSA.Encrypted.Des.CBC.12345.txt"))
-            {
-                try
-                {
-                    new PrivateKeyFile(stream, null);
-                    Assert.Fail();
-                }
-                catch (SshPassPhraseNullOrEmptyException ex)
-                {
-                    Assert.IsInstanceOfType(ex, typeof(SshPassPhraseNullOrEmptyException));
-                    Assert.IsNull(ex.InnerException);
-                    Assert.AreEqual("Private key is encrypted but passphrase is empty.", ex.Message);
-                }
-            }
-        }
-
-        [TestMethod]
-        [Owner("drieseng")]
-        [TestCategory("PrivateKey")]
-        public void Test_PrivateKey_SSH2_Encrypted_ShouldThrowSshPassPhraseNullOrEmptyExceptionWhenPassphraseIsEmpty()
-        {
-            using (var stream = this.GetData("Key.SSH2.RSA.Encrypted.Des.CBC.12345.txt"))
-            {
-                try
-                {
-                    new PrivateKeyFile(stream, string.Empty);
-                    Assert.Fail();
-                }
-                catch (SshPassPhraseNullOrEmptyException ex)
-                {
-                    Assert.IsInstanceOfType(ex, typeof(SshPassPhraseNullOrEmptyException));
-                    Assert.IsNull(ex.InnerException);
-                    Assert.AreEqual("Private key is encrypted but passphrase is empty.", ex.Message);
-                }
-            }
-        }
-
-        [TestMethod]
-        [Owner("olegkap")]
-        [TestCategory("PrivateKey")]
-        public void Test_PrivateKey_RSA_DES_CBC()
-        {
-            using (var stream = this.GetData("Key.RSA.Encrypted.Des.CBC.12345.txt"))
-            {
-                new PrivateKeyFile(stream, "12345");
-            }
-        }
-
-        [TestMethod]
-        [Owner("olegkap")]
-        [TestCategory("PrivateKey")]
-        public void Test_PrivateKey_RSA_DES_EDE3_CBC()
-        {
-            using (var stream = this.GetData("Key.RSA.Encrypted.Des.Ede3.CBC.12345.txt"))
-            {
-                new PrivateKeyFile(stream, "12345");
-            }
-        }
-
-        [TestMethod]
-        [Owner("olegkap")]
-        [TestCategory("PrivateKey")]
-        public void Test_PrivateKey_RSA_AES_128_CBC()
-        {
-            using (var stream = this.GetData("Key.RSA.Encrypted.Aes.128.CBC.12345.txt"))
-            {
-                new PrivateKeyFile(stream, "12345");
-            }
-        }
-
-        [TestMethod]
-        [Owner("olegkap")]
-        [TestCategory("PrivateKey")]
-        public void Test_PrivateKey_RSA_AES_192_CBC()
-        {
-            using (var stream = this.GetData("Key.RSA.Encrypted.Aes.192.CBC.12345.txt"))
-            {
-                new PrivateKeyFile(stream, "12345");
-            }
-        }
-
-        [TestMethod]
-        [Owner("olegkap")]
-        [TestCategory("PrivateKey")]
-        public void Test_PrivateKey_RSA_AES_256_CBC()
-        {
-            using (var stream = this.GetData("Key.RSA.Encrypted.Aes.256.CBC.12345.txt"))
-            {
-                new PrivateKeyFile(stream, "12345");
-            }
-        }
-
-        [TestMethod]
-        [Owner("olegkap")]
-        [TestCategory("PrivateKey")]
-        public void Test_PrivateKey_RSA_DES_EDE3_CFB()
-        {
-            using (var stream = this.GetData("Key.RSA.Encrypted.Des.Ede3.CFB.1234567890.txt"))
-            {
-                new PrivateKeyFile(stream, "1234567890");
-            }
-        }
-
-        /// <summary>
-        ///A test for Dispose
-        ///</summary>
-        [TestMethod()]
-        public void DisposeTest()
-        {
-            using (var privateKeyStream = GetData("Key.RSA.txt"))
-            {
-                var target = new PrivateKeyFile(privateKeyStream);
-                target.Dispose();
-            }
-        }
-
-        /// <summary>
-        /// A test for <see cref="PrivateKeyFile(Stream, string)"/> ctor.
-        ///</summary>
-        [TestMethod()]
-        public void ConstructorWithStreamAndPassphrase()
-        {
-            using (var stream = GetData("Key.RSA.Encrypted.Aes.128.CBC.12345.txt"))
-            {
-                var privateKeyFile = new PrivateKeyFile(stream, "12345");
-                Assert.IsNotNull(privateKeyFile.HostKey);
-            }
-        }
-
-        /// <summary>
-        /// A test for <see cref="PrivateKeyFile(string, string)"/> ctor.
-        ///</summary>
-        [TestMethod()]
-        public void ConstructorWithFileNameAndPassphrase()
-        {
-            using (var stream = GetData("Key.RSA.Encrypted.Aes.128.CBC.12345.txt"))
-            {
-                SaveStreamToFile(stream, _temporaryFile);
-            }
-
-            using (var fs = File.Open(_temporaryFile, FileMode.Open, FileAccess.Read, FileShare.Read))
-            {
-                var privateKeyFile = new PrivateKeyFile(_temporaryFile, "12345");
-                Assert.IsNotNull(privateKeyFile.HostKey);
-
-                fs.Close();
-            }
-        }
-
-        /// <summary>
-        /// A test for <see cref="PrivateKeyFile(string, string)"/> ctor.
-        ///</summary>
-        [TestMethod()]
-        public void ConstructorWithFileNameAndPassphraseShouldThrowSshPassPhraseNullOrEmptyExceptionWhenPrivateKeyIsEncryptedAndPassphraseIsEmpty()
-        {
-            var passphrase = string.Empty;
-
-            using (var stream = GetData("Key.RSA.Encrypted.Aes.128.CBC.12345.txt"))
-            {
-                SaveStreamToFile(stream, _temporaryFile);
-            }
-
-            try
-            {
-                new PrivateKeyFile(_temporaryFile, passphrase);
-                Assert.Fail();
-            }
-            catch (SshPassPhraseNullOrEmptyException ex)
-            {
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("Private key is encrypted but passphrase is empty.", ex.Message);
-            }
-        }
-
-        /// <summary>
-        /// A test for <see cref="PrivateKeyFile(string, string)"/> ctor.
-        ///</summary>
-        [TestMethod()]
-        public void ConstructorWithFileNameAndPassphraseShouldThrowSshPassPhraseNullOrEmptyExceptionWhenPrivateKeyIsEncryptedAndPassphraseIsNull()
-        {
-            string passphrase = null;
-
-            using (var stream = GetData("Key.RSA.Encrypted.Aes.128.CBC.12345.txt"))
-            {
-                SaveStreamToFile(stream, _temporaryFile);
-            }
-
-            try
-            {
-                new PrivateKeyFile(_temporaryFile, passphrase);
-                Assert.Fail();
-            }
-            catch (SshPassPhraseNullOrEmptyException ex)
-            {
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("Private key is encrypted but passphrase is empty.", ex.Message);
-            }
-        }
-
-        /// <summary>
-        /// A test for <see cref="PrivateKeyFile(string)"/> ctor.
-        ///</summary>
-        [TestMethod()]
-        public void ConstructorWithFileName()
-        {
-            using (var stream = GetData("Key.RSA.Encrypted.Aes.128.CBC.12345.txt"))
-            {
-                SaveStreamToFile(stream, _temporaryFile);
-            }
-
-            var privateKeyFile = new PrivateKeyFile(_temporaryFile, "12345");
-            Assert.IsNotNull(privateKeyFile.HostKey);
-        }
-
-        /// <summary>
-        /// A test for <see cref="PrivateKeyFile(Stream)"/> ctor.
-        ///</summary>
-        [TestMethod()]
-        public void ConstructorWithStream()
-        {
-            using (var stream = GetData("Key.RSA.txt"))
-            {
-                var privateKeyFile = new PrivateKeyFile(stream);
-                Assert.IsNotNull(privateKeyFile.HostKey);
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("PrivateKey")]
-        public void ConstructorWithFileNameShouldBeAbleToReadFileThatIsSharedForReadAccess()
-        {
-            using (var stream = GetData("Key.RSA.txt"))
-            {
-                SaveStreamToFile(stream, _temporaryFile);
-            }
-
-            using (var fs = File.Open(_temporaryFile, FileMode.Open, FileAccess.Read, FileShare.Read))
-            {
-                var privateKeyFile = new PrivateKeyFile(_temporaryFile);
-                Assert.IsNotNull(privateKeyFile.HostKey);
-
-                fs.Close();
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("PrivateKey")]
-        public void ConstructorWithFileNameAndPassPhraseShouldBeAbleToReadFileThatIsSharedForReadAccess()
-        {
-            using (var stream = GetData("Key.RSA.Encrypted.Aes.128.CBC.12345.txt"))
-            {
-                SaveStreamToFile(stream, _temporaryFile);
-            }
-
-            using (var fs = File.Open(_temporaryFile, FileMode.Open, FileAccess.Read, FileShare.Read))
-            {
-                var privateKeyFile = new PrivateKeyFile(_temporaryFile, "12345");
-                Assert.IsNotNull(privateKeyFile.HostKey);
-
-                fs.Close();
-            }
-        }
-
-        private void SaveStreamToFile(Stream stream, string fileName)
-        {
-            var buffer = new byte[4000];
-
-            using (var fs = new FileStream(fileName, FileMode.Create, FileAccess.Write))
-            {
-                var bytesRead = stream.Read(buffer, 0, buffer.Length);
-                while (bytesRead > 0)
-                {
-                    fs.Write(buffer, 0, bytesRead);
-                    bytesRead = stream.Read(buffer, 0, buffer.Length);
-                }
-            }
-        }
-
-        private string GetTempFileName()
-        {
-            var tempFile = Path.GetTempFileName();
-            File.Delete(tempFile);
-            return tempFile;
-        }
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Common;
+using Renci.SshNet.Tests.Common;
+using System;
+using System.IO;
+
+namespace Renci.SshNet.Tests.Classes
+{
+    /// <summary>
+    /// old private key information/
+    /// </summary>
+    [TestClass]
+    public class PrivateKeyFileTest : TestBase
+    {
+        private string _temporaryFile;
+
+        [TestInitialize]
+        public void SetUp()
+        {
+            _temporaryFile = GetTempFileName();
+        }
+
+        [TestCleanup]
+        public void TearDown()
+        {
+            if (_temporaryFile != null)
+                File.Delete(_temporaryFile);
+        }
+
+        /// <summary>
+        /// A test for <see cref="PrivateKeyFile(string)"/> ctor.
+        ///</summary>
+        [WorkItem(703), TestMethod]
+        public void ConstructorWithFileNameShouldThrowArgumentNullExceptionWhenFileNameIsEmpty()
+        {
+            var fileName = string.Empty;
+            try
+            {
+                new PrivateKeyFile(fileName);
+                Assert.Fail();
+            }
+            catch (ArgumentNullException ex)
+            {
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("fileName", ex.ParamName);
+            }
+        }
+
+        /// <summary>
+        /// A test for <see cref="PrivateKeyFile(string)"/> ctor.
+        ///</summary>
+        [WorkItem(703), TestMethod]
+        public void ConstructorWithFileNameShouldThrowArgumentNullExceptionWhenFileNameIsNull()
+        {
+            var fileName = string.Empty;
+            try
+            {
+                new PrivateKeyFile(fileName);
+                Assert.Fail();
+            }
+            catch (ArgumentNullException ex)
+            {
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("fileName", ex.ParamName);
+            }
+        }
+
+        /// <summary>
+        /// A test for <see cref="PrivateKeyFile(string, string)"/> ctor.
+        ///</summary>
+        [WorkItem(703), TestMethod]
+        public void ConstructorWithFileNameAndPassphraseShouldThrowArgumentNullExceptionWhenFileNameIsEmpty()
+        {
+            var fileName = string.Empty;
+            try
+            {
+                new PrivateKeyFile(fileName, "12345");
+                Assert.Fail();
+            }
+            catch (ArgumentNullException ex)
+            {
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("fileName", ex.ParamName);
+            }
+        }
+
+        /// <summary>
+        /// A test for <see cref="PrivateKeyFile(string, string)"/> ctor.
+        ///</summary>
+        [WorkItem(703), TestMethod]
+        public void ConstructorWithFileNameAndPassphraseShouldThrowArgumentNullExceptionWhenFileNameIsNull()
+        {
+            var fileName = string.Empty;
+            try
+            {
+                new PrivateKeyFile(fileName, "12345");
+                Assert.Fail();
+            }
+            catch (ArgumentNullException ex)
+            {
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("fileName", ex.ParamName);
+            }
+        }
+
+        [WorkItem(703), TestMethod]
+        public void ConstructorWithPrivateKeyShouldThrowArgumentNullExceptionWhenPrivateKeyIsNull()
+        {
+            Stream privateKey = null;
+            try
+            {
+                new PrivateKeyFile(privateKey);
+                Assert.Fail();
+            }
+            catch (ArgumentNullException ex)
+            {
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("privateKey", ex.ParamName);
+            }
+        }
+
+        [WorkItem(703), TestMethod]
+        public void ConstructorWithPrivateKeyAndPassphraseShouldThrowArgumentNullExceptionWhenPrivateKeyIsNull()
+        {
+            Stream privateKey = null;
+            try
+            {
+                new PrivateKeyFile(privateKey, "12345");
+                Assert.Fail();
+            }
+            catch (ArgumentNullException ex)
+            {
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("privateKey", ex.ParamName);
+            }
+        }
+
+        [TestMethod]
+        [Owner("olegkap")]
+        [TestCategory("PrivateKey")]
+        public void Test_PrivateKey_RSA()
+        {
+            using (var stream = this.GetData("Key.RSA.txt"))
+            {
+                new PrivateKeyFile(stream);
+            }
+        }
+
+        [TestMethod]
+        [Owner("drieseng")]
+        [TestCategory("PrivateKey")]
+        public void Test_PrivateKey_SSH2_DSA()
+        {
+            using (var stream = this.GetData("Key.SSH2.DSA.txt"))
+            {
+                new PrivateKeyFile(stream);
+            }
+        }
+
+        [TestMethod]
+        [Owner("drieseng")]
+        [TestCategory("PrivateKey")]
+        public void Test_PrivateKey_SSH2_RSA()
+        {
+            using (var stream = this.GetData("Key.SSH2.RSA.txt"))
+            {
+                new PrivateKeyFile(stream);
+            }
+        }
+
+        [TestMethod]
+        [Owner("drieseng")]
+        [TestCategory("PrivateKey")]
+        public void Test_PrivateKey_SSH2_Encrypted_DSA_DES_CBC()
+        {
+            using (var stream = this.GetData("Key.SSH2.DSA.Encrypted.Des.CBC.12345.txt"))
+            {
+                new PrivateKeyFile(stream, "12345");
+            }
+        }
+
+        [TestMethod]
+        [Owner("drieseng")]
+        [TestCategory("PrivateKey")]
+        public void Test_PrivateKey_SSH2_Encrypted_RSA_DES_CBC()
+        {
+            using (var stream = this.GetData("Key.SSH2.RSA.Encrypted.Des.CBC.12345.txt"))
+            {
+                new PrivateKeyFile(stream, "12345");
+            }
+        }
+
+        [TestMethod]
+        [Owner("drieseng")]
+        [TestCategory("PrivateKey")]
+        public void Test_PrivateKey_SSH2_Encrypted_ShouldThrowSshExceptionWhenPassphraseIsWrong()
+        {
+            using (var stream = this.GetData("Key.SSH2.RSA.Encrypted.Des.CBC.12345.txt"))
+            {
+                try
+                {
+                    new PrivateKeyFile(stream, "34567");
+                    Assert.Fail();
+                }
+                catch (SshException ex)
+                {
+                    Assert.IsInstanceOfType(ex, typeof(SshException));
+                    Assert.IsNull(ex.InnerException);
+                    Assert.AreEqual("Invalid passphrase.", ex.Message);
+                }
+            }
+        }
+
+        [TestMethod]
+        [Owner("drieseng")]
+        [TestCategory("PrivateKey")]
+        public void Test_PrivateKey_SSH2_Encrypted_ShouldThrowSshPassPhraseNullOrEmptyExceptionWhenPassphraseIsNull()
+        {
+            using (var stream = this.GetData("Key.SSH2.RSA.Encrypted.Des.CBC.12345.txt"))
+            {
+                try
+                {
+                    new PrivateKeyFile(stream, null);
+                    Assert.Fail();
+                }
+                catch (SshPassPhraseNullOrEmptyException ex)
+                {
+                    Assert.IsInstanceOfType(ex, typeof(SshPassPhraseNullOrEmptyException));
+                    Assert.IsNull(ex.InnerException);
+                    Assert.AreEqual("Private key is encrypted but passphrase is empty.", ex.Message);
+                }
+            }
+        }
+
+        [TestMethod]
+        [Owner("drieseng")]
+        [TestCategory("PrivateKey")]
+        public void Test_PrivateKey_SSH2_Encrypted_ShouldThrowSshPassPhraseNullOrEmptyExceptionWhenPassphraseIsEmpty()
+        {
+            using (var stream = this.GetData("Key.SSH2.RSA.Encrypted.Des.CBC.12345.txt"))
+            {
+                try
+                {
+                    new PrivateKeyFile(stream, string.Empty);
+                    Assert.Fail();
+                }
+                catch (SshPassPhraseNullOrEmptyException ex)
+                {
+                    Assert.IsInstanceOfType(ex, typeof(SshPassPhraseNullOrEmptyException));
+                    Assert.IsNull(ex.InnerException);
+                    Assert.AreEqual("Private key is encrypted but passphrase is empty.", ex.Message);
+                }
+            }
+        }
+
+        [TestMethod]
+        [Owner("olegkap")]
+        [TestCategory("PrivateKey")]
+        public void Test_PrivateKey_RSA_DES_CBC()
+        {
+            using (var stream = this.GetData("Key.RSA.Encrypted.Des.CBC.12345.txt"))
+            {
+                new PrivateKeyFile(stream, "12345");
+            }
+        }
+
+        [TestMethod]
+        [Owner("olegkap")]
+        [TestCategory("PrivateKey")]
+        public void Test_PrivateKey_RSA_DES_EDE3_CBC()
+        {
+            using (var stream = this.GetData("Key.RSA.Encrypted.Des.Ede3.CBC.12345.txt"))
+            {
+                new PrivateKeyFile(stream, "12345");
+            }
+        }
+
+        [TestMethod]
+        [Owner("olegkap")]
+        [TestCategory("PrivateKey")]
+        public void Test_PrivateKey_RSA_AES_128_CBC()
+        {
+            using (var stream = this.GetData("Key.RSA.Encrypted.Aes.128.CBC.12345.txt"))
+            {
+                new PrivateKeyFile(stream, "12345");
+            }
+        }
+
+        [TestMethod]
+        [Owner("olegkap")]
+        [TestCategory("PrivateKey")]
+        public void Test_PrivateKey_RSA_AES_192_CBC()
+        {
+            using (var stream = this.GetData("Key.RSA.Encrypted.Aes.192.CBC.12345.txt"))
+            {
+                new PrivateKeyFile(stream, "12345");
+            }
+        }
+
+        [TestMethod]
+        [Owner("olegkap")]
+        [TestCategory("PrivateKey")]
+        public void Test_PrivateKey_RSA_AES_256_CBC()
+        {
+            using (var stream = this.GetData("Key.RSA.Encrypted.Aes.256.CBC.12345.txt"))
+            {
+                new PrivateKeyFile(stream, "12345");
+            }
+        }
+
+        [TestMethod]
+        [Owner("olegkap")]
+        [TestCategory("PrivateKey")]
+        public void Test_PrivateKey_RSA_DES_EDE3_CFB()
+        {
+            using (var stream = this.GetData("Key.RSA.Encrypted.Des.Ede3.CFB.1234567890.txt"))
+            {
+                new PrivateKeyFile(stream, "1234567890");
+            }
+        }
+
+        /// <summary>
+        ///A test for Dispose
+        ///</summary>
+        [TestMethod()]
+        public void DisposeTest()
+        {
+            using (var privateKeyStream = GetData("Key.RSA.txt"))
+            {
+                var target = new PrivateKeyFile(privateKeyStream);
+                target.Dispose();
+            }
+        }
+
+        /// <summary>
+        /// A test for <see cref="PrivateKeyFile(Stream, string)"/> ctor.
+        ///</summary>
+        [TestMethod()]
+        public void ConstructorWithStreamAndPassphrase()
+        {
+            using (var stream = GetData("Key.RSA.Encrypted.Aes.128.CBC.12345.txt"))
+            {
+                var privateKeyFile = new PrivateKeyFile(stream, "12345");
+                Assert.IsNotNull(privateKeyFile.HostKey);
+            }
+        }
+
+        /// <summary>
+        /// A test for <see cref="PrivateKeyFile(string, string)"/> ctor.
+        ///</summary>
+        [TestMethod()]
+        public void ConstructorWithFileNameAndPassphrase()
+        {
+            using (var stream = GetData("Key.RSA.Encrypted.Aes.128.CBC.12345.txt"))
+            {
+                SaveStreamToFile(stream, _temporaryFile);
+            }
+
+            using (var fs = File.Open(_temporaryFile, FileMode.Open, FileAccess.Read, FileShare.Read))
+            {
+                var privateKeyFile = new PrivateKeyFile(_temporaryFile, "12345");
+                Assert.IsNotNull(privateKeyFile.HostKey);
+
+                fs.Close();
+            }
+        }
+
+        /// <summary>
+        /// A test for <see cref="PrivateKeyFile(string, string)"/> ctor.
+        ///</summary>
+        [TestMethod()]
+        public void ConstructorWithFileNameAndPassphraseShouldThrowSshPassPhraseNullOrEmptyExceptionWhenPrivateKeyIsEncryptedAndPassphraseIsEmpty()
+        {
+            var passphrase = string.Empty;
+
+            using (var stream = GetData("Key.RSA.Encrypted.Aes.128.CBC.12345.txt"))
+            {
+                SaveStreamToFile(stream, _temporaryFile);
+            }
+
+            try
+            {
+                new PrivateKeyFile(_temporaryFile, passphrase);
+                Assert.Fail();
+            }
+            catch (SshPassPhraseNullOrEmptyException ex)
+            {
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("Private key is encrypted but passphrase is empty.", ex.Message);
+            }
+        }
+
+        /// <summary>
+        /// A test for <see cref="PrivateKeyFile(string, string)"/> ctor.
+        ///</summary>
+        [TestMethod()]
+        public void ConstructorWithFileNameAndPassphraseShouldThrowSshPassPhraseNullOrEmptyExceptionWhenPrivateKeyIsEncryptedAndPassphraseIsNull()
+        {
+            string passphrase = null;
+
+            using (var stream = GetData("Key.RSA.Encrypted.Aes.128.CBC.12345.txt"))
+            {
+                SaveStreamToFile(stream, _temporaryFile);
+            }
+
+            try
+            {
+                new PrivateKeyFile(_temporaryFile, passphrase);
+                Assert.Fail();
+            }
+            catch (SshPassPhraseNullOrEmptyException ex)
+            {
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("Private key is encrypted but passphrase is empty.", ex.Message);
+            }
+        }
+
+        /// <summary>
+        /// A test for <see cref="PrivateKeyFile(string)"/> ctor.
+        ///</summary>
+        [TestMethod()]
+        public void ConstructorWithFileName()
+        {
+            using (var stream = GetData("Key.RSA.Encrypted.Aes.128.CBC.12345.txt"))
+            {
+                SaveStreamToFile(stream, _temporaryFile);
+            }
+
+            var privateKeyFile = new PrivateKeyFile(_temporaryFile, "12345");
+            Assert.IsNotNull(privateKeyFile.HostKey);
+        }
+
+        /// <summary>
+        /// A test for <see cref="PrivateKeyFile(Stream)"/> ctor.
+        ///</summary>
+        [TestMethod()]
+        public void ConstructorWithStream()
+        {
+            using (var stream = GetData("Key.RSA.txt"))
+            {
+                var privateKeyFile = new PrivateKeyFile(stream);
+                Assert.IsNotNull(privateKeyFile.HostKey);
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("PrivateKey")]
+        public void ConstructorWithFileNameShouldBeAbleToReadFileThatIsSharedForReadAccess()
+        {
+            using (var stream = GetData("Key.RSA.txt"))
+            {
+                SaveStreamToFile(stream, _temporaryFile);
+            }
+
+            using (var fs = File.Open(_temporaryFile, FileMode.Open, FileAccess.Read, FileShare.Read))
+            {
+                var privateKeyFile = new PrivateKeyFile(_temporaryFile);
+                Assert.IsNotNull(privateKeyFile.HostKey);
+
+                fs.Close();
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("PrivateKey")]
+        public void ConstructorWithFileNameAndPassPhraseShouldBeAbleToReadFileThatIsSharedForReadAccess()
+        {
+            using (var stream = GetData("Key.RSA.Encrypted.Aes.128.CBC.12345.txt"))
+            {
+                SaveStreamToFile(stream, _temporaryFile);
+            }
+
+            using (var fs = File.Open(_temporaryFile, FileMode.Open, FileAccess.Read, FileShare.Read))
+            {
+                var privateKeyFile = new PrivateKeyFile(_temporaryFile, "12345");
+                Assert.IsNotNull(privateKeyFile.HostKey);
+
+                fs.Close();
+            }
+        }
+
+        private void SaveStreamToFile(Stream stream, string fileName)
+        {
+            var buffer = new byte[4000];
+
+            using (var fs = new FileStream(fileName, FileMode.Create, FileAccess.Write))
+            {
+                var bytesRead = stream.Read(buffer, 0, buffer.Length);
+                while (bytesRead > 0)
+                {
+                    fs.Write(buffer, 0, bytesRead);
+                    bytesRead = stream.Read(buffer, 0, buffer.Length);
+                }
+            }
+        }
+
+        private string GetTempFileName()
+        {
+            var tempFile = Path.GetTempFileName();
+            File.Delete(tempFile);
+            return tempFile;
+        }
+    }
 }

+ 34 - 34
src/Renci.SshNet.Tests/Classes/Security/AlgorithmTest.cs

@@ -1,34 +1,34 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security
-{
-    /// <summary>
-    ///This is a test class for AlgorithmTest and is intended
-    ///to contain all AlgorithmTest Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class AlgorithmTest : TestBase
-    {
-        internal virtual Algorithm CreateAlgorithm()
-        {
-            // TODO: Instantiate an appropriate concrete class.
-            Algorithm target = null;
-            return target;
-        }
-
-        /// <summary>
-        ///A test for Name
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void NameTest()
-        {
-            Algorithm target = CreateAlgorithm(); // TODO: Initialize to an appropriate value
-            string actual;
-            actual = target.Name;
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
-}
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security
+{
+    /// <summary>
+    ///This is a test class for AlgorithmTest and is intended
+    ///to contain all AlgorithmTest Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class AlgorithmTest : TestBase
+    {
+        internal virtual Algorithm CreateAlgorithm()
+        {
+            // TODO: Instantiate an appropriate concrete class.
+            Algorithm target = null;
+            return target;
+        }
+
+        /// <summary>
+        ///A test for Name
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void NameTest()
+        {
+            Algorithm target = CreateAlgorithm(); // TODO: Initialize to an appropriate value
+            string actual;
+            actual = target.Name;
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
+}

+ 74 - 74
src/Renci.SshNet.Tests/Classes/Security/CertificateHostAlgorithmTest.cs

@@ -1,74 +1,74 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security
-{
-    /// <summary>
-    ///This is a test class for CertificateHostAlgorithmTest and is intended
-    ///to contain all CertificateHostAlgorithmTest Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class CertificateHostAlgorithmTest : TestBase
-    {
-        /// <summary>
-        ///A test for CertificateHostAlgorithm Constructor
-        ///</summary>
-        [TestMethod]
-        public void CertificateHostAlgorithmConstructorTest()
-        {
-            string name = string.Empty; // TODO: Initialize to an appropriate value
-            CertificateHostAlgorithm target = new CertificateHostAlgorithm(name);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for Sign
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void SignTest()
-        {
-            string name = string.Empty; // TODO: Initialize to an appropriate value
-            CertificateHostAlgorithm target = new CertificateHostAlgorithm(name); // TODO: Initialize to an appropriate value
-            byte[] data = null; // TODO: Initialize to an appropriate value
-            byte[] expected = null; // TODO: Initialize to an appropriate value
-            byte[] actual;
-            actual = target.Sign(data);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for VerifySignature
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void VerifySignatureTest()
-        {
-            string name = string.Empty; // TODO: Initialize to an appropriate value
-            CertificateHostAlgorithm target = new CertificateHostAlgorithm(name); // TODO: Initialize to an appropriate value
-            byte[] data = null; // TODO: Initialize to an appropriate value
-            byte[] signature = null; // TODO: Initialize to an appropriate value
-            bool expected = false; // TODO: Initialize to an appropriate value
-            bool actual;
-            actual = target.VerifySignature(data, signature);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for Data
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DataTest()
-        {
-            string name = string.Empty; // TODO: Initialize to an appropriate value
-            CertificateHostAlgorithm target = new CertificateHostAlgorithm(name); // TODO: Initialize to an appropriate value
-            byte[] actual;
-            actual = target.Data;
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
-}
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security
+{
+    /// <summary>
+    ///This is a test class for CertificateHostAlgorithmTest and is intended
+    ///to contain all CertificateHostAlgorithmTest Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class CertificateHostAlgorithmTest : TestBase
+    {
+        /// <summary>
+        ///A test for CertificateHostAlgorithm Constructor
+        ///</summary>
+        [TestMethod]
+        public void CertificateHostAlgorithmConstructorTest()
+        {
+            string name = string.Empty; // TODO: Initialize to an appropriate value
+            CertificateHostAlgorithm target = new CertificateHostAlgorithm(name);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for Sign
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void SignTest()
+        {
+            string name = string.Empty; // TODO: Initialize to an appropriate value
+            CertificateHostAlgorithm target = new CertificateHostAlgorithm(name); // TODO: Initialize to an appropriate value
+            byte[] data = null; // TODO: Initialize to an appropriate value
+            byte[] expected = null; // TODO: Initialize to an appropriate value
+            byte[] actual;
+            actual = target.Sign(data);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for VerifySignature
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void VerifySignatureTest()
+        {
+            string name = string.Empty; // TODO: Initialize to an appropriate value
+            CertificateHostAlgorithm target = new CertificateHostAlgorithm(name); // TODO: Initialize to an appropriate value
+            byte[] data = null; // TODO: Initialize to an appropriate value
+            byte[] signature = null; // TODO: Initialize to an appropriate value
+            bool expected = false; // TODO: Initialize to an appropriate value
+            bool actual;
+            actual = target.VerifySignature(data, signature);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for Data
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DataTest()
+        {
+            string name = string.Empty; // TODO: Initialize to an appropriate value
+            CertificateHostAlgorithm target = new CertificateHostAlgorithm(name); // TODO: Initialize to an appropriate value
+            byte[] actual;
+            actual = target.Data;
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
+}

+ 77 - 77
src/Renci.SshNet.Tests/Classes/Security/Cryptography/BlockCipherTest.cs

@@ -1,77 +1,77 @@
-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;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography
-{
-    [TestClass]
-    public class BlockCipherTest  : TestBase
-    {
-        [TestMethod]
-        public void EncryptShouldTakeIntoAccountPaddingForLengthOfOutputBufferPassedToEncryptBlock()
-        {
-            var input = new byte[] { 0x2c, 0x1a, 0x05, 0x00, 0x68 };
-            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;
-                        }
-                };
-
-            var actual = blockCipher.Encrypt(input);
-
-            Assert.IsTrue(output.SequenceEqual(actual));
-        }
-
-        [TestMethod]
-        public void DecryptShouldTakeIntoAccountPaddingForLengthOfOutputBufferPassedToDecryptBlock()
-        {
-            var input = new byte[] { 0x2c, 0x1a, 0x05, 0x00, 0x68 };
-            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;
-                        }
-                };
-
-            var actual = blockCipher.Decrypt(input);
-
-            Assert.IsTrue(output.SequenceEqual(actual));
-        }
-
-
-        private class BlockCipherStub : BlockCipher
-        {
-            public Func<byte[], int, int, byte[], int, int> EncryptBlockDelegate;
-            public Func<byte[], int, int, byte[], int, int> DecryptBlockDelegate;
-
-            public BlockCipherStub(byte[] key, byte blockSize, CipherMode mode, CipherPadding padding) : base(key, blockSize, mode, padding)
-            {
-            }
-
-            public override int EncryptBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset)
-            {
-                return EncryptBlockDelegate(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            }
-
-            public override int DecryptBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset)
-            {
-                return DecryptBlockDelegate(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            }
-        }
-    }
-}
+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;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography
+{
+    [TestClass]
+    public class BlockCipherTest  : TestBase
+    {
+        [TestMethod]
+        public void EncryptShouldTakeIntoAccountPaddingForLengthOfOutputBufferPassedToEncryptBlock()
+        {
+            var input = new byte[] { 0x2c, 0x1a, 0x05, 0x00, 0x68 };
+            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;
+                        }
+                };
+
+            var actual = blockCipher.Encrypt(input);
+
+            Assert.IsTrue(output.SequenceEqual(actual));
+        }
+
+        [TestMethod]
+        public void DecryptShouldTakeIntoAccountPaddingForLengthOfOutputBufferPassedToDecryptBlock()
+        {
+            var input = new byte[] { 0x2c, 0x1a, 0x05, 0x00, 0x68 };
+            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;
+                        }
+                };
+
+            var actual = blockCipher.Decrypt(input);
+
+            Assert.IsTrue(output.SequenceEqual(actual));
+        }
+
+
+        private class BlockCipherStub : BlockCipher
+        {
+            public Func<byte[], int, int, byte[], int, int> EncryptBlockDelegate;
+            public Func<byte[], int, int, byte[], int, int> DecryptBlockDelegate;
+
+            public BlockCipherStub(byte[] key, byte blockSize, CipherMode mode, CipherPadding padding) : base(key, blockSize, mode, padding)
+            {
+            }
+
+            public override int EncryptBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset)
+            {
+                return EncryptBlockDelegate(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            }
+
+            public override int DecryptBlock(byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset)
+            {
+                return DecryptBlockDelegate(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            }
+        }
+    }
+}

+ 54 - 54
src/Renci.SshNet.Tests/Classes/Security/Cryptography/CipherDigitalSignatureTest.cs

@@ -1,54 +1,54 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security.Cryptography;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography
-{
-    /// <summary>
-    ///This is a test class for CipherDigitalSignatureTest and is intended
-    ///to contain all CipherDigitalSignatureTest Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class CipherDigitalSignatureTest : TestBase
-    {
-        internal virtual CipherDigitalSignature CreateCipherDigitalSignature()
-        {
-            // TODO: Instantiate an appropriate concrete class.
-            CipherDigitalSignature target = null;
-            return target;
-        }
-
-        /// <summary>
-        ///A test for Sign
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void SignTest()
-        {
-            CipherDigitalSignature target = CreateCipherDigitalSignature(); // TODO: Initialize to an appropriate value
-            byte[] input = null; // TODO: Initialize to an appropriate value
-            byte[] expected = null; // TODO: Initialize to an appropriate value
-            byte[] actual;
-            actual = target.Sign(input);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for Verify
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void VerifyTest()
-        {
-            CipherDigitalSignature target = CreateCipherDigitalSignature(); // TODO: Initialize to an appropriate value
-            byte[] input = null; // TODO: Initialize to an appropriate value
-            byte[] signature = null; // TODO: Initialize to an appropriate value
-            bool expected = false; // TODO: Initialize to an appropriate value
-            bool actual;
-            actual = target.Verify(input, signature);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
-}
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security.Cryptography;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography
+{
+    /// <summary>
+    ///This is a test class for CipherDigitalSignatureTest and is intended
+    ///to contain all CipherDigitalSignatureTest Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class CipherDigitalSignatureTest : TestBase
+    {
+        internal virtual CipherDigitalSignature CreateCipherDigitalSignature()
+        {
+            // TODO: Instantiate an appropriate concrete class.
+            CipherDigitalSignature target = null;
+            return target;
+        }
+
+        /// <summary>
+        ///A test for Sign
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void SignTest()
+        {
+            CipherDigitalSignature target = CreateCipherDigitalSignature(); // TODO: Initialize to an appropriate value
+            byte[] input = null; // TODO: Initialize to an appropriate value
+            byte[] expected = null; // TODO: Initialize to an appropriate value
+            byte[] actual;
+            actual = target.Sign(input);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for Verify
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void VerifyTest()
+        {
+            CipherDigitalSignature target = CreateCipherDigitalSignature(); // TODO: Initialize to an appropriate value
+            byte[] input = null; // TODO: Initialize to an appropriate value
+            byte[] signature = null; // TODO: Initialize to an appropriate value
+            bool expected = false; // TODO: Initialize to an appropriate value
+            bool actual;
+            actual = target.Verify(input, signature);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
+}

+ 53 - 53
src/Renci.SshNet.Tests/Classes/Security/Cryptography/CipherTest.cs

@@ -1,53 +1,53 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security.Cryptography;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography
-{
-    /// <summary>
-    ///This is a test class for CipherTest and is intended
-    ///to contain all CipherTest Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class CipherTest : TestBase
-    {
-        internal virtual Cipher CreateCipher()
-        {
-            // TODO: Instantiate an appropriate concrete class.
-            Cipher target = null;
-            return target;
-        }
-
-        /// <summary>
-        ///A test for Decrypt
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DecryptTest()
-        {
-            Cipher target = CreateCipher(); // TODO: Initialize to an appropriate value
-            byte[] input = null; // TODO: Initialize to an appropriate value
-            byte[] expected = null; // TODO: Initialize to an appropriate value
-            byte[] actual;
-            actual = target.Decrypt(input);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for Encrypt
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void EncryptTest()
-        {
-            Cipher target = CreateCipher(); // TODO: Initialize to an appropriate value
-            byte[] input = null; // TODO: Initialize to an appropriate value
-            byte[] expected = null; // TODO: Initialize to an appropriate value
-            byte[] actual;
-            actual = target.Encrypt(input);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
-}
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security.Cryptography;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography
+{
+    /// <summary>
+    ///This is a test class for CipherTest and is intended
+    ///to contain all CipherTest Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class CipherTest : TestBase
+    {
+        internal virtual Cipher CreateCipher()
+        {
+            // TODO: Instantiate an appropriate concrete class.
+            Cipher target = null;
+            return target;
+        }
+
+        /// <summary>
+        ///A test for Decrypt
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DecryptTest()
+        {
+            Cipher target = CreateCipher(); // TODO: Initialize to an appropriate value
+            byte[] input = null; // TODO: Initialize to an appropriate value
+            byte[] expected = null; // TODO: Initialize to an appropriate value
+            byte[] actual;
+            actual = target.Decrypt(input);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for Encrypt
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void EncryptTest()
+        {
+            Cipher target = CreateCipher(); // TODO: Initialize to an appropriate value
+            byte[] input = null; // TODO: Initialize to an appropriate value
+            byte[] expected = null; // TODO: Initialize to an appropriate value
+            byte[] actual;
+            actual = target.Encrypt(input);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
+}

+ 238 - 238
src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/AesCipherTest.cs

@@ -1,239 +1,239 @@
-using System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security.Cryptography.Ciphers;
-using Renci.SshNet.Security.Cryptography.Ciphers.Modes;
-using Renci.SshNet.Tests.Common;
-using Renci.SshNet.Tests.Properties;
-using System.Linq;
-using Renci.SshNet.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers
-{
-    /// <summary>
-    ///
-    /// </summary>
-    [TestClass]
-    public class AesCipherTest : TestBase
-    {
-        [TestMethod]
-        public void Test_Cipher_AES_128_CBC()
-        {
-            var input = new byte[] { 0x00, 0x00, 0x00, 0x2c, 0x1a, 0x05, 0x00, 0x00, 0x00, 0x0c, 0x73, 0x73, 0x68, 0x2d, 0x75, 0x73, 0x65, 0x72, 0x61, 0x75, 0x74, 0x68, 0x30, 0x9e, 0xe0, 0x9c, 0x12, 0xee, 0x3a, 0x30, 0x03, 0x52, 0x1c, 0x1a, 0xe7, 0x3e, 0x0b, 0x9a, 0xcf, 0x9a, 0x57, 0x42, 0x0b, 0x4f, 0x4a, 0x15, 0xa0, 0xf5 };
-            var key = new byte[] { 0xe4, 0x94, 0xf9, 0xb1, 0x00, 0x4f, 0x16, 0x2a, 0x80, 0x11, 0xea, 0x73, 0x0d, 0xb9, 0xbf, 0x64 };
-            var iv = new byte[] { 0x74, 0x8b, 0x4f, 0xe6, 0xc1, 0x29, 0xb3, 0x54, 0xec, 0x77, 0x92, 0xf3, 0x15, 0xa0, 0x41, 0xa8 };
-            var output = new byte[] { 0x19, 0x7f, 0x80, 0xd8, 0xc9, 0x89, 0xc4, 0xa7, 0xc6, 0xc6, 0x3f, 0x9f, 0x1e, 0x00, 0x1f, 0x72, 0xa7, 0x5e, 0xde, 0x40, 0x88, 0xa2, 0x72, 0xf2, 0xed, 0x3f, 0x81, 0x45, 0xb6, 0xbd, 0x45, 0x87, 0x15, 0xa5, 0x10, 0x92, 0x4a, 0x37, 0x9e, 0xa9, 0x80, 0x1c, 0x14, 0x83, 0xa3, 0x39, 0x45, 0x28 };
-            var testCipher = new AesCipher(key, new CbcCipherMode(iv), null);
-            var r = testCipher.Encrypt(input);
-
-            if (!r.SequenceEqual(output))
-                Assert.Fail("Invalid encryption");
-        }
-
-        [TestMethod]
-        public void Test_Cipher_AES_128_CTR()
-        {
-            var input = new byte[] { 0x00, 0x00, 0x00, 0x2c, 0x1a, 0x05, 0x00, 0x00, 0x00, 0x0c, 0x73, 0x73, 0x68, 0x2d, 0x75, 0x73, 0x65, 0x72, 0x61, 0x75, 0x74, 0x68, 0xb0, 0x74, 0x21, 0x87, 0x16, 0xb9, 0x69, 0x48, 0x33, 0xce, 0xb3, 0xe7, 0xdc, 0x3f, 0x50, 0xdc, 0xcc, 0xd5, 0x27, 0xb7, 0xfe, 0x7a, 0x78, 0x22, 0xae, 0xc8 };
-            var key = new byte[] { 0x17, 0x78, 0x56, 0xe1, 0x3e, 0xbd, 0x3e, 0x50, 0x1d, 0x79, 0x3f, 0x0f, 0x55, 0x37, 0x45, 0x54 };
-            var iv = new byte[] { 0xe6, 0x65, 0x36, 0x0d, 0xdd, 0xd7, 0x50, 0xc3, 0x48, 0xdb, 0x48, 0x07, 0xa1, 0x30, 0xd2, 0x38 };
-            var expected = new byte[] { 0xca, 0xfb, 0x1c, 0x49, 0xbf, 0x82, 0x2a, 0xbb, 0x1c, 0x52, 0xc7, 0x86, 0x22, 0x8a, 0xe5, 0xa4, 0xf3, 0xda, 0x4e, 0x1c, 0x3a, 0x87, 0x41, 0x1c, 0xd2, 0x6e, 0x76, 0xdc, 0xc2, 0xe9, 0xc2, 0x0e, 0xf5, 0xc7, 0xbd, 0x12, 0x85, 0xfa, 0x0e, 0xda, 0xee, 0x50, 0xd7, 0xfd, 0x81, 0x34, 0x25, 0x6d };
-            var testCipher = new AesCipher(key, new CtrCipherMode(iv), null);
-
-            var actual = testCipher.Encrypt(input);
-
-            Assert.IsTrue(actual.IsEqualTo(expected));
-        }
-
-        [TestMethod]
-        public void Decrypt_AES_128_CTR()
-        {
-            var input = new byte[] { 0x00, 0x00, 0x00, 0x2c, 0x1a, 0x05, 0x00, 0x00, 0x00, 0x0c, 0x73, 0x73, 0x68, 0x2d, 0x75, 0x73, 0x65, 0x72, 0x61, 0x75, 0x74, 0x68, 0xb0, 0x74, 0x21, 0x87, 0x16, 0xb9, 0x69, 0x48, 0x33, 0xce, 0xb3, 0xe7, 0xdc, 0x3f, 0x50, 0xdc, 0xcc, 0xd5, 0x27, 0xb7, 0xfe, 0x7a, 0x78, 0x22, 0xae, 0xc8 };
-            var key = new byte[] { 0x17, 0x78, 0x56, 0xe1, 0x3e, 0xbd, 0x3e, 0x50, 0x1d, 0x79, 0x3f, 0x0f, 0x55, 0x37, 0x45, 0x54 };
-            var iv = new byte[] { 0xe6, 0x65, 0x36, 0x0d, 0xdd, 0xd7, 0x50, 0xc3, 0x48, 0xdb, 0x48, 0x07, 0xa1, 0x30, 0xd2, 0x38 };
-            var output = new byte[] { 0xca, 0xfb, 0x1c, 0x49, 0xbf, 0x82, 0x2a, 0xbb, 0x1c, 0x52, 0xc7, 0x86, 0x22, 0x8a, 0xe5, 0xa4, 0xf3, 0xda, 0x4e, 0x1c, 0x3a, 0x87, 0x41, 0x1c, 0xd2, 0x6e, 0x76, 0xdc, 0xc2, 0xe9, 0xc2, 0x0e, 0xf5, 0xc7, 0xbd, 0x12, 0x85, 0xfa, 0x0e, 0xda, 0xee, 0x50, 0xd7, 0xfd, 0x81, 0x34, 0x25, 0x6d };
-            var testCipher = new AesCipher(key, new CtrCipherMode(iv), null);
-
-            var actual = testCipher.Decrypt(output);
-
-            Assert.IsTrue(input.IsEqualTo(actual));
-        }
-
-        [TestMethod]
-        [Owner("olegkap")]
-        [TestCategory("Cipher")]
-        [TestCategory("integration")]
-        public void Test_Cipher_AEes128CBC_Connection()
-        {
-            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
-            connectionInfo.Encryptions.Clear();
-            connectionInfo.Encryptions.Add("aes128-cbc", new CipherInfo(128, (key, iv) => { return new AesCipher(key, new CbcCipherMode(iv), null); }));
-
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-        }
-
-        [TestMethod]
-        [Owner("olegkap")]
-        [TestCategory("Cipher")]
-        [TestCategory("integration")]
-        public void Test_Cipher_Aes192CBC_Connection()
-        {
-            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
-            connectionInfo.Encryptions.Clear();
-            connectionInfo.Encryptions.Add("aes192-cbc", new CipherInfo(192, (key, iv) => { return new AesCipher(key, new CbcCipherMode(iv), null); }));
-
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-        }
-
-        [TestMethod]
-        [Owner("olegkap")]
-        [TestCategory("Cipher")]
-        [TestCategory("integration")]
-        public void Test_Cipher_Aes256CBC_Connection()
-        {
-            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
-            connectionInfo.Encryptions.Clear();
-            connectionInfo.Encryptions.Add("aes256-cbc", new CipherInfo(256, (key, iv) => { return new AesCipher(key, new CbcCipherMode(iv), null); }));
-
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-        }
-
-        [TestMethod]
-        [Owner("olegkap")]
-        [TestCategory("Cipher")]
-        [TestCategory("integration")]
-        public void Test_Cipher_Aes128CTR_Connection()
-        {
-            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
-            connectionInfo.Encryptions.Clear();
-            connectionInfo.Encryptions.Add("aes128-ctr", new CipherInfo(128, (key, iv) => { return new AesCipher(key, new CtrCipherMode(iv), null); }));
-
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-        }
-
-        [TestMethod]
-        [Owner("olegkap")]
-        [TestCategory("Cipher")]
-        [TestCategory("integration")]
-        public void Test_Cipher_Aes192CTR_Connection()
-        {
-            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
-            connectionInfo.Encryptions.Clear();
-            connectionInfo.Encryptions.Add("aes192-ctr", new CipherInfo(192, (key, iv) => { return new AesCipher(key, new CtrCipherMode(iv), null); }));
-
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-        }
-
-        [TestMethod]
-        [Owner("olegkap")]
-        [TestCategory("Cipher")]
-        [TestCategory("integration")]
-        public void Test_Cipher_Aes256CTR_Connection()
-        {
-            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
-            connectionInfo.Encryptions.Clear();
-            connectionInfo.Encryptions.Add("aes256-ctr", new CipherInfo(256, (key, iv) => { return new AesCipher(key, new CtrCipherMode(iv), null); }));
-
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-        }
-
-        [TestMethod]
-        [Owner("olegkap")]
-        [TestCategory("Cipher")]
-        [TestCategory("integration")]
-        public void Test_Cipher_Arcfour_Connection()
-        {
-            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
-            connectionInfo.Encryptions.Clear();
-            connectionInfo.Encryptions.Add("arcfour", new CipherInfo(128, (key, iv) => { return new Arc4Cipher(key, false); }));
-
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-        }
-
-        /// <summary>
-        ///A test for DecryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DecryptBlockTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            CipherMode mode = null; // TODO: Initialize to an appropriate value
-            CipherPadding padding = null; // TODO: Initialize to an appropriate value
-            AesCipher target = new AesCipher(key, mode, padding); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for AesCipher Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void AesCipherConstructorTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            CipherMode mode = null; // TODO: Initialize to an appropriate value
-            CipherPadding padding = null; // TODO: Initialize to an appropriate value
-            AesCipher target = new AesCipher(key, mode, padding);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for EncryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void EncryptBlockTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            CipherMode mode = null; // TODO: Initialize to an appropriate value
-            CipherPadding padding = null; // TODO: Initialize to an appropriate value
-            AesCipher target = new AesCipher(key, mode, padding); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
+using System;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security.Cryptography.Ciphers;
+using Renci.SshNet.Security.Cryptography.Ciphers.Modes;
+using Renci.SshNet.Tests.Common;
+using Renci.SshNet.Tests.Properties;
+using System.Linq;
+using Renci.SshNet.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers
+{
+    /// <summary>
+    ///
+    /// </summary>
+    [TestClass]
+    public class AesCipherTest : TestBase
+    {
+        [TestMethod]
+        public void Test_Cipher_AES_128_CBC()
+        {
+            var input = new byte[] { 0x00, 0x00, 0x00, 0x2c, 0x1a, 0x05, 0x00, 0x00, 0x00, 0x0c, 0x73, 0x73, 0x68, 0x2d, 0x75, 0x73, 0x65, 0x72, 0x61, 0x75, 0x74, 0x68, 0x30, 0x9e, 0xe0, 0x9c, 0x12, 0xee, 0x3a, 0x30, 0x03, 0x52, 0x1c, 0x1a, 0xe7, 0x3e, 0x0b, 0x9a, 0xcf, 0x9a, 0x57, 0x42, 0x0b, 0x4f, 0x4a, 0x15, 0xa0, 0xf5 };
+            var key = new byte[] { 0xe4, 0x94, 0xf9, 0xb1, 0x00, 0x4f, 0x16, 0x2a, 0x80, 0x11, 0xea, 0x73, 0x0d, 0xb9, 0xbf, 0x64 };
+            var iv = new byte[] { 0x74, 0x8b, 0x4f, 0xe6, 0xc1, 0x29, 0xb3, 0x54, 0xec, 0x77, 0x92, 0xf3, 0x15, 0xa0, 0x41, 0xa8 };
+            var output = new byte[] { 0x19, 0x7f, 0x80, 0xd8, 0xc9, 0x89, 0xc4, 0xa7, 0xc6, 0xc6, 0x3f, 0x9f, 0x1e, 0x00, 0x1f, 0x72, 0xa7, 0x5e, 0xde, 0x40, 0x88, 0xa2, 0x72, 0xf2, 0xed, 0x3f, 0x81, 0x45, 0xb6, 0xbd, 0x45, 0x87, 0x15, 0xa5, 0x10, 0x92, 0x4a, 0x37, 0x9e, 0xa9, 0x80, 0x1c, 0x14, 0x83, 0xa3, 0x39, 0x45, 0x28 };
+            var testCipher = new AesCipher(key, new CbcCipherMode(iv), null);
+            var r = testCipher.Encrypt(input);
+
+            if (!r.SequenceEqual(output))
+                Assert.Fail("Invalid encryption");
+        }
+
+        [TestMethod]
+        public void Test_Cipher_AES_128_CTR()
+        {
+            var input = new byte[] { 0x00, 0x00, 0x00, 0x2c, 0x1a, 0x05, 0x00, 0x00, 0x00, 0x0c, 0x73, 0x73, 0x68, 0x2d, 0x75, 0x73, 0x65, 0x72, 0x61, 0x75, 0x74, 0x68, 0xb0, 0x74, 0x21, 0x87, 0x16, 0xb9, 0x69, 0x48, 0x33, 0xce, 0xb3, 0xe7, 0xdc, 0x3f, 0x50, 0xdc, 0xcc, 0xd5, 0x27, 0xb7, 0xfe, 0x7a, 0x78, 0x22, 0xae, 0xc8 };
+            var key = new byte[] { 0x17, 0x78, 0x56, 0xe1, 0x3e, 0xbd, 0x3e, 0x50, 0x1d, 0x79, 0x3f, 0x0f, 0x55, 0x37, 0x45, 0x54 };
+            var iv = new byte[] { 0xe6, 0x65, 0x36, 0x0d, 0xdd, 0xd7, 0x50, 0xc3, 0x48, 0xdb, 0x48, 0x07, 0xa1, 0x30, 0xd2, 0x38 };
+            var expected = new byte[] { 0xca, 0xfb, 0x1c, 0x49, 0xbf, 0x82, 0x2a, 0xbb, 0x1c, 0x52, 0xc7, 0x86, 0x22, 0x8a, 0xe5, 0xa4, 0xf3, 0xda, 0x4e, 0x1c, 0x3a, 0x87, 0x41, 0x1c, 0xd2, 0x6e, 0x76, 0xdc, 0xc2, 0xe9, 0xc2, 0x0e, 0xf5, 0xc7, 0xbd, 0x12, 0x85, 0xfa, 0x0e, 0xda, 0xee, 0x50, 0xd7, 0xfd, 0x81, 0x34, 0x25, 0x6d };
+            var testCipher = new AesCipher(key, new CtrCipherMode(iv), null);
+
+            var actual = testCipher.Encrypt(input);
+
+            Assert.IsTrue(actual.IsEqualTo(expected));
+        }
+
+        [TestMethod]
+        public void Decrypt_AES_128_CTR()
+        {
+            var input = new byte[] { 0x00, 0x00, 0x00, 0x2c, 0x1a, 0x05, 0x00, 0x00, 0x00, 0x0c, 0x73, 0x73, 0x68, 0x2d, 0x75, 0x73, 0x65, 0x72, 0x61, 0x75, 0x74, 0x68, 0xb0, 0x74, 0x21, 0x87, 0x16, 0xb9, 0x69, 0x48, 0x33, 0xce, 0xb3, 0xe7, 0xdc, 0x3f, 0x50, 0xdc, 0xcc, 0xd5, 0x27, 0xb7, 0xfe, 0x7a, 0x78, 0x22, 0xae, 0xc8 };
+            var key = new byte[] { 0x17, 0x78, 0x56, 0xe1, 0x3e, 0xbd, 0x3e, 0x50, 0x1d, 0x79, 0x3f, 0x0f, 0x55, 0x37, 0x45, 0x54 };
+            var iv = new byte[] { 0xe6, 0x65, 0x36, 0x0d, 0xdd, 0xd7, 0x50, 0xc3, 0x48, 0xdb, 0x48, 0x07, 0xa1, 0x30, 0xd2, 0x38 };
+            var output = new byte[] { 0xca, 0xfb, 0x1c, 0x49, 0xbf, 0x82, 0x2a, 0xbb, 0x1c, 0x52, 0xc7, 0x86, 0x22, 0x8a, 0xe5, 0xa4, 0xf3, 0xda, 0x4e, 0x1c, 0x3a, 0x87, 0x41, 0x1c, 0xd2, 0x6e, 0x76, 0xdc, 0xc2, 0xe9, 0xc2, 0x0e, 0xf5, 0xc7, 0xbd, 0x12, 0x85, 0xfa, 0x0e, 0xda, 0xee, 0x50, 0xd7, 0xfd, 0x81, 0x34, 0x25, 0x6d };
+            var testCipher = new AesCipher(key, new CtrCipherMode(iv), null);
+
+            var actual = testCipher.Decrypt(output);
+
+            Assert.IsTrue(input.IsEqualTo(actual));
+        }
+
+        [TestMethod]
+        [Owner("olegkap")]
+        [TestCategory("Cipher")]
+        [TestCategory("integration")]
+        public void Test_Cipher_AEes128CBC_Connection()
+        {
+            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
+            connectionInfo.Encryptions.Clear();
+            connectionInfo.Encryptions.Add("aes128-cbc", new CipherInfo(128, (key, iv) => { return new AesCipher(key, new CbcCipherMode(iv), null); }));
+
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+        }
+
+        [TestMethod]
+        [Owner("olegkap")]
+        [TestCategory("Cipher")]
+        [TestCategory("integration")]
+        public void Test_Cipher_Aes192CBC_Connection()
+        {
+            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
+            connectionInfo.Encryptions.Clear();
+            connectionInfo.Encryptions.Add("aes192-cbc", new CipherInfo(192, (key, iv) => { return new AesCipher(key, new CbcCipherMode(iv), null); }));
+
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+        }
+
+        [TestMethod]
+        [Owner("olegkap")]
+        [TestCategory("Cipher")]
+        [TestCategory("integration")]
+        public void Test_Cipher_Aes256CBC_Connection()
+        {
+            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
+            connectionInfo.Encryptions.Clear();
+            connectionInfo.Encryptions.Add("aes256-cbc", new CipherInfo(256, (key, iv) => { return new AesCipher(key, new CbcCipherMode(iv), null); }));
+
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+        }
+
+        [TestMethod]
+        [Owner("olegkap")]
+        [TestCategory("Cipher")]
+        [TestCategory("integration")]
+        public void Test_Cipher_Aes128CTR_Connection()
+        {
+            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
+            connectionInfo.Encryptions.Clear();
+            connectionInfo.Encryptions.Add("aes128-ctr", new CipherInfo(128, (key, iv) => { return new AesCipher(key, new CtrCipherMode(iv), null); }));
+
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+        }
+
+        [TestMethod]
+        [Owner("olegkap")]
+        [TestCategory("Cipher")]
+        [TestCategory("integration")]
+        public void Test_Cipher_Aes192CTR_Connection()
+        {
+            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
+            connectionInfo.Encryptions.Clear();
+            connectionInfo.Encryptions.Add("aes192-ctr", new CipherInfo(192, (key, iv) => { return new AesCipher(key, new CtrCipherMode(iv), null); }));
+
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+        }
+
+        [TestMethod]
+        [Owner("olegkap")]
+        [TestCategory("Cipher")]
+        [TestCategory("integration")]
+        public void Test_Cipher_Aes256CTR_Connection()
+        {
+            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
+            connectionInfo.Encryptions.Clear();
+            connectionInfo.Encryptions.Add("aes256-ctr", new CipherInfo(256, (key, iv) => { return new AesCipher(key, new CtrCipherMode(iv), null); }));
+
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+        }
+
+        [TestMethod]
+        [Owner("olegkap")]
+        [TestCategory("Cipher")]
+        [TestCategory("integration")]
+        public void Test_Cipher_Arcfour_Connection()
+        {
+            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
+            connectionInfo.Encryptions.Clear();
+            connectionInfo.Encryptions.Add("arcfour", new CipherInfo(128, (key, iv) => { return new Arc4Cipher(key, false); }));
+
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+        }
+
+        /// <summary>
+        ///A test for DecryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DecryptBlockTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            CipherMode mode = null; // TODO: Initialize to an appropriate value
+            CipherPadding padding = null; // TODO: Initialize to an appropriate value
+            AesCipher target = new AesCipher(key, mode, padding); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for AesCipher Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void AesCipherConstructorTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            CipherMode mode = null; // TODO: Initialize to an appropriate value
+            CipherPadding padding = null; // TODO: Initialize to an appropriate value
+            AesCipher target = new AesCipher(key, mode, padding);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for EncryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void EncryptBlockTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            CipherMode mode = null; // TODO: Initialize to an appropriate value
+            CipherPadding padding = null; // TODO: Initialize to an appropriate value
+            AesCipher target = new AesCipher(key, mode, padding); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
 }

+ 176 - 176
src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Arc4CipherTest.cs

@@ -1,177 +1,177 @@
-using System.Text;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Common;
-using Renci.SshNet.Security.Cryptography.Ciphers;
-using Renci.SshNet.Tests.Common;
-using Renci.SshNet.Tests.Properties;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers
-{
-    /// <summary>
-    /// Implements ARCH4 cipher algorithm
-    /// </summary>
-    [TestClass]
-    public class Arc4CipherTest : TestBase
-    {
-        /// <summary>
-        ///A test for Arc4Cipher Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void Arc4CipherConstructorTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            Arc4Cipher target = new Arc4Cipher(key, true);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        [TestMethod]
-        public void Decrypt_DischargeFirstBytes_False1()
-        {
-            const string key = "Key";
-            const string expectedPlainText = "Plaintext";
-            var encoding = Encoding.ASCII;
-            var cipher = new Arc4Cipher(encoding.GetBytes(key), false);
-            var cipherText = new byte[] { 0xBB, 0xF3, 0x16, 0xE8, 0xD9, 0x40, 0xAF, 0x0A, 0xD3 };
-
-            var actualPlainText = cipher.Decrypt(cipherText);
-
-            Assert.AreEqual(expectedPlainText, encoding.GetString(actualPlainText));
-        }
-
-        [TestMethod]
-        public void Decrypt_DischargeFirstBytes_False2()
-        {
-            const string key = "Wiki";
-            const string expectedPlainText = "pedia";
-            var encoding = Encoding.ASCII;
-            var cipher = new Arc4Cipher(encoding.GetBytes(key), false);
-            var cipherText = new byte[] { 0x10, 0X21, 0xBF, 0x04, 0x20 };
-
-            var actualPlainText = cipher.Decrypt(cipherText);
-
-            Assert.AreEqual(expectedPlainText, encoding.GetString(actualPlainText));
-        }
-
-        /// <summary>
-        ///A test for DecryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DecryptBlockTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            Arc4Cipher target = new Arc4Cipher(key, true); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        [TestMethod]
-        public void Encrypt_DischargeFirstBytes_False1()
-        {
-            const string key = "Key";
-            const string plainText = "Plaintext";
-            var encoding = Encoding.ASCII;
-            var cipher = new Arc4Cipher(encoding.GetBytes(key), false);
-            var expectedCipherText = new byte[] { 0xBB, 0xF3, 0x16, 0xE8, 0xD9, 0x40, 0xAF, 0x0A, 0xD3 };
-
-            var actualCipherText = cipher.Encrypt(encoding.GetBytes(plainText));
-
-            Assert.IsNotNull(actualCipherText);
-            Assert.AreEqual(expectedCipherText.Length, actualCipherText.Length);
-            Assert.AreEqual(expectedCipherText[0], actualCipherText[0]);
-            Assert.AreEqual(expectedCipherText[1], actualCipherText[1]);
-            Assert.AreEqual(expectedCipherText[2], actualCipherText[2]);
-            Assert.AreEqual(expectedCipherText[3], actualCipherText[3]);
-            Assert.AreEqual(expectedCipherText[4], actualCipherText[4]);
-            Assert.AreEqual(expectedCipherText[5], actualCipherText[5]);
-            Assert.AreEqual(expectedCipherText[6], actualCipherText[6]);
-            Assert.AreEqual(expectedCipherText[7], actualCipherText[7]);
-            Assert.AreEqual(expectedCipherText[8], actualCipherText[8]);
-        }
-
-        [TestMethod]
-        public void Encrypt_DischargeFirstBytes_False2()
-        {
-            const string key = "Wiki";
-            const string plainText = "pedia";
-            var encoding = Encoding.ASCII;
-            var cipher = new Arc4Cipher(encoding.GetBytes(key), false);
-            var expectedCipherText = new byte[] { 0x10, 0X21, 0xBF, 0x04, 0x20 };
-
-            var actualCipherText = cipher.Encrypt(encoding.GetBytes(plainText));
-
-            Assert.IsNotNull(actualCipherText);
-            Assert.AreEqual(expectedCipherText.Length, actualCipherText.Length);
-            Assert.AreEqual(expectedCipherText[0], actualCipherText[0]);
-            Assert.AreEqual(expectedCipherText[1], actualCipherText[1]);
-            Assert.AreEqual(expectedCipherText[2], actualCipherText[2]);
-            Assert.AreEqual(expectedCipherText[3], actualCipherText[3]);
-            Assert.AreEqual(expectedCipherText[4], actualCipherText[4]);
-        }
-
-        /// <summary>
-        ///A test for EncryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void EncryptBlockTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            Arc4Cipher target = new Arc4Cipher(key, true); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        [TestMethod]
-        [Owner("olegkap")]
-        [TestCategory("Cipher")]
-        [TestCategory("integration")]
-        public void Test_Cipher_Arcfour128_Connection()
-        {
-            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
-            connectionInfo.Encryptions.Clear();
-            connectionInfo.Encryptions.Add("arcfour128", new CipherInfo(128, (key, iv) => { return new Arc4Cipher(key, true); }));
-
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-        }
-
-        [TestMethod]
-        [Owner("olegkap")]
-        [TestCategory("Cipher")]
-        [TestCategory("integration")]
-        public void Test_Cipher_Arcfour256_Connection()
-        {
-            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
-            connectionInfo.Encryptions.Clear();
-            connectionInfo.Encryptions.Add("arcfour256", new CipherInfo(256, (key, iv) => { return new Arc4Cipher(key, true); }));
-
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-        }
-
-    }
+using System.Text;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Common;
+using Renci.SshNet.Security.Cryptography.Ciphers;
+using Renci.SshNet.Tests.Common;
+using Renci.SshNet.Tests.Properties;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers
+{
+    /// <summary>
+    /// Implements ARCH4 cipher algorithm
+    /// </summary>
+    [TestClass]
+    public class Arc4CipherTest : TestBase
+    {
+        /// <summary>
+        ///A test for Arc4Cipher Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void Arc4CipherConstructorTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            Arc4Cipher target = new Arc4Cipher(key, true);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        [TestMethod]
+        public void Decrypt_DischargeFirstBytes_False1()
+        {
+            const string key = "Key";
+            const string expectedPlainText = "Plaintext";
+            var encoding = Encoding.ASCII;
+            var cipher = new Arc4Cipher(encoding.GetBytes(key), false);
+            var cipherText = new byte[] { 0xBB, 0xF3, 0x16, 0xE8, 0xD9, 0x40, 0xAF, 0x0A, 0xD3 };
+
+            var actualPlainText = cipher.Decrypt(cipherText);
+
+            Assert.AreEqual(expectedPlainText, encoding.GetString(actualPlainText));
+        }
+
+        [TestMethod]
+        public void Decrypt_DischargeFirstBytes_False2()
+        {
+            const string key = "Wiki";
+            const string expectedPlainText = "pedia";
+            var encoding = Encoding.ASCII;
+            var cipher = new Arc4Cipher(encoding.GetBytes(key), false);
+            var cipherText = new byte[] { 0x10, 0X21, 0xBF, 0x04, 0x20 };
+
+            var actualPlainText = cipher.Decrypt(cipherText);
+
+            Assert.AreEqual(expectedPlainText, encoding.GetString(actualPlainText));
+        }
+
+        /// <summary>
+        ///A test for DecryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DecryptBlockTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            Arc4Cipher target = new Arc4Cipher(key, true); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        [TestMethod]
+        public void Encrypt_DischargeFirstBytes_False1()
+        {
+            const string key = "Key";
+            const string plainText = "Plaintext";
+            var encoding = Encoding.ASCII;
+            var cipher = new Arc4Cipher(encoding.GetBytes(key), false);
+            var expectedCipherText = new byte[] { 0xBB, 0xF3, 0x16, 0xE8, 0xD9, 0x40, 0xAF, 0x0A, 0xD3 };
+
+            var actualCipherText = cipher.Encrypt(encoding.GetBytes(plainText));
+
+            Assert.IsNotNull(actualCipherText);
+            Assert.AreEqual(expectedCipherText.Length, actualCipherText.Length);
+            Assert.AreEqual(expectedCipherText[0], actualCipherText[0]);
+            Assert.AreEqual(expectedCipherText[1], actualCipherText[1]);
+            Assert.AreEqual(expectedCipherText[2], actualCipherText[2]);
+            Assert.AreEqual(expectedCipherText[3], actualCipherText[3]);
+            Assert.AreEqual(expectedCipherText[4], actualCipherText[4]);
+            Assert.AreEqual(expectedCipherText[5], actualCipherText[5]);
+            Assert.AreEqual(expectedCipherText[6], actualCipherText[6]);
+            Assert.AreEqual(expectedCipherText[7], actualCipherText[7]);
+            Assert.AreEqual(expectedCipherText[8], actualCipherText[8]);
+        }
+
+        [TestMethod]
+        public void Encrypt_DischargeFirstBytes_False2()
+        {
+            const string key = "Wiki";
+            const string plainText = "pedia";
+            var encoding = Encoding.ASCII;
+            var cipher = new Arc4Cipher(encoding.GetBytes(key), false);
+            var expectedCipherText = new byte[] { 0x10, 0X21, 0xBF, 0x04, 0x20 };
+
+            var actualCipherText = cipher.Encrypt(encoding.GetBytes(plainText));
+
+            Assert.IsNotNull(actualCipherText);
+            Assert.AreEqual(expectedCipherText.Length, actualCipherText.Length);
+            Assert.AreEqual(expectedCipherText[0], actualCipherText[0]);
+            Assert.AreEqual(expectedCipherText[1], actualCipherText[1]);
+            Assert.AreEqual(expectedCipherText[2], actualCipherText[2]);
+            Assert.AreEqual(expectedCipherText[3], actualCipherText[3]);
+            Assert.AreEqual(expectedCipherText[4], actualCipherText[4]);
+        }
+
+        /// <summary>
+        ///A test for EncryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void EncryptBlockTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            Arc4Cipher target = new Arc4Cipher(key, true); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        [TestMethod]
+        [Owner("olegkap")]
+        [TestCategory("Cipher")]
+        [TestCategory("integration")]
+        public void Test_Cipher_Arcfour128_Connection()
+        {
+            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
+            connectionInfo.Encryptions.Clear();
+            connectionInfo.Encryptions.Add("arcfour128", new CipherInfo(128, (key, iv) => { return new Arc4Cipher(key, true); }));
+
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+        }
+
+        [TestMethod]
+        [Owner("olegkap")]
+        [TestCategory("Cipher")]
+        [TestCategory("integration")]
+        public void Test_Cipher_Arcfour256_Connection()
+        {
+            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
+            connectionInfo.Encryptions.Clear();
+            connectionInfo.Encryptions.Add("arcfour256", new CipherInfo(256, (key, iv) => { return new Arc4Cipher(key, true); }));
+
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+        }
+
+    }
 }

+ 107 - 107
src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/BlowfishCipherTest.cs

@@ -1,108 +1,108 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security.Cryptography.Ciphers;
-using Renci.SshNet.Security.Cryptography.Ciphers.Modes;
-using Renci.SshNet.Tests.Common;
-using Renci.SshNet.Tests.Properties;
-using System.Linq;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers
-{
-    /// <summary>
-    ///
-    /// </summary>
-    [TestClass]
-    public class BlowfishCipherTest : TestBase
-    {
-        [TestMethod]
-        public void Test_Cipher_Blowfish_128_CBC()
-        {
-            var input = new byte[] { 0x00, 0x00, 0x00, 0x2c, 0x1a, 0x05, 0x00, 0x00, 0x00, 0x0c, 0x73, 0x73, 0x68, 0x2d, 0x75, 0x73, 0x65, 0x72, 0x61, 0x75, 0x74, 0x68, 0x30, 0x9e, 0xe0, 0x9c, 0x12, 0xee, 0x3a, 0x30, 0x03, 0x52, 0x1c, 0x1a, 0xe7, 0x3e, 0x0b, 0x9a, 0xcf, 0x9a, 0x57, 0x42, 0x0b, 0x4f, 0x4a, 0x15, 0xa0, 0xf5 };
-            var key = new byte[] { 0xe4, 0x94, 0xf9, 0xb1, 0x00, 0x4f, 0x16, 0x2a, 0x80, 0x11, 0xea, 0x73, 0x0d, 0xb9, 0xbf, 0x64 };
-            var iv = new byte[] { 0x74, 0x8b, 0x4f, 0xe6, 0xc1, 0x29, 0xb3, 0x54, 0xec, 0x77, 0x92, 0xf3, 0x15, 0xa0, 0x41, 0xa8 };
-            var output = new byte[] { 0x50, 0x49, 0xe0, 0xce, 0x98, 0x93, 0x8b, 0xec, 0x82, 0x7d, 0x14, 0x1b, 0x3e, 0xdc, 0xca, 0x63, 0xef, 0x36, 0x20, 0x67, 0x58, 0x63, 0x1f, 0x9c, 0xd2, 0x12, 0x6b, 0xca, 0xea, 0xd0, 0x78, 0x8b, 0x61, 0x50, 0x4f, 0xc4, 0x5b, 0x32, 0x91, 0xd6, 0x65, 0xcb, 0x74, 0xe5, 0x6e, 0xf5, 0xde, 0x14 };
-            var testCipher = new Renci.SshNet.Security.Cryptography.Ciphers.BlowfishCipher(key, new Renci.SshNet.Security.Cryptography.Ciphers.Modes.CbcCipherMode(iv), null);
-            var r = testCipher.Encrypt(input);
-
-            if (!r.SequenceEqual(output))
-                Assert.Fail("Invalid encryption");
-        }
-
-        [TestMethod]
-        [Owner("olegkap")]
-        [TestCategory("Cipher")]
-        [TestCategory("integration")]
-        public void Test_Cipher_BlowfishCBC_Connection()
-        {
-            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
-            connectionInfo.Encryptions.Clear();
-            connectionInfo.Encryptions.Add("blowfish-cbc", new CipherInfo(128, (key, iv) => { return new BlowfishCipher(key, new CbcCipherMode(iv), null); }));
-
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-        }
-
-        /// <summary>
-        ///A test for BlowfishCipher Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void BlowfishCipherConstructorTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            CipherMode mode = null; // TODO: Initialize to an appropriate value
-            CipherPadding padding = null; // TODO: Initialize to an appropriate value
-            BlowfishCipher target = new BlowfishCipher(key, mode, padding);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for DecryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DecryptBlockTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            CipherMode mode = null; // TODO: Initialize to an appropriate value
-            CipherPadding padding = null; // TODO: Initialize to an appropriate value
-            BlowfishCipher target = new BlowfishCipher(key, mode, padding); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for EncryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void EncryptBlockTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            CipherMode mode = null; // TODO: Initialize to an appropriate value
-            CipherPadding padding = null; // TODO: Initialize to an appropriate value
-            BlowfishCipher target = new BlowfishCipher(key, mode, padding); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security.Cryptography.Ciphers;
+using Renci.SshNet.Security.Cryptography.Ciphers.Modes;
+using Renci.SshNet.Tests.Common;
+using Renci.SshNet.Tests.Properties;
+using System.Linq;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers
+{
+    /// <summary>
+    ///
+    /// </summary>
+    [TestClass]
+    public class BlowfishCipherTest : TestBase
+    {
+        [TestMethod]
+        public void Test_Cipher_Blowfish_128_CBC()
+        {
+            var input = new byte[] { 0x00, 0x00, 0x00, 0x2c, 0x1a, 0x05, 0x00, 0x00, 0x00, 0x0c, 0x73, 0x73, 0x68, 0x2d, 0x75, 0x73, 0x65, 0x72, 0x61, 0x75, 0x74, 0x68, 0x30, 0x9e, 0xe0, 0x9c, 0x12, 0xee, 0x3a, 0x30, 0x03, 0x52, 0x1c, 0x1a, 0xe7, 0x3e, 0x0b, 0x9a, 0xcf, 0x9a, 0x57, 0x42, 0x0b, 0x4f, 0x4a, 0x15, 0xa0, 0xf5 };
+            var key = new byte[] { 0xe4, 0x94, 0xf9, 0xb1, 0x00, 0x4f, 0x16, 0x2a, 0x80, 0x11, 0xea, 0x73, 0x0d, 0xb9, 0xbf, 0x64 };
+            var iv = new byte[] { 0x74, 0x8b, 0x4f, 0xe6, 0xc1, 0x29, 0xb3, 0x54, 0xec, 0x77, 0x92, 0xf3, 0x15, 0xa0, 0x41, 0xa8 };
+            var output = new byte[] { 0x50, 0x49, 0xe0, 0xce, 0x98, 0x93, 0x8b, 0xec, 0x82, 0x7d, 0x14, 0x1b, 0x3e, 0xdc, 0xca, 0x63, 0xef, 0x36, 0x20, 0x67, 0x58, 0x63, 0x1f, 0x9c, 0xd2, 0x12, 0x6b, 0xca, 0xea, 0xd0, 0x78, 0x8b, 0x61, 0x50, 0x4f, 0xc4, 0x5b, 0x32, 0x91, 0xd6, 0x65, 0xcb, 0x74, 0xe5, 0x6e, 0xf5, 0xde, 0x14 };
+            var testCipher = new Renci.SshNet.Security.Cryptography.Ciphers.BlowfishCipher(key, new Renci.SshNet.Security.Cryptography.Ciphers.Modes.CbcCipherMode(iv), null);
+            var r = testCipher.Encrypt(input);
+
+            if (!r.SequenceEqual(output))
+                Assert.Fail("Invalid encryption");
+        }
+
+        [TestMethod]
+        [Owner("olegkap")]
+        [TestCategory("Cipher")]
+        [TestCategory("integration")]
+        public void Test_Cipher_BlowfishCBC_Connection()
+        {
+            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
+            connectionInfo.Encryptions.Clear();
+            connectionInfo.Encryptions.Add("blowfish-cbc", new CipherInfo(128, (key, iv) => { return new BlowfishCipher(key, new CbcCipherMode(iv), null); }));
+
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+        }
+
+        /// <summary>
+        ///A test for BlowfishCipher Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void BlowfishCipherConstructorTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            CipherMode mode = null; // TODO: Initialize to an appropriate value
+            CipherPadding padding = null; // TODO: Initialize to an appropriate value
+            BlowfishCipher target = new BlowfishCipher(key, mode, padding);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for DecryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DecryptBlockTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            CipherMode mode = null; // TODO: Initialize to an appropriate value
+            CipherPadding padding = null; // TODO: Initialize to an appropriate value
+            BlowfishCipher target = new BlowfishCipher(key, mode, padding); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for EncryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void EncryptBlockTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            CipherMode mode = null; // TODO: Initialize to an appropriate value
+            CipherPadding padding = null; // TODO: Initialize to an appropriate value
+            BlowfishCipher target = new BlowfishCipher(key, mode, padding); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+    }
 }

+ 105 - 105
src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/CastCipherTest.cs

@@ -1,106 +1,106 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security.Cryptography.Ciphers;
-using Renci.SshNet.Security.Cryptography.Ciphers.Modes;
-using Renci.SshNet.Tests.Common;
-using Renci.SshNet.Tests.Properties;
-using System.Linq;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers
-{
-    /// <summary>
-    /// Implements CAST cipher algorithm
-    /// </summary>
-    [TestClass]
-    public class CastCipherTest : TestBase
-    {
-        [TestMethod]
-        public void Test_Cipher_CastCipher_128_CBC()
-        {
-            var input = new byte[] { 0x00, 0x00, 0x00, 0x2c, 0x1a, 0x05, 0x00, 0x00, 0x00, 0x0c, 0x73, 0x73, 0x68, 0x2d, 0x75, 0x73, 0x65, 0x72, 0x61, 0x75, 0x74, 0x68, 0x30, 0x9e, 0xe0, 0x9c, 0x12, 0xee, 0x3a, 0x30, 0x03, 0x52, 0x1c, 0x1a, 0xe7, 0x3e, 0x0b, 0x9a, 0xcf, 0x9a, 0x57, 0x42, 0x0b, 0x4f, 0x4a, 0x15, 0xa0, 0xf5 };
-            var key = new byte[] { 0xe4, 0x94, 0xf9, 0xb1, 0x00, 0x4f, 0x16, 0x2a, 0x80, 0x11, 0xea, 0x73, 0x0d, 0xb9, 0xbf, 0x64 };
-            var iv = new byte[] { 0x74, 0x8b, 0x4f, 0xe6, 0xc1, 0x29, 0xb3, 0x54, 0xec, 0x77, 0x92, 0xf3, 0x15, 0xa0, 0x41, 0xa8 };
-            var output = new byte[] { 0x32, 0xef, 0xbd, 0xac, 0xb6, 0xfd, 0x1f, 0xae, 0x1b, 0x13, 0x5f, 0x31, 0x6d, 0x38, 0xcd, 0xb0, 0xe3, 0xca, 0xe1, 0xbc, 0xf8, 0xa7, 0xc2, 0x31, 0x62, 0x14, 0x3a, 0x9a, 0xda, 0xe3, 0xf8, 0xc8, 0x70, 0x87, 0x53, 0x21, 0x5d, 0xb7, 0x94, 0xb7, 0xe8, 0xc6, 0x9d, 0x46, 0x0c, 0x6d, 0x64, 0x6d };
-            var testCipher = new Renci.SshNet.Security.Cryptography.Ciphers.CastCipher(key, new Renci.SshNet.Security.Cryptography.Ciphers.Modes.CbcCipherMode(iv), null);
-            var r = testCipher.Encrypt(input);
-
-            if (!r.SequenceEqual(output))
-                Assert.Fail("Invalid encryption");
-        }
-
-        [TestMethod]
-        [Owner("olegkap")]
-        [TestCategory("Cipher")]
-        [TestCategory("integration")]
-        public void Test_Cipher_Cast128CBC_Connection()
-        {
-            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
-            connectionInfo.Encryptions.Clear();
-            connectionInfo.Encryptions.Add("cast128-cbc", new CipherInfo(128, (key, iv) => { return new CastCipher(key, new CbcCipherMode(iv), null); }));
-
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-        }
-        /// <summary>
-        ///A test for CastCipher Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void CastCipherConstructorTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            CipherMode mode = null; // TODO: Initialize to an appropriate value
-            CipherPadding padding = null; // TODO: Initialize to an appropriate value
-            CastCipher target = new CastCipher(key, mode, padding);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for DecryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DecryptBlockTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            CipherMode mode = null; // TODO: Initialize to an appropriate value
-            CipherPadding padding = null; // TODO: Initialize to an appropriate value
-            CastCipher target = new CastCipher(key, mode, padding); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for EncryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void EncryptBlockTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            CipherMode mode = null; // TODO: Initialize to an appropriate value
-            CipherPadding padding = null; // TODO: Initialize to an appropriate value
-            CastCipher target = new CastCipher(key, mode, padding); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security.Cryptography.Ciphers;
+using Renci.SshNet.Security.Cryptography.Ciphers.Modes;
+using Renci.SshNet.Tests.Common;
+using Renci.SshNet.Tests.Properties;
+using System.Linq;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers
+{
+    /// <summary>
+    /// Implements CAST cipher algorithm
+    /// </summary>
+    [TestClass]
+    public class CastCipherTest : TestBase
+    {
+        [TestMethod]
+        public void Test_Cipher_CastCipher_128_CBC()
+        {
+            var input = new byte[] { 0x00, 0x00, 0x00, 0x2c, 0x1a, 0x05, 0x00, 0x00, 0x00, 0x0c, 0x73, 0x73, 0x68, 0x2d, 0x75, 0x73, 0x65, 0x72, 0x61, 0x75, 0x74, 0x68, 0x30, 0x9e, 0xe0, 0x9c, 0x12, 0xee, 0x3a, 0x30, 0x03, 0x52, 0x1c, 0x1a, 0xe7, 0x3e, 0x0b, 0x9a, 0xcf, 0x9a, 0x57, 0x42, 0x0b, 0x4f, 0x4a, 0x15, 0xa0, 0xf5 };
+            var key = new byte[] { 0xe4, 0x94, 0xf9, 0xb1, 0x00, 0x4f, 0x16, 0x2a, 0x80, 0x11, 0xea, 0x73, 0x0d, 0xb9, 0xbf, 0x64 };
+            var iv = new byte[] { 0x74, 0x8b, 0x4f, 0xe6, 0xc1, 0x29, 0xb3, 0x54, 0xec, 0x77, 0x92, 0xf3, 0x15, 0xa0, 0x41, 0xa8 };
+            var output = new byte[] { 0x32, 0xef, 0xbd, 0xac, 0xb6, 0xfd, 0x1f, 0xae, 0x1b, 0x13, 0x5f, 0x31, 0x6d, 0x38, 0xcd, 0xb0, 0xe3, 0xca, 0xe1, 0xbc, 0xf8, 0xa7, 0xc2, 0x31, 0x62, 0x14, 0x3a, 0x9a, 0xda, 0xe3, 0xf8, 0xc8, 0x70, 0x87, 0x53, 0x21, 0x5d, 0xb7, 0x94, 0xb7, 0xe8, 0xc6, 0x9d, 0x46, 0x0c, 0x6d, 0x64, 0x6d };
+            var testCipher = new Renci.SshNet.Security.Cryptography.Ciphers.CastCipher(key, new Renci.SshNet.Security.Cryptography.Ciphers.Modes.CbcCipherMode(iv), null);
+            var r = testCipher.Encrypt(input);
+
+            if (!r.SequenceEqual(output))
+                Assert.Fail("Invalid encryption");
+        }
+
+        [TestMethod]
+        [Owner("olegkap")]
+        [TestCategory("Cipher")]
+        [TestCategory("integration")]
+        public void Test_Cipher_Cast128CBC_Connection()
+        {
+            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
+            connectionInfo.Encryptions.Clear();
+            connectionInfo.Encryptions.Add("cast128-cbc", new CipherInfo(128, (key, iv) => { return new CastCipher(key, new CbcCipherMode(iv), null); }));
+
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+        }
+        /// <summary>
+        ///A test for CastCipher Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void CastCipherConstructorTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            CipherMode mode = null; // TODO: Initialize to an appropriate value
+            CipherPadding padding = null; // TODO: Initialize to an appropriate value
+            CastCipher target = new CastCipher(key, mode, padding);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for DecryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DecryptBlockTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            CipherMode mode = null; // TODO: Initialize to an appropriate value
+            CipherPadding padding = null; // TODO: Initialize to an appropriate value
+            CastCipher target = new CastCipher(key, mode, padding); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for EncryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void EncryptBlockTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            CipherMode mode = null; // TODO: Initialize to an appropriate value
+            CipherPadding padding = null; // TODO: Initialize to an appropriate value
+            CastCipher target = new CastCipher(key, mode, padding); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
 }

+ 61 - 61
src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/CipherModeTest.cs

@@ -1,61 +1,61 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security.Cryptography.Ciphers;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers
-{
-    /// <summary>
-    ///This is a test class for CipherModeTest and is intended
-    ///to contain all CipherModeTest Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class CipherModeTest : TestBase
-    {
-        internal virtual CipherMode CreateCipherMode()
-        {
-            // TODO: Instantiate an appropriate concrete class.
-            CipherMode target = null;
-            return target;
-        }
-
-        /// <summary>
-        ///A test for DecryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DecryptBlockTest()
-        {
-            CipherMode target = CreateCipherMode(); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for EncryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void EncryptBlockTest()
-        {
-            CipherMode target = CreateCipherMode(); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
-}
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security.Cryptography.Ciphers;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers
+{
+    /// <summary>
+    ///This is a test class for CipherModeTest and is intended
+    ///to contain all CipherModeTest Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class CipherModeTest : TestBase
+    {
+        internal virtual CipherMode CreateCipherMode()
+        {
+            // TODO: Instantiate an appropriate concrete class.
+            CipherMode target = null;
+            return target;
+        }
+
+        /// <summary>
+        ///A test for DecryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DecryptBlockTest()
+        {
+            CipherMode target = CreateCipherMode(); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for EncryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void EncryptBlockTest()
+        {
+            CipherMode target = CreateCipherMode(); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
+}

+ 38 - 38
src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/CipherPaddingTest.cs

@@ -1,38 +1,38 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security.Cryptography.Ciphers;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers
-{
-    /// <summary>
-    ///This is a test class for CipherPaddingTest and is intended
-    ///to contain all CipherPaddingTest Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class CipherPaddingTest : TestBase
-    {
-        internal virtual CipherPadding CreateCipherPadding()
-        {
-            // TODO: Instantiate an appropriate concrete class.
-            CipherPadding target = null;
-            return target;
-        }
-
-        /// <summary>
-        ///A test for Pad
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void PadTest()
-        {
-            CipherPadding target = CreateCipherPadding(); // TODO: Initialize to an appropriate value
-            int blockSize = 0; // TODO: Initialize to an appropriate value
-            byte[] input = null; // TODO: Initialize to an appropriate value
-            byte[] expected = null; // TODO: Initialize to an appropriate value
-            byte[] actual;
-            actual = target.Pad(blockSize, input);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
-}
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security.Cryptography.Ciphers;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers
+{
+    /// <summary>
+    ///This is a test class for CipherPaddingTest and is intended
+    ///to contain all CipherPaddingTest Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class CipherPaddingTest : TestBase
+    {
+        internal virtual CipherPadding CreateCipherPadding()
+        {
+            // TODO: Instantiate an appropriate concrete class.
+            CipherPadding target = null;
+            return target;
+        }
+
+        /// <summary>
+        ///A test for Pad
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void PadTest()
+        {
+            CipherPadding target = CreateCipherPadding(); // TODO: Initialize to an appropriate value
+            int blockSize = 0; // TODO: Initialize to an appropriate value
+            byte[] input = null; // TODO: Initialize to an appropriate value
+            byte[] expected = null; // TODO: Initialize to an appropriate value
+            byte[] actual;
+            actual = target.Pad(blockSize, input);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
+}

+ 72 - 72
src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/DesCipherTest.cs

@@ -1,73 +1,73 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security.Cryptography.Ciphers;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers
-{
-    /// <summary>
-    /// Implements DES cipher algorithm.
-    /// </summary>
-    [TestClass]
-    public class DesCipherTest : TestBase
-    {
-        /// <summary>
-        ///A test for DesCipher Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DesCipherConstructorTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            CipherMode mode = null; // TODO: Initialize to an appropriate value
-            CipherPadding padding = null; // TODO: Initialize to an appropriate value
-            DesCipher target = new DesCipher(key, mode, padding);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for DecryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DecryptBlockTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            CipherMode mode = null; // TODO: Initialize to an appropriate value
-            CipherPadding padding = null; // TODO: Initialize to an appropriate value
-            DesCipher target = new DesCipher(key, mode, padding); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for EncryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void EncryptBlockTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            CipherMode mode = null; // TODO: Initialize to an appropriate value
-            CipherPadding padding = null; // TODO: Initialize to an appropriate value
-            DesCipher target = new DesCipher(key, mode, padding); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security.Cryptography.Ciphers;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers
+{
+    /// <summary>
+    /// Implements DES cipher algorithm.
+    /// </summary>
+    [TestClass]
+    public class DesCipherTest : TestBase
+    {
+        /// <summary>
+        ///A test for DesCipher Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DesCipherConstructorTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            CipherMode mode = null; // TODO: Initialize to an appropriate value
+            CipherPadding padding = null; // TODO: Initialize to an appropriate value
+            DesCipher target = new DesCipher(key, mode, padding);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for DecryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DecryptBlockTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            CipherMode mode = null; // TODO: Initialize to an appropriate value
+            CipherPadding padding = null; // TODO: Initialize to an appropriate value
+            DesCipher target = new DesCipher(key, mode, padding); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for EncryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void EncryptBlockTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            CipherMode mode = null; // TODO: Initialize to an appropriate value
+            CipherPadding padding = null; // TODO: Initialize to an appropriate value
+            DesCipher target = new DesCipher(key, mode, padding); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
 }

+ 67 - 67
src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Modes/CbcCipherModeTest.cs

@@ -1,67 +1,67 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security.Cryptography.Ciphers.Modes;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers.Modes
-{
-    /// <summary>
-    ///This is a test class for CbcCipherModeTest and is intended
-    ///to contain all CbcCipherModeTest Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class CbcCipherModeTest : TestBase
-    {
-        /// <summary>
-        ///A test for EncryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void EncryptBlockTest()
-        {
-            byte[] iv = null; // TODO: Initialize to an appropriate value
-            CbcCipherMode target = new CbcCipherMode(iv); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for DecryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DecryptBlockTest()
-        {
-            byte[] iv = null; // TODO: Initialize to an appropriate value
-            CbcCipherMode target = new CbcCipherMode(iv); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for CbcCipherMode Constructor
-        ///</summary>
-        [TestMethod()]
-        public void CbcCipherModeConstructorTest()
-        {
-            byte[] iv = null; // TODO: Initialize to an appropriate value
-            CbcCipherMode target = new CbcCipherMode(iv);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-    }
-}
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security.Cryptography.Ciphers.Modes;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers.Modes
+{
+    /// <summary>
+    ///This is a test class for CbcCipherModeTest and is intended
+    ///to contain all CbcCipherModeTest Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class CbcCipherModeTest : TestBase
+    {
+        /// <summary>
+        ///A test for EncryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void EncryptBlockTest()
+        {
+            byte[] iv = null; // TODO: Initialize to an appropriate value
+            CbcCipherMode target = new CbcCipherMode(iv); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for DecryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DecryptBlockTest()
+        {
+            byte[] iv = null; // TODO: Initialize to an appropriate value
+            CbcCipherMode target = new CbcCipherMode(iv); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for CbcCipherMode Constructor
+        ///</summary>
+        [TestMethod()]
+        public void CbcCipherModeConstructorTest()
+        {
+            byte[] iv = null; // TODO: Initialize to an appropriate value
+            CbcCipherMode target = new CbcCipherMode(iv);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+    }
+}

+ 68 - 68
src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Modes/CfbCipherModeTest.cs

@@ -1,68 +1,68 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security.Cryptography.Ciphers.Modes;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers.Modes
-{
-    /// <summary>
-    ///This is a test class for CfbCipherModeTest and is intended
-    ///to contain all CfbCipherModeTest Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class CfbCipherModeTest : TestBase
-    {
-        /// <summary>
-        ///A test for EncryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void EncryptBlockTest()
-        {
-            byte[] iv = null; // TODO: Initialize to an appropriate value
-            CfbCipherMode target = new CfbCipherMode(iv); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for DecryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DecryptBlockTest()
-        {
-            byte[] iv = null; // TODO: Initialize to an appropriate value
-            CfbCipherMode target = new CfbCipherMode(iv); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for CfbCipherMode Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void CfbCipherModeConstructorTest()
-        {
-            byte[] iv = null; // TODO: Initialize to an appropriate value
-            CfbCipherMode target = new CfbCipherMode(iv);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-    }
-}
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security.Cryptography.Ciphers.Modes;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers.Modes
+{
+    /// <summary>
+    ///This is a test class for CfbCipherModeTest and is intended
+    ///to contain all CfbCipherModeTest Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class CfbCipherModeTest : TestBase
+    {
+        /// <summary>
+        ///A test for EncryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void EncryptBlockTest()
+        {
+            byte[] iv = null; // TODO: Initialize to an appropriate value
+            CfbCipherMode target = new CfbCipherMode(iv); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for DecryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DecryptBlockTest()
+        {
+            byte[] iv = null; // TODO: Initialize to an appropriate value
+            CfbCipherMode target = new CfbCipherMode(iv); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for CfbCipherMode Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void CfbCipherModeConstructorTest()
+        {
+            byte[] iv = null; // TODO: Initialize to an appropriate value
+            CfbCipherMode target = new CfbCipherMode(iv);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+    }
+}

+ 68 - 68
src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Modes/CtrCipherModeTest.cs

@@ -1,68 +1,68 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security.Cryptography.Ciphers.Modes;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers.Modes
-{
-    /// <summary>
-    ///This is a test class for CtrCipherModeTest and is intended
-    ///to contain all CtrCipherModeTest Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class CtrCipherModeTest : TestBase
-    {
-        /// <summary>
-        ///A test for EncryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void EncryptBlockTest()
-        {
-            byte[] iv = null; // TODO: Initialize to an appropriate value
-            CtrCipherMode target = new CtrCipherMode(iv); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for DecryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DecryptBlockTest()
-        {
-            byte[] iv = null; // TODO: Initialize to an appropriate value
-            CtrCipherMode target = new CtrCipherMode(iv); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for CtrCipherMode Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void CtrCipherModeConstructorTest()
-        {
-            byte[] iv = null; // TODO: Initialize to an appropriate value
-            CtrCipherMode target = new CtrCipherMode(iv);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-    }
-}
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security.Cryptography.Ciphers.Modes;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers.Modes
+{
+    /// <summary>
+    ///This is a test class for CtrCipherModeTest and is intended
+    ///to contain all CtrCipherModeTest Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class CtrCipherModeTest : TestBase
+    {
+        /// <summary>
+        ///A test for EncryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void EncryptBlockTest()
+        {
+            byte[] iv = null; // TODO: Initialize to an appropriate value
+            CtrCipherMode target = new CtrCipherMode(iv); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for DecryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DecryptBlockTest()
+        {
+            byte[] iv = null; // TODO: Initialize to an appropriate value
+            CtrCipherMode target = new CtrCipherMode(iv); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for CtrCipherMode Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void CtrCipherModeConstructorTest()
+        {
+            byte[] iv = null; // TODO: Initialize to an appropriate value
+            CtrCipherMode target = new CtrCipherMode(iv);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+    }
+}

+ 68 - 68
src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Modes/OfbCipherModeTest.cs

@@ -1,68 +1,68 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security.Cryptography.Ciphers.Modes;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers.Modes
-{
-    /// <summary>
-    ///This is a test class for OfbCipherModeTest and is intended
-    ///to contain all OfbCipherModeTest Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class OfbCipherModeTest : TestBase
-    {
-        /// <summary>
-        ///A test for EncryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void EncryptBlockTest()
-        {
-            byte[] iv = null; // TODO: Initialize to an appropriate value
-            OfbCipherMode target = new OfbCipherMode(iv); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for DecryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DecryptBlockTest()
-        {
-            byte[] iv = null; // TODO: Initialize to an appropriate value
-            OfbCipherMode target = new OfbCipherMode(iv); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for OfbCipherMode Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void OfbCipherModeConstructorTest()
-        {
-            byte[] iv = null; // TODO: Initialize to an appropriate value
-            OfbCipherMode target = new OfbCipherMode(iv);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-    }
-}
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security.Cryptography.Ciphers.Modes;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers.Modes
+{
+    /// <summary>
+    ///This is a test class for OfbCipherModeTest and is intended
+    ///to contain all OfbCipherModeTest Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class OfbCipherModeTest : TestBase
+    {
+        /// <summary>
+        ///A test for EncryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void EncryptBlockTest()
+        {
+            byte[] iv = null; // TODO: Initialize to an appropriate value
+            OfbCipherMode target = new OfbCipherMode(iv); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for DecryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DecryptBlockTest()
+        {
+            byte[] iv = null; // TODO: Initialize to an appropriate value
+            OfbCipherMode target = new OfbCipherMode(iv); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for OfbCipherMode Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void OfbCipherModeConstructorTest()
+        {
+            byte[] iv = null; // TODO: Initialize to an appropriate value
+            OfbCipherMode target = new OfbCipherMode(iv);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+    }
+}

+ 41 - 41
src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Paddings/PKCS5PaddingTest.cs

@@ -1,41 +1,41 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security.Cryptography.Ciphers.Paddings;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers.Paddings
-{
-    /// <summary>
-    ///This is a test class for PKCS5PaddingTest and is intended
-    ///to contain all PKCS5PaddingTest Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class PKCS5PaddingTest : TestBase
-    {
-        /// <summary>
-        ///A test for Pad
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void PadTest()
-        {
-            PKCS5Padding target = new PKCS5Padding(); // TODO: Initialize to an appropriate value
-            int blockSize = 0; // TODO: Initialize to an appropriate value
-            byte[] input = null; // TODO: Initialize to an appropriate value
-            byte[] expected = null; // TODO: Initialize to an appropriate value
-            byte[] actual;
-            actual = target.Pad(blockSize, input);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for PKCS5Padding Constructor
-        ///</summary>
-        [TestMethod()]
-        public void PKCS5PaddingConstructorTest()
-        {
-            PKCS5Padding target = new PKCS5Padding();
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-    }
-}
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security.Cryptography.Ciphers.Paddings;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers.Paddings
+{
+    /// <summary>
+    ///This is a test class for PKCS5PaddingTest and is intended
+    ///to contain all PKCS5PaddingTest Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class PKCS5PaddingTest : TestBase
+    {
+        /// <summary>
+        ///A test for Pad
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void PadTest()
+        {
+            PKCS5Padding target = new PKCS5Padding(); // TODO: Initialize to an appropriate value
+            int blockSize = 0; // TODO: Initialize to an appropriate value
+            byte[] input = null; // TODO: Initialize to an appropriate value
+            byte[] expected = null; // TODO: Initialize to an appropriate value
+            byte[] actual;
+            actual = target.Pad(blockSize, input);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for PKCS5Padding Constructor
+        ///</summary>
+        [TestMethod()]
+        public void PKCS5PaddingConstructorTest()
+        {
+            PKCS5Padding target = new PKCS5Padding();
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+    }
+}

+ 41 - 41
src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/Paddings/PKCS7PaddingTest.cs

@@ -1,41 +1,41 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security.Cryptography.Ciphers.Paddings;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers.Paddings
-{
-    /// <summary>
-    ///This is a test class for PKCS7PaddingTest and is intended
-    ///to contain all PKCS7PaddingTest Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class PKCS7PaddingTest : TestBase
-    {
-        /// <summary>
-        ///A test for Pad
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void PadTest()
-        {
-            PKCS7Padding target = new PKCS7Padding(); // TODO: Initialize to an appropriate value
-            int blockSize = 0; // TODO: Initialize to an appropriate value
-            byte[] input = null; // TODO: Initialize to an appropriate value
-            byte[] expected = null; // TODO: Initialize to an appropriate value
-            byte[] actual;
-            actual = target.Pad(blockSize, input);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for PKCS7Padding Constructor
-        ///</summary>
-        [TestMethod()]
-        public void PKCS7PaddingConstructorTest()
-        {
-            PKCS7Padding target = new PKCS7Padding();
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-    }
-}
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security.Cryptography.Ciphers.Paddings;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers.Paddings
+{
+    /// <summary>
+    ///This is a test class for PKCS7PaddingTest and is intended
+    ///to contain all PKCS7PaddingTest Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class PKCS7PaddingTest : TestBase
+    {
+        /// <summary>
+        ///A test for Pad
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void PadTest()
+        {
+            PKCS7Padding target = new PKCS7Padding(); // TODO: Initialize to an appropriate value
+            int blockSize = 0; // TODO: Initialize to an appropriate value
+            byte[] input = null; // TODO: Initialize to an appropriate value
+            byte[] expected = null; // TODO: Initialize to an appropriate value
+            byte[] actual;
+            actual = target.Pad(blockSize, input);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for PKCS7Padding Constructor
+        ///</summary>
+        [TestMethod()]
+        public void PKCS7PaddingConstructorTest()
+        {
+            PKCS7Padding target = new PKCS7Padding();
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+    }
+}

+ 59 - 59
src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/RsaCipherTest.cs

@@ -1,60 +1,60 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security;
-using Renci.SshNet.Security.Cryptography.Ciphers;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers
-{
-    /// <summary>
-    /// Implements RSA cipher algorithm.
-    /// </summary>
-    [TestClass]
-    public class RsaCipherTest : TestBase
-    {
-        /// <summary>
-        ///A test for RsaCipher Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void RsaCipherConstructorTest()
-        {
-            RsaKey key = null; // TODO: Initialize to an appropriate value
-            RsaCipher target = new RsaCipher(key);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for Decrypt
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DecryptTest()
-        {
-            RsaKey key = null; // TODO: Initialize to an appropriate value
-            RsaCipher target = new RsaCipher(key); // TODO: Initialize to an appropriate value
-            byte[] data = null; // TODO: Initialize to an appropriate value
-            byte[] expected = null; // TODO: Initialize to an appropriate value
-            byte[] actual;
-            actual = target.Decrypt(data);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for Encrypt
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void EncryptTest()
-        {
-            RsaKey key = null; // TODO: Initialize to an appropriate value
-            RsaCipher target = new RsaCipher(key); // TODO: Initialize to an appropriate value
-            byte[] data = null; // TODO: Initialize to an appropriate value
-            byte[] expected = null; // TODO: Initialize to an appropriate value
-            byte[] actual;
-            actual = target.Encrypt(data);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security;
+using Renci.SshNet.Security.Cryptography.Ciphers;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers
+{
+    /// <summary>
+    /// Implements RSA cipher algorithm.
+    /// </summary>
+    [TestClass]
+    public class RsaCipherTest : TestBase
+    {
+        /// <summary>
+        ///A test for RsaCipher Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void RsaCipherConstructorTest()
+        {
+            RsaKey key = null; // TODO: Initialize to an appropriate value
+            RsaCipher target = new RsaCipher(key);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for Decrypt
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DecryptTest()
+        {
+            RsaKey key = null; // TODO: Initialize to an appropriate value
+            RsaCipher target = new RsaCipher(key); // TODO: Initialize to an appropriate value
+            byte[] data = null; // TODO: Initialize to an appropriate value
+            byte[] expected = null; // TODO: Initialize to an appropriate value
+            byte[] actual;
+            actual = target.Decrypt(data);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for Encrypt
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void EncryptTest()
+        {
+            RsaKey key = null; // TODO: Initialize to an appropriate value
+            RsaCipher target = new RsaCipher(key); // TODO: Initialize to an appropriate value
+            byte[] data = null; // TODO: Initialize to an appropriate value
+            byte[] expected = null; // TODO: Initialize to an appropriate value
+            byte[] actual;
+            actual = target.Encrypt(data);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
 }

+ 72 - 72
src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/SerpentCipherTest.cs

@@ -1,73 +1,73 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security.Cryptography.Ciphers;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers
-{
-    /// <summary>
-    /// Implements Serpent cipher algorithm.
-    /// </summary>
-    [TestClass]
-    public class SerpentCipherTest : TestBase
-    {
-        /// <summary>
-        ///A test for SerpentCipher Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void SerpentCipherConstructorTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            CipherMode mode = null; // TODO: Initialize to an appropriate value
-            CipherPadding padding = null; // TODO: Initialize to an appropriate value
-            SerpentCipher target = new SerpentCipher(key, mode, padding);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for DecryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DecryptBlockTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            CipherMode mode = null; // TODO: Initialize to an appropriate value
-            CipherPadding padding = null; // TODO: Initialize to an appropriate value
-            SerpentCipher target = new SerpentCipher(key, mode, padding); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for EncryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void EncryptBlockTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            CipherMode mode = null; // TODO: Initialize to an appropriate value
-            CipherPadding padding = null; // TODO: Initialize to an appropriate value
-            SerpentCipher target = new SerpentCipher(key, mode, padding); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security.Cryptography.Ciphers;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers
+{
+    /// <summary>
+    /// Implements Serpent cipher algorithm.
+    /// </summary>
+    [TestClass]
+    public class SerpentCipherTest : TestBase
+    {
+        /// <summary>
+        ///A test for SerpentCipher Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void SerpentCipherConstructorTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            CipherMode mode = null; // TODO: Initialize to an appropriate value
+            CipherPadding padding = null; // TODO: Initialize to an appropriate value
+            SerpentCipher target = new SerpentCipher(key, mode, padding);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for DecryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DecryptBlockTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            CipherMode mode = null; // TODO: Initialize to an appropriate value
+            CipherPadding padding = null; // TODO: Initialize to an appropriate value
+            SerpentCipher target = new SerpentCipher(key, mode, padding); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for EncryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void EncryptBlockTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            CipherMode mode = null; // TODO: Initialize to an appropriate value
+            CipherPadding padding = null; // TODO: Initialize to an appropriate value
+            SerpentCipher target = new SerpentCipher(key, mode, padding); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
 }

+ 105 - 105
src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/TripleDesCipherTest.cs

@@ -1,106 +1,106 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security.Cryptography.Ciphers;
-using Renci.SshNet.Security.Cryptography.Ciphers.Modes;
-using Renci.SshNet.Tests.Common;
-using Renci.SshNet.Tests.Properties;
-using System.Linq;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers
-{
-    /// <summary>
-    /// Implements 3DES cipher algorithm.
-    /// </summary>
-    [TestClass]
-    public class TripleDesCipherTest : TestBase
-    {
-        [TestMethod]
-        public void Test_Cipher_3DES_CBC()
-        {
-            var input = new byte[] { 0x00, 0x00, 0x00, 0x1c, 0x0a, 0x05, 0x00, 0x00, 0x00, 0x0c, 0x73, 0x73, 0x68, 0x2d, 0x75, 0x73, 0x65, 0x72, 0x61, 0x75, 0x74, 0x68, 0x72, 0x4e, 0x06, 0x08, 0x28, 0x2d, 0xaa, 0xe2, 0xb3, 0xd9 };
-            var key = new byte[] { 0x78, 0xf6, 0xc6, 0xbb, 0x57, 0x03, 0x69, 0xca, 0xba, 0x31, 0x18, 0x2f, 0x2f, 0x4c, 0x35, 0x34, 0x64, 0x06, 0x85, 0x30, 0xbe, 0x78, 0x60, 0xb3 };
-            var iv = new byte[] { 0xc0, 0x75, 0xf2, 0x26, 0x0a, 0x2a, 0x42, 0x96 };
-            var output = new byte[] { 0x28, 0x77, 0x2f, 0x07, 0x3e, 0xc2, 0x27, 0xa6, 0xdb, 0x36, 0x4d, 0xc6, 0x7a, 0x26, 0x7a, 0x38, 0xe6, 0x54, 0x0b, 0xab, 0x07, 0x87, 0xf0, 0xa4, 0x73, 0x1f, 0xde, 0xe6, 0x81, 0x1d, 0x4b, 0x4b };
-            var testCipher = new Renci.SshNet.Security.Cryptography.Ciphers.TripleDesCipher(key, new Renci.SshNet.Security.Cryptography.Ciphers.Modes.CbcCipherMode(iv), null);
-            var r = testCipher.Encrypt(input);
-
-            if (!r.SequenceEqual(output))
-                Assert.Fail("Invalid encryption");
-        }
-
-        [TestMethod]
-        [Owner("olegkap")]
-        [TestCategory("Cipher")]
-        [TestCategory("integration")]
-        public void Test_Cipher_TripleDESCBC_Connection()
-        {
-            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
-            connectionInfo.Encryptions.Clear();
-            connectionInfo.Encryptions.Add("3des-cbc", new CipherInfo(192, (key, iv) => { return new TripleDesCipher(key, new CbcCipherMode(iv), null); }));
-
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-        }
-        /// <summary>
-        ///A test for TripleDesCipher Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void TripleDesCipherConstructorTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            CipherMode mode = null; // TODO: Initialize to an appropriate value
-            CipherPadding padding = null; // TODO: Initialize to an appropriate value
-            TripleDesCipher target = new TripleDesCipher(key, mode, padding);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for DecryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DecryptBlockTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            CipherMode mode = null; // TODO: Initialize to an appropriate value
-            CipherPadding padding = null; // TODO: Initialize to an appropriate value
-            TripleDesCipher target = new TripleDesCipher(key, mode, padding); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for EncryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void EncryptBlockTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            CipherMode mode = null; // TODO: Initialize to an appropriate value
-            CipherPadding padding = null; // TODO: Initialize to an appropriate value
-            TripleDesCipher target = new TripleDesCipher(key, mode, padding); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security.Cryptography.Ciphers;
+using Renci.SshNet.Security.Cryptography.Ciphers.Modes;
+using Renci.SshNet.Tests.Common;
+using Renci.SshNet.Tests.Properties;
+using System.Linq;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers
+{
+    /// <summary>
+    /// Implements 3DES cipher algorithm.
+    /// </summary>
+    [TestClass]
+    public class TripleDesCipherTest : TestBase
+    {
+        [TestMethod]
+        public void Test_Cipher_3DES_CBC()
+        {
+            var input = new byte[] { 0x00, 0x00, 0x00, 0x1c, 0x0a, 0x05, 0x00, 0x00, 0x00, 0x0c, 0x73, 0x73, 0x68, 0x2d, 0x75, 0x73, 0x65, 0x72, 0x61, 0x75, 0x74, 0x68, 0x72, 0x4e, 0x06, 0x08, 0x28, 0x2d, 0xaa, 0xe2, 0xb3, 0xd9 };
+            var key = new byte[] { 0x78, 0xf6, 0xc6, 0xbb, 0x57, 0x03, 0x69, 0xca, 0xba, 0x31, 0x18, 0x2f, 0x2f, 0x4c, 0x35, 0x34, 0x64, 0x06, 0x85, 0x30, 0xbe, 0x78, 0x60, 0xb3 };
+            var iv = new byte[] { 0xc0, 0x75, 0xf2, 0x26, 0x0a, 0x2a, 0x42, 0x96 };
+            var output = new byte[] { 0x28, 0x77, 0x2f, 0x07, 0x3e, 0xc2, 0x27, 0xa6, 0xdb, 0x36, 0x4d, 0xc6, 0x7a, 0x26, 0x7a, 0x38, 0xe6, 0x54, 0x0b, 0xab, 0x07, 0x87, 0xf0, 0xa4, 0x73, 0x1f, 0xde, 0xe6, 0x81, 0x1d, 0x4b, 0x4b };
+            var testCipher = new Renci.SshNet.Security.Cryptography.Ciphers.TripleDesCipher(key, new Renci.SshNet.Security.Cryptography.Ciphers.Modes.CbcCipherMode(iv), null);
+            var r = testCipher.Encrypt(input);
+
+            if (!r.SequenceEqual(output))
+                Assert.Fail("Invalid encryption");
+        }
+
+        [TestMethod]
+        [Owner("olegkap")]
+        [TestCategory("Cipher")]
+        [TestCategory("integration")]
+        public void Test_Cipher_TripleDESCBC_Connection()
+        {
+            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
+            connectionInfo.Encryptions.Clear();
+            connectionInfo.Encryptions.Add("3des-cbc", new CipherInfo(192, (key, iv) => { return new TripleDesCipher(key, new CbcCipherMode(iv), null); }));
+
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+        }
+        /// <summary>
+        ///A test for TripleDesCipher Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void TripleDesCipherConstructorTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            CipherMode mode = null; // TODO: Initialize to an appropriate value
+            CipherPadding padding = null; // TODO: Initialize to an appropriate value
+            TripleDesCipher target = new TripleDesCipher(key, mode, padding);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for DecryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DecryptBlockTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            CipherMode mode = null; // TODO: Initialize to an appropriate value
+            CipherPadding padding = null; // TODO: Initialize to an appropriate value
+            TripleDesCipher target = new TripleDesCipher(key, mode, padding); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for EncryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void EncryptBlockTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            CipherMode mode = null; // TODO: Initialize to an appropriate value
+            CipherPadding padding = null; // TODO: Initialize to an appropriate value
+            TripleDesCipher target = new TripleDesCipher(key, mode, padding); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
 }

+ 72 - 72
src/Renci.SshNet.Tests/Classes/Security/Cryptography/Ciphers/TwofishCipherTest.cs

@@ -1,73 +1,73 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security.Cryptography.Ciphers;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers
-{
-    /// <summary>
-    /// Implements Twofish cipher algorithm
-    /// </summary>
-    [TestClass]
-    public class TwofishCipherTest : TestBase
-    {
-        /// <summary>
-        ///A test for TwofishCipher Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void TwofishCipherConstructorTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            CipherMode mode = null; // TODO: Initialize to an appropriate value
-            CipherPadding padding = null; // TODO: Initialize to an appropriate value
-            TwofishCipher target = new TwofishCipher(key, mode, padding);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for DecryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DecryptBlockTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            CipherMode mode = null; // TODO: Initialize to an appropriate value
-            CipherPadding padding = null; // TODO: Initialize to an appropriate value
-            TwofishCipher target = new TwofishCipher(key, mode, padding); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for EncryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void EncryptBlockTest()
-        {
-            byte[] key = null; // TODO: Initialize to an appropriate value
-            CipherMode mode = null; // TODO: Initialize to an appropriate value
-            CipherPadding padding = null; // TODO: Initialize to an appropriate value
-            TwofishCipher target = new TwofishCipher(key, mode, padding); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security.Cryptography.Ciphers;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography.Ciphers
+{
+    /// <summary>
+    /// Implements Twofish cipher algorithm
+    /// </summary>
+    [TestClass]
+    public class TwofishCipherTest : TestBase
+    {
+        /// <summary>
+        ///A test for TwofishCipher Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void TwofishCipherConstructorTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            CipherMode mode = null; // TODO: Initialize to an appropriate value
+            CipherPadding padding = null; // TODO: Initialize to an appropriate value
+            TwofishCipher target = new TwofishCipher(key, mode, padding);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for DecryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DecryptBlockTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            CipherMode mode = null; // TODO: Initialize to an appropriate value
+            CipherPadding padding = null; // TODO: Initialize to an appropriate value
+            TwofishCipher target = new TwofishCipher(key, mode, padding); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for EncryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void EncryptBlockTest()
+        {
+            byte[] key = null; // TODO: Initialize to an appropriate value
+            CipherMode mode = null; // TODO: Initialize to an appropriate value
+            CipherPadding padding = null; // TODO: Initialize to an appropriate value
+            TwofishCipher target = new TwofishCipher(key, mode, padding); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
 }

+ 54 - 54
src/Renci.SshNet.Tests/Classes/Security/Cryptography/DigitalSignatureTest.cs

@@ -1,54 +1,54 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security.Cryptography;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography
-{
-    /// <summary>
-    ///This is a test class for DigitalSignatureTest and is intended
-    ///to contain all DigitalSignatureTest Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class DigitalSignatureTest : TestBase
-    {
-        internal virtual DigitalSignature CreateDigitalSignature()
-        {
-            // TODO: Instantiate an appropriate concrete class.
-            DigitalSignature target = null;
-            return target;
-        }
-
-        /// <summary>
-        ///A test for Sign
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void SignTest()
-        {
-            DigitalSignature target = CreateDigitalSignature(); // TODO: Initialize to an appropriate value
-            byte[] input = null; // TODO: Initialize to an appropriate value
-            byte[] expected = null; // TODO: Initialize to an appropriate value
-            byte[] actual;
-            actual = target.Sign(input);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for Verify
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void VerifyTest()
-        {
-            DigitalSignature target = CreateDigitalSignature(); // TODO: Initialize to an appropriate value
-            byte[] input = null; // TODO: Initialize to an appropriate value
-            byte[] signature = null; // TODO: Initialize to an appropriate value
-            bool expected = false; // TODO: Initialize to an appropriate value
-            bool actual;
-            actual = target.Verify(input, signature);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
-}
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security.Cryptography;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography
+{
+    /// <summary>
+    ///This is a test class for DigitalSignatureTest and is intended
+    ///to contain all DigitalSignatureTest Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class DigitalSignatureTest : TestBase
+    {
+        internal virtual DigitalSignature CreateDigitalSignature()
+        {
+            // TODO: Instantiate an appropriate concrete class.
+            DigitalSignature target = null;
+            return target;
+        }
+
+        /// <summary>
+        ///A test for Sign
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void SignTest()
+        {
+            DigitalSignature target = CreateDigitalSignature(); // TODO: Initialize to an appropriate value
+            byte[] input = null; // TODO: Initialize to an appropriate value
+            byte[] expected = null; // TODO: Initialize to an appropriate value
+            byte[] actual;
+            actual = target.Sign(input);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for Verify
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void VerifyTest()
+        {
+            DigitalSignature target = CreateDigitalSignature(); // TODO: Initialize to an appropriate value
+            byte[] input = null; // TODO: Initialize to an appropriate value
+            byte[] signature = null; // TODO: Initialize to an appropriate value
+            bool expected = false; // TODO: Initialize to an appropriate value
+            bool actual;
+            actual = target.Verify(input, signature);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
+}

+ 73 - 73
src/Renci.SshNet.Tests/Classes/Security/Cryptography/DsaDigitalSignatureTest.cs

@@ -1,74 +1,74 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security;
-using Renci.SshNet.Security.Cryptography;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography
-{
-    /// <summary>
-    /// Implements DSA digital signature algorithm.
-    /// </summary>
-    [TestClass]
-    public class DsaDigitalSignatureTest : TestBase
-    {
-        /// <summary>
-        ///A test for DsaDigitalSignature Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DsaDigitalSignatureConstructorTest()
-        {
-            DsaKey key = null; // TODO: Initialize to an appropriate value
-            DsaDigitalSignature target = new DsaDigitalSignature(key);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for Dispose
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DisposeTest()
-        {
-            DsaKey key = null; // TODO: Initialize to an appropriate value
-            DsaDigitalSignature target = new DsaDigitalSignature(key); // TODO: Initialize to an appropriate value
-            target.Dispose();
-            Assert.Inconclusive("A method that does not return a value cannot be verified.");
-        }
-
-        /// <summary>
-        ///A test for Sign
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void SignTest()
-        {
-            DsaKey key = null; // TODO: Initialize to an appropriate value
-            DsaDigitalSignature target = new DsaDigitalSignature(key); // TODO: Initialize to an appropriate value
-            byte[] input = null; // TODO: Initialize to an appropriate value
-            byte[] expected = null; // TODO: Initialize to an appropriate value
-            byte[] actual;
-            actual = target.Sign(input);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for Verify
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void VerifyTest()
-        {
-            DsaKey key = null; // TODO: Initialize to an appropriate value
-            DsaDigitalSignature target = new DsaDigitalSignature(key); // TODO: Initialize to an appropriate value
-            byte[] input = null; // TODO: Initialize to an appropriate value
-            byte[] signature = null; // TODO: Initialize to an appropriate value
-            bool expected = false; // TODO: Initialize to an appropriate value
-            bool actual;
-            actual = target.Verify(input, signature);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security;
+using Renci.SshNet.Security.Cryptography;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography
+{
+    /// <summary>
+    /// Implements DSA digital signature algorithm.
+    /// </summary>
+    [TestClass]
+    public class DsaDigitalSignatureTest : TestBase
+    {
+        /// <summary>
+        ///A test for DsaDigitalSignature Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DsaDigitalSignatureConstructorTest()
+        {
+            DsaKey key = null; // TODO: Initialize to an appropriate value
+            DsaDigitalSignature target = new DsaDigitalSignature(key);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for Dispose
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DisposeTest()
+        {
+            DsaKey key = null; // TODO: Initialize to an appropriate value
+            DsaDigitalSignature target = new DsaDigitalSignature(key); // TODO: Initialize to an appropriate value
+            target.Dispose();
+            Assert.Inconclusive("A method that does not return a value cannot be verified.");
+        }
+
+        /// <summary>
+        ///A test for Sign
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void SignTest()
+        {
+            DsaKey key = null; // TODO: Initialize to an appropriate value
+            DsaDigitalSignature target = new DsaDigitalSignature(key); // TODO: Initialize to an appropriate value
+            byte[] input = null; // TODO: Initialize to an appropriate value
+            byte[] expected = null; // TODO: Initialize to an appropriate value
+            byte[] actual;
+            actual = target.Sign(input);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for Verify
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void VerifyTest()
+        {
+            DsaKey key = null; // TODO: Initialize to an appropriate value
+            DsaDigitalSignature target = new DsaDigitalSignature(key); // TODO: Initialize to an appropriate value
+            byte[] input = null; // TODO: Initialize to an appropriate value
+            byte[] signature = null; // TODO: Initialize to an appropriate value
+            bool expected = false; // TODO: Initialize to an appropriate value
+            bool actual;
+            actual = target.Verify(input, signature);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
 }

+ 151 - 151
src/Renci.SshNet.Tests/Classes/Security/Cryptography/DsaKeyTest.cs

@@ -1,151 +1,151 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Common;
-using Renci.SshNet.Security;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography
-{
-    /// <summary>
-    ///This is a test class for DsaKeyTest and is intended
-    ///to contain all DsaKeyTest Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class DsaKeyTest : TestBase
-    {
-        /// <summary>
-        ///A test for DsaKey Constructor
-        ///</summary>
-        [TestMethod()]
-        public void DsaKeyConstructorTest()
-        {
-            DsaKey target = new DsaKey();
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for DsaKey Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DsaKeyConstructorTest1()
-        {
-            byte[] data = null; // TODO: Initialize to an appropriate value
-            DsaKey target = new DsaKey(data);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for DsaKey Constructor
-        ///</summary>
-        [TestMethod()]
-        public void DsaKeyConstructorTest2()
-        {
-            BigInteger p = new BigInteger(); // TODO: Initialize to an appropriate value
-            BigInteger q = new BigInteger(); // TODO: Initialize to an appropriate value
-            BigInteger g = new BigInteger(); // TODO: Initialize to an appropriate value
-            BigInteger y = new BigInteger(); // TODO: Initialize to an appropriate value
-            BigInteger x = new BigInteger(); // TODO: Initialize to an appropriate value
-            DsaKey target = new DsaKey(p, q, g, y, x);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for Dispose
-        ///</summary>
-        [TestMethod()]
-        public void DisposeTest()
-        {
-            DsaKey target = new DsaKey(); // TODO: Initialize to an appropriate value
-            target.Dispose();
-            Assert.Inconclusive("A method that does not return a value cannot be verified.");
-        }
-
-        /// <summary>
-        ///A test for G
-        ///</summary>
-        [TestMethod()]
-        public void GTest()
-        {
-            DsaKey target = new DsaKey(); // TODO: Initialize to an appropriate value
-            BigInteger actual;
-            actual = target.G;
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for KeyLength
-        ///</summary>
-        [TestMethod()]
-        public void KeyLengthTest()
-        {
-            DsaKey target = new DsaKey(); // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.KeyLength;
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for P
-        ///</summary>
-        [TestMethod()]
-        public void PTest()
-        {
-            DsaKey target = new DsaKey(); // TODO: Initialize to an appropriate value
-            BigInteger actual;
-            actual = target.P;
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for Public
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void PublicTest()
-        {
-            DsaKey target = new DsaKey(); // TODO: Initialize to an appropriate value
-            BigInteger[] expected = null; // TODO: Initialize to an appropriate value
-            BigInteger[] actual;
-            target.Public = expected;
-            actual = target.Public;
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for Q
-        ///</summary>
-        [TestMethod()]
-        public void QTest()
-        {
-            DsaKey target = new DsaKey(); // TODO: Initialize to an appropriate value
-            BigInteger actual;
-            actual = target.Q;
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for X
-        ///</summary>
-        [TestMethod()]
-        public void XTest()
-        {
-            DsaKey target = new DsaKey(); // TODO: Initialize to an appropriate value
-            BigInteger actual;
-            actual = target.X;
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for Y
-        ///</summary>
-        [TestMethod()]
-        public void YTest()
-        {
-            DsaKey target = new DsaKey(); // TODO: Initialize to an appropriate value
-            BigInteger actual;
-            actual = target.Y;
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
-}
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Common;
+using Renci.SshNet.Security;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography
+{
+    /// <summary>
+    ///This is a test class for DsaKeyTest and is intended
+    ///to contain all DsaKeyTest Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class DsaKeyTest : TestBase
+    {
+        /// <summary>
+        ///A test for DsaKey Constructor
+        ///</summary>
+        [TestMethod()]
+        public void DsaKeyConstructorTest()
+        {
+            DsaKey target = new DsaKey();
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for DsaKey Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DsaKeyConstructorTest1()
+        {
+            byte[] data = null; // TODO: Initialize to an appropriate value
+            DsaKey target = new DsaKey(data);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for DsaKey Constructor
+        ///</summary>
+        [TestMethod()]
+        public void DsaKeyConstructorTest2()
+        {
+            BigInteger p = new BigInteger(); // TODO: Initialize to an appropriate value
+            BigInteger q = new BigInteger(); // TODO: Initialize to an appropriate value
+            BigInteger g = new BigInteger(); // TODO: Initialize to an appropriate value
+            BigInteger y = new BigInteger(); // TODO: Initialize to an appropriate value
+            BigInteger x = new BigInteger(); // TODO: Initialize to an appropriate value
+            DsaKey target = new DsaKey(p, q, g, y, x);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for Dispose
+        ///</summary>
+        [TestMethod()]
+        public void DisposeTest()
+        {
+            DsaKey target = new DsaKey(); // TODO: Initialize to an appropriate value
+            target.Dispose();
+            Assert.Inconclusive("A method that does not return a value cannot be verified.");
+        }
+
+        /// <summary>
+        ///A test for G
+        ///</summary>
+        [TestMethod()]
+        public void GTest()
+        {
+            DsaKey target = new DsaKey(); // TODO: Initialize to an appropriate value
+            BigInteger actual;
+            actual = target.G;
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for KeyLength
+        ///</summary>
+        [TestMethod()]
+        public void KeyLengthTest()
+        {
+            DsaKey target = new DsaKey(); // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.KeyLength;
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for P
+        ///</summary>
+        [TestMethod()]
+        public void PTest()
+        {
+            DsaKey target = new DsaKey(); // TODO: Initialize to an appropriate value
+            BigInteger actual;
+            actual = target.P;
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for Public
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void PublicTest()
+        {
+            DsaKey target = new DsaKey(); // TODO: Initialize to an appropriate value
+            BigInteger[] expected = null; // TODO: Initialize to an appropriate value
+            BigInteger[] actual;
+            target.Public = expected;
+            actual = target.Public;
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for Q
+        ///</summary>
+        [TestMethod()]
+        public void QTest()
+        {
+            DsaKey target = new DsaKey(); // TODO: Initialize to an appropriate value
+            BigInteger actual;
+            actual = target.Q;
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for X
+        ///</summary>
+        [TestMethod()]
+        public void XTest()
+        {
+            DsaKey target = new DsaKey(); // TODO: Initialize to an appropriate value
+            BigInteger actual;
+            actual = target.X;
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for Y
+        ///</summary>
+        [TestMethod()]
+        public void YTest()
+        {
+            DsaKey target = new DsaKey(); // TODO: Initialize to an appropriate value
+            BigInteger actual;
+            actual = target.Y;
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
+}

+ 135 - 135
src/Renci.SshNet.Tests/Classes/Security/Cryptography/HMacTest.cs

@@ -1,136 +1,136 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security.Cryptography;
-using Renci.SshNet.Tests.Common;
-using Renci.SshNet.Tests.Properties;
-using System.Security.Cryptography;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography
-{
-    /// <summary>
-    /// Provides HMAC algorithm implementation.
-    /// </summary>
-    /// <typeparam name="T"></typeparam>
-    [TestClass]
-    public class HMacTest : TestBase
-    {
-        [TestMethod]
-        [TestCategory("integration")]
-        public void Test_HMac_MD5_Connection()
-        {
-            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
-            connectionInfo.HmacAlgorithms.Clear();
-            connectionInfo.HmacAlgorithms.Add("hmac-md5", new HashInfo(16 * 8, HashAlgorithmFactory.CreateHMACMD5));
-
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("integration")]
-        public void Test_HMac_Sha1_Connection()
-        {
-            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
-            connectionInfo.HmacAlgorithms.Clear();
-            connectionInfo.HmacAlgorithms.Add("hmac-sha1", new HashInfo(20 * 8, HashAlgorithmFactory.CreateHMACSHA1));
-
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("integration")]
-        public void Test_HMac_MD5_96_Connection()
-        {
-            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
-            connectionInfo.HmacAlgorithms.Clear();
-            connectionInfo.HmacAlgorithms.Add("hmac-md5", new HashInfo(16 * 8, key => HashAlgorithmFactory.CreateHMACMD5(key, 96)));
-
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("integration")]
-        public void Test_HMac_Sha1_96_Connection()
-        {
-            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
-            connectionInfo.HmacAlgorithms.Clear();
-            connectionInfo.HmacAlgorithms.Add("hmac-sha1", new HashInfo(20 * 8, key => HashAlgorithmFactory.CreateHMACSHA1(key, 96)));
-
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("integration")]
-        public void Test_HMac_Sha256_Connection()
-        {
-            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
-            connectionInfo.HmacAlgorithms.Clear();
-            connectionInfo.HmacAlgorithms.Add("hmac-sha2-256", new HashInfo(32 * 8, HashAlgorithmFactory.CreateHMACSHA256));
-
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("integration")]
-        public void Test_HMac_Sha256_96_Connection()
-        {
-            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
-            connectionInfo.HmacAlgorithms.Clear();
-            connectionInfo.HmacAlgorithms.Add("hmac-sha2-256-96", new HashInfo(32 * 8, (key) => HashAlgorithmFactory.CreateHMACSHA256(key, 96)));
-
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("integration")]
-        public void Test_HMac_RIPEMD160_Connection()
-        {
-            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
-            connectionInfo.HmacAlgorithms.Clear();
-            connectionInfo.HmacAlgorithms.Add("hmac-ripemd160", new HashInfo(160, HashAlgorithmFactory.CreateHMACRIPEMD160));
-
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("integration")]
-        public void Test_HMac_RIPEMD160_OPENSSH_Connection()
-        {
-            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
-            connectionInfo.HmacAlgorithms.Clear();
-            connectionInfo.HmacAlgorithms.Add("hmac-ripemd160@openssh.com", new HashInfo(160, HashAlgorithmFactory.CreateHMACRIPEMD160));
-
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-        }
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security.Cryptography;
+using Renci.SshNet.Tests.Common;
+using Renci.SshNet.Tests.Properties;
+using System.Security.Cryptography;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography
+{
+    /// <summary>
+    /// Provides HMAC algorithm implementation.
+    /// </summary>
+    /// <typeparam name="T"></typeparam>
+    [TestClass]
+    public class HMacTest : TestBase
+    {
+        [TestMethod]
+        [TestCategory("integration")]
+        public void Test_HMac_MD5_Connection()
+        {
+            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
+            connectionInfo.HmacAlgorithms.Clear();
+            connectionInfo.HmacAlgorithms.Add("hmac-md5", new HashInfo(16 * 8, HashAlgorithmFactory.CreateHMACMD5));
+
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("integration")]
+        public void Test_HMac_Sha1_Connection()
+        {
+            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
+            connectionInfo.HmacAlgorithms.Clear();
+            connectionInfo.HmacAlgorithms.Add("hmac-sha1", new HashInfo(20 * 8, HashAlgorithmFactory.CreateHMACSHA1));
+
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("integration")]
+        public void Test_HMac_MD5_96_Connection()
+        {
+            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
+            connectionInfo.HmacAlgorithms.Clear();
+            connectionInfo.HmacAlgorithms.Add("hmac-md5", new HashInfo(16 * 8, key => HashAlgorithmFactory.CreateHMACMD5(key, 96)));
+
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("integration")]
+        public void Test_HMac_Sha1_96_Connection()
+        {
+            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
+            connectionInfo.HmacAlgorithms.Clear();
+            connectionInfo.HmacAlgorithms.Add("hmac-sha1", new HashInfo(20 * 8, key => HashAlgorithmFactory.CreateHMACSHA1(key, 96)));
+
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("integration")]
+        public void Test_HMac_Sha256_Connection()
+        {
+            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
+            connectionInfo.HmacAlgorithms.Clear();
+            connectionInfo.HmacAlgorithms.Add("hmac-sha2-256", new HashInfo(32 * 8, HashAlgorithmFactory.CreateHMACSHA256));
+
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("integration")]
+        public void Test_HMac_Sha256_96_Connection()
+        {
+            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
+            connectionInfo.HmacAlgorithms.Clear();
+            connectionInfo.HmacAlgorithms.Add("hmac-sha2-256-96", new HashInfo(32 * 8, (key) => HashAlgorithmFactory.CreateHMACSHA256(key, 96)));
+
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("integration")]
+        public void Test_HMac_RIPEMD160_Connection()
+        {
+            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
+            connectionInfo.HmacAlgorithms.Clear();
+            connectionInfo.HmacAlgorithms.Add("hmac-ripemd160", new HashInfo(160, HashAlgorithmFactory.CreateHMACRIPEMD160));
+
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("integration")]
+        public void Test_HMac_RIPEMD160_OPENSSH_Connection()
+        {
+            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
+            connectionInfo.HmacAlgorithms.Clear();
+            connectionInfo.HmacAlgorithms.Add("hmac-ripemd160@openssh.com", new HashInfo(160, HashAlgorithmFactory.CreateHMACRIPEMD160));
+
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+        }
+    }
 }

+ 39 - 39
src/Renci.SshNet.Tests/Classes/Security/Cryptography/RsaDigitalSignatureTest.cs

@@ -1,40 +1,40 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security;
-using Renci.SshNet.Security.Cryptography;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security.Cryptography
-{
-    /// <summary>
-    /// Implements RSA digital signature algorithm.
-    /// </summary>
-    [TestClass]
-    public class RsaDigitalSignatureTest : TestBase
-    {
-
-        /// <summary>
-        ///A test for RsaDigitalSignature Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void RsaDigitalSignatureConstructorTest()
-        {
-            RsaKey rsaKey = null; // TODO: Initialize to an appropriate value
-            RsaDigitalSignature target = new RsaDigitalSignature(rsaKey);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for Dispose
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DisposeTest()
-        {
-            RsaKey rsaKey = null; // TODO: Initialize to an appropriate value
-            RsaDigitalSignature target = new RsaDigitalSignature(rsaKey); // TODO: Initialize to an appropriate value
-            target.Dispose();
-            Assert.Inconclusive("A method that does not return a value cannot be verified.");
-        }
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security;
+using Renci.SshNet.Security.Cryptography;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security.Cryptography
+{
+    /// <summary>
+    /// Implements RSA digital signature algorithm.
+    /// </summary>
+    [TestClass]
+    public class RsaDigitalSignatureTest : TestBase
+    {
+
+        /// <summary>
+        ///A test for RsaDigitalSignature Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void RsaDigitalSignatureConstructorTest()
+        {
+            RsaKey rsaKey = null; // TODO: Initialize to an appropriate value
+            RsaDigitalSignature target = new RsaDigitalSignature(rsaKey);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for Dispose
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DisposeTest()
+        {
+            RsaKey rsaKey = null; // TODO: Initialize to an appropriate value
+            RsaDigitalSignature target = new RsaDigitalSignature(rsaKey); // TODO: Initialize to an appropriate value
+            target.Dispose();
+            Assert.Inconclusive("A method that does not return a value cannot be verified.");
+        }
+    }
 }

+ 12 - 12
src/Renci.SshNet.Tests/Classes/Security/Cryptography/RsaKeyTest.cs

@@ -1,13 +1,13 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security
-{
-    /// <summary>
-    /// Contains RSA private and public key
-    /// </summary>
-    [TestClass]
-    public class RsaKeyTest : TestBase
-    {
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security
+{
+    /// <summary>
+    /// Contains RSA private and public key
+    /// </summary>
+    [TestClass]
+    public class RsaKeyTest : TestBase
+    {
+    }
 }

+ 62 - 62
src/Renci.SshNet.Tests/Classes/Security/Cryptography/SymmetricCipherTest.cs

@@ -1,62 +1,62 @@
-using Renci.SshNet.Security.Cryptography;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests
-{
-    /// <summary>
-    ///This is a test class for SymmetricCipherTest and is intended
-    ///to contain all SymmetricCipherTest Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class SymmetricCipherTest : TestBase
-    {
-        internal virtual SymmetricCipher CreateSymmetricCipher()
-        {
-            // TODO: Instantiate an appropriate concrete class.
-            SymmetricCipher target = null;
-            return target;
-        }
-
-        /// <summary>
-        ///A test for DecryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DecryptBlockTest()
-        {
-            SymmetricCipher target = CreateSymmetricCipher(); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for EncryptBlock
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void EncryptBlockTest()
-        {
-            SymmetricCipher target = CreateSymmetricCipher(); // TODO: Initialize to an appropriate value
-            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
-            int inputOffset = 0; // TODO: Initialize to an appropriate value
-            int inputCount = 0; // TODO: Initialize to an appropriate value
-            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
-            int outputOffset = 0; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
-}
+using Renci.SshNet.Security.Cryptography;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests
+{
+    /// <summary>
+    ///This is a test class for SymmetricCipherTest and is intended
+    ///to contain all SymmetricCipherTest Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class SymmetricCipherTest : TestBase
+    {
+        internal virtual SymmetricCipher CreateSymmetricCipher()
+        {
+            // TODO: Instantiate an appropriate concrete class.
+            SymmetricCipher target = null;
+            return target;
+        }
+
+        /// <summary>
+        ///A test for DecryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DecryptBlockTest()
+        {
+            SymmetricCipher target = CreateSymmetricCipher(); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.DecryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for EncryptBlock
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void EncryptBlockTest()
+        {
+            SymmetricCipher target = CreateSymmetricCipher(); // TODO: Initialize to an appropriate value
+            byte[] inputBuffer = null; // TODO: Initialize to an appropriate value
+            int inputOffset = 0; // TODO: Initialize to an appropriate value
+            int inputCount = 0; // TODO: Initialize to an appropriate value
+            byte[] outputBuffer = null; // TODO: Initialize to an appropriate value
+            int outputOffset = 0; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.EncryptBlock(inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
+}

+ 67 - 67
src/Renci.SshNet.Tests/Classes/Security/HostAlgorithmTest.cs

@@ -1,67 +1,67 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security
-{
-    /// <summary>
-    ///This is a test class for HostAlgorithmTest and is intended
-    ///to contain all HostAlgorithmTest Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class HostAlgorithmTest : TestBase
-    {
-        internal virtual HostAlgorithm CreateHostAlgorithm()
-        {
-            // TODO: Instantiate an appropriate concrete class.
-            HostAlgorithm target = null;
-            return target;
-        }
-
-        /// <summary>
-        ///A test for Sign
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void SignTest()
-        {
-            HostAlgorithm target = CreateHostAlgorithm(); // TODO: Initialize to an appropriate value
-            byte[] data = null; // TODO: Initialize to an appropriate value
-            byte[] expected = null; // TODO: Initialize to an appropriate value
-            byte[] actual;
-            actual = target.Sign(data);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for VerifySignature
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void VerifySignatureTest()
-        {
-            HostAlgorithm target = CreateHostAlgorithm(); // TODO: Initialize to an appropriate value
-            byte[] data = null; // TODO: Initialize to an appropriate value
-            byte[] signature = null; // TODO: Initialize to an appropriate value
-            bool expected = false; // TODO: Initialize to an appropriate value
-            bool actual;
-            actual = target.VerifySignature(data, signature);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for Data
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DataTest()
-        {
-            HostAlgorithm target = CreateHostAlgorithm(); // TODO: Initialize to an appropriate value
-            byte[] actual;
-            actual = target.Data;
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
-}
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security
+{
+    /// <summary>
+    ///This is a test class for HostAlgorithmTest and is intended
+    ///to contain all HostAlgorithmTest Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class HostAlgorithmTest : TestBase
+    {
+        internal virtual HostAlgorithm CreateHostAlgorithm()
+        {
+            // TODO: Instantiate an appropriate concrete class.
+            HostAlgorithm target = null;
+            return target;
+        }
+
+        /// <summary>
+        ///A test for Sign
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void SignTest()
+        {
+            HostAlgorithm target = CreateHostAlgorithm(); // TODO: Initialize to an appropriate value
+            byte[] data = null; // TODO: Initialize to an appropriate value
+            byte[] expected = null; // TODO: Initialize to an appropriate value
+            byte[] actual;
+            actual = target.Sign(data);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for VerifySignature
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void VerifySignatureTest()
+        {
+            HostAlgorithm target = CreateHostAlgorithm(); // TODO: Initialize to an appropriate value
+            byte[] data = null; // TODO: Initialize to an appropriate value
+            byte[] signature = null; // TODO: Initialize to an appropriate value
+            bool expected = false; // TODO: Initialize to an appropriate value
+            bool actual;
+            actual = target.VerifySignature(data, signature);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for Data
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DataTest()
+        {
+            HostAlgorithm target = CreateHostAlgorithm(); // TODO: Initialize to an appropriate value
+            byte[] actual;
+            actual = target.Data;
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
+}

+ 12 - 12
src/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanGroup14Sha1Test.cs

@@ -1,13 +1,13 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security
-{
-    /// <summary>
-    /// Represents "diffie-hellman-group14-sha1" algorithm implementation.
-    /// </summary>
-    [TestClass]
-    public class KeyExchangeDiffieHellmanGroup14Sha1Test : TestBase
-    {
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security
+{
+    /// <summary>
+    /// Represents "diffie-hellman-group14-sha1" algorithm implementation.
+    /// </summary>
+    [TestClass]
+    public class KeyExchangeDiffieHellmanGroup14Sha1Test : TestBase
+    {
+    }
 }

+ 49 - 49
src/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanGroup1Sha1Test.cs

@@ -1,49 +1,49 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Common;
-using Renci.SshNet.Security;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security
-{
-    /// <summary>
-    ///This is a test class for KeyExchangeDiffieHellmanGroup1Sha1Test and is intended
-    ///to contain all KeyExchangeDiffieHellmanGroup1Sha1Test Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class KeyExchangeDiffieHellmanGroup1Sha1Test : TestBase
-    {
-        /// <summary>
-        ///A test for KeyExchangeDiffieHellmanGroup1Sha1 Constructor
-        ///</summary>
-        [TestMethod()]
-        public void KeyExchangeDiffieHellmanGroup1Sha1ConstructorTest()
-        {
-            KeyExchangeDiffieHellmanGroup1Sha1 target = new KeyExchangeDiffieHellmanGroup1Sha1();
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for GroupPrime
-        ///</summary>
-        [TestMethod()]
-        public void GroupPrimeTest()
-        {
-            KeyExchangeDiffieHellmanGroup1Sha1 target = new KeyExchangeDiffieHellmanGroup1Sha1(); // TODO: Initialize to an appropriate value
-            BigInteger actual;
-            actual = target.GroupPrime;
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for Name
-        ///</summary>
-        [TestMethod()]
-        public void NameTest()
-        {
-            KeyExchangeDiffieHellmanGroup1Sha1 target = new KeyExchangeDiffieHellmanGroup1Sha1(); // TODO: Initialize to an appropriate value
-            string actual;
-            actual = target.Name;
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
-}
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Common;
+using Renci.SshNet.Security;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security
+{
+    /// <summary>
+    ///This is a test class for KeyExchangeDiffieHellmanGroup1Sha1Test and is intended
+    ///to contain all KeyExchangeDiffieHellmanGroup1Sha1Test Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class KeyExchangeDiffieHellmanGroup1Sha1Test : TestBase
+    {
+        /// <summary>
+        ///A test for KeyExchangeDiffieHellmanGroup1Sha1 Constructor
+        ///</summary>
+        [TestMethod()]
+        public void KeyExchangeDiffieHellmanGroup1Sha1ConstructorTest()
+        {
+            KeyExchangeDiffieHellmanGroup1Sha1 target = new KeyExchangeDiffieHellmanGroup1Sha1();
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for GroupPrime
+        ///</summary>
+        [TestMethod()]
+        public void GroupPrimeTest()
+        {
+            KeyExchangeDiffieHellmanGroup1Sha1 target = new KeyExchangeDiffieHellmanGroup1Sha1(); // TODO: Initialize to an appropriate value
+            BigInteger actual;
+            actual = target.GroupPrime;
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for Name
+        ///</summary>
+        [TestMethod()]
+        public void NameTest()
+        {
+            KeyExchangeDiffieHellmanGroup1Sha1 target = new KeyExchangeDiffieHellmanGroup1Sha1(); // TODO: Initialize to an appropriate value
+            string actual;
+            actual = target.Name;
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
+}

+ 12 - 12
src/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanGroupExchangeSha1Test.cs

@@ -1,13 +1,13 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security
-{
-    /// <summary>
-    /// Represents "diffie-hellman-group-exchange-sha1" algorithm implementation.
-    /// </summary>
-    [TestClass]
-    public class KeyExchangeDiffieHellmanGroupExchangeSha1Test : TestBase
-    {
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security
+{
+    /// <summary>
+    /// Represents "diffie-hellman-group-exchange-sha1" algorithm implementation.
+    /// </summary>
+    [TestClass]
+    public class KeyExchangeDiffieHellmanGroupExchangeSha1Test : TestBase
+    {
+    }
 }

+ 63 - 63
src/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanGroupExchangeSha256Test.cs

@@ -1,63 +1,63 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Messages.Transport;
-using Renci.SshNet.Security;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security
-{
-    /// <summary>
-    ///This is a test class for KeyExchangeDiffieHellmanGroupExchangeSha256Test and is intended
-    ///to contain all KeyExchangeDiffieHellmanGroupExchangeSha256Test Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class KeyExchangeDiffieHellmanGroupExchangeSha256Test : TestBase
-    {
-        /// <summary>
-        ///A test for KeyExchangeDiffieHellmanGroupExchangeSha256 Constructor
-        ///</summary>
-        [TestMethod()]
-        public void KeyExchangeDiffieHellmanGroupExchangeSha256ConstructorTest()
-        {
-            KeyExchangeDiffieHellmanGroupExchangeSha256 target = new KeyExchangeDiffieHellmanGroupExchangeSha256();
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for Finish
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void FinishTest()
-        {
-            KeyExchangeDiffieHellmanGroupExchangeSha256 target = new KeyExchangeDiffieHellmanGroupExchangeSha256(); // TODO: Initialize to an appropriate value
-            target.Finish();
-            Assert.Inconclusive("A method that does not return a value cannot be verified.");
-        }
-
-        /// <summary>
-        ///A test for Start
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void StartTest()
-        {
-            KeyExchangeDiffieHellmanGroupExchangeSha256 target = new KeyExchangeDiffieHellmanGroupExchangeSha256(); // TODO: Initialize to an appropriate value
-            Session session = null; // TODO: Initialize to an appropriate value
-            KeyExchangeInitMessage message = null; // TODO: Initialize to an appropriate value
-            target.Start(session, message);
-            Assert.Inconclusive("A method that does not return a value cannot be verified.");
-        }
-
-        /// <summary>
-        ///A test for Name
-        ///</summary>
-        [TestMethod()]
-        public void NameTest()
-        {
-            KeyExchangeDiffieHellmanGroupExchangeSha256 target = new KeyExchangeDiffieHellmanGroupExchangeSha256(); // TODO: Initialize to an appropriate value
-            string actual;
-            actual = target.Name;
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
-}
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Messages.Transport;
+using Renci.SshNet.Security;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security
+{
+    /// <summary>
+    ///This is a test class for KeyExchangeDiffieHellmanGroupExchangeSha256Test and is intended
+    ///to contain all KeyExchangeDiffieHellmanGroupExchangeSha256Test Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class KeyExchangeDiffieHellmanGroupExchangeSha256Test : TestBase
+    {
+        /// <summary>
+        ///A test for KeyExchangeDiffieHellmanGroupExchangeSha256 Constructor
+        ///</summary>
+        [TestMethod()]
+        public void KeyExchangeDiffieHellmanGroupExchangeSha256ConstructorTest()
+        {
+            KeyExchangeDiffieHellmanGroupExchangeSha256 target = new KeyExchangeDiffieHellmanGroupExchangeSha256();
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for Finish
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void FinishTest()
+        {
+            KeyExchangeDiffieHellmanGroupExchangeSha256 target = new KeyExchangeDiffieHellmanGroupExchangeSha256(); // TODO: Initialize to an appropriate value
+            target.Finish();
+            Assert.Inconclusive("A method that does not return a value cannot be verified.");
+        }
+
+        /// <summary>
+        ///A test for Start
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void StartTest()
+        {
+            KeyExchangeDiffieHellmanGroupExchangeSha256 target = new KeyExchangeDiffieHellmanGroupExchangeSha256(); // TODO: Initialize to an appropriate value
+            Session session = null; // TODO: Initialize to an appropriate value
+            KeyExchangeInitMessage message = null; // TODO: Initialize to an appropriate value
+            target.Start(session, message);
+            Assert.Inconclusive("A method that does not return a value cannot be verified.");
+        }
+
+        /// <summary>
+        ///A test for Name
+        ///</summary>
+        [TestMethod()]
+        public void NameTest()
+        {
+            KeyExchangeDiffieHellmanGroupExchangeSha256 target = new KeyExchangeDiffieHellmanGroupExchangeSha256(); // TODO: Initialize to an appropriate value
+            string actual;
+            actual = target.Name;
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
+}

+ 62 - 62
src/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanGroupSha1Test.cs

@@ -1,62 +1,62 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Common;
-using Renci.SshNet.Messages.Transport;
-using Renci.SshNet.Security;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security
-{
-    /// <summary>
-    ///This is a test class for KeyExchangeDiffieHellmanGroupSha1Test and is intended
-    ///to contain all KeyExchangeDiffieHellmanGroupSha1Test Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class KeyExchangeDiffieHellmanGroupSha1Test : TestBase
-    {
-        internal virtual KeyExchangeDiffieHellmanGroupSha1 CreateKeyExchangeDiffieHellmanGroupSha1()
-        {
-            // TODO: Instantiate an appropriate concrete class.
-            KeyExchangeDiffieHellmanGroupSha1 target = null;
-            return target;
-        }
-
-        /// <summary>
-        ///A test for Finish
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void FinishTest()
-        {
-            KeyExchangeDiffieHellmanGroupSha1 target = CreateKeyExchangeDiffieHellmanGroupSha1(); // TODO: Initialize to an appropriate value
-            target.Finish();
-            Assert.Inconclusive("A method that does not return a value cannot be verified.");
-        }
-
-        /// <summary>
-        ///A test for Start
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void StartTest()
-        {
-            KeyExchangeDiffieHellmanGroupSha1 target = CreateKeyExchangeDiffieHellmanGroupSha1(); // TODO: Initialize to an appropriate value
-            Session session = null; // TODO: Initialize to an appropriate value
-            KeyExchangeInitMessage message = null; // TODO: Initialize to an appropriate value
-            target.Start(session, message);
-            Assert.Inconclusive("A method that does not return a value cannot be verified.");
-        }
-
-        /// <summary>
-        ///A test for GroupPrime
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void GroupPrimeTest()
-        {
-            KeyExchangeDiffieHellmanGroupSha1 target = CreateKeyExchangeDiffieHellmanGroupSha1(); // TODO: Initialize to an appropriate value
-            BigInteger actual;
-            actual = target.GroupPrime;
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
-}
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Common;
+using Renci.SshNet.Messages.Transport;
+using Renci.SshNet.Security;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security
+{
+    /// <summary>
+    ///This is a test class for KeyExchangeDiffieHellmanGroupSha1Test and is intended
+    ///to contain all KeyExchangeDiffieHellmanGroupSha1Test Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class KeyExchangeDiffieHellmanGroupSha1Test : TestBase
+    {
+        internal virtual KeyExchangeDiffieHellmanGroupSha1 CreateKeyExchangeDiffieHellmanGroupSha1()
+        {
+            // TODO: Instantiate an appropriate concrete class.
+            KeyExchangeDiffieHellmanGroupSha1 target = null;
+            return target;
+        }
+
+        /// <summary>
+        ///A test for Finish
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void FinishTest()
+        {
+            KeyExchangeDiffieHellmanGroupSha1 target = CreateKeyExchangeDiffieHellmanGroupSha1(); // TODO: Initialize to an appropriate value
+            target.Finish();
+            Assert.Inconclusive("A method that does not return a value cannot be verified.");
+        }
+
+        /// <summary>
+        ///A test for Start
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void StartTest()
+        {
+            KeyExchangeDiffieHellmanGroupSha1 target = CreateKeyExchangeDiffieHellmanGroupSha1(); // TODO: Initialize to an appropriate value
+            Session session = null; // TODO: Initialize to an appropriate value
+            KeyExchangeInitMessage message = null; // TODO: Initialize to an appropriate value
+            target.Start(session, message);
+            Assert.Inconclusive("A method that does not return a value cannot be verified.");
+        }
+
+        /// <summary>
+        ///A test for GroupPrime
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void GroupPrimeTest()
+        {
+            KeyExchangeDiffieHellmanGroupSha1 target = CreateKeyExchangeDiffieHellmanGroupSha1(); // TODO: Initialize to an appropriate value
+            BigInteger actual;
+            actual = target.GroupPrime;
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
+}

+ 36 - 36
src/Renci.SshNet.Tests/Classes/Security/KeyExchangeDiffieHellmanTest.cs

@@ -1,36 +1,36 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Messages.Transport;
-using Renci.SshNet.Security;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security
-{
-    /// <summary>
-    ///This is a test class for KeyExchangeDiffieHellmanTest and is intended
-    ///to contain all KeyExchangeDiffieHellmanTest Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class KeyExchangeDiffieHellmanTest : TestBase
-    {
-        internal virtual KeyExchangeDiffieHellman CreateKeyExchangeDiffieHellman()
-        {
-            // TODO: Instantiate an appropriate concrete class.
-            KeyExchangeDiffieHellman target = null;
-            return target;
-        }
-
-        /// <summary>
-        ///A test for Start
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void StartTest()
-        {
-            KeyExchangeDiffieHellman target = CreateKeyExchangeDiffieHellman(); // TODO: Initialize to an appropriate value
-            Session session = null; // TODO: Initialize to an appropriate value
-            KeyExchangeInitMessage message = null; // TODO: Initialize to an appropriate value
-            target.Start(session, message);
-            Assert.Inconclusive("A method that does not return a value cannot be verified.");
-        }
-    }
-}
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Messages.Transport;
+using Renci.SshNet.Security;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security
+{
+    /// <summary>
+    ///This is a test class for KeyExchangeDiffieHellmanTest and is intended
+    ///to contain all KeyExchangeDiffieHellmanTest Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class KeyExchangeDiffieHellmanTest : TestBase
+    {
+        internal virtual KeyExchangeDiffieHellman CreateKeyExchangeDiffieHellman()
+        {
+            // TODO: Instantiate an appropriate concrete class.
+            KeyExchangeDiffieHellman target = null;
+            return target;
+        }
+
+        /// <summary>
+        ///A test for Start
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void StartTest()
+        {
+            KeyExchangeDiffieHellman target = CreateKeyExchangeDiffieHellman(); // TODO: Initialize to an appropriate value
+            Session session = null; // TODO: Initialize to an appropriate value
+            KeyExchangeInitMessage message = null; // TODO: Initialize to an appropriate value
+            target.Start(session, message);
+            Assert.Inconclusive("A method that does not return a value cannot be verified.");
+        }
+    }
+}

+ 16 - 16
src/Renci.SshNet.Tests/Classes/Security/KeyExchangeTest.cs

@@ -1,16 +1,16 @@
-using Renci.SshNet.Security;
-using Renci.SshNet.Tests.Common;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-namespace Renci.SshNet.Tests
-{
-    /// <summary>
-    ///This is a test class for KeyExchangeTest and is intended
-    ///to contain all KeyExchangeTest Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class KeyExchangeTest : TestBase
-    {
-
-    }
-}
+using Renci.SshNet.Security;
+using Renci.SshNet.Tests.Common;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace Renci.SshNet.Tests
+{
+    /// <summary>
+    ///This is a test class for KeyExchangeTest and is intended
+    ///to contain all KeyExchangeTest Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class KeyExchangeTest : TestBase
+    {
+
+    }
+}

+ 122 - 122
src/Renci.SshNet.Tests/Classes/Security/KeyHostAlgorithmTest.cs

@@ -1,123 +1,123 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Security;
-using Renci.SshNet.Tests.Common;
-using Renci.SshNet.Tests.Properties;
-
-namespace Renci.SshNet.Tests.Classes.Security
-{
-    /// <summary>
-    /// Implements key support for host algorithm.
-    /// </summary>
-    [TestClass]
-    public class KeyHostAlgorithmTest : TestBase
-    {
-        [TestMethod]
-        [TestCategory("integration")]
-        public void Test_HostKey_SshRsa_Connection()
-        {
-            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
-            connectionInfo.HostKeyAlgorithms.Clear();
-            connectionInfo.HostKeyAlgorithms.Add("ssh-rsa", (data) => { return new KeyHostAlgorithm("ssh-rsa", new RsaKey(), data); });
-
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("integration")]
-        public void Test_HostKey_SshDss_Connection()
-        {
-            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
-            connectionInfo.HostKeyAlgorithms.Clear();
-            connectionInfo.HostKeyAlgorithms.Add("ssh-dss", (data) => { return new KeyHostAlgorithm("ssh-dss", new DsaKey(), data); });
-
-            using (var client = new SshClient(connectionInfo))
-            {
-                client.Connect();
-                client.Disconnect();
-            }
-        }
-
-        /// <summary>
-        ///A test for KeyHostAlgorithm Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void KeyHostAlgorithmConstructorTest()
-        {
-            string name = string.Empty; // TODO: Initialize to an appropriate value
-            Key key = null; // TODO: Initialize to an appropriate value
-            KeyHostAlgorithm target = new KeyHostAlgorithm(name, key);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for KeyHostAlgorithm Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void KeyHostAlgorithmConstructorTest1()
-        {
-            string name = string.Empty; // TODO: Initialize to an appropriate value
-            Key key = null; // TODO: Initialize to an appropriate value
-            byte[] data = null; // TODO: Initialize to an appropriate value
-            KeyHostAlgorithm target = new KeyHostAlgorithm(name, key, data);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for Sign
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void SignTest()
-        {
-            string name = string.Empty; // TODO: Initialize to an appropriate value
-            Key key = null; // TODO: Initialize to an appropriate value
-            KeyHostAlgorithm target = new KeyHostAlgorithm(name, key); // TODO: Initialize to an appropriate value
-            byte[] data = null; // TODO: Initialize to an appropriate value
-            byte[] expected = null; // TODO: Initialize to an appropriate value
-            byte[] actual;
-            actual = target.Sign(data);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for VerifySignature
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void VerifySignatureTest()
-        {
-            string name = string.Empty; // TODO: Initialize to an appropriate value
-            Key key = null; // TODO: Initialize to an appropriate value
-            KeyHostAlgorithm target = new KeyHostAlgorithm(name, key); // TODO: Initialize to an appropriate value
-            byte[] data = null; // TODO: Initialize to an appropriate value
-            byte[] signature = null; // TODO: Initialize to an appropriate value
-            bool expected = false; // TODO: Initialize to an appropriate value
-            bool actual;
-            actual = target.VerifySignature(data, signature);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for Data
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DataTest()
-        {
-            string name = string.Empty; // TODO: Initialize to an appropriate value
-            Key key = null; // TODO: Initialize to an appropriate value
-            KeyHostAlgorithm target = new KeyHostAlgorithm(name, key); // TODO: Initialize to an appropriate value
-            byte[] actual;
-            actual = target.Data;
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Security;
+using Renci.SshNet.Tests.Common;
+using Renci.SshNet.Tests.Properties;
+
+namespace Renci.SshNet.Tests.Classes.Security
+{
+    /// <summary>
+    /// Implements key support for host algorithm.
+    /// </summary>
+    [TestClass]
+    public class KeyHostAlgorithmTest : TestBase
+    {
+        [TestMethod]
+        [TestCategory("integration")]
+        public void Test_HostKey_SshRsa_Connection()
+        {
+            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
+            connectionInfo.HostKeyAlgorithms.Clear();
+            connectionInfo.HostKeyAlgorithms.Add("ssh-rsa", (data) => { return new KeyHostAlgorithm("ssh-rsa", new RsaKey(), data); });
+
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("integration")]
+        public void Test_HostKey_SshDss_Connection()
+        {
+            var connectionInfo = new PasswordConnectionInfo(Resources.HOST, int.Parse(Resources.PORT), Resources.USERNAME, Resources.PASSWORD);
+            connectionInfo.HostKeyAlgorithms.Clear();
+            connectionInfo.HostKeyAlgorithms.Add("ssh-dss", (data) => { return new KeyHostAlgorithm("ssh-dss", new DsaKey(), data); });
+
+            using (var client = new SshClient(connectionInfo))
+            {
+                client.Connect();
+                client.Disconnect();
+            }
+        }
+
+        /// <summary>
+        ///A test for KeyHostAlgorithm Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void KeyHostAlgorithmConstructorTest()
+        {
+            string name = string.Empty; // TODO: Initialize to an appropriate value
+            Key key = null; // TODO: Initialize to an appropriate value
+            KeyHostAlgorithm target = new KeyHostAlgorithm(name, key);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for KeyHostAlgorithm Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void KeyHostAlgorithmConstructorTest1()
+        {
+            string name = string.Empty; // TODO: Initialize to an appropriate value
+            Key key = null; // TODO: Initialize to an appropriate value
+            byte[] data = null; // TODO: Initialize to an appropriate value
+            KeyHostAlgorithm target = new KeyHostAlgorithm(name, key, data);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for Sign
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void SignTest()
+        {
+            string name = string.Empty; // TODO: Initialize to an appropriate value
+            Key key = null; // TODO: Initialize to an appropriate value
+            KeyHostAlgorithm target = new KeyHostAlgorithm(name, key); // TODO: Initialize to an appropriate value
+            byte[] data = null; // TODO: Initialize to an appropriate value
+            byte[] expected = null; // TODO: Initialize to an appropriate value
+            byte[] actual;
+            actual = target.Sign(data);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for VerifySignature
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void VerifySignatureTest()
+        {
+            string name = string.Empty; // TODO: Initialize to an appropriate value
+            Key key = null; // TODO: Initialize to an appropriate value
+            KeyHostAlgorithm target = new KeyHostAlgorithm(name, key); // TODO: Initialize to an appropriate value
+            byte[] data = null; // TODO: Initialize to an appropriate value
+            byte[] signature = null; // TODO: Initialize to an appropriate value
+            bool expected = false; // TODO: Initialize to an appropriate value
+            bool actual;
+            actual = target.VerifySignature(data, signature);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for Data
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DataTest()
+        {
+            string name = string.Empty; // TODO: Initialize to an appropriate value
+            Key key = null; // TODO: Initialize to an appropriate value
+            KeyHostAlgorithm target = new KeyHostAlgorithm(name, key); // TODO: Initialize to an appropriate value
+            byte[] actual;
+            actual = target.Data;
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
 }

+ 84 - 84
src/Renci.SshNet.Tests/Classes/Security/KeyTest.cs

@@ -1,84 +1,84 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Common;
-using Renci.SshNet.Security;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Security
-{
-    /// <summary>
-    ///This is a test class for KeyTest and is intended
-    ///to contain all KeyTest Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class KeyTest : TestBase
-    {
-        internal virtual Key CreateKey()
-        {
-            // TODO: Instantiate an appropriate concrete class.
-            Key target = null;
-            return target;
-        }
-
-        /// <summary>
-        ///A test for Sign
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void SignTest()
-        {
-            Key target = CreateKey(); // TODO: Initialize to an appropriate value
-            byte[] data = null; // TODO: Initialize to an appropriate value
-            byte[] expected = null; // TODO: Initialize to an appropriate value
-            byte[] actual;
-            actual = target.Sign(data);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for VerifySignature
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void VerifySignatureTest()
-        {
-            Key target = CreateKey(); // TODO: Initialize to an appropriate value
-            byte[] data = null; // TODO: Initialize to an appropriate value
-            byte[] signature = null; // TODO: Initialize to an appropriate value
-            bool expected = false; // TODO: Initialize to an appropriate value
-            bool actual;
-            actual = target.VerifySignature(data, signature);
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for KeyLength
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void KeyLengthTest()
-        {
-            Key target = CreateKey(); // TODO: Initialize to an appropriate value
-            int actual;
-            actual = target.KeyLength;
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for Public
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void PublicTest()
-        {
-            Key target = CreateKey(); // TODO: Initialize to an appropriate value
-            BigInteger[] expected = null; // TODO: Initialize to an appropriate value
-            BigInteger[] actual;
-            target.Public = expected;
-            actual = target.Public;
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
-}
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Common;
+using Renci.SshNet.Security;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Security
+{
+    /// <summary>
+    ///This is a test class for KeyTest and is intended
+    ///to contain all KeyTest Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class KeyTest : TestBase
+    {
+        internal virtual Key CreateKey()
+        {
+            // TODO: Instantiate an appropriate concrete class.
+            Key target = null;
+            return target;
+        }
+
+        /// <summary>
+        ///A test for Sign
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void SignTest()
+        {
+            Key target = CreateKey(); // TODO: Initialize to an appropriate value
+            byte[] data = null; // TODO: Initialize to an appropriate value
+            byte[] expected = null; // TODO: Initialize to an appropriate value
+            byte[] actual;
+            actual = target.Sign(data);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for VerifySignature
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void VerifySignatureTest()
+        {
+            Key target = CreateKey(); // TODO: Initialize to an appropriate value
+            byte[] data = null; // TODO: Initialize to an appropriate value
+            byte[] signature = null; // TODO: Initialize to an appropriate value
+            bool expected = false; // TODO: Initialize to an appropriate value
+            bool actual;
+            actual = target.VerifySignature(data, signature);
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for KeyLength
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void KeyLengthTest()
+        {
+            Key target = CreateKey(); // TODO: Initialize to an appropriate value
+            int actual;
+            actual = target.KeyLength;
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for Public
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void PublicTest()
+        {
+            Key target = CreateKey(); // TODO: Initialize to an appropriate value
+            BigInteger[] expected = null; // TODO: Initialize to an appropriate value
+            BigInteger[] actual;
+            target.Public = expected;
+            actual = target.Public;
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
+}

+ 263 - 263
src/Renci.SshNet.Tests/Classes/SessionTest.HttpProxy.cs

@@ -1,263 +1,263 @@
-using System;
-using System.Net;
-using System.Linq;
-using System.Text;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Common;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes
-{
-    public partial class SessionTest
-    {
-        [TestMethod]
-        public void ConnectShouldThrowProxyExceptionWhenHttpProxyResponseDoesNotContainStatusLine()
-        {
-            var proxyEndPoint = new IPEndPoint(IPAddress.Loopback, 8123);
-            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
-
-            using (var proxyStub = new HttpProxyStub(proxyEndPoint))
-            {
-                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("Whatever\r\n"));
-                proxyStub.Start();
-
-                using (var session = new Session(CreateConnectionInfoWithProxy(proxyEndPoint, serverEndPoint, "anon"), _serviceFactoryMock.Object))
-                {
-                    try
-                    {
-                        session.Connect();
-                        Assert.Fail();
-                    }
-                    catch (ProxyException ex)
-                    {
-                        Assert.IsNull(ex.InnerException);
-                        Assert.AreEqual("HTTP response does not contain status line.", ex.Message);
-                    }
-                }
-            }
-        }
-
-        [TestMethod]
-        public void ConnectShouldThrowProxyExceptionWhenHttpProxyReturnsHttpStatusOtherThan200()
-        {
-            var proxyEndPoint = new IPEndPoint(IPAddress.Loopback, 8123);
-            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
-
-            using (var proxyStub = new HttpProxyStub(proxyEndPoint))
-            {
-                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("HTTP/1.0 501 Custom\r\n"));
-                proxyStub.Start();
-
-                using (var session = new Session(CreateConnectionInfoWithProxy(proxyEndPoint, serverEndPoint, "anon"), _serviceFactoryMock.Object))
-                {
-                    try
-                    {
-                        session.Connect();
-                        Assert.Fail();
-                    }
-                    catch (ProxyException ex)
-                    {
-                        Assert.IsNull(ex.InnerException);
-                        Assert.AreEqual("HTTP: Status code 501, \"Custom\"", ex.Message);
-                    }
-                }
-            }
-        }
-
-        [TestMethod]
-        public void ConnectShouldSkipHeadersWhenHttpProxyReturnsHttpStatus200()
-        {
-            var proxyEndPoint = new IPEndPoint(IPAddress.Loopback, 8123);
-            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
-
-            using (var proxyStub = new HttpProxyStub(proxyEndPoint))
-            {
-                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("HTTP/1.0 200 OK\r\n"));
-                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("Content-Type: application/octet-stream\r\n"));
-                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("\r\n"));
-                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("SSH-666-SshStub"));
-                proxyStub.Start();
-
-                using (var session = new Session(CreateConnectionInfoWithProxy(proxyEndPoint, serverEndPoint, "anon"), _serviceFactoryMock.Object))
-                {
-                    try
-                    {
-                        session.Connect();
-                        Assert.Fail();
-                    }
-                    catch (SshConnectionException ex)
-                    {
-                        Assert.IsNull(ex.InnerException);
-                        Assert.AreEqual("Server version '666' is not supported.", ex.Message);
-                    }
-                }
-            }
-        }
-
-        [TestMethod]
-        public void ConnectShouldSkipContentWhenHttpProxyReturnsHttpStatus200()
-        {
-            var proxyEndPoint = new IPEndPoint(IPAddress.Loopback, 8123);
-            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
-
-            using (var proxyStub = new HttpProxyStub(proxyEndPoint))
-            {
-                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("HTTP/1.0 200 OK\r\n"));
-                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("Content-Length: 13\r\n"));
-                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("Content-Type: application/octet-stream\r\n"));
-                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("\r\n"));
-                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("DUMMY_CONTENT"));
-                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("SSH-666-SshStub"));
-                proxyStub.Start();
-
-                using (var session = new Session(CreateConnectionInfoWithProxy(proxyEndPoint, serverEndPoint, "anon"), _serviceFactoryMock.Object))
-                {
-                    try
-                    {
-                        session.Connect();
-                        Assert.Fail();
-                    }
-                    catch (SshConnectionException ex)
-                    {
-                        Assert.IsNull(ex.InnerException);
-                        Assert.AreEqual("Server version '666' is not supported.", ex.Message);
-                    }
-                }
-            }
-        }
-
-        [TestMethod]
-        public void ConnectShouldWriteConnectMethodToHttpProxy()
-        {
-            var proxyEndPoint = new IPEndPoint(IPAddress.Loopback, 8123);
-            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
-
-            using (var proxyStub = new HttpProxyStub(proxyEndPoint))
-            {
-                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("HTTP/1.0 501 Custom\r\n"));
-                proxyStub.Start();
-
-                using (var session = new Session(CreateConnectionInfoWithProxy(proxyEndPoint, serverEndPoint, "anon"), _serviceFactoryMock.Object))
-                {
-                    try
-                    {
-                        session.Connect();
-                        Assert.Fail();
-                    }
-                    catch (ProxyException)
-                    {
-                    }
-                }
-
-                Assert.AreEqual(string.Format("CONNECT {0} HTTP/1.0", serverEndPoint), proxyStub.HttpRequest.RequestLine);
-            }
-        }
-
-        [TestMethod]
-        public void ConnectShouldWriteProxyAuthorizationToHttpProxyWhenProxyUserNameIsNotNullAndNotEmpty()
-        {
-            var proxyEndPoint = new IPEndPoint(IPAddress.Loopback, 8123);
-            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
-
-            using (var proxyStub = new HttpProxyStub(proxyEndPoint))
-            {
-                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("HTTP/1.0 501 Custom\r\n"));
-                proxyStub.Start();
-
-                var connectionInfo = CreateConnectionInfoWithProxy(proxyEndPoint, serverEndPoint, "anon");
-                using (var session = new Session(connectionInfo, _serviceFactoryMock.Object))
-                {
-                    try
-                    {
-                        session.Connect();
-                        Assert.Fail();
-                    }
-                    catch (ProxyException)
-                    {
-                    }
-                }
-
-                var expectedProxyAuthorizationHeader = CreateProxyAuthorizationHeader(connectionInfo);
-                Assert.IsNotNull(proxyStub.HttpRequest.Headers.SingleOrDefault(p => p == expectedProxyAuthorizationHeader));
-            }
-        }
-
-        [TestMethod]
-        public void ConnectShouldNotWriteProxyAuthorizationToHttpProxyWhenProxyUserNameIsEmpty()
-        {
-            var proxyEndPoint = new IPEndPoint(IPAddress.Loopback, 8123);
-            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
-
-            using (var proxyStub = new HttpProxyStub(proxyEndPoint))
-            {
-                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("HTTP/1.0 501 Custom\r\n"));
-                proxyStub.Start();
-
-                var connectionInfo = CreateConnectionInfoWithProxy(proxyEndPoint, serverEndPoint, string.Empty);
-                using (var session = new Session(connectionInfo, _serviceFactoryMock.Object))
-                {
-                    try
-                    {
-                        session.Connect();
-                        Assert.Fail();
-                    }
-                    catch (ProxyException)
-                    {
-                    }
-                }
-
-                Assert.IsFalse(proxyStub.HttpRequest.Headers.Any(p => p.StartsWith("Proxy-Authorization:")));
-            }
-        }
-
-        [TestMethod]
-        public void ConnectShouldNotWriteProxyAuthorizationToHttpProxyWhenProxyUserNameIsNull()
-        {
-            var proxyEndPoint = new IPEndPoint(IPAddress.Loopback, 8123);
-            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
-
-            using (var proxyStub = new HttpProxyStub(proxyEndPoint))
-            {
-                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("HTTP/1.0 501 Custom\r\n"));
-                proxyStub.Start();
-
-                var connectionInfo = CreateConnectionInfoWithProxy(proxyEndPoint, serverEndPoint, null);
-                using (var session = new Session(connectionInfo, _serviceFactoryMock.Object))
-                {
-                    try
-                    {
-                        session.Connect();
-                        Assert.Fail();
-                    }
-                    catch (ProxyException)
-                    {
-                    }
-                }
-
-                Assert.IsFalse(proxyStub.HttpRequest.Headers.Any(p => p.StartsWith("Proxy-Authorization:")));
-            }
-        }
-
-        private static ConnectionInfo CreateConnectionInfoWithProxy(IPEndPoint proxyEndPoint, IPEndPoint serverEndPoint, string proxyUserName)
-        {
-            return new ConnectionInfo(
-                serverEndPoint.Address.ToString(),
-                serverEndPoint.Port,
-                "eric",
-                ProxyTypes.Http,
-                proxyEndPoint.Address.ToString(),
-                proxyEndPoint.Port,
-                proxyUserName,
-                "proxypwd",
-                new NoneAuthenticationMethod("eric"));
-        }
-
-        private static string CreateProxyAuthorizationHeader(ConnectionInfo connectionInfo)
-        {
-            return string.Format("Proxy-Authorization: Basic {0}",
-                Convert.ToBase64String(
-                    Encoding.ASCII.GetBytes(string.Format("{0}:{1}", connectionInfo.ProxyUsername,
-                        connectionInfo.ProxyPassword))));
-        }
-    }
-}
+using System;
+using System.Net;
+using System.Linq;
+using System.Text;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Common;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes
+{
+    public partial class SessionTest
+    {
+        [TestMethod]
+        public void ConnectShouldThrowProxyExceptionWhenHttpProxyResponseDoesNotContainStatusLine()
+        {
+            var proxyEndPoint = new IPEndPoint(IPAddress.Loopback, 8123);
+            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
+
+            using (var proxyStub = new HttpProxyStub(proxyEndPoint))
+            {
+                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("Whatever\r\n"));
+                proxyStub.Start();
+
+                using (var session = new Session(CreateConnectionInfoWithProxy(proxyEndPoint, serverEndPoint, "anon"), _serviceFactoryMock.Object))
+                {
+                    try
+                    {
+                        session.Connect();
+                        Assert.Fail();
+                    }
+                    catch (ProxyException ex)
+                    {
+                        Assert.IsNull(ex.InnerException);
+                        Assert.AreEqual("HTTP response does not contain status line.", ex.Message);
+                    }
+                }
+            }
+        }
+
+        [TestMethod]
+        public void ConnectShouldThrowProxyExceptionWhenHttpProxyReturnsHttpStatusOtherThan200()
+        {
+            var proxyEndPoint = new IPEndPoint(IPAddress.Loopback, 8123);
+            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
+
+            using (var proxyStub = new HttpProxyStub(proxyEndPoint))
+            {
+                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("HTTP/1.0 501 Custom\r\n"));
+                proxyStub.Start();
+
+                using (var session = new Session(CreateConnectionInfoWithProxy(proxyEndPoint, serverEndPoint, "anon"), _serviceFactoryMock.Object))
+                {
+                    try
+                    {
+                        session.Connect();
+                        Assert.Fail();
+                    }
+                    catch (ProxyException ex)
+                    {
+                        Assert.IsNull(ex.InnerException);
+                        Assert.AreEqual("HTTP: Status code 501, \"Custom\"", ex.Message);
+                    }
+                }
+            }
+        }
+
+        [TestMethod]
+        public void ConnectShouldSkipHeadersWhenHttpProxyReturnsHttpStatus200()
+        {
+            var proxyEndPoint = new IPEndPoint(IPAddress.Loopback, 8123);
+            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
+
+            using (var proxyStub = new HttpProxyStub(proxyEndPoint))
+            {
+                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("HTTP/1.0 200 OK\r\n"));
+                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("Content-Type: application/octet-stream\r\n"));
+                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("\r\n"));
+                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("SSH-666-SshStub"));
+                proxyStub.Start();
+
+                using (var session = new Session(CreateConnectionInfoWithProxy(proxyEndPoint, serverEndPoint, "anon"), _serviceFactoryMock.Object))
+                {
+                    try
+                    {
+                        session.Connect();
+                        Assert.Fail();
+                    }
+                    catch (SshConnectionException ex)
+                    {
+                        Assert.IsNull(ex.InnerException);
+                        Assert.AreEqual("Server version '666' is not supported.", ex.Message);
+                    }
+                }
+            }
+        }
+
+        [TestMethod]
+        public void ConnectShouldSkipContentWhenHttpProxyReturnsHttpStatus200()
+        {
+            var proxyEndPoint = new IPEndPoint(IPAddress.Loopback, 8123);
+            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
+
+            using (var proxyStub = new HttpProxyStub(proxyEndPoint))
+            {
+                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("HTTP/1.0 200 OK\r\n"));
+                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("Content-Length: 13\r\n"));
+                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("Content-Type: application/octet-stream\r\n"));
+                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("\r\n"));
+                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("DUMMY_CONTENT"));
+                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("SSH-666-SshStub"));
+                proxyStub.Start();
+
+                using (var session = new Session(CreateConnectionInfoWithProxy(proxyEndPoint, serverEndPoint, "anon"), _serviceFactoryMock.Object))
+                {
+                    try
+                    {
+                        session.Connect();
+                        Assert.Fail();
+                    }
+                    catch (SshConnectionException ex)
+                    {
+                        Assert.IsNull(ex.InnerException);
+                        Assert.AreEqual("Server version '666' is not supported.", ex.Message);
+                    }
+                }
+            }
+        }
+
+        [TestMethod]
+        public void ConnectShouldWriteConnectMethodToHttpProxy()
+        {
+            var proxyEndPoint = new IPEndPoint(IPAddress.Loopback, 8123);
+            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
+
+            using (var proxyStub = new HttpProxyStub(proxyEndPoint))
+            {
+                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("HTTP/1.0 501 Custom\r\n"));
+                proxyStub.Start();
+
+                using (var session = new Session(CreateConnectionInfoWithProxy(proxyEndPoint, serverEndPoint, "anon"), _serviceFactoryMock.Object))
+                {
+                    try
+                    {
+                        session.Connect();
+                        Assert.Fail();
+                    }
+                    catch (ProxyException)
+                    {
+                    }
+                }
+
+                Assert.AreEqual(string.Format("CONNECT {0} HTTP/1.0", serverEndPoint), proxyStub.HttpRequest.RequestLine);
+            }
+        }
+
+        [TestMethod]
+        public void ConnectShouldWriteProxyAuthorizationToHttpProxyWhenProxyUserNameIsNotNullAndNotEmpty()
+        {
+            var proxyEndPoint = new IPEndPoint(IPAddress.Loopback, 8123);
+            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
+
+            using (var proxyStub = new HttpProxyStub(proxyEndPoint))
+            {
+                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("HTTP/1.0 501 Custom\r\n"));
+                proxyStub.Start();
+
+                var connectionInfo = CreateConnectionInfoWithProxy(proxyEndPoint, serverEndPoint, "anon");
+                using (var session = new Session(connectionInfo, _serviceFactoryMock.Object))
+                {
+                    try
+                    {
+                        session.Connect();
+                        Assert.Fail();
+                    }
+                    catch (ProxyException)
+                    {
+                    }
+                }
+
+                var expectedProxyAuthorizationHeader = CreateProxyAuthorizationHeader(connectionInfo);
+                Assert.IsNotNull(proxyStub.HttpRequest.Headers.SingleOrDefault(p => p == expectedProxyAuthorizationHeader));
+            }
+        }
+
+        [TestMethod]
+        public void ConnectShouldNotWriteProxyAuthorizationToHttpProxyWhenProxyUserNameIsEmpty()
+        {
+            var proxyEndPoint = new IPEndPoint(IPAddress.Loopback, 8123);
+            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
+
+            using (var proxyStub = new HttpProxyStub(proxyEndPoint))
+            {
+                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("HTTP/1.0 501 Custom\r\n"));
+                proxyStub.Start();
+
+                var connectionInfo = CreateConnectionInfoWithProxy(proxyEndPoint, serverEndPoint, string.Empty);
+                using (var session = new Session(connectionInfo, _serviceFactoryMock.Object))
+                {
+                    try
+                    {
+                        session.Connect();
+                        Assert.Fail();
+                    }
+                    catch (ProxyException)
+                    {
+                    }
+                }
+
+                Assert.IsFalse(proxyStub.HttpRequest.Headers.Any(p => p.StartsWith("Proxy-Authorization:")));
+            }
+        }
+
+        [TestMethod]
+        public void ConnectShouldNotWriteProxyAuthorizationToHttpProxyWhenProxyUserNameIsNull()
+        {
+            var proxyEndPoint = new IPEndPoint(IPAddress.Loopback, 8123);
+            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
+
+            using (var proxyStub = new HttpProxyStub(proxyEndPoint))
+            {
+                proxyStub.Responses.Add(Encoding.ASCII.GetBytes("HTTP/1.0 501 Custom\r\n"));
+                proxyStub.Start();
+
+                var connectionInfo = CreateConnectionInfoWithProxy(proxyEndPoint, serverEndPoint, null);
+                using (var session = new Session(connectionInfo, _serviceFactoryMock.Object))
+                {
+                    try
+                    {
+                        session.Connect();
+                        Assert.Fail();
+                    }
+                    catch (ProxyException)
+                    {
+                    }
+                }
+
+                Assert.IsFalse(proxyStub.HttpRequest.Headers.Any(p => p.StartsWith("Proxy-Authorization:")));
+            }
+        }
+
+        private static ConnectionInfo CreateConnectionInfoWithProxy(IPEndPoint proxyEndPoint, IPEndPoint serverEndPoint, string proxyUserName)
+        {
+            return new ConnectionInfo(
+                serverEndPoint.Address.ToString(),
+                serverEndPoint.Port,
+                "eric",
+                ProxyTypes.Http,
+                proxyEndPoint.Address.ToString(),
+                proxyEndPoint.Port,
+                proxyUserName,
+                "proxypwd",
+                new NoneAuthenticationMethod("eric"));
+        }
+
+        private static string CreateProxyAuthorizationHeader(ConnectionInfo connectionInfo)
+        {
+            return string.Format("Proxy-Authorization: Basic {0}",
+                Convert.ToBase64String(
+                    Encoding.ASCII.GetBytes(string.Format("{0}:{1}", connectionInfo.ProxyUsername,
+                        connectionInfo.ProxyPassword))));
+        }
+    }
+}

+ 362 - 362
src/Renci.SshNet.Tests/Classes/SessionTest.cs

@@ -1,363 +1,363 @@
-using System;
-using System.Globalization;
-using System.Net;
-using System.Net.Sockets;
-using System.Text;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Moq;
-using Renci.SshNet.Common;
-using Renci.SshNet.Tests.Common;
-using Renci.SshNet.Tests.Properties;
-
-namespace Renci.SshNet.Tests.Classes
-{
-    /// <summary>
-    /// Provides functionality to connect and interact with SSH server.
-    /// </summary>
-    [TestClass]
-    public partial class SessionTest : TestBase
-    {
-        private Mock<IServiceFactory> _serviceFactoryMock;
-
-        protected override void OnInit()
-        {
-            base.OnInit();
-
-            _serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
-        }
-
-        [TestMethod]
-        public void ConstructorShouldThrowArgumentNullExceptionWhenConnectionInfoIsNull()
-        {
-            ConnectionInfo connectionInfo = null;
-            var serviceFactory = new Mock<IServiceFactory>(MockBehavior.Strict).Object;
-
-            try
-            {
-                new Session(connectionInfo, serviceFactory);
-                Assert.Fail();
-            }
-            catch (ArgumentNullException ex)
-            {
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("connectionInfo", ex.ParamName);
-            }
-        }
-
-        [TestMethod]
-        public void ConstructorShouldThrowArgumentNullExceptionWhenServiceFactoryIsNull()
-        {
-            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
-            var connectionInfo = CreateConnectionInfo(serverEndPoint, TimeSpan.FromSeconds(5));
-            IServiceFactory serviceFactory = null;
-
-            try
-            {
-                new Session(connectionInfo, serviceFactory);
-                Assert.Fail();
-            }
-            catch (ArgumentNullException ex)
-            {
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("serviceFactory", ex.ParamName);
-            }
-        }
-
-        [TestMethod]
-        public void ConnectShouldSkipLinesBeforeProtocolIdentificationString()
-        {
-            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
-            var connectionInfo = CreateConnectionInfo(serverEndPoint, TimeSpan.FromSeconds(5));
-
-            using (var serverStub = new AsyncSocketListener(serverEndPoint))
-            {
-                serverStub.Connected += socket =>
-                    {
-                        socket.Send(Encoding.ASCII.GetBytes("\r\n"));
-                        socket.Send(Encoding.ASCII.GetBytes("WELCOME banner\r\n"));
-                        socket.Send(Encoding.ASCII.GetBytes("SSH-666-SshStub\r\n"));
-                        socket.Shutdown(SocketShutdown.Send);
-                    };
-                serverStub.Start();
-
-                using (var session = new Session(connectionInfo, _serviceFactoryMock.Object))
-                {
-                    try
-                    {
-                        session.Connect();
-                        Assert.Fail();
-                    }
-                    catch (SshConnectionException ex)
-                    {
-                        Assert.IsNull(ex.InnerException);
-                        Assert.AreEqual("Server version '666' is not supported.", ex.Message);
-
-                        Assert.AreEqual("SSH-666-SshStub", connectionInfo.ServerVersion);
-                    }
-                }
-            }
-        }
-
-        [TestMethod]
-        public void ConnectShouldSupportProtocolIdentificationStringThatDoesNotEndWithCrlf()
-        {
-            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
-            var connectionInfo = CreateConnectionInfo(serverEndPoint, TimeSpan.FromSeconds(5));
-
-            using (var serverStub = new AsyncSocketListener(serverEndPoint))
-            {
-                serverStub.Connected += socket =>
-                    {
-                        socket.Send(Encoding.ASCII.GetBytes("\r\n"));
-                        socket.Send(Encoding.ASCII.GetBytes("WELCOME banner\r\n"));
-                        socket.Send(Encoding.ASCII.GetBytes("SSH-666-SshStub"));
-                        socket.Shutdown(SocketShutdown.Send);
-                    };
-                serverStub.Start();
-
-                using (var session = new Session(connectionInfo, _serviceFactoryMock.Object))
-                {
-                    try
-                    {
-                        session.Connect();
-                        Assert.Fail();
-                    }
-                    catch (SshConnectionException ex)
-                    {
-                        Assert.IsNull(ex.InnerException);
-                        Assert.AreEqual("Server version '666' is not supported.", ex.Message);
-
-                        Assert.AreEqual("SSH-666-SshStub", connectionInfo.ServerVersion);
-                    }
-                }
-            }
-        }
-
-        [TestMethod]
-        public void ConnectShouldThrowSshOperationExceptionWhenServerDoesNotRespondWithinConnectionTimeout()
-        {
-            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
-            var timeout = TimeSpan.FromMilliseconds(500);
-            Socket clientSocket = null;
-
-            using (var serverStub = new AsyncSocketListener(serverEndPoint))
-            {
-                serverStub.Connected += socket =>
-                    {
-                        socket.Send(Encoding.ASCII.GetBytes("\r\n"));
-                        socket.Send(Encoding.ASCII.GetBytes("WELCOME banner\r\n"));
-                        clientSocket = socket;
-                    };
-                serverStub.Start();
-
-                using (var session = new Session(CreateConnectionInfo(serverEndPoint, TimeSpan.FromMilliseconds(500)), _serviceFactoryMock.Object))
-                {
-                    try
-                    {
-                        session.Connect();
-                        Assert.Fail();
-                    }
-                    catch (SshOperationTimeoutException ex)
-                    {
-                        Assert.IsNull(ex.InnerException);
-                        Assert.AreEqual(string.Format(CultureInfo.InvariantCulture, "Socket read operation has timed out after {0:F0} milliseconds.", timeout.TotalMilliseconds), ex.Message);
-
-                        Assert.IsNotNull(clientSocket);
-                        Assert.IsTrue(clientSocket.Connected);
-
-                        // shut down socket
-                        clientSocket.Shutdown(SocketShutdown.Send);
-                    }
-                }
-            }
-        }
-
-        [TestMethod]
-        public void ConnectShouldSshConnectionExceptionWhenServerResponseDoesNotContainProtocolIdentificationString()
-        {
-            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
-
-            // response ends with CRLF
-            using (var serverStub = new AsyncSocketListener(serverEndPoint))
-            {
-                serverStub.Connected += socket =>
-                    {
-                        socket.Send(Encoding.ASCII.GetBytes("\r\n"));
-                        socket.Send(Encoding.ASCII.GetBytes("WELCOME banner\r\n"));
-                        socket.Shutdown(SocketShutdown.Send);
-                    };
-                serverStub.Start();
-
-                using (var session = new Session(CreateConnectionInfo(serverEndPoint, TimeSpan.FromSeconds(5)), _serviceFactoryMock.Object))
-                {
-                    try
-                    {
-                        session.Connect();
-                        Assert.Fail();
-                    }
-                    catch (SshConnectionException ex)
-                    {
-                        Assert.IsNull(ex.InnerException);
-                        Assert.AreEqual("Server response does not contain SSH protocol identification.", ex.Message);
-                    }
-                }
-            }
-
-            // response does not end with CRLF
-            using (var serverStub = new AsyncSocketListener(serverEndPoint))
-            {
-                serverStub.Connected += socket =>
-                    {
-                        socket.Send(Encoding.ASCII.GetBytes("\r\n"));
-                        socket.Send(Encoding.ASCII.GetBytes("WELCOME banner"));
-                        socket.Shutdown(SocketShutdown.Send);
-                    };
-                serverStub.Start();
-
-                using (var session = new Session(CreateConnectionInfo(serverEndPoint, TimeSpan.FromSeconds(5)), _serviceFactoryMock.Object))
-                {
-                    try
-                    {
-                        session.Connect();
-                        Assert.Fail();
-                    }
-                    catch (SshConnectionException ex)
-                    {
-                        Assert.IsNull(ex.InnerException);
-                        Assert.AreEqual("Server response does not contain SSH protocol identification.", ex.Message);
-                    }
-                }
-            }
-
-            // last line is empty
-            using (var serverStub = new AsyncSocketListener(serverEndPoint))
-            {
-                serverStub.Connected += socket =>
-                    {
-                        socket.Send(Encoding.ASCII.GetBytes("\r\n"));
-                        socket.Send(Encoding.ASCII.GetBytes("WELCOME banner\r\n"));
-                        socket.Send(Encoding.ASCII.GetBytes("\r\n"));
-                        socket.Shutdown(SocketShutdown.Send);
-                    };
-                serverStub.Start();
-
-                using (var session = new Session(CreateConnectionInfo(serverEndPoint, TimeSpan.FromSeconds(5)), _serviceFactoryMock.Object))
-                {
-                    try
-                    {
-                        session.Connect();
-                        Assert.Fail();
-                    }
-                    catch (SshConnectionException ex)
-                    {
-                        Assert.IsNull(ex.InnerException);
-                        Assert.AreEqual("Server response does not contain SSH protocol identification.", ex.Message);
-                    }
-                }
-            }
-        }
-
-        [TestMethod]
-        public void Connect_HostNameInvalid_ShouldThrowSocketExceptionWithErrorCodeHostNotFound()
-        {
-            var connectionInfo = new ConnectionInfo("invalid.", 40, "user",
-                new KeyboardInteractiveAuthenticationMethod("user"));
-            var session = new Session(connectionInfo, _serviceFactoryMock.Object);
-
-            try
-            {
-                session.Connect();
-                Assert.Fail();
-            }
-            catch (SocketException ex)
-            {
-                Assert.AreEqual(ex.ErrorCode, (int)SocketError.HostNotFound);
-            }
-        }
-
-        [TestMethod]
-        public void Connect_ProxyHostNameInvalid_ShouldThrowSocketExceptionWithErrorCodeHostNotFound()
-        {
-            var connectionInfo = new ConnectionInfo("localhost", 40, "user", ProxyTypes.Http, "invalid.", 80,
-                "proxyUser", "proxyPwd", new KeyboardInteractiveAuthenticationMethod("user"));
-            var session = new Session(connectionInfo, _serviceFactoryMock.Object);
-
-            try
-            {
-                session.Connect();
-                Assert.Fail();
-            }
-            catch (SocketException ex)
-            {
-                Assert.AreEqual(ex.ErrorCode, (int)SocketError.HostNotFound);
-            }
-        }
-
-        [TestMethod]
-        public void DisconnectShouldNotThrowExceptionWhenSocketIsNotConnected()
-        {
-            var connectionInfo = new ConnectionInfo("localhost", 6767, Resources.USERNAME,
-                new KeyboardInteractiveAuthenticationMethod(Resources.USERNAME));
-            var session = new Session(connectionInfo, _serviceFactoryMock.Object);
-
-            try
-            {
-                session.Connect();
-                Assert.Fail();
-            }
-            catch (SocketException)
-            {
-                session.Disconnect();
-            }
-        }
-
-        [TestMethod]
-        public void DisconnectShouldNotThrowExceptionWhenConnectHasNotBeenInvoked()
-        {
-            var connectionInfo = new ConnectionInfo("localhost", 6767, Resources.USERNAME,
-                new KeyboardInteractiveAuthenticationMethod(Resources.USERNAME));
-            var session = new Session(connectionInfo, _serviceFactoryMock.Object);
-
-            session.Disconnect();
-        }
-
-        [TestMethod]
-        public void DisposeShouldNotThrowExceptionWhenSocketIsNotConnected()
-        {
-            var connectionInfo = new ConnectionInfo("localhost", 6767, Resources.USERNAME,
-                new KeyboardInteractiveAuthenticationMethod(Resources.USERNAME));
-            var session = new Session(connectionInfo, _serviceFactoryMock.Object);
-
-            try
-            {
-                session.Connect();
-                Assert.Fail();
-            }
-            catch (SocketException)
-            {
-                session.Dispose();
-            }
-        }
-
-        [TestMethod]
-        public void DisposeShouldNotThrowExceptionWhenConenectHasNotBeenInvoked()
-        {
-            var connectionInfo = new ConnectionInfo("localhost", 6767, Resources.USERNAME,
-                new KeyboardInteractiveAuthenticationMethod(Resources.USERNAME));
-            var session = new Session(connectionInfo, _serviceFactoryMock.Object);
-
-            session.Disconnect();
-        }
-
-        private static ConnectionInfo CreateConnectionInfo(IPEndPoint serverEndPoint, TimeSpan timeout)
-        {
-            var connectionInfo = new ConnectionInfo(
-                serverEndPoint.Address.ToString(),
-                serverEndPoint.Port,
-                "eric",
-                new NoneAuthenticationMethod("eric"));
-            connectionInfo.Timeout = timeout;
-            return connectionInfo;
-        }
-    }
+using System;
+using System.Globalization;
+using System.Net;
+using System.Net.Sockets;
+using System.Text;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Moq;
+using Renci.SshNet.Common;
+using Renci.SshNet.Tests.Common;
+using Renci.SshNet.Tests.Properties;
+
+namespace Renci.SshNet.Tests.Classes
+{
+    /// <summary>
+    /// Provides functionality to connect and interact with SSH server.
+    /// </summary>
+    [TestClass]
+    public partial class SessionTest : TestBase
+    {
+        private Mock<IServiceFactory> _serviceFactoryMock;
+
+        protected override void OnInit()
+        {
+            base.OnInit();
+
+            _serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
+        }
+
+        [TestMethod]
+        public void ConstructorShouldThrowArgumentNullExceptionWhenConnectionInfoIsNull()
+        {
+            ConnectionInfo connectionInfo = null;
+            var serviceFactory = new Mock<IServiceFactory>(MockBehavior.Strict).Object;
+
+            try
+            {
+                new Session(connectionInfo, serviceFactory);
+                Assert.Fail();
+            }
+            catch (ArgumentNullException ex)
+            {
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("connectionInfo", ex.ParamName);
+            }
+        }
+
+        [TestMethod]
+        public void ConstructorShouldThrowArgumentNullExceptionWhenServiceFactoryIsNull()
+        {
+            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
+            var connectionInfo = CreateConnectionInfo(serverEndPoint, TimeSpan.FromSeconds(5));
+            IServiceFactory serviceFactory = null;
+
+            try
+            {
+                new Session(connectionInfo, serviceFactory);
+                Assert.Fail();
+            }
+            catch (ArgumentNullException ex)
+            {
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("serviceFactory", ex.ParamName);
+            }
+        }
+
+        [TestMethod]
+        public void ConnectShouldSkipLinesBeforeProtocolIdentificationString()
+        {
+            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
+            var connectionInfo = CreateConnectionInfo(serverEndPoint, TimeSpan.FromSeconds(5));
+
+            using (var serverStub = new AsyncSocketListener(serverEndPoint))
+            {
+                serverStub.Connected += socket =>
+                    {
+                        socket.Send(Encoding.ASCII.GetBytes("\r\n"));
+                        socket.Send(Encoding.ASCII.GetBytes("WELCOME banner\r\n"));
+                        socket.Send(Encoding.ASCII.GetBytes("SSH-666-SshStub\r\n"));
+                        socket.Shutdown(SocketShutdown.Send);
+                    };
+                serverStub.Start();
+
+                using (var session = new Session(connectionInfo, _serviceFactoryMock.Object))
+                {
+                    try
+                    {
+                        session.Connect();
+                        Assert.Fail();
+                    }
+                    catch (SshConnectionException ex)
+                    {
+                        Assert.IsNull(ex.InnerException);
+                        Assert.AreEqual("Server version '666' is not supported.", ex.Message);
+
+                        Assert.AreEqual("SSH-666-SshStub", connectionInfo.ServerVersion);
+                    }
+                }
+            }
+        }
+
+        [TestMethod]
+        public void ConnectShouldSupportProtocolIdentificationStringThatDoesNotEndWithCrlf()
+        {
+            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
+            var connectionInfo = CreateConnectionInfo(serverEndPoint, TimeSpan.FromSeconds(5));
+
+            using (var serverStub = new AsyncSocketListener(serverEndPoint))
+            {
+                serverStub.Connected += socket =>
+                    {
+                        socket.Send(Encoding.ASCII.GetBytes("\r\n"));
+                        socket.Send(Encoding.ASCII.GetBytes("WELCOME banner\r\n"));
+                        socket.Send(Encoding.ASCII.GetBytes("SSH-666-SshStub"));
+                        socket.Shutdown(SocketShutdown.Send);
+                    };
+                serverStub.Start();
+
+                using (var session = new Session(connectionInfo, _serviceFactoryMock.Object))
+                {
+                    try
+                    {
+                        session.Connect();
+                        Assert.Fail();
+                    }
+                    catch (SshConnectionException ex)
+                    {
+                        Assert.IsNull(ex.InnerException);
+                        Assert.AreEqual("Server version '666' is not supported.", ex.Message);
+
+                        Assert.AreEqual("SSH-666-SshStub", connectionInfo.ServerVersion);
+                    }
+                }
+            }
+        }
+
+        [TestMethod]
+        public void ConnectShouldThrowSshOperationExceptionWhenServerDoesNotRespondWithinConnectionTimeout()
+        {
+            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
+            var timeout = TimeSpan.FromMilliseconds(500);
+            Socket clientSocket = null;
+
+            using (var serverStub = new AsyncSocketListener(serverEndPoint))
+            {
+                serverStub.Connected += socket =>
+                    {
+                        socket.Send(Encoding.ASCII.GetBytes("\r\n"));
+                        socket.Send(Encoding.ASCII.GetBytes("WELCOME banner\r\n"));
+                        clientSocket = socket;
+                    };
+                serverStub.Start();
+
+                using (var session = new Session(CreateConnectionInfo(serverEndPoint, TimeSpan.FromMilliseconds(500)), _serviceFactoryMock.Object))
+                {
+                    try
+                    {
+                        session.Connect();
+                        Assert.Fail();
+                    }
+                    catch (SshOperationTimeoutException ex)
+                    {
+                        Assert.IsNull(ex.InnerException);
+                        Assert.AreEqual(string.Format(CultureInfo.InvariantCulture, "Socket read operation has timed out after {0:F0} milliseconds.", timeout.TotalMilliseconds), ex.Message);
+
+                        Assert.IsNotNull(clientSocket);
+                        Assert.IsTrue(clientSocket.Connected);
+
+                        // shut down socket
+                        clientSocket.Shutdown(SocketShutdown.Send);
+                    }
+                }
+            }
+        }
+
+        [TestMethod]
+        public void ConnectShouldSshConnectionExceptionWhenServerResponseDoesNotContainProtocolIdentificationString()
+        {
+            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
+
+            // response ends with CRLF
+            using (var serverStub = new AsyncSocketListener(serverEndPoint))
+            {
+                serverStub.Connected += socket =>
+                    {
+                        socket.Send(Encoding.ASCII.GetBytes("\r\n"));
+                        socket.Send(Encoding.ASCII.GetBytes("WELCOME banner\r\n"));
+                        socket.Shutdown(SocketShutdown.Send);
+                    };
+                serverStub.Start();
+
+                using (var session = new Session(CreateConnectionInfo(serverEndPoint, TimeSpan.FromSeconds(5)), _serviceFactoryMock.Object))
+                {
+                    try
+                    {
+                        session.Connect();
+                        Assert.Fail();
+                    }
+                    catch (SshConnectionException ex)
+                    {
+                        Assert.IsNull(ex.InnerException);
+                        Assert.AreEqual("Server response does not contain SSH protocol identification.", ex.Message);
+                    }
+                }
+            }
+
+            // response does not end with CRLF
+            using (var serverStub = new AsyncSocketListener(serverEndPoint))
+            {
+                serverStub.Connected += socket =>
+                    {
+                        socket.Send(Encoding.ASCII.GetBytes("\r\n"));
+                        socket.Send(Encoding.ASCII.GetBytes("WELCOME banner"));
+                        socket.Shutdown(SocketShutdown.Send);
+                    };
+                serverStub.Start();
+
+                using (var session = new Session(CreateConnectionInfo(serverEndPoint, TimeSpan.FromSeconds(5)), _serviceFactoryMock.Object))
+                {
+                    try
+                    {
+                        session.Connect();
+                        Assert.Fail();
+                    }
+                    catch (SshConnectionException ex)
+                    {
+                        Assert.IsNull(ex.InnerException);
+                        Assert.AreEqual("Server response does not contain SSH protocol identification.", ex.Message);
+                    }
+                }
+            }
+
+            // last line is empty
+            using (var serverStub = new AsyncSocketListener(serverEndPoint))
+            {
+                serverStub.Connected += socket =>
+                    {
+                        socket.Send(Encoding.ASCII.GetBytes("\r\n"));
+                        socket.Send(Encoding.ASCII.GetBytes("WELCOME banner\r\n"));
+                        socket.Send(Encoding.ASCII.GetBytes("\r\n"));
+                        socket.Shutdown(SocketShutdown.Send);
+                    };
+                serverStub.Start();
+
+                using (var session = new Session(CreateConnectionInfo(serverEndPoint, TimeSpan.FromSeconds(5)), _serviceFactoryMock.Object))
+                {
+                    try
+                    {
+                        session.Connect();
+                        Assert.Fail();
+                    }
+                    catch (SshConnectionException ex)
+                    {
+                        Assert.IsNull(ex.InnerException);
+                        Assert.AreEqual("Server response does not contain SSH protocol identification.", ex.Message);
+                    }
+                }
+            }
+        }
+
+        [TestMethod]
+        public void Connect_HostNameInvalid_ShouldThrowSocketExceptionWithErrorCodeHostNotFound()
+        {
+            var connectionInfo = new ConnectionInfo("invalid.", 40, "user",
+                new KeyboardInteractiveAuthenticationMethod("user"));
+            var session = new Session(connectionInfo, _serviceFactoryMock.Object);
+
+            try
+            {
+                session.Connect();
+                Assert.Fail();
+            }
+            catch (SocketException ex)
+            {
+                Assert.AreEqual(ex.ErrorCode, (int)SocketError.HostNotFound);
+            }
+        }
+
+        [TestMethod]
+        public void Connect_ProxyHostNameInvalid_ShouldThrowSocketExceptionWithErrorCodeHostNotFound()
+        {
+            var connectionInfo = new ConnectionInfo("localhost", 40, "user", ProxyTypes.Http, "invalid.", 80,
+                "proxyUser", "proxyPwd", new KeyboardInteractiveAuthenticationMethod("user"));
+            var session = new Session(connectionInfo, _serviceFactoryMock.Object);
+
+            try
+            {
+                session.Connect();
+                Assert.Fail();
+            }
+            catch (SocketException ex)
+            {
+                Assert.AreEqual(ex.ErrorCode, (int)SocketError.HostNotFound);
+            }
+        }
+
+        [TestMethod]
+        public void DisconnectShouldNotThrowExceptionWhenSocketIsNotConnected()
+        {
+            var connectionInfo = new ConnectionInfo("localhost", 6767, Resources.USERNAME,
+                new KeyboardInteractiveAuthenticationMethod(Resources.USERNAME));
+            var session = new Session(connectionInfo, _serviceFactoryMock.Object);
+
+            try
+            {
+                session.Connect();
+                Assert.Fail();
+            }
+            catch (SocketException)
+            {
+                session.Disconnect();
+            }
+        }
+
+        [TestMethod]
+        public void DisconnectShouldNotThrowExceptionWhenConnectHasNotBeenInvoked()
+        {
+            var connectionInfo = new ConnectionInfo("localhost", 6767, Resources.USERNAME,
+                new KeyboardInteractiveAuthenticationMethod(Resources.USERNAME));
+            var session = new Session(connectionInfo, _serviceFactoryMock.Object);
+
+            session.Disconnect();
+        }
+
+        [TestMethod]
+        public void DisposeShouldNotThrowExceptionWhenSocketIsNotConnected()
+        {
+            var connectionInfo = new ConnectionInfo("localhost", 6767, Resources.USERNAME,
+                new KeyboardInteractiveAuthenticationMethod(Resources.USERNAME));
+            var session = new Session(connectionInfo, _serviceFactoryMock.Object);
+
+            try
+            {
+                session.Connect();
+                Assert.Fail();
+            }
+            catch (SocketException)
+            {
+                session.Dispose();
+            }
+        }
+
+        [TestMethod]
+        public void DisposeShouldNotThrowExceptionWhenConenectHasNotBeenInvoked()
+        {
+            var connectionInfo = new ConnectionInfo("localhost", 6767, Resources.USERNAME,
+                new KeyboardInteractiveAuthenticationMethod(Resources.USERNAME));
+            var session = new Session(connectionInfo, _serviceFactoryMock.Object);
+
+            session.Disconnect();
+        }
+
+        private static ConnectionInfo CreateConnectionInfo(IPEndPoint serverEndPoint, TimeSpan timeout)
+        {
+            var connectionInfo = new ConnectionInfo(
+                serverEndPoint.Address.ToString(),
+                serverEndPoint.Port,
+                "eric",
+                new NoneAuthenticationMethod("eric"));
+            connectionInfo.Timeout = timeout;
+            return connectionInfo;
+        }
+    }
 }

+ 169 - 169
src/Renci.SshNet.Tests/Classes/SessionTest_Connected.cs

@@ -1,169 +1,169 @@
-using System;
-using System.Threading;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Messages.Transport;
-
-namespace Renci.SshNet.Tests.Classes
-{
-    [TestClass]
-    public class SessionTest_Connected : SessionTest_ConnectedBase
-    {
-        private IgnoreMessage _ignoreMessage;
-
-        protected override void Arrange()
-        {
-            base.Arrange();
-
-            var data = new byte[10];
-            Random.NextBytes(data);
-            _ignoreMessage = new IgnoreMessage(data);
-        }
-
-        protected override void Act()
-        {
-        }
-
-        [TestMethod]
-        public void ClientVersionIsRenciSshNet()
-        {
-            Assert.AreEqual("SSH-2.0-Renci.SshNet.SshClient.0.0.1", Session.ClientVersion);
-        }
-
-        [TestMethod]
-        public void ConnectionInfoShouldReturnConnectionInfoPassedThroughConstructor()
-        {
-            Assert.AreSame(ConnectionInfo, Session.ConnectionInfo);
-        }
-
-        [TestMethod]
-        public void IsConnectedShouldReturnTrue()
-        {
-            Assert.IsTrue(Session.IsConnected);
-        }
-
-        [TestMethod]
-        public void SendMessageShouldSendPacketToServer()
-        {
-            ServerBytesReceivedRegister.Clear();
-
-            Session.SendMessage(_ignoreMessage);
-
-            // give session time to process message
-            Thread.Sleep(100);
-
-            Assert.AreEqual(1, ServerBytesReceivedRegister.Count);
-        }
-
-        [TestMethod]
-        public void SessionIdShouldReturnExchangeHashCalculatedFromKeyExchangeInitMessage()
-        {
-            Assert.IsNotNull(Session.SessionId);
-            Assert.AreSame(SessionId, Session.SessionId);
-        }
-
-        [TestMethod]
-        public void ServerVersionShouldNotReturnNull()
-        {
-            Assert.IsNotNull(Session.ServerVersion);
-            Assert.AreEqual("SSH-2.0-SshStub", Session.ServerVersion);
-        }
-
-        [TestMethod]
-        public void WaitOnHandle_WaitHandle_ShouldThrowArgumentNullExceptionWhenWaitHandleIsNull()
-        {
-            WaitHandle waitHandle = null;
-
-            try
-            {
-                Session.WaitOnHandle(waitHandle);
-                Assert.Fail();
-            }
-            catch (ArgumentNullException ex)
-            {
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("waitHandle", ex.ParamName);
-            }
-        }
-
-        [TestMethod]
-        public void WaitOnHandle_WaitHandleAndTimeout_ShouldThrowArgumentNullExceptionWhenWaitHandleIsNull()
-        {
-            WaitHandle waitHandle = null;
-            var timeout = TimeSpan.FromMinutes(5);
-
-            try
-            {
-                Session.WaitOnHandle(waitHandle, timeout);
-                Assert.Fail();
-            }
-            catch (ArgumentNullException ex)
-            {
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("waitHandle", ex.ParamName);
-            }
-        }
-
-        [TestMethod]
-        public void ISession_ConnectionInfoShouldReturnConnectionInfoPassedThroughConstructor()
-        {
-            var session = (ISession) Session;
-            Assert.AreSame(ConnectionInfo, session.ConnectionInfo);
-        }
-
-        [TestMethod]
-        public void ISession_MessageListenerCompletedShouldNotBeSignaled()
-        {
-            var session = (ISession) Session;
-
-            Assert.IsNotNull(session.MessageListenerCompleted);
-            Assert.IsFalse(session.MessageListenerCompleted.WaitOne(0));
-        }
-
-        [TestMethod]
-        public void ISession_SendMessageShouldSendPacketToServer()
-        {
-            var session = (ISession) Session;
-            ServerBytesReceivedRegister.Clear();
-
-            session.SendMessage(_ignoreMessage);
-
-            // give session time to process message
-            Thread.Sleep(100);
-
-            Assert.AreEqual(1, ServerBytesReceivedRegister.Count);
-        }
-
-        [TestMethod]
-        public void ISession_TrySendMessageShouldSendPacketToServerAndReturnTrue()
-        {
-            var session = (ISession) Session;
-            ServerBytesReceivedRegister.Clear();
-
-            var actual = session.TrySendMessage(new IgnoreMessage());
-
-            // give session time to process message
-            Thread.Sleep(100);
-
-            Assert.IsTrue(actual);
-            Assert.AreEqual(1, ServerBytesReceivedRegister.Count);
-        }
-
-        [TestMethod]
-        public void ISession_WaitOnHandleShouldThrowArgumentNullExceptionWhenWaitHandleIsNull()
-        {
-            WaitHandle waitHandle = null;
-            var session = (ISession) Session;
-
-            try
-            {
-                session.WaitOnHandle(waitHandle);
-                Assert.Fail();
-            }
-            catch (ArgumentNullException ex)
-            {
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("waitHandle", ex.ParamName);
-            }
-        }
-    }
-}
+using System;
+using System.Threading;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Messages.Transport;
+
+namespace Renci.SshNet.Tests.Classes
+{
+    [TestClass]
+    public class SessionTest_Connected : SessionTest_ConnectedBase
+    {
+        private IgnoreMessage _ignoreMessage;
+
+        protected override void Arrange()
+        {
+            base.Arrange();
+
+            var data = new byte[10];
+            Random.NextBytes(data);
+            _ignoreMessage = new IgnoreMessage(data);
+        }
+
+        protected override void Act()
+        {
+        }
+
+        [TestMethod]
+        public void ClientVersionIsRenciSshNet()
+        {
+            Assert.AreEqual("SSH-2.0-Renci.SshNet.SshClient.0.0.1", Session.ClientVersion);
+        }
+
+        [TestMethod]
+        public void ConnectionInfoShouldReturnConnectionInfoPassedThroughConstructor()
+        {
+            Assert.AreSame(ConnectionInfo, Session.ConnectionInfo);
+        }
+
+        [TestMethod]
+        public void IsConnectedShouldReturnTrue()
+        {
+            Assert.IsTrue(Session.IsConnected);
+        }
+
+        [TestMethod]
+        public void SendMessageShouldSendPacketToServer()
+        {
+            ServerBytesReceivedRegister.Clear();
+
+            Session.SendMessage(_ignoreMessage);
+
+            // give session time to process message
+            Thread.Sleep(100);
+
+            Assert.AreEqual(1, ServerBytesReceivedRegister.Count);
+        }
+
+        [TestMethod]
+        public void SessionIdShouldReturnExchangeHashCalculatedFromKeyExchangeInitMessage()
+        {
+            Assert.IsNotNull(Session.SessionId);
+            Assert.AreSame(SessionId, Session.SessionId);
+        }
+
+        [TestMethod]
+        public void ServerVersionShouldNotReturnNull()
+        {
+            Assert.IsNotNull(Session.ServerVersion);
+            Assert.AreEqual("SSH-2.0-SshStub", Session.ServerVersion);
+        }
+
+        [TestMethod]
+        public void WaitOnHandle_WaitHandle_ShouldThrowArgumentNullExceptionWhenWaitHandleIsNull()
+        {
+            WaitHandle waitHandle = null;
+
+            try
+            {
+                Session.WaitOnHandle(waitHandle);
+                Assert.Fail();
+            }
+            catch (ArgumentNullException ex)
+            {
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("waitHandle", ex.ParamName);
+            }
+        }
+
+        [TestMethod]
+        public void WaitOnHandle_WaitHandleAndTimeout_ShouldThrowArgumentNullExceptionWhenWaitHandleIsNull()
+        {
+            WaitHandle waitHandle = null;
+            var timeout = TimeSpan.FromMinutes(5);
+
+            try
+            {
+                Session.WaitOnHandle(waitHandle, timeout);
+                Assert.Fail();
+            }
+            catch (ArgumentNullException ex)
+            {
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("waitHandle", ex.ParamName);
+            }
+        }
+
+        [TestMethod]
+        public void ISession_ConnectionInfoShouldReturnConnectionInfoPassedThroughConstructor()
+        {
+            var session = (ISession) Session;
+            Assert.AreSame(ConnectionInfo, session.ConnectionInfo);
+        }
+
+        [TestMethod]
+        public void ISession_MessageListenerCompletedShouldNotBeSignaled()
+        {
+            var session = (ISession) Session;
+
+            Assert.IsNotNull(session.MessageListenerCompleted);
+            Assert.IsFalse(session.MessageListenerCompleted.WaitOne(0));
+        }
+
+        [TestMethod]
+        public void ISession_SendMessageShouldSendPacketToServer()
+        {
+            var session = (ISession) Session;
+            ServerBytesReceivedRegister.Clear();
+
+            session.SendMessage(_ignoreMessage);
+
+            // give session time to process message
+            Thread.Sleep(100);
+
+            Assert.AreEqual(1, ServerBytesReceivedRegister.Count);
+        }
+
+        [TestMethod]
+        public void ISession_TrySendMessageShouldSendPacketToServerAndReturnTrue()
+        {
+            var session = (ISession) Session;
+            ServerBytesReceivedRegister.Clear();
+
+            var actual = session.TrySendMessage(new IgnoreMessage());
+
+            // give session time to process message
+            Thread.Sleep(100);
+
+            Assert.IsTrue(actual);
+            Assert.AreEqual(1, ServerBytesReceivedRegister.Count);
+        }
+
+        [TestMethod]
+        public void ISession_WaitOnHandleShouldThrowArgumentNullExceptionWhenWaitHandleIsNull()
+        {
+            WaitHandle waitHandle = null;
+            var session = (ISession) Session;
+
+            try
+            {
+                session.WaitOnHandle(waitHandle);
+                Assert.Fail();
+            }
+            catch (ArgumentNullException ex)
+            {
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("waitHandle", ex.ParamName);
+            }
+        }
+    }
+}

+ 192 - 192
src/Renci.SshNet.Tests/Classes/SessionTest_ConnectedBase.cs

@@ -1,192 +1,192 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Net;
-using System.Net.Sockets;
-using System.Security.Cryptography;
-using System.Text;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Moq;
-using Renci.SshNet.Common;
-using Renci.SshNet.Compression;
-using Renci.SshNet.Messages;
-using Renci.SshNet.Messages.Transport;
-using Renci.SshNet.Security;
-using Renci.SshNet.Security.Cryptography;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes
-{
-    [TestClass]
-    public abstract class SessionTest_ConnectedBase
-    {
-        private Mock<IServiceFactory> _serviceFactoryMock;
-        private Mock<IKeyExchange> _keyExchangeMock;
-        private Mock<IClientAuthentication> _clientAuthenticationMock;
-        private IPEndPoint _serverEndPoint;
-        private string _keyExchangeAlgorithm;
-
-        protected Random Random { get; private set; }
-        protected byte[] SessionId { get; private set; }
-        protected ConnectionInfo ConnectionInfo { get; private set; }
-        protected IList<EventArgs> DisconnectedRegister { get; private set; }
-        protected IList<MessageEventArgs<DisconnectMessage>> DisconnectReceivedRegister { get; private set; }
-        protected IList<ExceptionEventArgs> ErrorOccurredRegister { get; private set; }
-        protected AsyncSocketListener ServerListener { get; private set; }
-        protected IList<byte[]> ServerBytesReceivedRegister { get; private set; }
-        protected Session Session { get; private set; }
-        protected Socket ServerSocket { get; private set; }
-
-        [TestInitialize]
-        public void Setup()
-        {
-            Arrange();
-            Act();
-        }
-
-        [TestCleanup]
-        public void TearDown()
-        {
-            if (ServerListener != null)
-            {
-                ServerListener.Dispose();
-            }
-
-            if (Session != null)
-            {
-                Session.Dispose();
-            }
-        }
-
-        protected virtual void Arrange()
-        {
-            Random = new Random();
-
-            _serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
-            ConnectionInfo = new ConnectionInfo(
-                _serverEndPoint.Address.ToString(),
-                _serverEndPoint.Port,
-                "user",
-                new PasswordAuthenticationMethod("user", "password"));
-            ConnectionInfo.Timeout = TimeSpan.FromSeconds(20);
-            _keyExchangeAlgorithm = Random.Next().ToString(CultureInfo.InvariantCulture);
-            SessionId = new byte[10];
-            Random.NextBytes(SessionId);
-            DisconnectedRegister = new List<EventArgs>();
-            DisconnectReceivedRegister = new List<MessageEventArgs<DisconnectMessage>>();
-            ErrorOccurredRegister = new List<ExceptionEventArgs>();
-            ServerBytesReceivedRegister = new List<byte[]>();
-
-            _serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
-            _keyExchangeMock = new Mock<IKeyExchange>(MockBehavior.Strict);
-            _clientAuthenticationMock = new Mock<IClientAuthentication>(MockBehavior.Strict);
-
-            Session = new Session(ConnectionInfo, _serviceFactoryMock.Object);
-            Session.Disconnected += (sender, args) => DisconnectedRegister.Add(args);
-            Session.DisconnectReceived += (sender, args) => DisconnectReceivedRegister.Add(args);
-            Session.ErrorOccured += (sender, args) => ErrorOccurredRegister.Add(args);
-            Session.KeyExchangeInitReceived += (sender, args) =>
-                {
-                    var newKeysMessage = new NewKeysMessage();
-                    var newKeys = newKeysMessage.GetPacket(8, null);
-                    ServerSocket.Send(newKeys, 4, newKeys.Length - 4, SocketFlags.None);
-                };
-
-            _serviceFactoryMock.Setup(
-                p =>
-                    p.CreateKeyExchange(ConnectionInfo.KeyExchangeAlgorithms, new[] {_keyExchangeAlgorithm})).Returns(_keyExchangeMock.Object);
-            _keyExchangeMock.Setup(p => p.Name).Returns(_keyExchangeAlgorithm);
-            _keyExchangeMock.Setup(p => p.Start(Session, It.IsAny<KeyExchangeInitMessage>()));
-            _keyExchangeMock.Setup(p => p.ExchangeHash).Returns(SessionId);
-            _keyExchangeMock.Setup(p => p.CreateServerCipher()).Returns((Cipher) null);
-            _keyExchangeMock.Setup(p => p.CreateClientCipher()).Returns((Cipher) null);
-            _keyExchangeMock.Setup(p => p.CreateServerHash()).Returns((HashAlgorithm) null);
-            _keyExchangeMock.Setup(p => p.CreateClientHash()).Returns((HashAlgorithm) null);
-            _keyExchangeMock.Setup(p => p.CreateCompressor()).Returns((Compressor) null);
-            _keyExchangeMock.Setup(p => p.CreateDecompressor()).Returns((Compressor) null);
-            _keyExchangeMock.Setup(p => p.Dispose());
-            _serviceFactoryMock.Setup(p => p.CreateClientAuthentication()).Callback(ClientAuthentication_Callback).Returns(_clientAuthenticationMock.Object);
-            _clientAuthenticationMock.Setup(p => p.Authenticate(ConnectionInfo, Session));
-
-            ServerListener = new AsyncSocketListener(_serverEndPoint);
-            ServerListener.Connected += socket =>
-                {
-                    ServerSocket = socket;
-
-                    socket.Send(Encoding.ASCII.GetBytes("\r\n"));
-                    socket.Send(Encoding.ASCII.GetBytes("WELCOME banner\r\n"));
-                    socket.Send(Encoding.ASCII.GetBytes("SSH-2.0-SshStub\r\n"));
-                };
-
-            var counter = 0;
-
-            ServerListener.BytesReceived += (received, socket) =>
-                {
-                    ServerBytesReceivedRegister.Add(received);
-
-                    switch (counter++)
-                    {
-                        case 0:
-                            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]
-                                };
-                            var keyExchangeInit = keyExchangeInitMessage.GetPacket(8, null);
-                            ServerSocket.Send(keyExchangeInit, 4, keyExchangeInit.Length - 4, SocketFlags.None);
-                            break;
-                        case 1:
-                            var serviceAcceptMessage =
-                                ServiceAcceptMessageBuilder.Create(ServiceName.UserAuthentication)
-                                    .Build();
-                            ServerSocket.Send(serviceAcceptMessage, 0, serviceAcceptMessage.Length, SocketFlags.None);
-                            break;
-                    }
-                };
-            ServerListener.Start();
-
-            Session.Connect();
-        }
-
-        protected virtual void ClientAuthentication_Callback()
-        {
-        }
-
-        protected abstract void Act();
-
-        private class ServiceAcceptMessageBuilder
-        {
-            private readonly ServiceName _serviceName;
-
-            private ServiceAcceptMessageBuilder(ServiceName serviceName)
-            {
-                _serviceName = serviceName;
-            }
-
-            public static ServiceAcceptMessageBuilder Create(ServiceName serviceName)
-            {
-                return new ServiceAcceptMessageBuilder(serviceName);
-            }
-
-            public byte[] Build()
-            {
-                var serviceName = _serviceName.ToArray();
-
-                var sshDataStream = new SshDataStream(4 + 1 + 1 + 4 + serviceName.Length);
-                sshDataStream.Write((uint)(sshDataStream.Capacity - 4)); // packet length
-                sshDataStream.WriteByte(0); // padding length
-                sshDataStream.WriteByte(ServiceAcceptMessage.MessageNumber);
-                sshDataStream.WriteBinary(serviceName);
-                return sshDataStream.ToArray();
-            }
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Net;
+using System.Net.Sockets;
+using System.Security.Cryptography;
+using System.Text;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Moq;
+using Renci.SshNet.Common;
+using Renci.SshNet.Compression;
+using Renci.SshNet.Messages;
+using Renci.SshNet.Messages.Transport;
+using Renci.SshNet.Security;
+using Renci.SshNet.Security.Cryptography;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes
+{
+    [TestClass]
+    public abstract class SessionTest_ConnectedBase
+    {
+        private Mock<IServiceFactory> _serviceFactoryMock;
+        private Mock<IKeyExchange> _keyExchangeMock;
+        private Mock<IClientAuthentication> _clientAuthenticationMock;
+        private IPEndPoint _serverEndPoint;
+        private string _keyExchangeAlgorithm;
+
+        protected Random Random { get; private set; }
+        protected byte[] SessionId { get; private set; }
+        protected ConnectionInfo ConnectionInfo { get; private set; }
+        protected IList<EventArgs> DisconnectedRegister { get; private set; }
+        protected IList<MessageEventArgs<DisconnectMessage>> DisconnectReceivedRegister { get; private set; }
+        protected IList<ExceptionEventArgs> ErrorOccurredRegister { get; private set; }
+        protected AsyncSocketListener ServerListener { get; private set; }
+        protected IList<byte[]> ServerBytesReceivedRegister { get; private set; }
+        protected Session Session { get; private set; }
+        protected Socket ServerSocket { get; private set; }
+
+        [TestInitialize]
+        public void Setup()
+        {
+            Arrange();
+            Act();
+        }
+
+        [TestCleanup]
+        public void TearDown()
+        {
+            if (ServerListener != null)
+            {
+                ServerListener.Dispose();
+            }
+
+            if (Session != null)
+            {
+                Session.Dispose();
+            }
+        }
+
+        protected virtual void Arrange()
+        {
+            Random = new Random();
+
+            _serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
+            ConnectionInfo = new ConnectionInfo(
+                _serverEndPoint.Address.ToString(),
+                _serverEndPoint.Port,
+                "user",
+                new PasswordAuthenticationMethod("user", "password"));
+            ConnectionInfo.Timeout = TimeSpan.FromSeconds(20);
+            _keyExchangeAlgorithm = Random.Next().ToString(CultureInfo.InvariantCulture);
+            SessionId = new byte[10];
+            Random.NextBytes(SessionId);
+            DisconnectedRegister = new List<EventArgs>();
+            DisconnectReceivedRegister = new List<MessageEventArgs<DisconnectMessage>>();
+            ErrorOccurredRegister = new List<ExceptionEventArgs>();
+            ServerBytesReceivedRegister = new List<byte[]>();
+
+            _serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
+            _keyExchangeMock = new Mock<IKeyExchange>(MockBehavior.Strict);
+            _clientAuthenticationMock = new Mock<IClientAuthentication>(MockBehavior.Strict);
+
+            Session = new Session(ConnectionInfo, _serviceFactoryMock.Object);
+            Session.Disconnected += (sender, args) => DisconnectedRegister.Add(args);
+            Session.DisconnectReceived += (sender, args) => DisconnectReceivedRegister.Add(args);
+            Session.ErrorOccured += (sender, args) => ErrorOccurredRegister.Add(args);
+            Session.KeyExchangeInitReceived += (sender, args) =>
+                {
+                    var newKeysMessage = new NewKeysMessage();
+                    var newKeys = newKeysMessage.GetPacket(8, null);
+                    ServerSocket.Send(newKeys, 4, newKeys.Length - 4, SocketFlags.None);
+                };
+
+            _serviceFactoryMock.Setup(
+                p =>
+                    p.CreateKeyExchange(ConnectionInfo.KeyExchangeAlgorithms, new[] {_keyExchangeAlgorithm})).Returns(_keyExchangeMock.Object);
+            _keyExchangeMock.Setup(p => p.Name).Returns(_keyExchangeAlgorithm);
+            _keyExchangeMock.Setup(p => p.Start(Session, It.IsAny<KeyExchangeInitMessage>()));
+            _keyExchangeMock.Setup(p => p.ExchangeHash).Returns(SessionId);
+            _keyExchangeMock.Setup(p => p.CreateServerCipher()).Returns((Cipher) null);
+            _keyExchangeMock.Setup(p => p.CreateClientCipher()).Returns((Cipher) null);
+            _keyExchangeMock.Setup(p => p.CreateServerHash()).Returns((HashAlgorithm) null);
+            _keyExchangeMock.Setup(p => p.CreateClientHash()).Returns((HashAlgorithm) null);
+            _keyExchangeMock.Setup(p => p.CreateCompressor()).Returns((Compressor) null);
+            _keyExchangeMock.Setup(p => p.CreateDecompressor()).Returns((Compressor) null);
+            _keyExchangeMock.Setup(p => p.Dispose());
+            _serviceFactoryMock.Setup(p => p.CreateClientAuthentication()).Callback(ClientAuthentication_Callback).Returns(_clientAuthenticationMock.Object);
+            _clientAuthenticationMock.Setup(p => p.Authenticate(ConnectionInfo, Session));
+
+            ServerListener = new AsyncSocketListener(_serverEndPoint);
+            ServerListener.Connected += socket =>
+                {
+                    ServerSocket = socket;
+
+                    socket.Send(Encoding.ASCII.GetBytes("\r\n"));
+                    socket.Send(Encoding.ASCII.GetBytes("WELCOME banner\r\n"));
+                    socket.Send(Encoding.ASCII.GetBytes("SSH-2.0-SshStub\r\n"));
+                };
+
+            var counter = 0;
+
+            ServerListener.BytesReceived += (received, socket) =>
+                {
+                    ServerBytesReceivedRegister.Add(received);
+
+                    switch (counter++)
+                    {
+                        case 0:
+                            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]
+                                };
+                            var keyExchangeInit = keyExchangeInitMessage.GetPacket(8, null);
+                            ServerSocket.Send(keyExchangeInit, 4, keyExchangeInit.Length - 4, SocketFlags.None);
+                            break;
+                        case 1:
+                            var serviceAcceptMessage =
+                                ServiceAcceptMessageBuilder.Create(ServiceName.UserAuthentication)
+                                    .Build();
+                            ServerSocket.Send(serviceAcceptMessage, 0, serviceAcceptMessage.Length, SocketFlags.None);
+                            break;
+                    }
+                };
+            ServerListener.Start();
+
+            Session.Connect();
+        }
+
+        protected virtual void ClientAuthentication_Callback()
+        {
+        }
+
+        protected abstract void Act();
+
+        private class ServiceAcceptMessageBuilder
+        {
+            private readonly ServiceName _serviceName;
+
+            private ServiceAcceptMessageBuilder(ServiceName serviceName)
+            {
+                _serviceName = serviceName;
+            }
+
+            public static ServiceAcceptMessageBuilder Create(ServiceName serviceName)
+            {
+                return new ServiceAcceptMessageBuilder(serviceName);
+            }
+
+            public byte[] Build()
+            {
+                var serviceName = _serviceName.ToArray();
+
+                var sshDataStream = new SshDataStream(4 + 1 + 1 + 4 + serviceName.Length);
+                sshDataStream.Write((uint)(sshDataStream.Capacity - 4)); // packet length
+                sshDataStream.WriteByte(0); // padding length
+                sshDataStream.WriteByte(ServiceAcceptMessage.MessageNumber);
+                sshDataStream.WriteBinary(serviceName);
+                return sshDataStream.ToArray();
+            }
+        }
+    }
+}

+ 168 - 168
src/Renci.SshNet.Tests/Classes/SessionTest_Connected_ConnectionReset.cs

@@ -1,168 +1,168 @@
-using System.Diagnostics;
-using System.Net.Sockets;
-using System.Threading;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Common;
-using Renci.SshNet.Messages.Transport;
-
-namespace Renci.SshNet.Tests.Classes
-{
-    [TestClass]
-    public class SessionTest_Connected_ConnectionReset : SessionTest_ConnectedBase
-    {
-        protected override void Act()
-        {
-            ServerSocket.Close();
-
-            // give session some time to react to connection reset
-            Thread.Sleep(200);
-        }
-
-        [TestMethodAttribute]
-        public void IsConnectedShouldReturnFalse()
-        {
-            Assert.IsFalse(Session.IsConnected);
-        }
-
-        [TestMethodAttribute]
-        public void DisconnectShouldFinishImmediately()
-        {
-            var stopwatch = new Stopwatch();
-            stopwatch.Start();
-
-            Session.Disconnect();
-
-            stopwatch.Stop();
-            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
-        }
-
-        [TestMethod]
-        public void DisconnectedIsNeverRaised()
-        {
-            Assert.AreEqual(0, DisconnectedRegister.Count);
-        }
-
-        [TestMethod]
-        public void DisconnectReceivedIsNeverRaised()
-        {
-            Assert.AreEqual(0, DisconnectReceivedRegister.Count);
-        }
-
-        [TestMethod]
-        public void ErrorOccurredIsRaisedOnce()
-        {
-            Assert.AreEqual(1, ErrorOccurredRegister.Count);
-
-            var errorOccurred = ErrorOccurredRegister[0];
-            Assert.IsNotNull(errorOccurred);
-
-            var exception = errorOccurred.Exception;
-            Assert.IsNotNull(exception);
-            Assert.AreEqual(typeof(SshConnectionException), exception.GetType());
-
-            var connectionException = (SshConnectionException) exception;
-            Assert.AreEqual(DisconnectReason.ConnectionLost, connectionException.DisconnectReason);
-
-            var innerException = exception.InnerException;
-            Assert.IsNotNull(innerException);
-            Assert.AreEqual(typeof(SocketException), innerException.GetType());
-
-            var socketException = (SocketException) innerException;
-            Assert.AreEqual(SocketError.ConnectionReset, socketException.SocketErrorCode);
-
-            Assert.AreSame(innerException.Message, connectionException.Message);
-        }
-
-        [TestMethodAttribute]
-        public void DisposeShouldFinishImmediately()
-        {
-            var stopwatch = new Stopwatch();
-            stopwatch.Start();
-
-            Session.Dispose();
-
-            stopwatch.Stop();
-            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
-        }
-
-        [TestMethodAttribute]
-        public void SendMessageShouldThrowSshConnectionException()
-        {
-            try
-            {
-                Session.SendMessage(new IgnoreMessage());
-                Assert.Fail();
-            }
-            catch (SshConnectionException ex)
-            {
-                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("Client not connected.", ex.Message);
-            }
-        }
-
-        [TestMethodAttribute]
-        public void ISession_MessageListenerCompletedShouldBeSignaled()
-        {
-            var session = (ISession) Session;
-
-            Assert.IsNotNull(session.MessageListenerCompleted);
-            Assert.IsTrue(session.MessageListenerCompleted.WaitOne());
-        }
-
-        [TestMethodAttribute]
-        public void ISession_SendMessageShouldThrowSshConnectionException()
-        {
-            var session = (ISession) Session;
-
-            try
-            {
-                session.SendMessage(new IgnoreMessage());
-                Assert.Fail();
-            }
-            catch (SshConnectionException ex)
-            {
-                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("Client not connected.", ex.Message);
-            }
-        }
-
-        [TestMethodAttribute]
-        public void ISession_TrySendMessageShouldReturnFalse()
-        {
-            var session = (ISession) Session;
-
-            var actual = session.TrySendMessage(new IgnoreMessage());
-
-            Assert.IsFalse(actual);
-        }
-
-        [TestMethodAttribute]
-        public void ISession_WaitOnHandleShouldThrowSshConnectionExceptionDetailingConnectionReset()
-        {
-            var session = (ISession) Session;
-            var waitHandle = new ManualResetEvent(false);
-
-            try
-            {
-                session.WaitOnHandle(waitHandle);
-                Assert.Fail();
-            }
-            catch (SshConnectionException ex)
-            {
-                Assert.AreEqual(DisconnectReason.ConnectionLost, ex.DisconnectReason);
-
-                var innerException = ex.InnerException;
-                Assert.IsNotNull(innerException);
-                Assert.AreEqual(typeof(SocketException), innerException.GetType());
-
-                var socketException = (SocketException)ex.InnerException;
-                Assert.AreEqual(SocketError.ConnectionReset, socketException.SocketErrorCode);
-
-                Assert.AreSame(innerException.Message, ex.Message);
-
-            }
-        }
-    }
-}
+using System.Diagnostics;
+using System.Net.Sockets;
+using System.Threading;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Common;
+using Renci.SshNet.Messages.Transport;
+
+namespace Renci.SshNet.Tests.Classes
+{
+    [TestClass]
+    public class SessionTest_Connected_ConnectionReset : SessionTest_ConnectedBase
+    {
+        protected override void Act()
+        {
+            ServerSocket.Close();
+
+            // give session some time to react to connection reset
+            Thread.Sleep(200);
+        }
+
+        [TestMethodAttribute]
+        public void IsConnectedShouldReturnFalse()
+        {
+            Assert.IsFalse(Session.IsConnected);
+        }
+
+        [TestMethodAttribute]
+        public void DisconnectShouldFinishImmediately()
+        {
+            var stopwatch = new Stopwatch();
+            stopwatch.Start();
+
+            Session.Disconnect();
+
+            stopwatch.Stop();
+            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+        }
+
+        [TestMethod]
+        public void DisconnectedIsNeverRaised()
+        {
+            Assert.AreEqual(0, DisconnectedRegister.Count);
+        }
+
+        [TestMethod]
+        public void DisconnectReceivedIsNeverRaised()
+        {
+            Assert.AreEqual(0, DisconnectReceivedRegister.Count);
+        }
+
+        [TestMethod]
+        public void ErrorOccurredIsRaisedOnce()
+        {
+            Assert.AreEqual(1, ErrorOccurredRegister.Count);
+
+            var errorOccurred = ErrorOccurredRegister[0];
+            Assert.IsNotNull(errorOccurred);
+
+            var exception = errorOccurred.Exception;
+            Assert.IsNotNull(exception);
+            Assert.AreEqual(typeof(SshConnectionException), exception.GetType());
+
+            var connectionException = (SshConnectionException) exception;
+            Assert.AreEqual(DisconnectReason.ConnectionLost, connectionException.DisconnectReason);
+
+            var innerException = exception.InnerException;
+            Assert.IsNotNull(innerException);
+            Assert.AreEqual(typeof(SocketException), innerException.GetType());
+
+            var socketException = (SocketException) innerException;
+            Assert.AreEqual(SocketError.ConnectionReset, socketException.SocketErrorCode);
+
+            Assert.AreSame(innerException.Message, connectionException.Message);
+        }
+
+        [TestMethodAttribute]
+        public void DisposeShouldFinishImmediately()
+        {
+            var stopwatch = new Stopwatch();
+            stopwatch.Start();
+
+            Session.Dispose();
+
+            stopwatch.Stop();
+            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+        }
+
+        [TestMethodAttribute]
+        public void SendMessageShouldThrowSshConnectionException()
+        {
+            try
+            {
+                Session.SendMessage(new IgnoreMessage());
+                Assert.Fail();
+            }
+            catch (SshConnectionException ex)
+            {
+                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("Client not connected.", ex.Message);
+            }
+        }
+
+        [TestMethodAttribute]
+        public void ISession_MessageListenerCompletedShouldBeSignaled()
+        {
+            var session = (ISession) Session;
+
+            Assert.IsNotNull(session.MessageListenerCompleted);
+            Assert.IsTrue(session.MessageListenerCompleted.WaitOne());
+        }
+
+        [TestMethodAttribute]
+        public void ISession_SendMessageShouldThrowSshConnectionException()
+        {
+            var session = (ISession) Session;
+
+            try
+            {
+                session.SendMessage(new IgnoreMessage());
+                Assert.Fail();
+            }
+            catch (SshConnectionException ex)
+            {
+                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("Client not connected.", ex.Message);
+            }
+        }
+
+        [TestMethodAttribute]
+        public void ISession_TrySendMessageShouldReturnFalse()
+        {
+            var session = (ISession) Session;
+
+            var actual = session.TrySendMessage(new IgnoreMessage());
+
+            Assert.IsFalse(actual);
+        }
+
+        [TestMethodAttribute]
+        public void ISession_WaitOnHandleShouldThrowSshConnectionExceptionDetailingConnectionReset()
+        {
+            var session = (ISession) Session;
+            var waitHandle = new ManualResetEvent(false);
+
+            try
+            {
+                session.WaitOnHandle(waitHandle);
+                Assert.Fail();
+            }
+            catch (SshConnectionException ex)
+            {
+                Assert.AreEqual(DisconnectReason.ConnectionLost, ex.DisconnectReason);
+
+                var innerException = ex.InnerException;
+                Assert.IsNotNull(innerException);
+                Assert.AreEqual(typeof(SocketException), innerException.GetType());
+
+                var socketException = (SocketException)ex.InnerException;
+                Assert.AreEqual(SocketError.ConnectionReset, socketException.SocketErrorCode);
+
+                Assert.AreSame(innerException.Message, ex.Message);
+
+            }
+        }
+    }
+}

+ 148 - 148
src/Renci.SshNet.Tests/Classes/SessionTest_Connected_Disconnect.cs

@@ -1,148 +1,148 @@
-using System.Diagnostics;
-using System.Net.Sockets;
-using System.Threading;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Common;
-using Renci.SshNet.Messages.Transport;
-
-namespace Renci.SshNet.Tests.Classes
-{
-    [TestClass]
-    public class SessionTest_Connected_Disconnect : SessionTest_ConnectedBase
-    {
-        protected override void Act()
-        {
-            Session.Disconnect();
-        }
-
-        [TestMethod]
-        public void IsConnectedShouldReturnFalse()
-        {
-            Assert.IsFalse(Session.IsConnected);
-        }
-
-        [TestMethod]
-        public void DisconnectShouldFinishImmediately()
-        {
-            var stopwatch = new Stopwatch();
-            stopwatch.Start();
-
-            Session.Disconnect();
-
-            stopwatch.Stop();
-            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
-        }
-
-        [TestMethod]
-        public void DisconnectedIsNeverRaised()
-        {
-            Assert.AreEqual(0, DisconnectedRegister.Count);
-        }
-
-        [TestMethod]
-        public void DisconnectReceivedIsNeverRaised()
-        {
-            Assert.AreEqual(0, DisconnectReceivedRegister.Count);
-        }
-
-        [TestMethod]
-        public void ErrorOccurredIsNeverRaised()
-        {
-            Assert.AreEqual(0, ErrorOccurredRegister.Count);
-        }
-
-        [TestMethod]
-        public void DisposeShouldFinishImmediately()
-        {
-            var stopwatch = new Stopwatch();
-            stopwatch.Start();
-
-            Session.Dispose();
-
-            stopwatch.Stop();
-            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
-        }
-
-        [TestMethod]
-        public void ReceiveOnServerSocketShouldReturnZero()
-        {
-            var buffer = new byte[1];
-
-            var actual = ServerSocket.Receive(buffer, 0, buffer.Length, SocketFlags.None);
-
-            Assert.AreEqual(0, actual);
-        }
-
-        [TestMethod]
-        public void SendMessageShouldThrowSshConnectionException()
-        {
-            try
-            {
-                Session.SendMessage(new IgnoreMessage());
-                Assert.Fail();
-            }
-            catch (SshConnectionException ex)
-            {
-                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("Client not connected.", ex.Message);
-            }
-        }
-
-        [TestMethod]
-        public void ISession_MessageListenerCompletedShouldBeSignaled()
-        {
-            var session = (ISession)Session;
-
-            Assert.IsNotNull(session.MessageListenerCompleted);
-            Assert.IsTrue(session.MessageListenerCompleted.WaitOne());
-        }
-
-        [TestMethodAttribute]
-        public void ISession_SendMessageShouldThrowSshConnectionException()
-        {
-            var session = (ISession) Session;
-
-            try
-            {
-                session.SendMessage(new IgnoreMessage());
-                Assert.Fail();
-            }
-            catch (SshConnectionException ex)
-            {
-                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("Client not connected.", ex.Message);
-            }
-        }
-
-        [TestMethod]
-        public void ISession_TrySendMessageShouldReturnFalse()
-        {
-            var session = (ISession) Session;
-
-            var actual = session.TrySendMessage(new IgnoreMessage());
-
-            Assert.IsFalse(actual);
-        }
-
-        [TestMethod]
-        public void ISession_WaitOnHandleShouldThrowSshConnectionExceptionDetailingBadPacket()
-        {
-            var session = (ISession) Session;
-            var waitHandle = new ManualResetEvent(false);
-
-            try
-            {
-                session.WaitOnHandle(waitHandle);
-                Assert.Fail();
-            }
-            catch (SshConnectionException ex)
-            {
-                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("Client not connected.", ex.Message);
-            }
-        }
-    }
-}
+using System.Diagnostics;
+using System.Net.Sockets;
+using System.Threading;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Common;
+using Renci.SshNet.Messages.Transport;
+
+namespace Renci.SshNet.Tests.Classes
+{
+    [TestClass]
+    public class SessionTest_Connected_Disconnect : SessionTest_ConnectedBase
+    {
+        protected override void Act()
+        {
+            Session.Disconnect();
+        }
+
+        [TestMethod]
+        public void IsConnectedShouldReturnFalse()
+        {
+            Assert.IsFalse(Session.IsConnected);
+        }
+
+        [TestMethod]
+        public void DisconnectShouldFinishImmediately()
+        {
+            var stopwatch = new Stopwatch();
+            stopwatch.Start();
+
+            Session.Disconnect();
+
+            stopwatch.Stop();
+            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+        }
+
+        [TestMethod]
+        public void DisconnectedIsNeverRaised()
+        {
+            Assert.AreEqual(0, DisconnectedRegister.Count);
+        }
+
+        [TestMethod]
+        public void DisconnectReceivedIsNeverRaised()
+        {
+            Assert.AreEqual(0, DisconnectReceivedRegister.Count);
+        }
+
+        [TestMethod]
+        public void ErrorOccurredIsNeverRaised()
+        {
+            Assert.AreEqual(0, ErrorOccurredRegister.Count);
+        }
+
+        [TestMethod]
+        public void DisposeShouldFinishImmediately()
+        {
+            var stopwatch = new Stopwatch();
+            stopwatch.Start();
+
+            Session.Dispose();
+
+            stopwatch.Stop();
+            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+        }
+
+        [TestMethod]
+        public void ReceiveOnServerSocketShouldReturnZero()
+        {
+            var buffer = new byte[1];
+
+            var actual = ServerSocket.Receive(buffer, 0, buffer.Length, SocketFlags.None);
+
+            Assert.AreEqual(0, actual);
+        }
+
+        [TestMethod]
+        public void SendMessageShouldThrowSshConnectionException()
+        {
+            try
+            {
+                Session.SendMessage(new IgnoreMessage());
+                Assert.Fail();
+            }
+            catch (SshConnectionException ex)
+            {
+                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("Client not connected.", ex.Message);
+            }
+        }
+
+        [TestMethod]
+        public void ISession_MessageListenerCompletedShouldBeSignaled()
+        {
+            var session = (ISession)Session;
+
+            Assert.IsNotNull(session.MessageListenerCompleted);
+            Assert.IsTrue(session.MessageListenerCompleted.WaitOne());
+        }
+
+        [TestMethodAttribute]
+        public void ISession_SendMessageShouldThrowSshConnectionException()
+        {
+            var session = (ISession) Session;
+
+            try
+            {
+                session.SendMessage(new IgnoreMessage());
+                Assert.Fail();
+            }
+            catch (SshConnectionException ex)
+            {
+                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("Client not connected.", ex.Message);
+            }
+        }
+
+        [TestMethod]
+        public void ISession_TrySendMessageShouldReturnFalse()
+        {
+            var session = (ISession) Session;
+
+            var actual = session.TrySendMessage(new IgnoreMessage());
+
+            Assert.IsFalse(actual);
+        }
+
+        [TestMethod]
+        public void ISession_WaitOnHandleShouldThrowSshConnectionExceptionDetailingBadPacket()
+        {
+            var session = (ISession) Session;
+            var waitHandle = new ManualResetEvent(false);
+
+            try
+            {
+                session.WaitOnHandle(waitHandle);
+                Assert.Fail();
+            }
+            catch (SshConnectionException ex)
+            {
+                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("Client not connected.", ex.Message);
+            }
+        }
+    }
+}

+ 164 - 164
src/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsBadPacket.cs

@@ -1,164 +1,164 @@
-using System.Diagnostics;
-using System.Net.Sockets;
-using System.Threading;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Common;
-using Renci.SshNet.Messages.Transport;
-
-namespace Renci.SshNet.Tests.Classes
-{
-    [TestClass]
-    public class SessionTest_Connected_ServerSendsBadPacket : SessionTest_ConnectedBase
-    {
-        protected override void Act()
-        {
-            var badPacket = new byte[] { 0x0a, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 };
-            ServerSocket.Send(badPacket, 0, badPacket.Length, SocketFlags.None);
-
-            // give session some time to react to bad packet
-            Thread.Sleep(200);
-        }
-
-        [TestMethod]
-        public void IsConnectedShouldReturnFalse()
-        {
-            Assert.IsFalse(Session.IsConnected);
-        }
-
-        [TestMethod]
-        public void DisconnectShouldFinishImmediately()
-        {
-            var stopwatch = new Stopwatch();
-            stopwatch.Start();
-
-            Session.Disconnect();
-
-            stopwatch.Stop();
-            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
-        }
-
-        [TestMethod]
-        public void DisconnectedIsNeverRaised()
-        {
-            Assert.AreEqual(0, DisconnectedRegister.Count);
-        }
-
-        [TestMethod]
-        public void DisconnectReceivedIsNeverRaised()
-        {
-            Assert.AreEqual(0, DisconnectReceivedRegister.Count);
-        }
-
-        [TestMethod]
-        public void ErrorOccurredIsRaisedOnce()
-        {
-            Assert.AreEqual(1, ErrorOccurredRegister.Count);
-
-            var errorOccurred = ErrorOccurredRegister[0];
-            Assert.IsNotNull(errorOccurred);
-
-            var exception = errorOccurred.Exception;
-            Assert.IsNotNull(exception);
-            Assert.AreEqual(typeof (SshConnectionException), exception.GetType());
-
-            var connectionException = (SshConnectionException) exception;
-            Assert.AreEqual(DisconnectReason.ProtocolError, connectionException.DisconnectReason);
-            Assert.IsNull(connectionException.InnerException);
-            Assert.AreEqual("Bad packet length: 168101125.", connectionException.Message);
-        }
-
-        [TestMethod]
-        public void DisposeShouldFinishImmediately()
-        {
-            var stopwatch = new Stopwatch();
-            stopwatch.Start();
-
-            Session.Dispose();
-
-            stopwatch.Stop();
-            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
-        }
-
-        [TestMethod]
-        public void ReceiveOnServerSocketShouldReturnZero()
-        {
-            var buffer = new byte[1];
-
-            var actual = ServerSocket.Receive(buffer, 0, buffer.Length, SocketFlags.None);
-
-            Assert.AreEqual(0, actual);
-        }
-
-        [TestMethod]
-        public void SendMessageShouldThrowSshConnectionException()
-        {
-            try
-            {
-                Session.SendMessage(new IgnoreMessage());
-                Assert.Fail();
-            }
-            catch (SshConnectionException ex)
-            {
-                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("Client not connected.", ex.Message);
-            }
-        }
-
-        [TestMethod]
-        public void ISession_MessageListenerCompletedShouldBeSignaled()
-        {
-            var session = (ISession)Session;
-
-            Assert.IsNotNull(session.MessageListenerCompleted);
-            Assert.IsTrue(session.MessageListenerCompleted.WaitOne());
-        }
-
-        [TestMethodAttribute]
-        public void ISession_SendMessageShouldThrowSshConnectionException()
-        {
-            var session = (ISession) Session;
-
-            try
-            {
-                session.SendMessage(new IgnoreMessage());
-                Assert.Fail();
-            }
-            catch (SshConnectionException ex)
-            {
-                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("Client not connected.", ex.Message);
-            }
-        }
-
-        [TestMethod]
-        public void ISession_TrySendMessageShouldReturnFalse()
-        {
-            var session = (ISession) Session;
-
-            var actual = session.TrySendMessage(new IgnoreMessage());
-
-            Assert.IsFalse(actual);
-        }
-
-        [TestMethod]
-        public void ISession_WaitOnHandleShouldThrowSshConnectionExceptionDetailingBadPacket()
-        {
-            var session = (ISession) Session;
-            var waitHandle = new ManualResetEvent(false);
-
-            try
-            {
-                session.WaitOnHandle(waitHandle);
-                Assert.Fail();
-            }
-            catch (SshConnectionException ex)
-            {
-                Assert.AreEqual(DisconnectReason.ProtocolError, ex.DisconnectReason);
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("Bad packet length: 168101125.", ex.Message);
-            }
-        }
-    }
-}
+using System.Diagnostics;
+using System.Net.Sockets;
+using System.Threading;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Common;
+using Renci.SshNet.Messages.Transport;
+
+namespace Renci.SshNet.Tests.Classes
+{
+    [TestClass]
+    public class SessionTest_Connected_ServerSendsBadPacket : SessionTest_ConnectedBase
+    {
+        protected override void Act()
+        {
+            var badPacket = new byte[] { 0x0a, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05 };
+            ServerSocket.Send(badPacket, 0, badPacket.Length, SocketFlags.None);
+
+            // give session some time to react to bad packet
+            Thread.Sleep(200);
+        }
+
+        [TestMethod]
+        public void IsConnectedShouldReturnFalse()
+        {
+            Assert.IsFalse(Session.IsConnected);
+        }
+
+        [TestMethod]
+        public void DisconnectShouldFinishImmediately()
+        {
+            var stopwatch = new Stopwatch();
+            stopwatch.Start();
+
+            Session.Disconnect();
+
+            stopwatch.Stop();
+            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+        }
+
+        [TestMethod]
+        public void DisconnectedIsNeverRaised()
+        {
+            Assert.AreEqual(0, DisconnectedRegister.Count);
+        }
+
+        [TestMethod]
+        public void DisconnectReceivedIsNeverRaised()
+        {
+            Assert.AreEqual(0, DisconnectReceivedRegister.Count);
+        }
+
+        [TestMethod]
+        public void ErrorOccurredIsRaisedOnce()
+        {
+            Assert.AreEqual(1, ErrorOccurredRegister.Count);
+
+            var errorOccurred = ErrorOccurredRegister[0];
+            Assert.IsNotNull(errorOccurred);
+
+            var exception = errorOccurred.Exception;
+            Assert.IsNotNull(exception);
+            Assert.AreEqual(typeof (SshConnectionException), exception.GetType());
+
+            var connectionException = (SshConnectionException) exception;
+            Assert.AreEqual(DisconnectReason.ProtocolError, connectionException.DisconnectReason);
+            Assert.IsNull(connectionException.InnerException);
+            Assert.AreEqual("Bad packet length: 168101125.", connectionException.Message);
+        }
+
+        [TestMethod]
+        public void DisposeShouldFinishImmediately()
+        {
+            var stopwatch = new Stopwatch();
+            stopwatch.Start();
+
+            Session.Dispose();
+
+            stopwatch.Stop();
+            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+        }
+
+        [TestMethod]
+        public void ReceiveOnServerSocketShouldReturnZero()
+        {
+            var buffer = new byte[1];
+
+            var actual = ServerSocket.Receive(buffer, 0, buffer.Length, SocketFlags.None);
+
+            Assert.AreEqual(0, actual);
+        }
+
+        [TestMethod]
+        public void SendMessageShouldThrowSshConnectionException()
+        {
+            try
+            {
+                Session.SendMessage(new IgnoreMessage());
+                Assert.Fail();
+            }
+            catch (SshConnectionException ex)
+            {
+                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("Client not connected.", ex.Message);
+            }
+        }
+
+        [TestMethod]
+        public void ISession_MessageListenerCompletedShouldBeSignaled()
+        {
+            var session = (ISession)Session;
+
+            Assert.IsNotNull(session.MessageListenerCompleted);
+            Assert.IsTrue(session.MessageListenerCompleted.WaitOne());
+        }
+
+        [TestMethodAttribute]
+        public void ISession_SendMessageShouldThrowSshConnectionException()
+        {
+            var session = (ISession) Session;
+
+            try
+            {
+                session.SendMessage(new IgnoreMessage());
+                Assert.Fail();
+            }
+            catch (SshConnectionException ex)
+            {
+                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("Client not connected.", ex.Message);
+            }
+        }
+
+        [TestMethod]
+        public void ISession_TrySendMessageShouldReturnFalse()
+        {
+            var session = (ISession) Session;
+
+            var actual = session.TrySendMessage(new IgnoreMessage());
+
+            Assert.IsFalse(actual);
+        }
+
+        [TestMethod]
+        public void ISession_WaitOnHandleShouldThrowSshConnectionExceptionDetailingBadPacket()
+        {
+            var session = (ISession) Session;
+            var waitHandle = new ManualResetEvent(false);
+
+            try
+            {
+                session.WaitOnHandle(waitHandle);
+                Assert.Fail();
+            }
+            catch (SshConnectionException ex)
+            {
+                Assert.AreEqual(DisconnectReason.ProtocolError, ex.DisconnectReason);
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("Bad packet length: 168101125.", ex.Message);
+            }
+        }
+    }
+}

+ 168 - 168
src/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsDisconnectMessage.cs

@@ -1,168 +1,168 @@
-using System.Diagnostics;
-using System.Globalization;
-using System.Net.Sockets;
-using System.Threading;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Common;
-using Renci.SshNet.Messages.Transport;
-
-namespace Renci.SshNet.Tests.Classes
-{
-    [TestClass]
-    public class SessionTest_Connected_ServerSendsDisconnectMessage : SessionTest_ConnectedBase
-    {
-        private DisconnectMessage _disconnectMessage;
-
-        protected override void Arrange()
-        {
-            _disconnectMessage = new DisconnectMessage(DisconnectReason.ServiceNotAvailable, "Not today!");
-
-            base.Arrange();
-        }
-
-        protected override void Act()
-        {
-            var disconnect = _disconnectMessage.GetPacket(8, null);
-            ServerSocket.Send(disconnect, 4, disconnect.Length - 4, SocketFlags.None);
-
-            // give session some time to process DisconnectMessage
-            Thread.Sleep(200);
-        }
-
-        [TestMethod]
-        public void IsConnectedShouldReturnFalse()
-        {
-            Assert.IsFalse(Session.IsConnected);
-        }
-
-        [TestMethod]
-        public void DisconnectShouldFinishImmediately()
-        {
-            var stopwatch = new Stopwatch();
-            stopwatch.Start();
-
-            Session.Disconnect();
-
-            stopwatch.Stop();
-            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
-        }
-
-        [TestMethod]
-        public void DisconnectedIsRaisedOnce()
-        {
-            Assert.AreEqual(1, DisconnectedRegister.Count);
-        }
-
-        [TestMethod]
-        public void DisconnectReceivedIsRaisedOnce()
-        {
-            Assert.AreEqual(1, DisconnectReceivedRegister.Count);
-
-            var disconnectMessage = DisconnectReceivedRegister[0].Message;
-            Assert.IsNotNull(disconnectMessage);
-            Assert.AreEqual(_disconnectMessage.Description, disconnectMessage.Description);
-            Assert.AreEqual("en", disconnectMessage.Language);
-            Assert.AreEqual(_disconnectMessage.ReasonCode, disconnectMessage.ReasonCode);
-        }
-
-        [TestMethod]
-        public void ErrorOccurredIsNeverRaised()
-        {
-            Assert.AreEqual(0, ErrorOccurredRegister.Count);
-        }
-
-        [TestMethod]
-        public void DisposeShouldFinishImmediately()
-        {
-            var stopwatch = new Stopwatch();
-            stopwatch.Start();
-
-            Session.Dispose();
-
-            stopwatch.Stop();
-            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
-        }
-
-        [TestMethod]
-        public void ReceiveOnServerSocketShouldReturnZero()
-        {
-            var buffer = new byte[1];
-
-            var actual = ServerSocket.Receive(buffer, 0, buffer.Length, SocketFlags.None);
-
-            Assert.AreEqual(0, actual);
-        }
-
-        [TestMethod]
-        public void SendMessageShouldThrowSshConnectionException()
-        {
-            try
-            {
-                Session.SendMessage(new IgnoreMessage());
-                Assert.Fail();
-            }
-            catch (SshConnectionException ex)
-            {
-                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("Client not connected.", ex.Message);
-            }
-        }
-
-        [TestMethod]
-        public void ISession_MessageListenerCompletedShouldBeSignaled()
-        {
-            var session = (ISession)Session;
-
-            Assert.IsNotNull(session.MessageListenerCompleted);
-            Assert.IsTrue(session.MessageListenerCompleted.WaitOne());
-        }
-
-        [TestMethodAttribute]
-        public void ISession_SendMessageShouldThrowSshConnectionException()
-        {
-            var session = (ISession) Session;
-
-            try
-            {
-                session.SendMessage(new IgnoreMessage());
-                Assert.Fail();
-            }
-            catch (SshConnectionException ex)
-            {
-                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("Client not connected.", ex.Message);
-            }
-        }
-
-        [TestMethod]
-        public void ISession_TrySendMessageShouldReturnFalse()
-        {
-            var session = (ISession) Session;
-
-            var actual = session.TrySendMessage(new IgnoreMessage());
-
-            Assert.IsFalse(actual);
-        }
-
-        [TestMethod]
-        public void ISession_WaitOnHandleShouldThrowSshConnectionExceptionDetailingDisconnectReason()
-        {
-            var session = (ISession)Session;
-            var waitHandle = new ManualResetEvent(false);
-
-            try
-            {
-                session.WaitOnHandle(waitHandle);
-                Assert.Fail();
-            }
-            catch (SshConnectionException ex)
-            {
-                Assert.AreEqual(DisconnectReason.ServiceNotAvailable, ex.DisconnectReason);
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual(string.Format(CultureInfo.InvariantCulture, "The connection was closed by the server: {0} ({1}).", _disconnectMessage.Description, _disconnectMessage.ReasonCode), ex.Message);
-            }
-        }
-    }
-}
+using System.Diagnostics;
+using System.Globalization;
+using System.Net.Sockets;
+using System.Threading;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Common;
+using Renci.SshNet.Messages.Transport;
+
+namespace Renci.SshNet.Tests.Classes
+{
+    [TestClass]
+    public class SessionTest_Connected_ServerSendsDisconnectMessage : SessionTest_ConnectedBase
+    {
+        private DisconnectMessage _disconnectMessage;
+
+        protected override void Arrange()
+        {
+            _disconnectMessage = new DisconnectMessage(DisconnectReason.ServiceNotAvailable, "Not today!");
+
+            base.Arrange();
+        }
+
+        protected override void Act()
+        {
+            var disconnect = _disconnectMessage.GetPacket(8, null);
+            ServerSocket.Send(disconnect, 4, disconnect.Length - 4, SocketFlags.None);
+
+            // give session some time to process DisconnectMessage
+            Thread.Sleep(200);
+        }
+
+        [TestMethod]
+        public void IsConnectedShouldReturnFalse()
+        {
+            Assert.IsFalse(Session.IsConnected);
+        }
+
+        [TestMethod]
+        public void DisconnectShouldFinishImmediately()
+        {
+            var stopwatch = new Stopwatch();
+            stopwatch.Start();
+
+            Session.Disconnect();
+
+            stopwatch.Stop();
+            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+        }
+
+        [TestMethod]
+        public void DisconnectedIsRaisedOnce()
+        {
+            Assert.AreEqual(1, DisconnectedRegister.Count);
+        }
+
+        [TestMethod]
+        public void DisconnectReceivedIsRaisedOnce()
+        {
+            Assert.AreEqual(1, DisconnectReceivedRegister.Count);
+
+            var disconnectMessage = DisconnectReceivedRegister[0].Message;
+            Assert.IsNotNull(disconnectMessage);
+            Assert.AreEqual(_disconnectMessage.Description, disconnectMessage.Description);
+            Assert.AreEqual("en", disconnectMessage.Language);
+            Assert.AreEqual(_disconnectMessage.ReasonCode, disconnectMessage.ReasonCode);
+        }
+
+        [TestMethod]
+        public void ErrorOccurredIsNeverRaised()
+        {
+            Assert.AreEqual(0, ErrorOccurredRegister.Count);
+        }
+
+        [TestMethod]
+        public void DisposeShouldFinishImmediately()
+        {
+            var stopwatch = new Stopwatch();
+            stopwatch.Start();
+
+            Session.Dispose();
+
+            stopwatch.Stop();
+            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+        }
+
+        [TestMethod]
+        public void ReceiveOnServerSocketShouldReturnZero()
+        {
+            var buffer = new byte[1];
+
+            var actual = ServerSocket.Receive(buffer, 0, buffer.Length, SocketFlags.None);
+
+            Assert.AreEqual(0, actual);
+        }
+
+        [TestMethod]
+        public void SendMessageShouldThrowSshConnectionException()
+        {
+            try
+            {
+                Session.SendMessage(new IgnoreMessage());
+                Assert.Fail();
+            }
+            catch (SshConnectionException ex)
+            {
+                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("Client not connected.", ex.Message);
+            }
+        }
+
+        [TestMethod]
+        public void ISession_MessageListenerCompletedShouldBeSignaled()
+        {
+            var session = (ISession)Session;
+
+            Assert.IsNotNull(session.MessageListenerCompleted);
+            Assert.IsTrue(session.MessageListenerCompleted.WaitOne());
+        }
+
+        [TestMethodAttribute]
+        public void ISession_SendMessageShouldThrowSshConnectionException()
+        {
+            var session = (ISession) Session;
+
+            try
+            {
+                session.SendMessage(new IgnoreMessage());
+                Assert.Fail();
+            }
+            catch (SshConnectionException ex)
+            {
+                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("Client not connected.", ex.Message);
+            }
+        }
+
+        [TestMethod]
+        public void ISession_TrySendMessageShouldReturnFalse()
+        {
+            var session = (ISession) Session;
+
+            var actual = session.TrySendMessage(new IgnoreMessage());
+
+            Assert.IsFalse(actual);
+        }
+
+        [TestMethod]
+        public void ISession_WaitOnHandleShouldThrowSshConnectionExceptionDetailingDisconnectReason()
+        {
+            var session = (ISession)Session;
+            var waitHandle = new ManualResetEvent(false);
+
+            try
+            {
+                session.WaitOnHandle(waitHandle);
+                Assert.Fail();
+            }
+            catch (SshConnectionException ex)
+            {
+                Assert.AreEqual(DisconnectReason.ServiceNotAvailable, ex.DisconnectReason);
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual(string.Format(CultureInfo.InvariantCulture, "The connection was closed by the server: {0} ({1}).", _disconnectMessage.Description, _disconnectMessage.ReasonCode), ex.Message);
+            }
+        }
+    }
+}

+ 172 - 172
src/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerSendsDisconnectMessageAndShutsDownSocket.cs

@@ -1,172 +1,172 @@
-using System.Diagnostics;
-using System.Globalization;
-using System.Net.Sockets;
-using System.Threading;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Common;
-using Renci.SshNet.Messages.Transport;
-
-namespace Renci.SshNet.Tests.Classes
-{
-    [TestClass]
-    public class SessionTest_Connected_ServerSendsDisconnectMessageAndShutsDownSocket : SessionTest_ConnectedBase
-    {
-        private DisconnectMessage _disconnectMessage;
-
-        protected override void Arrange()
-        {
-            _disconnectMessage = new DisconnectMessage(DisconnectReason.ServiceNotAvailable, "Not today!");
-
-            base.Arrange();
-        }
-
-        protected override void Act()
-        {
-            // server sends SSH_MSG_DISCONNECT
-            var disconnect = _disconnectMessage.GetPacket(8, null);
-            ServerSocket.Send(disconnect, 4, disconnect.Length - 4, SocketFlags.None);
-
-            // server shuts down the socket
-            ServerSocket.Shutdown(SocketShutdown.Send);
-
-            // give session some time to process DisconnectMessage and socket shutdown
-            Thread.Sleep(200);
-        }
-
-        [TestMethod]
-        public void IsConnectedShouldReturnFalse()
-        {
-            Assert.IsFalse(Session.IsConnected);
-        }
-
-        [TestMethod]
-        public void DisconnectShouldFinishImmediately()
-        {
-            var stopwatch = new Stopwatch();
-            stopwatch.Start();
-
-            Session.Disconnect();
-
-            stopwatch.Stop();
-            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
-        }
-
-        [TestMethod]
-        public void DisconnectedIsRaisedOnce()
-        {
-            Assert.AreEqual(1, DisconnectedRegister.Count);
-        }
-
-        [TestMethod]
-        public void DisconnectReceivedIsRaisedOnce()
-        {
-            Assert.AreEqual(1, DisconnectReceivedRegister.Count);
-
-            var disconnectMessage = DisconnectReceivedRegister[0].Message;
-            Assert.IsNotNull(disconnectMessage);
-            Assert.AreEqual(_disconnectMessage.Description, disconnectMessage.Description);
-            Assert.AreEqual("en", disconnectMessage.Language);
-            Assert.AreEqual(_disconnectMessage.ReasonCode, disconnectMessage.ReasonCode);
-        }
-
-        [TestMethod]
-        public void ErrorOccurredIsNeverRaised()
-        {
-            Assert.AreEqual(0, ErrorOccurredRegister.Count);
-        }
-
-        [TestMethod]
-        public void DisposeShouldFinishImmediately()
-        {
-            var stopwatch = new Stopwatch();
-            stopwatch.Start();
-
-            Session.Dispose();
-
-            stopwatch.Stop();
-            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
-        }
-
-        [TestMethod]
-        public void ReceiveOnServerSocketShouldReturnZero()
-        {
-            var buffer = new byte[1];
-
-            var actual = ServerSocket.Receive(buffer, 0, buffer.Length, SocketFlags.None);
-
-            Assert.AreEqual(0, actual);
-        }
-
-        [TestMethod]
-        public void SendMessageShouldThrowSshConnectionException()
-        {
-            try
-            {
-                Session.SendMessage(new IgnoreMessage());
-                Assert.Fail();
-            }
-            catch (SshConnectionException ex)
-            {
-                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("Client not connected.", ex.Message);
-            }
-        }
-
-        [TestMethod]
-        public void ISession_MessageListenerCompletedShouldBeSignaled()
-        {
-            var session = (ISession)Session;
-
-            Assert.IsNotNull(session.MessageListenerCompleted);
-            Assert.IsTrue(session.MessageListenerCompleted.WaitOne());
-        }
-
-        [TestMethodAttribute]
-        public void ISession_SendMessageShouldThrowSshConnectionException()
-        {
-            var session = (ISession) Session;
-
-            try
-            {
-                session.SendMessage(new IgnoreMessage());
-                Assert.Fail();
-            }
-            catch (SshConnectionException ex)
-            {
-                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("Client not connected.", ex.Message);
-            }
-        }
-
-        [TestMethod]
-        public void ISession_TrySendMessageShouldReturnFalse()
-        {
-            var session = (ISession)Session;
-
-            var actual = session.TrySendMessage(new IgnoreMessage());
-
-            Assert.IsFalse(actual);
-        }
-
-        [TestMethod]
-        public void ISession_WaitOnHandleShouldThrowSshConnectionExceptionDetailingDisconnectReason()
-        {
-            var session = (ISession)Session;
-            var waitHandle = new ManualResetEvent(false);
-
-            try
-            {
-                session.WaitOnHandle(waitHandle);
-                Assert.Fail();
-            }
-            catch (SshConnectionException ex)
-            {
-                Assert.AreEqual(DisconnectReason.ServiceNotAvailable, ex.DisconnectReason);
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual(string.Format(CultureInfo.InvariantCulture, "The connection was closed by the server: {0} ({1}).", _disconnectMessage.Description, _disconnectMessage.ReasonCode), ex.Message);
-            }
-        }
-    }
-}
+using System.Diagnostics;
+using System.Globalization;
+using System.Net.Sockets;
+using System.Threading;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Common;
+using Renci.SshNet.Messages.Transport;
+
+namespace Renci.SshNet.Tests.Classes
+{
+    [TestClass]
+    public class SessionTest_Connected_ServerSendsDisconnectMessageAndShutsDownSocket : SessionTest_ConnectedBase
+    {
+        private DisconnectMessage _disconnectMessage;
+
+        protected override void Arrange()
+        {
+            _disconnectMessage = new DisconnectMessage(DisconnectReason.ServiceNotAvailable, "Not today!");
+
+            base.Arrange();
+        }
+
+        protected override void Act()
+        {
+            // server sends SSH_MSG_DISCONNECT
+            var disconnect = _disconnectMessage.GetPacket(8, null);
+            ServerSocket.Send(disconnect, 4, disconnect.Length - 4, SocketFlags.None);
+
+            // server shuts down the socket
+            ServerSocket.Shutdown(SocketShutdown.Send);
+
+            // give session some time to process DisconnectMessage and socket shutdown
+            Thread.Sleep(200);
+        }
+
+        [TestMethod]
+        public void IsConnectedShouldReturnFalse()
+        {
+            Assert.IsFalse(Session.IsConnected);
+        }
+
+        [TestMethod]
+        public void DisconnectShouldFinishImmediately()
+        {
+            var stopwatch = new Stopwatch();
+            stopwatch.Start();
+
+            Session.Disconnect();
+
+            stopwatch.Stop();
+            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+        }
+
+        [TestMethod]
+        public void DisconnectedIsRaisedOnce()
+        {
+            Assert.AreEqual(1, DisconnectedRegister.Count);
+        }
+
+        [TestMethod]
+        public void DisconnectReceivedIsRaisedOnce()
+        {
+            Assert.AreEqual(1, DisconnectReceivedRegister.Count);
+
+            var disconnectMessage = DisconnectReceivedRegister[0].Message;
+            Assert.IsNotNull(disconnectMessage);
+            Assert.AreEqual(_disconnectMessage.Description, disconnectMessage.Description);
+            Assert.AreEqual("en", disconnectMessage.Language);
+            Assert.AreEqual(_disconnectMessage.ReasonCode, disconnectMessage.ReasonCode);
+        }
+
+        [TestMethod]
+        public void ErrorOccurredIsNeverRaised()
+        {
+            Assert.AreEqual(0, ErrorOccurredRegister.Count);
+        }
+
+        [TestMethod]
+        public void DisposeShouldFinishImmediately()
+        {
+            var stopwatch = new Stopwatch();
+            stopwatch.Start();
+
+            Session.Dispose();
+
+            stopwatch.Stop();
+            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+        }
+
+        [TestMethod]
+        public void ReceiveOnServerSocketShouldReturnZero()
+        {
+            var buffer = new byte[1];
+
+            var actual = ServerSocket.Receive(buffer, 0, buffer.Length, SocketFlags.None);
+
+            Assert.AreEqual(0, actual);
+        }
+
+        [TestMethod]
+        public void SendMessageShouldThrowSshConnectionException()
+        {
+            try
+            {
+                Session.SendMessage(new IgnoreMessage());
+                Assert.Fail();
+            }
+            catch (SshConnectionException ex)
+            {
+                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("Client not connected.", ex.Message);
+            }
+        }
+
+        [TestMethod]
+        public void ISession_MessageListenerCompletedShouldBeSignaled()
+        {
+            var session = (ISession)Session;
+
+            Assert.IsNotNull(session.MessageListenerCompleted);
+            Assert.IsTrue(session.MessageListenerCompleted.WaitOne());
+        }
+
+        [TestMethodAttribute]
+        public void ISession_SendMessageShouldThrowSshConnectionException()
+        {
+            var session = (ISession) Session;
+
+            try
+            {
+                session.SendMessage(new IgnoreMessage());
+                Assert.Fail();
+            }
+            catch (SshConnectionException ex)
+            {
+                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("Client not connected.", ex.Message);
+            }
+        }
+
+        [TestMethod]
+        public void ISession_TrySendMessageShouldReturnFalse()
+        {
+            var session = (ISession)Session;
+
+            var actual = session.TrySendMessage(new IgnoreMessage());
+
+            Assert.IsFalse(actual);
+        }
+
+        [TestMethod]
+        public void ISession_WaitOnHandleShouldThrowSshConnectionExceptionDetailingDisconnectReason()
+        {
+            var session = (ISession)Session;
+            var waitHandle = new ManualResetEvent(false);
+
+            try
+            {
+                session.WaitOnHandle(waitHandle);
+                Assert.Fail();
+            }
+            catch (SshConnectionException ex)
+            {
+                Assert.AreEqual(DisconnectReason.ServiceNotAvailable, ex.DisconnectReason);
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual(string.Format(CultureInfo.InvariantCulture, "The connection was closed by the server: {0} ({1}).", _disconnectMessage.Description, _disconnectMessage.ReasonCode), ex.Message);
+            }
+        }
+    }
+}

+ 161 - 161
src/Renci.SshNet.Tests/Classes/SessionTest_Connected_ServerShutsDownSocket.cs

@@ -1,161 +1,161 @@
-using System;
-using System.Diagnostics;
-using System.Net.Sockets;
-using System.Threading;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Common;
-using Renci.SshNet.Messages.Transport;
-
-namespace Renci.SshNet.Tests.Classes
-{
-    [TestClass]
-    public class SessionTest_Connected_ServerShutsDownSocket : SessionTest_ConnectedBase
-    {
-        protected override void Act()
-        {
-            ServerSocket.Shutdown(SocketShutdown.Send);
-
-            // give session some time to process socket shutdown
-            Thread.Sleep(200);
-        }
-
-        [TestMethod]
-        public void IsConnectedShouldReturnFalse()
-        {
-            Assert.IsFalse(Session.IsConnected);
-        }
-
-        [TestMethod]
-        public void DisconnectShouldFinishImmediately()
-        {
-            var stopwatch = new Stopwatch();
-            stopwatch.Start();
-
-            Session.Disconnect();
-
-            stopwatch.Stop();
-            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
-        }
-
-        [TestMethod]
-        public void DisconnectedIsNeverRaised()
-        {
-            Assert.AreEqual(0, DisconnectedRegister.Count);
-        }
-
-        [TestMethod]
-        public void DisconnectReceivedIsNeverRaised()
-        {
-            Assert.AreEqual(0, DisconnectReceivedRegister.Count);
-        }
-
-        [TestMethod]
-        public void ErrorOccurredIsRaisedOnce()
-        {
-            Assert.AreEqual(1, ErrorOccurredRegister.Count);
-
-            var errorOccurred = ErrorOccurredRegister[0];
-            Assert.IsNotNull(errorOccurred);
-
-            var exception = errorOccurred.Exception;
-            Assert.IsNotNull(exception);
-            Assert.AreEqual(typeof(SshConnectionException), exception.GetType());
-
-            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);
-        }
-
-        [TestMethod]
-        public void DisposeShouldFinishImmediately()
-        {
-            var stopwatch = new Stopwatch();
-            stopwatch.Start();
-
-            Session.Dispose();
-
-            stopwatch.Stop();
-            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
-        }
-
-        [TestMethod]
-        public void ReceiveOnServerSocketShouldReturnZero()
-        {
-            var buffer = new byte[1];
-
-            var actual = ServerSocket.Receive(buffer, 0, buffer.Length, SocketFlags.None);
-
-            Assert.AreEqual(0, actual);
-        }
-
-        [TestMethod]
-        public void SendMessageShouldThrowSshConnectionException()
-        {
-            try
-            {
-                Session.SendMessage(new IgnoreMessage());
-                Assert.Fail();
-            }
-            catch (SshConnectionException ex)
-            {
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("Client not connected.", ex.Message);
-            }
-        }
-
-        [TestMethod]
-        public void ISession_MessageListenerCompletedShouldBeSignaled()
-        {
-            var session = (ISession)Session;
-
-            Assert.IsNotNull(session.MessageListenerCompleted);
-            Assert.IsTrue(session.MessageListenerCompleted.WaitOne());
-        }
-
-        [TestMethodAttribute]
-        public void ISession_SendMessageShouldThrowSshConnectionException()
-        {
-            var session = (ISession) Session;
-
-            try
-            {
-                session.SendMessage(new IgnoreMessage());
-                Assert.Fail();
-            }
-            catch (SshConnectionException ex)
-            {
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("Client not connected.", ex.Message);
-            }
-        }
-
-        [TestMethod]
-        public void ISession_TrySendMessageShouldReturnFalse()
-        {
-            var session = (ISession)Session;
-
-            var actual = session.TrySendMessage(new IgnoreMessage());
-
-            Assert.IsFalse(actual);
-        }
-
-        [TestMethod]
-        public void ISession_WaitOnHandleShouldThrowSshConnectionExceptionDetailingAbortedConnection()
-        {
-            var session = (ISession)Session;
-            var waitHandle = new ManualResetEvent(false);
-
-            try
-            {
-                session.WaitOnHandle(waitHandle);
-                Assert.Fail();
-            }
-            catch (SshConnectionException ex)
-            {
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("An established connection was aborted by the server.", ex.Message);
-            }
-        }
-    }
-}
+using System;
+using System.Diagnostics;
+using System.Net.Sockets;
+using System.Threading;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Common;
+using Renci.SshNet.Messages.Transport;
+
+namespace Renci.SshNet.Tests.Classes
+{
+    [TestClass]
+    public class SessionTest_Connected_ServerShutsDownSocket : SessionTest_ConnectedBase
+    {
+        protected override void Act()
+        {
+            ServerSocket.Shutdown(SocketShutdown.Send);
+
+            // give session some time to process socket shutdown
+            Thread.Sleep(200);
+        }
+
+        [TestMethod]
+        public void IsConnectedShouldReturnFalse()
+        {
+            Assert.IsFalse(Session.IsConnected);
+        }
+
+        [TestMethod]
+        public void DisconnectShouldFinishImmediately()
+        {
+            var stopwatch = new Stopwatch();
+            stopwatch.Start();
+
+            Session.Disconnect();
+
+            stopwatch.Stop();
+            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+        }
+
+        [TestMethod]
+        public void DisconnectedIsNeverRaised()
+        {
+            Assert.AreEqual(0, DisconnectedRegister.Count);
+        }
+
+        [TestMethod]
+        public void DisconnectReceivedIsNeverRaised()
+        {
+            Assert.AreEqual(0, DisconnectReceivedRegister.Count);
+        }
+
+        [TestMethod]
+        public void ErrorOccurredIsRaisedOnce()
+        {
+            Assert.AreEqual(1, ErrorOccurredRegister.Count);
+
+            var errorOccurred = ErrorOccurredRegister[0];
+            Assert.IsNotNull(errorOccurred);
+
+            var exception = errorOccurred.Exception;
+            Assert.IsNotNull(exception);
+            Assert.AreEqual(typeof(SshConnectionException), exception.GetType());
+
+            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);
+        }
+
+        [TestMethod]
+        public void DisposeShouldFinishImmediately()
+        {
+            var stopwatch = new Stopwatch();
+            stopwatch.Start();
+
+            Session.Dispose();
+
+            stopwatch.Stop();
+            Assert.IsTrue(stopwatch.ElapsedMilliseconds < 500);
+        }
+
+        [TestMethod]
+        public void ReceiveOnServerSocketShouldReturnZero()
+        {
+            var buffer = new byte[1];
+
+            var actual = ServerSocket.Receive(buffer, 0, buffer.Length, SocketFlags.None);
+
+            Assert.AreEqual(0, actual);
+        }
+
+        [TestMethod]
+        public void SendMessageShouldThrowSshConnectionException()
+        {
+            try
+            {
+                Session.SendMessage(new IgnoreMessage());
+                Assert.Fail();
+            }
+            catch (SshConnectionException ex)
+            {
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("Client not connected.", ex.Message);
+            }
+        }
+
+        [TestMethod]
+        public void ISession_MessageListenerCompletedShouldBeSignaled()
+        {
+            var session = (ISession)Session;
+
+            Assert.IsNotNull(session.MessageListenerCompleted);
+            Assert.IsTrue(session.MessageListenerCompleted.WaitOne());
+        }
+
+        [TestMethodAttribute]
+        public void ISession_SendMessageShouldThrowSshConnectionException()
+        {
+            var session = (ISession) Session;
+
+            try
+            {
+                session.SendMessage(new IgnoreMessage());
+                Assert.Fail();
+            }
+            catch (SshConnectionException ex)
+            {
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("Client not connected.", ex.Message);
+            }
+        }
+
+        [TestMethod]
+        public void ISession_TrySendMessageShouldReturnFalse()
+        {
+            var session = (ISession)Session;
+
+            var actual = session.TrySendMessage(new IgnoreMessage());
+
+            Assert.IsFalse(actual);
+        }
+
+        [TestMethod]
+        public void ISession_WaitOnHandleShouldThrowSshConnectionExceptionDetailingAbortedConnection()
+        {
+            var session = (ISession)Session;
+            var waitHandle = new ManualResetEvent(false);
+
+            try
+            {
+                session.WaitOnHandle(waitHandle);
+                Assert.Fail();
+            }
+            catch (SshConnectionException ex)
+            {
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("An established connection was aborted by the server.", ex.Message);
+            }
+        }
+    }
+}

+ 191 - 191
src/Renci.SshNet.Tests/Classes/SessionTest_NotConnected.cs

@@ -1,191 +1,191 @@
-using System;
-using System.Net;
-using System.Threading;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Moq;
-using Renci.SshNet.Common;
-using Renci.SshNet.Messages.Transport;
-
-namespace Renci.SshNet.Tests.Classes
-{
-    [TestClass]
-    public class SessionTest_NotConnected
-    {
-        private ConnectionInfo _connectionInfo;
-        private IServiceFactory _serviceFactory;
-        private Session _session;
-
-        [TestInitialize]
-        public void Setup()
-        {
-            Arrange();
-            Act();
-        }
-
-        protected void Arrange()
-        {
-            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
-            _connectionInfo = CreateConnectionInfo(serverEndPoint, TimeSpan.FromSeconds(5));
-            _serviceFactory = new Mock<IServiceFactory>(MockBehavior.Strict).Object;
-        }
-
-        protected void Act()
-        {
-            _session = new Session(_connectionInfo, _serviceFactory);
-        }
-
-        [TestMethod]
-        public void ClientVersionIsRenciSshNet()
-        {
-            Assert.AreEqual("SSH-2.0-Renci.SshNet.SshClient.0.0.1", _session.ClientVersion);
-        }
-
-        [TestMethod]
-        public void ConnectionInfoShouldReturnConnectionInfoPassedThroughConstructor()
-        {
-            Assert.AreSame(_connectionInfo, _session.ConnectionInfo);
-        }
-
-        [TestMethod]
-        public void IsConnectedShouldReturnFalse()
-        {
-            Assert.IsFalse(_session.IsConnected);
-        }
-
-        [TestMethod]
-        public void SendMessageShouldThrowShhConnectionException()
-        {
-            try
-            {
-                _session.SendMessage(new IgnoreMessage());
-                Assert.Fail();
-            }
-            catch (SshConnectionException ex)
-            {
-                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("Client not connected.", ex.Message);
-            }
-        }
-
-        [TestMethod]
-        public void SessionIdShouldReturnNull()
-        {
-            Assert.IsNull(_session.SessionId);
-        }
-
-        [TestMethod]
-        public void ServerVersionShouldReturnNull()
-        {
-            Assert.IsNull(_session.ServerVersion);
-        }
-
-        [TestMethod]
-        public void WaitOnHandle_WaitHandle_ShouldThrowArgumentNullExceptionWhenWaitHandleIsNull()
-        {
-            WaitHandle waitHandle = null;
-
-            try
-            {
-                _session.WaitOnHandle(waitHandle);
-                Assert.Fail();
-            }
-            catch (ArgumentNullException ex)
-            {
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("waitHandle", ex.ParamName);
-            }
-        }
-
-        [TestMethod]
-        public void WaitOnHandle_WaitHandleAndTimeout_ShouldThrowArgumentNullExceptionWhenWaitHandleIsNull()
-        {
-            WaitHandle waitHandle = null;
-            var timeout = TimeSpan.FromMinutes(5);
-
-            try
-            {
-                _session.WaitOnHandle(waitHandle, timeout);
-                Assert.Fail();
-            }
-            catch (ArgumentNullException ex)
-            {
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("waitHandle", ex.ParamName);
-            }
-        }
-
-        [TestMethod]
-        public void ISession_ConnectionInfoShouldReturnConnectionInfoPassedThroughConstructor()
-        {
-            var session = (ISession)_session;
-            Assert.AreSame(_connectionInfo, session.ConnectionInfo);
-        }
-
-        [TestMethod]
-        public void ISession_MessageListenerCompletedShouldBeSignaled()
-        {
-            var session = (ISession) _session;
-
-            Assert.IsNotNull(session.MessageListenerCompleted);
-            Assert.IsTrue(session.MessageListenerCompleted.WaitOne(0));
-        }
-
-        [TestMethod]
-        public void ISession_SendMessageShouldThrowShhConnectionException()
-        {
-            var session = (ISession)_session;
-
-            try
-            {
-                session.SendMessage(new IgnoreMessage());
-                Assert.Fail();
-            }
-            catch (SshConnectionException ex)
-            {
-                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("Client not connected.", ex.Message);
-            }
-        }
-
-        [TestMethod]
-        public void ISession_TrySendMessageShouldReturnFalse()
-        {
-            var session = (ISession)_session;
-
-            var actual = session.TrySendMessage(new IgnoreMessage());
-
-            Assert.IsFalse(actual);
-        }
-
-        [TestMethod]
-        public void ISession_WaitOnHandleShouldThrowArgumentNullExceptionWhenWaitHandleIsNull()
-        {
-            WaitHandle waitHandle = null;
-            var session = (ISession)_session;
-
-            try
-            {
-                session.WaitOnHandle(waitHandle);
-                Assert.Fail();
-            }
-            catch (ArgumentNullException ex)
-            {
-                Assert.IsNull(ex.InnerException);
-                Assert.AreEqual("waitHandle", ex.ParamName);
-            }
-        }
-
-        private static ConnectionInfo CreateConnectionInfo(IPEndPoint serverEndPoint, TimeSpan timeout)
-        {
-            var connectionInfo = new ConnectionInfo(
-                serverEndPoint.Address.ToString(),
-                serverEndPoint.Port,
-                "eric",
-                new NoneAuthenticationMethod("eric"));
-            connectionInfo.Timeout = timeout;
-            return connectionInfo;
-        }
-    }
-}
+using System;
+using System.Net;
+using System.Threading;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Moq;
+using Renci.SshNet.Common;
+using Renci.SshNet.Messages.Transport;
+
+namespace Renci.SshNet.Tests.Classes
+{
+    [TestClass]
+    public class SessionTest_NotConnected
+    {
+        private ConnectionInfo _connectionInfo;
+        private IServiceFactory _serviceFactory;
+        private Session _session;
+
+        [TestInitialize]
+        public void Setup()
+        {
+            Arrange();
+            Act();
+        }
+
+        protected void Arrange()
+        {
+            var serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
+            _connectionInfo = CreateConnectionInfo(serverEndPoint, TimeSpan.FromSeconds(5));
+            _serviceFactory = new Mock<IServiceFactory>(MockBehavior.Strict).Object;
+        }
+
+        protected void Act()
+        {
+            _session = new Session(_connectionInfo, _serviceFactory);
+        }
+
+        [TestMethod]
+        public void ClientVersionIsRenciSshNet()
+        {
+            Assert.AreEqual("SSH-2.0-Renci.SshNet.SshClient.0.0.1", _session.ClientVersion);
+        }
+
+        [TestMethod]
+        public void ConnectionInfoShouldReturnConnectionInfoPassedThroughConstructor()
+        {
+            Assert.AreSame(_connectionInfo, _session.ConnectionInfo);
+        }
+
+        [TestMethod]
+        public void IsConnectedShouldReturnFalse()
+        {
+            Assert.IsFalse(_session.IsConnected);
+        }
+
+        [TestMethod]
+        public void SendMessageShouldThrowShhConnectionException()
+        {
+            try
+            {
+                _session.SendMessage(new IgnoreMessage());
+                Assert.Fail();
+            }
+            catch (SshConnectionException ex)
+            {
+                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("Client not connected.", ex.Message);
+            }
+        }
+
+        [TestMethod]
+        public void SessionIdShouldReturnNull()
+        {
+            Assert.IsNull(_session.SessionId);
+        }
+
+        [TestMethod]
+        public void ServerVersionShouldReturnNull()
+        {
+            Assert.IsNull(_session.ServerVersion);
+        }
+
+        [TestMethod]
+        public void WaitOnHandle_WaitHandle_ShouldThrowArgumentNullExceptionWhenWaitHandleIsNull()
+        {
+            WaitHandle waitHandle = null;
+
+            try
+            {
+                _session.WaitOnHandle(waitHandle);
+                Assert.Fail();
+            }
+            catch (ArgumentNullException ex)
+            {
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("waitHandle", ex.ParamName);
+            }
+        }
+
+        [TestMethod]
+        public void WaitOnHandle_WaitHandleAndTimeout_ShouldThrowArgumentNullExceptionWhenWaitHandleIsNull()
+        {
+            WaitHandle waitHandle = null;
+            var timeout = TimeSpan.FromMinutes(5);
+
+            try
+            {
+                _session.WaitOnHandle(waitHandle, timeout);
+                Assert.Fail();
+            }
+            catch (ArgumentNullException ex)
+            {
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("waitHandle", ex.ParamName);
+            }
+        }
+
+        [TestMethod]
+        public void ISession_ConnectionInfoShouldReturnConnectionInfoPassedThroughConstructor()
+        {
+            var session = (ISession)_session;
+            Assert.AreSame(_connectionInfo, session.ConnectionInfo);
+        }
+
+        [TestMethod]
+        public void ISession_MessageListenerCompletedShouldBeSignaled()
+        {
+            var session = (ISession) _session;
+
+            Assert.IsNotNull(session.MessageListenerCompleted);
+            Assert.IsTrue(session.MessageListenerCompleted.WaitOne(0));
+        }
+
+        [TestMethod]
+        public void ISession_SendMessageShouldThrowShhConnectionException()
+        {
+            var session = (ISession)_session;
+
+            try
+            {
+                session.SendMessage(new IgnoreMessage());
+                Assert.Fail();
+            }
+            catch (SshConnectionException ex)
+            {
+                Assert.AreEqual(DisconnectReason.None, ex.DisconnectReason);
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("Client not connected.", ex.Message);
+            }
+        }
+
+        [TestMethod]
+        public void ISession_TrySendMessageShouldReturnFalse()
+        {
+            var session = (ISession)_session;
+
+            var actual = session.TrySendMessage(new IgnoreMessage());
+
+            Assert.IsFalse(actual);
+        }
+
+        [TestMethod]
+        public void ISession_WaitOnHandleShouldThrowArgumentNullExceptionWhenWaitHandleIsNull()
+        {
+            WaitHandle waitHandle = null;
+            var session = (ISession)_session;
+
+            try
+            {
+                session.WaitOnHandle(waitHandle);
+                Assert.Fail();
+            }
+            catch (ArgumentNullException ex)
+            {
+                Assert.IsNull(ex.InnerException);
+                Assert.AreEqual("waitHandle", ex.ParamName);
+            }
+        }
+
+        private static ConnectionInfo CreateConnectionInfo(IPEndPoint serverEndPoint, TimeSpan timeout)
+        {
+            var connectionInfo = new ConnectionInfo(
+                serverEndPoint.Address.ToString(),
+                serverEndPoint.Port,
+                "eric",
+                new NoneAuthenticationMethod("eric"));
+            connectionInfo.Timeout = timeout;
+            return connectionInfo;
+        }
+    }
+}

+ 95 - 95
src/Renci.SshNet.Tests/Classes/SessionTest_SocketConnected_BadPacketAndDispose.cs

@@ -1,95 +1,95 @@
-using System;
-using System.Net;
-using System.Net.Sockets;
-using System.Text;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Moq;
-using Renci.SshNet.Common;
-using Renci.SshNet.Messages.Transport;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes
-{
-    [TestClass]
-    public class SessionTest_SocketConnected_BadPacketAndDispose
-    {
-        private Mock<IServiceFactory> _serviceFactoryMock;
-        private ConnectionInfo _connectionInfo;
-        private Session _session;
-        private AsyncSocketListener _serverListener;
-        private IPEndPoint _serverEndPoint;
-        private Socket _serverSocket;
-        private SshConnectionException _actualException;
-
-        [TestInitialize]
-        public void Setup()
-        {
-            Arrange();
-            Act();
-        }
-
-        [TestCleanup]
-        public void TearDown()
-        {
-            if (_serverListener != null)
-            {
-                _serverListener.Dispose();
-            }
-        }
-
-        protected void Arrange()
-        {
-            _serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
-            _connectionInfo = new ConnectionInfo(
-                _serverEndPoint.Address.ToString(),
-                _serverEndPoint.Port,
-                "user",
-                new PasswordAuthenticationMethod("user", "password"));
-            _connectionInfo.Timeout = TimeSpan.FromMilliseconds(200);
-            _actualException = null;
-
-            _serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
-
-            _serverListener = new AsyncSocketListener(_serverEndPoint);
-            _serverListener.Connected += (socket) =>
-                {
-                    _serverSocket = socket;
-
-                    socket.Send(Encoding.ASCII.GetBytes("\r\n"));
-                    socket.Send(Encoding.ASCII.GetBytes("WELCOME banner\r\n"));
-                    socket.Send(Encoding.ASCII.GetBytes("SSH-2.0-SshStub\r\n"));
-                };
-            _serverListener.BytesReceived += (received, socket) =>
-                {
-                    var badPacket = new byte[] {0x0a, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05};
-                    _serverSocket.Send(badPacket, 0, badPacket.Length, SocketFlags.None);
-                    _serverSocket.Shutdown(SocketShutdown.Send);
-                };
-            _serverListener.Start();
-        }
-
-        protected virtual void Act()
-        {
-            try
-            {
-                using (_session = new Session(_connectionInfo, _serviceFactoryMock.Object))
-                {
-                    _session.Connect();
-                }
-            }
-            catch (SshConnectionException ex)
-            {
-                _actualException = ex;
-            }
-        }
-
-        [TestMethod]
-        public void ConnectShouldThrowSshConnectionException()
-        {
-            Assert.IsNotNull(_actualException);
-            Assert.IsNull(_actualException.InnerException);
-            Assert.AreEqual(DisconnectReason.ProtocolError, _actualException.DisconnectReason);
-            Assert.AreEqual("Bad packet length: 168101125.", _actualException.Message);
-        }
-    }
-}
+using System;
+using System.Net;
+using System.Net.Sockets;
+using System.Text;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Moq;
+using Renci.SshNet.Common;
+using Renci.SshNet.Messages.Transport;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes
+{
+    [TestClass]
+    public class SessionTest_SocketConnected_BadPacketAndDispose
+    {
+        private Mock<IServiceFactory> _serviceFactoryMock;
+        private ConnectionInfo _connectionInfo;
+        private Session _session;
+        private AsyncSocketListener _serverListener;
+        private IPEndPoint _serverEndPoint;
+        private Socket _serverSocket;
+        private SshConnectionException _actualException;
+
+        [TestInitialize]
+        public void Setup()
+        {
+            Arrange();
+            Act();
+        }
+
+        [TestCleanup]
+        public void TearDown()
+        {
+            if (_serverListener != null)
+            {
+                _serverListener.Dispose();
+            }
+        }
+
+        protected void Arrange()
+        {
+            _serverEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
+            _connectionInfo = new ConnectionInfo(
+                _serverEndPoint.Address.ToString(),
+                _serverEndPoint.Port,
+                "user",
+                new PasswordAuthenticationMethod("user", "password"));
+            _connectionInfo.Timeout = TimeSpan.FromMilliseconds(200);
+            _actualException = null;
+
+            _serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
+
+            _serverListener = new AsyncSocketListener(_serverEndPoint);
+            _serverListener.Connected += (socket) =>
+                {
+                    _serverSocket = socket;
+
+                    socket.Send(Encoding.ASCII.GetBytes("\r\n"));
+                    socket.Send(Encoding.ASCII.GetBytes("WELCOME banner\r\n"));
+                    socket.Send(Encoding.ASCII.GetBytes("SSH-2.0-SshStub\r\n"));
+                };
+            _serverListener.BytesReceived += (received, socket) =>
+                {
+                    var badPacket = new byte[] {0x0a, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05};
+                    _serverSocket.Send(badPacket, 0, badPacket.Length, SocketFlags.None);
+                    _serverSocket.Shutdown(SocketShutdown.Send);
+                };
+            _serverListener.Start();
+        }
+
+        protected virtual void Act()
+        {
+            try
+            {
+                using (_session = new Session(_connectionInfo, _serviceFactoryMock.Object))
+                {
+                    _session.Connect();
+                }
+            }
+            catch (SshConnectionException ex)
+            {
+                _actualException = ex;
+            }
+        }
+
+        [TestMethod]
+        public void ConnectShouldThrowSshConnectionException()
+        {
+            Assert.IsNotNull(_actualException);
+            Assert.IsNull(_actualException.InnerException);
+            Assert.AreEqual(DisconnectReason.ProtocolError, _actualException.DisconnectReason);
+            Assert.AreEqual("Bad packet length: 168101125.", _actualException.Message);
+        }
+    }
+}

+ 122 - 122
src/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/FStatVfsRequestTest.cs

@@ -1,123 +1,123 @@
-using System;
-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;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests
-{
-    [TestClass]
-    public class FStatVfsRequestTest
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private byte[] _handle;
-        private string _name;
-        private byte[] _nameBytes;
-
-        [TestInitialize]
-        public void Init()
-        {
-            var random = new Random();
-            _protocolVersion = (uint)random.Next(0, int.MaxValue);
-            _requestId = (uint)random.Next(0, int.MaxValue);
-            _handle = new byte[random.Next(1, 10)];
-            random.NextBytes(_handle);
-
-            _name = "fstatvfs@openssh.com";
-            _nameBytes = Encoding.UTF8.GetBytes(_name);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var request = new FStatVfsRequest(_protocolVersion, _requestId, _handle, null, null);
-
-            Assert.AreSame(_handle, request.Handle);
-            Assert.AreEqual(_name, request.Name);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.Extended, request.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            IList<SftpStatusResponse> statusActionInvocations = new List<SftpStatusResponse>();
-            IList<SftpExtendedReplyResponse> extendedReplyActionInvocations = new List<SftpExtendedReplyResponse>();
-
-            Action<SftpExtendedReplyResponse> extendedAction = extendedReplyActionInvocations.Add;
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new FStatVfsRequest(_protocolVersion, _requestId, _handle, extendedAction, statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-            Assert.AreEqual(0, extendedReplyActionInvocations.Count);
-        }
-
-        [TestMethod]
-        public void Complete_SftpExtendedReplyResponse()
-        {
-            IList<SftpStatusResponse> statusActionInvocations = new List<SftpStatusResponse>();
-            IList<SftpExtendedReplyResponse> extendedReplyActionInvocations = new List<SftpExtendedReplyResponse>();
-
-            Action<SftpExtendedReplyResponse> extendedAction = extendedReplyActionInvocations.Add;
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            var extendedReplyResponse = new SftpExtendedReplyResponse(_protocolVersion);
-
-            var request = new FStatVfsRequest(_protocolVersion, _requestId, _handle, extendedAction, statusAction);
-
-            request.Complete(extendedReplyResponse);
-
-            Assert.AreEqual(0, statusActionInvocations.Count);
-            Assert.AreEqual(1, extendedReplyActionInvocations.Count);
-            Assert.AreSame(extendedReplyResponse, extendedReplyActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var request = new FStatVfsRequest(_protocolVersion, _requestId, _handle, null, null);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // Name length
-            expectedBytesLength += _nameBytes.Length; // Name
-            expectedBytesLength += 4; // Handle length
-            expectedBytesLength += _handle.Length; // Handle
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            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());
-
-            var actualNameBytes = new byte[_nameBytes.Length];
-            sshDataStream.Read(actualNameBytes, 0, actualNameBytes.Length);
-            Assert.IsTrue(_nameBytes.SequenceEqual(actualNameBytes));
-
-            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.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
+using System;
+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;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests
+{
+    [TestClass]
+    public class FStatVfsRequestTest
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private byte[] _handle;
+        private string _name;
+        private byte[] _nameBytes;
+
+        [TestInitialize]
+        public void Init()
+        {
+            var random = new Random();
+            _protocolVersion = (uint)random.Next(0, int.MaxValue);
+            _requestId = (uint)random.Next(0, int.MaxValue);
+            _handle = new byte[random.Next(1, 10)];
+            random.NextBytes(_handle);
+
+            _name = "fstatvfs@openssh.com";
+            _nameBytes = Encoding.UTF8.GetBytes(_name);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var request = new FStatVfsRequest(_protocolVersion, _requestId, _handle, null, null);
+
+            Assert.AreSame(_handle, request.Handle);
+            Assert.AreEqual(_name, request.Name);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.Extended, request.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            IList<SftpStatusResponse> statusActionInvocations = new List<SftpStatusResponse>();
+            IList<SftpExtendedReplyResponse> extendedReplyActionInvocations = new List<SftpExtendedReplyResponse>();
+
+            Action<SftpExtendedReplyResponse> extendedAction = extendedReplyActionInvocations.Add;
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new FStatVfsRequest(_protocolVersion, _requestId, _handle, extendedAction, statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+            Assert.AreEqual(0, extendedReplyActionInvocations.Count);
+        }
+
+        [TestMethod]
+        public void Complete_SftpExtendedReplyResponse()
+        {
+            IList<SftpStatusResponse> statusActionInvocations = new List<SftpStatusResponse>();
+            IList<SftpExtendedReplyResponse> extendedReplyActionInvocations = new List<SftpExtendedReplyResponse>();
+
+            Action<SftpExtendedReplyResponse> extendedAction = extendedReplyActionInvocations.Add;
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            var extendedReplyResponse = new SftpExtendedReplyResponse(_protocolVersion);
+
+            var request = new FStatVfsRequest(_protocolVersion, _requestId, _handle, extendedAction, statusAction);
+
+            request.Complete(extendedReplyResponse);
+
+            Assert.AreEqual(0, statusActionInvocations.Count);
+            Assert.AreEqual(1, extendedReplyActionInvocations.Count);
+            Assert.AreSame(extendedReplyResponse, extendedReplyActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var request = new FStatVfsRequest(_protocolVersion, _requestId, _handle, null, null);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // Name length
+            expectedBytesLength += _nameBytes.Length; // Name
+            expectedBytesLength += 4; // Handle length
+            expectedBytesLength += _handle.Length; // Handle
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            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());
+
+            var actualNameBytes = new byte[_nameBytes.Length];
+            sshDataStream.Read(actualNameBytes, 0, actualNameBytes.Length);
+            Assert.IsTrue(_nameBytes.SequenceEqual(actualNameBytes));
+
+            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.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
 }

+ 115 - 115
src/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/HardLinkRequestTest.cs

@@ -1,116 +1,116 @@
-using System;
-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;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests
-{
-    [TestClass]
-    public class HardLinkRequestTest
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private string _name;
-        private string _oldPath;
-        private byte[] _oldPathBytes;
-        private string _newPath;
-        private byte[] _newPathBytes;
-        private byte[] _nameBytes;
-
-        [TestInitialize]
-        public void Init()
-        {
-            var random = new Random();
-            _protocolVersion = (uint)random.Next(0, int.MaxValue);
-            _requestId = (uint)random.Next(0, int.MaxValue);
-            _oldPath = random.Next().ToString(CultureInfo.InvariantCulture);
-            _oldPathBytes = Encoding.UTF8.GetBytes(_oldPath);
-            _newPath = random.Next().ToString(CultureInfo.InvariantCulture);
-            _newPathBytes = Encoding.UTF8.GetBytes(_newPath);
-
-            _name = "hardlink@openssh.com";
-            _nameBytes = Encoding.UTF8.GetBytes(_name);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var request = new HardLinkRequest(_protocolVersion, _requestId, _oldPath, _newPath, null);
-
-            Assert.AreEqual(_name, request.Name);
-            Assert.AreEqual(_newPath, request.NewPath);
-            Assert.AreEqual(_oldPath, request.OldPath);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.Extended, request.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            IList<SftpStatusResponse> statusActionInvocations = new List<SftpStatusResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new HardLinkRequest(_protocolVersion, _requestId, _oldPath, _newPath, statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var request = new HardLinkRequest(_protocolVersion, _requestId, _oldPath, _newPath, null);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // Name length
-            expectedBytesLength += _nameBytes.Length; // Name
-            expectedBytesLength += 4; // OldPath length
-            expectedBytesLength += _oldPathBytes.Length; // OldPath
-            expectedBytesLength += 4; // NewPath length
-            expectedBytesLength += _newPathBytes.Length; // NewPath
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            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());
-
-            var actualNameBytes = new byte[_nameBytes.Length];
-            sshDataStream.Read(actualNameBytes, 0, actualNameBytes.Length);
-            Assert.IsTrue(_nameBytes.SequenceEqual(actualNameBytes));
-
-            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());
-
-            var actualNewPath = new byte[_newPathBytes.Length];
-            sshDataStream.Read(actualNewPath, 0, actualNewPath.Length);
-            Assert.IsTrue(_newPathBytes.SequenceEqual(actualNewPath));
-
-            Assert.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
+using System;
+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;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests
+{
+    [TestClass]
+    public class HardLinkRequestTest
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private string _name;
+        private string _oldPath;
+        private byte[] _oldPathBytes;
+        private string _newPath;
+        private byte[] _newPathBytes;
+        private byte[] _nameBytes;
+
+        [TestInitialize]
+        public void Init()
+        {
+            var random = new Random();
+            _protocolVersion = (uint)random.Next(0, int.MaxValue);
+            _requestId = (uint)random.Next(0, int.MaxValue);
+            _oldPath = random.Next().ToString(CultureInfo.InvariantCulture);
+            _oldPathBytes = Encoding.UTF8.GetBytes(_oldPath);
+            _newPath = random.Next().ToString(CultureInfo.InvariantCulture);
+            _newPathBytes = Encoding.UTF8.GetBytes(_newPath);
+
+            _name = "hardlink@openssh.com";
+            _nameBytes = Encoding.UTF8.GetBytes(_name);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var request = new HardLinkRequest(_protocolVersion, _requestId, _oldPath, _newPath, null);
+
+            Assert.AreEqual(_name, request.Name);
+            Assert.AreEqual(_newPath, request.NewPath);
+            Assert.AreEqual(_oldPath, request.OldPath);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.Extended, request.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            IList<SftpStatusResponse> statusActionInvocations = new List<SftpStatusResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new HardLinkRequest(_protocolVersion, _requestId, _oldPath, _newPath, statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var request = new HardLinkRequest(_protocolVersion, _requestId, _oldPath, _newPath, null);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // Name length
+            expectedBytesLength += _nameBytes.Length; // Name
+            expectedBytesLength += 4; // OldPath length
+            expectedBytesLength += _oldPathBytes.Length; // OldPath
+            expectedBytesLength += 4; // NewPath length
+            expectedBytesLength += _newPathBytes.Length; // NewPath
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            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());
+
+            var actualNameBytes = new byte[_nameBytes.Length];
+            sshDataStream.Read(actualNameBytes, 0, actualNameBytes.Length);
+            Assert.IsTrue(_nameBytes.SequenceEqual(actualNameBytes));
+
+            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());
+
+            var actualNewPath = new byte[_newPathBytes.Length];
+            sshDataStream.Read(actualNewPath, 0, actualNewPath.Length);
+            Assert.IsTrue(_newPathBytes.SequenceEqual(actualNewPath));
+
+            Assert.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
 }

+ 119 - 119
src/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/PosixRenameRequestTest.cs

@@ -1,120 +1,120 @@
-using System;
-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;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests
-{
-    [TestClass]
-    public class PosixRenameRequestTest
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private string _name;
-        private string _oldPath;
-        private byte[] _oldPathBytes;
-        private string _newPath;
-        private byte[] _newPathBytes;
-        private byte[] _nameBytes;
-        private Encoding _encoding;
-
-        [TestInitialize]
-        public void Init()
-        {
-            var random = new Random();
-
-            _encoding = Encoding.Unicode;
-            _protocolVersion = (uint)random.Next(0, int.MaxValue);
-            _requestId = (uint)random.Next(0, int.MaxValue);
-            _oldPath = random.Next().ToString(CultureInfo.InvariantCulture);
-            _oldPathBytes = _encoding.GetBytes(_oldPath);
-            _newPath = random.Next().ToString(CultureInfo.InvariantCulture);
-            _newPathBytes = _encoding.GetBytes(_newPath);
-
-            _name = "posix-rename@openssh.com";
-            _nameBytes = Encoding.UTF8.GetBytes(_name);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var request = new PosixRenameRequest(_protocolVersion, _requestId, _oldPath, _newPath, _encoding, null);
-
-            Assert.AreSame(_encoding, request.Encoding);
-            Assert.AreEqual(_name, request.Name);
-            Assert.AreEqual(_newPath, request.NewPath);
-            Assert.AreEqual(_oldPath, request.OldPath);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.Extended, request.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            IList<SftpStatusResponse> statusActionInvocations = new List<SftpStatusResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new PosixRenameRequest(_protocolVersion, _requestId, _oldPath, _newPath, _encoding, statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var request = new PosixRenameRequest(_protocolVersion, _requestId, _oldPath, _newPath, _encoding, null);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // Name length
-            expectedBytesLength += _nameBytes.Length; // Name
-            expectedBytesLength += 4; // OldPath length
-            expectedBytesLength += _oldPathBytes.Length; // OldPath
-            expectedBytesLength += 4; // NewPath length
-            expectedBytesLength += _newPathBytes.Length; // NewPath
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            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());
-
-            var actualNameBytes = new byte[_nameBytes.Length];
-            sshDataStream.Read(actualNameBytes, 0, actualNameBytes.Length);
-            Assert.IsTrue(_nameBytes.SequenceEqual(actualNameBytes));
-
-            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());
-
-            var actualNewPath = new byte[_newPathBytes.Length];
-            sshDataStream.Read(actualNewPath, 0, actualNewPath.Length);
-            Assert.IsTrue(_newPathBytes.SequenceEqual(actualNewPath));
-
-            Assert.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
+using System;
+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;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests
+{
+    [TestClass]
+    public class PosixRenameRequestTest
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private string _name;
+        private string _oldPath;
+        private byte[] _oldPathBytes;
+        private string _newPath;
+        private byte[] _newPathBytes;
+        private byte[] _nameBytes;
+        private Encoding _encoding;
+
+        [TestInitialize]
+        public void Init()
+        {
+            var random = new Random();
+
+            _encoding = Encoding.Unicode;
+            _protocolVersion = (uint)random.Next(0, int.MaxValue);
+            _requestId = (uint)random.Next(0, int.MaxValue);
+            _oldPath = random.Next().ToString(CultureInfo.InvariantCulture);
+            _oldPathBytes = _encoding.GetBytes(_oldPath);
+            _newPath = random.Next().ToString(CultureInfo.InvariantCulture);
+            _newPathBytes = _encoding.GetBytes(_newPath);
+
+            _name = "posix-rename@openssh.com";
+            _nameBytes = Encoding.UTF8.GetBytes(_name);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var request = new PosixRenameRequest(_protocolVersion, _requestId, _oldPath, _newPath, _encoding, null);
+
+            Assert.AreSame(_encoding, request.Encoding);
+            Assert.AreEqual(_name, request.Name);
+            Assert.AreEqual(_newPath, request.NewPath);
+            Assert.AreEqual(_oldPath, request.OldPath);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.Extended, request.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            IList<SftpStatusResponse> statusActionInvocations = new List<SftpStatusResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new PosixRenameRequest(_protocolVersion, _requestId, _oldPath, _newPath, _encoding, statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var request = new PosixRenameRequest(_protocolVersion, _requestId, _oldPath, _newPath, _encoding, null);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // Name length
+            expectedBytesLength += _nameBytes.Length; // Name
+            expectedBytesLength += 4; // OldPath length
+            expectedBytesLength += _oldPathBytes.Length; // OldPath
+            expectedBytesLength += 4; // NewPath length
+            expectedBytesLength += _newPathBytes.Length; // NewPath
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            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());
+
+            var actualNameBytes = new byte[_nameBytes.Length];
+            sshDataStream.Read(actualNameBytes, 0, actualNameBytes.Length);
+            Assert.IsTrue(_nameBytes.SequenceEqual(actualNameBytes));
+
+            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());
+
+            var actualNewPath = new byte[_newPathBytes.Length];
+            sshDataStream.Read(actualNewPath, 0, actualNewPath.Length);
+            Assert.IsTrue(_newPathBytes.SequenceEqual(actualNewPath));
+
+            Assert.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
 }

+ 128 - 128
src/Renci.SshNet.Tests/Classes/Sftp/Requests/ExtendedRequests/StatVfsRequestTest.cs

@@ -1,129 +1,129 @@
-using System;
-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;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests
-{
-    [TestClass]
-    public class StatVfsRequestTest
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private string _name;
-        private string _path;
-        private byte[] _pathBytes;
-        private byte[] _nameBytes;
-        private Encoding _encoding;
-
-        [TestInitialize]
-        public void Init()
-        {
-            var random = new Random();
-
-            _encoding = Encoding.Unicode;
-            _protocolVersion = (uint)random.Next(0, int.MaxValue);
-            _requestId = (uint)random.Next(0, int.MaxValue);
-            _path = random.Next().ToString(CultureInfo.InvariantCulture);
-            _pathBytes = _encoding.GetBytes(_path);
-
-            _name = "statvfs@openssh.com";
-            _nameBytes = Encoding.UTF8.GetBytes(_name);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var request = new StatVfsRequest(_protocolVersion, _requestId, _path, _encoding, null, null);
-
-            Assert.AreSame(_encoding, request.Encoding);
-            Assert.AreEqual(_name, request.Name);
-            Assert.AreEqual(_path, request.Path);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.Extended, request.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            IList<SftpStatusResponse> statusActionInvocations = new List<SftpStatusResponse>();
-            IList<SftpExtendedReplyResponse> extendedReplyActionInvocations = new List<SftpExtendedReplyResponse>();
-
-            Action<SftpExtendedReplyResponse> extendedAction = extendedReplyActionInvocations.Add;
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new StatVfsRequest(_protocolVersion, _requestId, _path, _encoding, extendedAction, statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-            Assert.AreEqual(0, extendedReplyActionInvocations.Count);
-        }
-
-        [TestMethod]
-        public void Complete_SftpExtendedReplyResponse()
-        {
-            IList<SftpStatusResponse> statusActionInvocations = new List<SftpStatusResponse>();
-            IList<SftpExtendedReplyResponse> extendedReplyActionInvocations = new List<SftpExtendedReplyResponse>();
-
-            Action<SftpExtendedReplyResponse> extendedAction = extendedReplyActionInvocations.Add;
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            var extendedReplyResponse = new SftpExtendedReplyResponse(_protocolVersion);
-
-            var request = new StatVfsRequest(_protocolVersion, _requestId, _path, _encoding, extendedAction, statusAction);
-
-            request.Complete(extendedReplyResponse);
-
-            Assert.AreEqual(0, statusActionInvocations.Count);
-            Assert.AreEqual(1, extendedReplyActionInvocations.Count);
-            Assert.AreSame(extendedReplyResponse, extendedReplyActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var request = new StatVfsRequest(_protocolVersion, _requestId, _path, _encoding, null, null);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // Name length
-            expectedBytesLength += _nameBytes.Length; // Name
-            expectedBytesLength += 4; // Path length
-            expectedBytesLength += _pathBytes.Length; // Path
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            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());
-
-            var actualNameBytes = new byte[_nameBytes.Length];
-            sshDataStream.Read(actualNameBytes, 0, actualNameBytes.Length);
-            Assert.IsTrue(_nameBytes.SequenceEqual(actualNameBytes));
-
-            Assert.AreEqual((uint) _pathBytes.Length, sshDataStream.ReadUInt32());
-
-            var actualPath = new byte[_pathBytes.Length];
-            sshDataStream.Read(actualPath, 0, actualPath.Length);
-            Assert.IsTrue(_pathBytes.SequenceEqual(actualPath));
-
-            Assert.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
+using System;
+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;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests.ExtendedRequests
+{
+    [TestClass]
+    public class StatVfsRequestTest
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private string _name;
+        private string _path;
+        private byte[] _pathBytes;
+        private byte[] _nameBytes;
+        private Encoding _encoding;
+
+        [TestInitialize]
+        public void Init()
+        {
+            var random = new Random();
+
+            _encoding = Encoding.Unicode;
+            _protocolVersion = (uint)random.Next(0, int.MaxValue);
+            _requestId = (uint)random.Next(0, int.MaxValue);
+            _path = random.Next().ToString(CultureInfo.InvariantCulture);
+            _pathBytes = _encoding.GetBytes(_path);
+
+            _name = "statvfs@openssh.com";
+            _nameBytes = Encoding.UTF8.GetBytes(_name);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var request = new StatVfsRequest(_protocolVersion, _requestId, _path, _encoding, null, null);
+
+            Assert.AreSame(_encoding, request.Encoding);
+            Assert.AreEqual(_name, request.Name);
+            Assert.AreEqual(_path, request.Path);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.Extended, request.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            IList<SftpStatusResponse> statusActionInvocations = new List<SftpStatusResponse>();
+            IList<SftpExtendedReplyResponse> extendedReplyActionInvocations = new List<SftpExtendedReplyResponse>();
+
+            Action<SftpExtendedReplyResponse> extendedAction = extendedReplyActionInvocations.Add;
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new StatVfsRequest(_protocolVersion, _requestId, _path, _encoding, extendedAction, statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+            Assert.AreEqual(0, extendedReplyActionInvocations.Count);
+        }
+
+        [TestMethod]
+        public void Complete_SftpExtendedReplyResponse()
+        {
+            IList<SftpStatusResponse> statusActionInvocations = new List<SftpStatusResponse>();
+            IList<SftpExtendedReplyResponse> extendedReplyActionInvocations = new List<SftpExtendedReplyResponse>();
+
+            Action<SftpExtendedReplyResponse> extendedAction = extendedReplyActionInvocations.Add;
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            var extendedReplyResponse = new SftpExtendedReplyResponse(_protocolVersion);
+
+            var request = new StatVfsRequest(_protocolVersion, _requestId, _path, _encoding, extendedAction, statusAction);
+
+            request.Complete(extendedReplyResponse);
+
+            Assert.AreEqual(0, statusActionInvocations.Count);
+            Assert.AreEqual(1, extendedReplyActionInvocations.Count);
+            Assert.AreSame(extendedReplyResponse, extendedReplyActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var request = new StatVfsRequest(_protocolVersion, _requestId, _path, _encoding, null, null);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // Name length
+            expectedBytesLength += _nameBytes.Length; // Name
+            expectedBytesLength += 4; // Path length
+            expectedBytesLength += _pathBytes.Length; // Path
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            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());
+
+            var actualNameBytes = new byte[_nameBytes.Length];
+            sshDataStream.Read(actualNameBytes, 0, actualNameBytes.Length);
+            Assert.IsTrue(_nameBytes.SequenceEqual(actualNameBytes));
+
+            Assert.AreEqual((uint) _pathBytes.Length, sshDataStream.ReadUInt32());
+
+            var actualPath = new byte[_pathBytes.Length];
+            sshDataStream.Read(actualPath, 0, actualPath.Length);
+            Assert.IsTrue(_pathBytes.SequenceEqual(actualPath));
+
+            Assert.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
 }

+ 101 - 101
src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpBlockRequestTest.cs

@@ -1,102 +1,102 @@
-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;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests
-{
-    [TestClass]
-    public class SftpBlockRequestTest
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private byte[] _handle;
-        private ulong _offset;
-        private ulong _length;
-        private uint _lockMask;
-
-        [TestInitialize]
-        public void Init()
-        {
-            var random = new Random();
-
-            _protocolVersion = (uint)random.Next(0, int.MaxValue);
-            _requestId = (uint)random.Next(0, int.MaxValue);
-            _handle = new byte[random.Next(1, 10)];
-            random.NextBytes(_handle);
-            _offset = (ulong) random.Next(0, int.MaxValue);
-            _length = (ulong) random.Next(0, int.MaxValue);
-            _lockMask = (uint) random.Next(0, int.MaxValue);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var request = new SftpBlockRequest(_protocolVersion, _requestId, _handle, _offset, _length, _lockMask, null);
-
-            Assert.AreSame(_handle, request.Handle);
-            Assert.AreEqual(_length, request.Length);
-            Assert.AreEqual(_lockMask, request.LockMask);
-            Assert.AreEqual(_offset, request.Offset);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.Block, request.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            IList<SftpStatusResponse> statusActionInvocations = new List<SftpStatusResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new SftpBlockRequest(_protocolVersion, _requestId, _handle, _offset, _length, _lockMask, statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var request = new SftpBlockRequest(_protocolVersion, _requestId, _handle, _offset, _length, _lockMask, null);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // Handle length
-            expectedBytesLength += _handle.Length; // Handle
-            expectedBytesLength += 8; // Offset
-            expectedBytesLength += 8; // Length
-            expectedBytesLength += 4; // LockMask
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            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());
-            var actualHandle = new byte[_handle.Length];
-            sshDataStream.Read(actualHandle, 0, actualHandle.Length);
-            Assert.IsTrue(_handle.SequenceEqual(actualHandle));
-
-            Assert.AreEqual(_offset, sshDataStream.ReadUInt64());
-            Assert.AreEqual(_length, sshDataStream.ReadUInt64());
-            Assert.AreEqual(_lockMask, sshDataStream.ReadUInt32());
-            Assert.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
+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;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests
+{
+    [TestClass]
+    public class SftpBlockRequestTest
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private byte[] _handle;
+        private ulong _offset;
+        private ulong _length;
+        private uint _lockMask;
+
+        [TestInitialize]
+        public void Init()
+        {
+            var random = new Random();
+
+            _protocolVersion = (uint)random.Next(0, int.MaxValue);
+            _requestId = (uint)random.Next(0, int.MaxValue);
+            _handle = new byte[random.Next(1, 10)];
+            random.NextBytes(_handle);
+            _offset = (ulong) random.Next(0, int.MaxValue);
+            _length = (ulong) random.Next(0, int.MaxValue);
+            _lockMask = (uint) random.Next(0, int.MaxValue);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var request = new SftpBlockRequest(_protocolVersion, _requestId, _handle, _offset, _length, _lockMask, null);
+
+            Assert.AreSame(_handle, request.Handle);
+            Assert.AreEqual(_length, request.Length);
+            Assert.AreEqual(_lockMask, request.LockMask);
+            Assert.AreEqual(_offset, request.Offset);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.Block, request.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            IList<SftpStatusResponse> statusActionInvocations = new List<SftpStatusResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new SftpBlockRequest(_protocolVersion, _requestId, _handle, _offset, _length, _lockMask, statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var request = new SftpBlockRequest(_protocolVersion, _requestId, _handle, _offset, _length, _lockMask, null);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // Handle length
+            expectedBytesLength += _handle.Length; // Handle
+            expectedBytesLength += 8; // Offset
+            expectedBytesLength += 8; // Length
+            expectedBytesLength += 4; // LockMask
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            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());
+            var actualHandle = new byte[_handle.Length];
+            sshDataStream.Read(actualHandle, 0, actualHandle.Length);
+            Assert.IsTrue(_handle.SequenceEqual(actualHandle));
+
+            Assert.AreEqual(_offset, sshDataStream.ReadUInt64());
+            Assert.AreEqual(_length, sshDataStream.ReadUInt64());
+            Assert.AreEqual(_lockMask, sshDataStream.ReadUInt32());
+            Assert.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
 }

+ 86 - 86
src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpCloseRequestTest.cs

@@ -1,87 +1,87 @@
-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;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests
-{
-    [TestClass]
-    public class SftpCloseRequestTest
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private byte[] _handle;
-
-        [TestInitialize]
-        public void Init()
-        {
-            var random = new Random();
-
-            _protocolVersion = (uint)random.Next(0, int.MaxValue);
-            _requestId = (uint)random.Next(0, int.MaxValue);
-            _handle = new byte[random.Next(1, 10)];
-            random.NextBytes(_handle);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var request = new SftpCloseRequest(_protocolVersion, _requestId, _handle, null);
-
-            Assert.AreSame(_handle, request.Handle);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.Close, request.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            IList<SftpStatusResponse> statusActionInvocations = new List<SftpStatusResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new SftpCloseRequest(_protocolVersion, _requestId, _handle, statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var request = new SftpCloseRequest(_protocolVersion, _requestId, _handle, null);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // Handle length
-            expectedBytesLength += _handle.Length; // Handle
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32());
-            Assert.AreEqual((byte) SftpMessageTypes.Close, sshDataStream.ReadByte());
-            Assert.AreEqual(_requestId, sshDataStream.ReadUInt32());
-
-            Assert.AreEqual((uint) _handle.Length, sshDataStream.ReadUInt32());
-            var actualHandle = new byte[_handle.Length];
-            sshDataStream.Read(actualHandle, 0, actualHandle.Length);
-            Assert.IsTrue(_handle.SequenceEqual(actualHandle));
-
-            Assert.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
+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;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests
+{
+    [TestClass]
+    public class SftpCloseRequestTest
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private byte[] _handle;
+
+        [TestInitialize]
+        public void Init()
+        {
+            var random = new Random();
+
+            _protocolVersion = (uint)random.Next(0, int.MaxValue);
+            _requestId = (uint)random.Next(0, int.MaxValue);
+            _handle = new byte[random.Next(1, 10)];
+            random.NextBytes(_handle);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var request = new SftpCloseRequest(_protocolVersion, _requestId, _handle, null);
+
+            Assert.AreSame(_handle, request.Handle);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.Close, request.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            IList<SftpStatusResponse> statusActionInvocations = new List<SftpStatusResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new SftpCloseRequest(_protocolVersion, _requestId, _handle, statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var request = new SftpCloseRequest(_protocolVersion, _requestId, _handle, null);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // Handle length
+            expectedBytesLength += _handle.Length; // Handle
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            Assert.AreEqual((uint)bytes.Length - 4, sshDataStream.ReadUInt32());
+            Assert.AreEqual((byte) SftpMessageTypes.Close, sshDataStream.ReadByte());
+            Assert.AreEqual(_requestId, sshDataStream.ReadUInt32());
+
+            Assert.AreEqual((uint) _handle.Length, sshDataStream.ReadUInt32());
+            var actualHandle = new byte[_handle.Length];
+            sshDataStream.Read(actualHandle, 0, actualHandle.Length);
+            Assert.IsTrue(_handle.SequenceEqual(actualHandle));
+
+            Assert.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
 }

+ 95 - 95
src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFSetStatRequestTest.cs

@@ -1,96 +1,96 @@
-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;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests
-{
-    [TestClass]
-    public class SftpFSetStatRequestTest
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private byte[] _handle;
-        private SftpFileAttributes _attributes;
-        private byte[] _attributesBytes;
-
-        [TestInitialize]
-        public void Init()
-        {
-            var random = new Random();
-
-            _protocolVersion = (uint)random.Next(0, int.MaxValue);
-            _requestId = (uint)random.Next(0, int.MaxValue);
-            _handle = new byte[random.Next(1, 10)];
-            random.NextBytes(_handle);
-            _attributes = SftpFileAttributes.Empty;
-            _attributesBytes = _attributes.GetBytes();
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var request = new SftpFSetStatRequest(_protocolVersion, _requestId, _handle, _attributes, null);
-
-            Assert.AreSame(_handle, request.Handle);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.FSetStat, request.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            IList<SftpStatusResponse> statusActionInvocations = new List<SftpStatusResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new SftpFSetStatRequest(_protocolVersion, _requestId, _handle, _attributes, statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var request = new SftpFSetStatRequest(_protocolVersion, _requestId, _handle, _attributes, null);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // Handle length
-            expectedBytesLength += _handle.Length; // Handle
-            expectedBytesLength += _attributesBytes.Length; // Attributes
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            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());
-            var actualHandle = new byte[_handle.Length];
-            sshDataStream.Read(actualHandle, 0, actualHandle.Length);
-            Assert.IsTrue(_handle.SequenceEqual(actualHandle));
-
-            var actualAttributes = new byte[_attributesBytes.Length];
-            sshDataStream.Read(actualAttributes, 0, actualAttributes.Length);
-            Assert.IsTrue(_attributesBytes.SequenceEqual(actualAttributes));
-
-            Assert.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
+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;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests
+{
+    [TestClass]
+    public class SftpFSetStatRequestTest
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private byte[] _handle;
+        private SftpFileAttributes _attributes;
+        private byte[] _attributesBytes;
+
+        [TestInitialize]
+        public void Init()
+        {
+            var random = new Random();
+
+            _protocolVersion = (uint)random.Next(0, int.MaxValue);
+            _requestId = (uint)random.Next(0, int.MaxValue);
+            _handle = new byte[random.Next(1, 10)];
+            random.NextBytes(_handle);
+            _attributes = SftpFileAttributes.Empty;
+            _attributesBytes = _attributes.GetBytes();
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var request = new SftpFSetStatRequest(_protocolVersion, _requestId, _handle, _attributes, null);
+
+            Assert.AreSame(_handle, request.Handle);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.FSetStat, request.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            IList<SftpStatusResponse> statusActionInvocations = new List<SftpStatusResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new SftpFSetStatRequest(_protocolVersion, _requestId, _handle, _attributes, statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var request = new SftpFSetStatRequest(_protocolVersion, _requestId, _handle, _attributes, null);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // Handle length
+            expectedBytesLength += _handle.Length; // Handle
+            expectedBytesLength += _attributesBytes.Length; // Attributes
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            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());
+            var actualHandle = new byte[_handle.Length];
+            sshDataStream.Read(actualHandle, 0, actualHandle.Length);
+            Assert.IsTrue(_handle.SequenceEqual(actualHandle));
+
+            var actualAttributes = new byte[_attributesBytes.Length];
+            sshDataStream.Read(actualAttributes, 0, actualAttributes.Length);
+            Assert.IsTrue(_attributesBytes.SequenceEqual(actualAttributes));
+
+            Assert.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
 }

+ 108 - 108
src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpFStatRequestTest.cs

@@ -1,109 +1,109 @@
-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;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests
-{
-    [TestClass]
-    public class SftpFStatRequestTest
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private byte[] _handle;
-
-        [TestInitialize]
-        public void Init()
-        {
-            var random = new Random();
-
-            _protocolVersion = (uint)random.Next(0, int.MaxValue);
-            _requestId = (uint)random.Next(0, int.MaxValue);
-            _handle = new byte[random.Next(1, 10)];
-            random.NextBytes(_handle);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var request = new SftpFStatRequest(_protocolVersion, _requestId, _handle, null, null);
-
-            Assert.AreSame(_handle, request.Handle);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.FStat, request.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Complete_SftpAttrsResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-            var attrsActionInvocations = new List<SftpAttrsResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            Action<SftpAttrsResponse> attrsAction = attrsActionInvocations.Add;
-            var attrsResponse = new SftpAttrsResponse(_protocolVersion);
-
-            var request = new SftpFStatRequest(_protocolVersion, _requestId, _handle, attrsAction, statusAction);
-
-            request.Complete(attrsResponse);
-
-            Assert.AreEqual(0, statusActionInvocations.Count);
-            Assert.AreEqual(1, attrsActionInvocations.Count);
-            Assert.AreSame(attrsResponse, attrsActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-            var attrsActionInvocations = new List<SftpAttrsResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            Action<SftpAttrsResponse> attrsAction = attrsActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new SftpFStatRequest(_protocolVersion, _requestId, _handle, attrsAction, statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-            Assert.AreEqual(0, attrsActionInvocations.Count);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var request = new SftpFStatRequest(_protocolVersion, _requestId, _handle, null, null);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // Handle length
-            expectedBytesLength += _handle.Length; // Handle
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            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());
-            var actualHandle = new byte[_handle.Length];
-            sshDataStream.Read(actualHandle, 0, actualHandle.Length);
-            Assert.IsTrue(_handle.SequenceEqual(actualHandle));
-
-            Assert.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
+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;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests
+{
+    [TestClass]
+    public class SftpFStatRequestTest
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private byte[] _handle;
+
+        [TestInitialize]
+        public void Init()
+        {
+            var random = new Random();
+
+            _protocolVersion = (uint)random.Next(0, int.MaxValue);
+            _requestId = (uint)random.Next(0, int.MaxValue);
+            _handle = new byte[random.Next(1, 10)];
+            random.NextBytes(_handle);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var request = new SftpFStatRequest(_protocolVersion, _requestId, _handle, null, null);
+
+            Assert.AreSame(_handle, request.Handle);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.FStat, request.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Complete_SftpAttrsResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+            var attrsActionInvocations = new List<SftpAttrsResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            Action<SftpAttrsResponse> attrsAction = attrsActionInvocations.Add;
+            var attrsResponse = new SftpAttrsResponse(_protocolVersion);
+
+            var request = new SftpFStatRequest(_protocolVersion, _requestId, _handle, attrsAction, statusAction);
+
+            request.Complete(attrsResponse);
+
+            Assert.AreEqual(0, statusActionInvocations.Count);
+            Assert.AreEqual(1, attrsActionInvocations.Count);
+            Assert.AreSame(attrsResponse, attrsActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+            var attrsActionInvocations = new List<SftpAttrsResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            Action<SftpAttrsResponse> attrsAction = attrsActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new SftpFStatRequest(_protocolVersion, _requestId, _handle, attrsAction, statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+            Assert.AreEqual(0, attrsActionInvocations.Count);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var request = new SftpFStatRequest(_protocolVersion, _requestId, _handle, null, null);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // Handle length
+            expectedBytesLength += _handle.Length; // Handle
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            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());
+            var actualHandle = new byte[_handle.Length];
+            sshDataStream.Read(actualHandle, 0, actualHandle.Length);
+            Assert.IsTrue(_handle.SequenceEqual(actualHandle));
+
+            Assert.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
 }

+ 9 - 9
src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpInitRequestTest.cs

@@ -1,10 +1,10 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests
-{
-    [TestClass]
-    public class SftpInitRequestTest : TestBase
-    {
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests
+{
+    [TestClass]
+    public class SftpInitRequestTest : TestBase
+    {
+    }
 }

+ 114 - 114
src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLStatRequestTest.cs

@@ -1,115 +1,115 @@
-using System;
-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;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests
-{
-    [TestClass]
-    public class SftpLStatRequestTest
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private Encoding _encoding;
-        private string _path;
-        private byte[] _pathBytes;
-
-        [TestInitialize]
-        public void Init()
-        {
-            var random = new Random();
-
-            _encoding = Encoding.Unicode;
-            _protocolVersion = (uint) random.Next(0, int.MaxValue);
-            _requestId = (uint) random.Next(0, int.MaxValue);
-            _path = random.Next().ToString(CultureInfo.InvariantCulture);
-            _pathBytes = _encoding.GetBytes(_path);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var request = new SftpLStatRequest(_protocolVersion, _requestId, _path, _encoding, null, null);
-
-            Assert.AreSame(_encoding, request.Encoding);
-            Assert.AreEqual(_path, request.Path);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.LStat, request.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Complete_SftpAttrsResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-            var attrsActionInvocations = new List<SftpAttrsResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            Action<SftpAttrsResponse> attrsAction = attrsActionInvocations.Add;
-            var attrsResponse = new SftpAttrsResponse(_protocolVersion);
-
-            var request = new SftpLStatRequest(_protocolVersion, _requestId, _path, _encoding, attrsAction, statusAction);
-
-            request.Complete(attrsResponse);
-
-            Assert.AreEqual(0, statusActionInvocations.Count);
-            Assert.AreEqual(1, attrsActionInvocations.Count);
-            Assert.AreSame(attrsResponse, attrsActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-            var attrsActionInvocations = new List<SftpAttrsResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            Action<SftpAttrsResponse> attrsAction = attrsActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new SftpLStatRequest(_protocolVersion, _requestId, _path, _encoding, attrsAction, statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-            Assert.AreEqual(0, attrsActionInvocations.Count);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var request = new SftpLStatRequest(_protocolVersion, _requestId, _path, _encoding, null, null);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // Pah length
-            expectedBytesLength += _pathBytes.Length; // Path
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            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());
-            var actualPath = new byte[_pathBytes.Length];
-            sshDataStream.Read(actualPath, 0, actualPath.Length);
-            Assert.IsTrue(_pathBytes.SequenceEqual(actualPath));
-
-            Assert.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
+using System;
+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;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests
+{
+    [TestClass]
+    public class SftpLStatRequestTest
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private Encoding _encoding;
+        private string _path;
+        private byte[] _pathBytes;
+
+        [TestInitialize]
+        public void Init()
+        {
+            var random = new Random();
+
+            _encoding = Encoding.Unicode;
+            _protocolVersion = (uint) random.Next(0, int.MaxValue);
+            _requestId = (uint) random.Next(0, int.MaxValue);
+            _path = random.Next().ToString(CultureInfo.InvariantCulture);
+            _pathBytes = _encoding.GetBytes(_path);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var request = new SftpLStatRequest(_protocolVersion, _requestId, _path, _encoding, null, null);
+
+            Assert.AreSame(_encoding, request.Encoding);
+            Assert.AreEqual(_path, request.Path);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.LStat, request.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Complete_SftpAttrsResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+            var attrsActionInvocations = new List<SftpAttrsResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            Action<SftpAttrsResponse> attrsAction = attrsActionInvocations.Add;
+            var attrsResponse = new SftpAttrsResponse(_protocolVersion);
+
+            var request = new SftpLStatRequest(_protocolVersion, _requestId, _path, _encoding, attrsAction, statusAction);
+
+            request.Complete(attrsResponse);
+
+            Assert.AreEqual(0, statusActionInvocations.Count);
+            Assert.AreEqual(1, attrsActionInvocations.Count);
+            Assert.AreSame(attrsResponse, attrsActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+            var attrsActionInvocations = new List<SftpAttrsResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            Action<SftpAttrsResponse> attrsAction = attrsActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new SftpLStatRequest(_protocolVersion, _requestId, _path, _encoding, attrsAction, statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+            Assert.AreEqual(0, attrsActionInvocations.Count);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var request = new SftpLStatRequest(_protocolVersion, _requestId, _path, _encoding, null, null);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // Pah length
+            expectedBytesLength += _pathBytes.Length; // Path
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            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());
+            var actualPath = new byte[_pathBytes.Length];
+            sshDataStream.Read(actualPath, 0, actualPath.Length);
+            Assert.IsTrue(_pathBytes.SequenceEqual(actualPath));
+
+            Assert.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
 }

+ 109 - 109
src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpLinkRequestTest.cs

@@ -1,110 +1,110 @@
-using System;
-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;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests
-{
-    [TestClass]
-    public class SftpLinkRequestTest
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private string _newLinkPath;
-        private byte[] _newLinkPathBytes;
-        private string _existingPath;
-        private byte[] _existingPathBytes;
-
-        [TestInitialize]
-        public void Init()
-        {
-            var random = new Random();
-
-            _protocolVersion = (uint)random.Next(0, int.MaxValue);
-            _requestId = (uint)random.Next(0, int.MaxValue);
-            _newLinkPath = random.Next().ToString(CultureInfo.InvariantCulture);
-            _newLinkPathBytes = Encoding.UTF8.GetBytes(_newLinkPath);
-            _existingPath = random.Next().ToString(CultureInfo.InvariantCulture);
-            _existingPathBytes = Encoding.UTF8.GetBytes(_existingPath);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var request = new SftpLinkRequest(_protocolVersion, _requestId, _newLinkPath, _existingPath, true, null);
-
-            Assert.AreEqual(_existingPath, request.ExistingPath);
-            Assert.IsTrue(request.IsSymLink);
-            Assert.AreEqual(_newLinkPath, request.NewLinkPath);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.Link, request.SftpMessageType);
-
-            request = new SftpLinkRequest(_protocolVersion, _requestId, _newLinkPath, _existingPath, false, null);
-
-            Assert.IsFalse(request.IsSymLink);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new SftpLinkRequest(_protocolVersion, _requestId, _newLinkPath, _existingPath, true, statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var request = new SftpLinkRequest(_protocolVersion, _requestId, _newLinkPath, _existingPath, true, null);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // NewLinkPath length
-            expectedBytesLength += _newLinkPathBytes.Length; // NewLinkPath
-            expectedBytesLength += 4; // ExistingPath length
-            expectedBytesLength += _existingPathBytes.Length; // ExistingPath
-            expectedBytesLength += 1; // IsSymLink
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            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());
-            var actualNewLinkPath = new byte[_newLinkPathBytes.Length];
-            sshDataStream.Read(actualNewLinkPath, 0, actualNewLinkPath.Length);
-            Assert.IsTrue(_newLinkPathBytes.SequenceEqual(actualNewLinkPath));
-
-            Assert.AreEqual((uint) _existingPathBytes.Length, sshDataStream.ReadUInt32());
-            var actualExistingPath = new byte[_existingPathBytes.Length];
-            sshDataStream.Read(actualExistingPath, 0, actualExistingPath.Length);
-            Assert.IsTrue(_existingPathBytes.SequenceEqual(actualExistingPath));
-
-            Assert.AreEqual(1, sshDataStream.ReadByte());
-
-            Assert.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
+using System;
+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;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests
+{
+    [TestClass]
+    public class SftpLinkRequestTest
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private string _newLinkPath;
+        private byte[] _newLinkPathBytes;
+        private string _existingPath;
+        private byte[] _existingPathBytes;
+
+        [TestInitialize]
+        public void Init()
+        {
+            var random = new Random();
+
+            _protocolVersion = (uint)random.Next(0, int.MaxValue);
+            _requestId = (uint)random.Next(0, int.MaxValue);
+            _newLinkPath = random.Next().ToString(CultureInfo.InvariantCulture);
+            _newLinkPathBytes = Encoding.UTF8.GetBytes(_newLinkPath);
+            _existingPath = random.Next().ToString(CultureInfo.InvariantCulture);
+            _existingPathBytes = Encoding.UTF8.GetBytes(_existingPath);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var request = new SftpLinkRequest(_protocolVersion, _requestId, _newLinkPath, _existingPath, true, null);
+
+            Assert.AreEqual(_existingPath, request.ExistingPath);
+            Assert.IsTrue(request.IsSymLink);
+            Assert.AreEqual(_newLinkPath, request.NewLinkPath);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.Link, request.SftpMessageType);
+
+            request = new SftpLinkRequest(_protocolVersion, _requestId, _newLinkPath, _existingPath, false, null);
+
+            Assert.IsFalse(request.IsSymLink);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new SftpLinkRequest(_protocolVersion, _requestId, _newLinkPath, _existingPath, true, statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var request = new SftpLinkRequest(_protocolVersion, _requestId, _newLinkPath, _existingPath, true, null);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // NewLinkPath length
+            expectedBytesLength += _newLinkPathBytes.Length; // NewLinkPath
+            expectedBytesLength += 4; // ExistingPath length
+            expectedBytesLength += _existingPathBytes.Length; // ExistingPath
+            expectedBytesLength += 1; // IsSymLink
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            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());
+            var actualNewLinkPath = new byte[_newLinkPathBytes.Length];
+            sshDataStream.Read(actualNewLinkPath, 0, actualNewLinkPath.Length);
+            Assert.IsTrue(_newLinkPathBytes.SequenceEqual(actualNewLinkPath));
+
+            Assert.AreEqual((uint) _existingPathBytes.Length, sshDataStream.ReadUInt32());
+            var actualExistingPath = new byte[_existingPathBytes.Length];
+            sshDataStream.Read(actualExistingPath, 0, actualExistingPath.Length);
+            Assert.IsTrue(_existingPathBytes.SequenceEqual(actualExistingPath));
+
+            Assert.AreEqual(1, sshDataStream.ReadByte());
+
+            Assert.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
 }

+ 101 - 101
src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpMkDirRequestTest.cs

@@ -1,102 +1,102 @@
-using System;
-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;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests
-{
-    [TestClass]
-    public class SftpMkDirRequestTest
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private Encoding _encoding;
-        private string _path;
-        private byte[] _pathBytes;
-        private SftpFileAttributes _attributes;
-        private byte[] _attributesBytes;
-
-        [TestInitialize]
-        public void Init()
-        {
-            var random = new Random();
-
-            _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);
-            _attributes = SftpFileAttributes.Empty;
-            _attributesBytes = _attributes.GetBytes();
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var request = new SftpMkDirRequest(_protocolVersion, _requestId, _path, _encoding, null);
-
-            Assert.AreSame(_encoding, request.Encoding);
-            Assert.AreEqual(_path, request.Path);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.MkDir, request.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new SftpMkDirRequest(_protocolVersion, _requestId, _path, _encoding, statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var request = new SftpMkDirRequest(_protocolVersion, _requestId, _path, _encoding, null);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // Path length
-            expectedBytesLength += _pathBytes.Length; // Path
-            expectedBytesLength += _attributesBytes.Length; // Attributes
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            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());
-            var actualPath = new byte[_pathBytes.Length];
-            sshDataStream.Read(actualPath, 0, actualPath.Length);
-            Assert.IsTrue(_pathBytes.SequenceEqual(actualPath));
-
-            var actualAttributes = new byte[_attributesBytes.Length];
-            sshDataStream.Read(actualAttributes, 0, actualAttributes.Length);
-            Assert.IsTrue(_attributesBytes.SequenceEqual(actualAttributes));
-
-            Assert.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
+using System;
+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;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests
+{
+    [TestClass]
+    public class SftpMkDirRequestTest
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private Encoding _encoding;
+        private string _path;
+        private byte[] _pathBytes;
+        private SftpFileAttributes _attributes;
+        private byte[] _attributesBytes;
+
+        [TestInitialize]
+        public void Init()
+        {
+            var random = new Random();
+
+            _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);
+            _attributes = SftpFileAttributes.Empty;
+            _attributesBytes = _attributes.GetBytes();
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var request = new SftpMkDirRequest(_protocolVersion, _requestId, _path, _encoding, null);
+
+            Assert.AreSame(_encoding, request.Encoding);
+            Assert.AreEqual(_path, request.Path);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.MkDir, request.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new SftpMkDirRequest(_protocolVersion, _requestId, _path, _encoding, statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var request = new SftpMkDirRequest(_protocolVersion, _requestId, _path, _encoding, null);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // Path length
+            expectedBytesLength += _pathBytes.Length; // Path
+            expectedBytesLength += _attributesBytes.Length; // Attributes
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            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());
+            var actualPath = new byte[_pathBytes.Length];
+            sshDataStream.Read(actualPath, 0, actualPath.Length);
+            Assert.IsTrue(_pathBytes.SequenceEqual(actualPath));
+
+            var actualAttributes = new byte[_attributesBytes.Length];
+            sshDataStream.Read(actualAttributes, 0, actualAttributes.Length);
+            Assert.IsTrue(_attributesBytes.SequenceEqual(actualAttributes));
+
+            Assert.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
 }

+ 142 - 142
src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpOpenRequestTest.cs

@@ -1,143 +1,143 @@
-using System;
-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;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests
-{
-    [TestClass]
-    public class SftpOpenRequestTest
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private Encoding _encoding;
-        private string _filename;
-        private byte[] _filenameBytes;
-        private Flags _flags;
-        private SftpFileAttributes _attributes;
-        private byte[] _attributesBytes;
-
-        [TestInitialize]
-        public void Init()
-        {
-            var random = new Random();
-
-            _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);
-            _flags = Flags.Read;
-            _attributes = SftpFileAttributes.Empty;
-            _attributesBytes = _attributes.GetBytes();
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var request = new SftpOpenRequest(_protocolVersion, _requestId, _filename, _encoding, _flags, null, null);
-
-            Assert.AreSame(_encoding, request.Encoding);
-            Assert.AreEqual(_filename, request.Filename);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.Open, request.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Complete_SftpHandleResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-            var handleActionInvocations = new List<SftpHandleResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            Action<SftpHandleResponse> handleAction = handleActionInvocations.Add;
-            var handleResponse = new SftpHandleResponse(_protocolVersion);
-
-            var request = new SftpOpenRequest(
-                _protocolVersion,
-                _requestId,
-                _filename,
-                _encoding,
-                _flags,
-                handleAction,
-                statusAction);
-
-            request.Complete(handleResponse);
-
-            Assert.AreEqual(0, statusActionInvocations.Count);
-            Assert.AreEqual(1, handleActionInvocations.Count);
-            Assert.AreSame(handleResponse, handleActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-            var handleActionInvocations = new List<SftpHandleResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            Action<SftpHandleResponse> handleAction = handleActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new SftpOpenRequest(
-                _protocolVersion,
-                _requestId,
-                _filename,
-                _encoding,
-                _flags,
-                handleAction,
-                statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-            Assert.AreEqual(0, handleActionInvocations.Count);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var request = new SftpOpenRequest(_protocolVersion, _requestId, _filename, _encoding, _flags, null, null);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // Filename length
-            expectedBytesLength += _filenameBytes.Length; // Filename
-            expectedBytesLength += 4; // Flags
-            expectedBytesLength += _attributesBytes.Length; // Attributes
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            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());
-            var actualPath = new byte[_filenameBytes.Length];
-            sshDataStream.Read(actualPath, 0, actualPath.Length);
-            Assert.IsTrue(_filenameBytes.SequenceEqual(actualPath));
-
-            Assert.AreEqual((uint) _flags, sshDataStream.ReadUInt32());
-
-            var actualAttributes = new byte[_attributesBytes.Length];
-            sshDataStream.Read(actualAttributes, 0, actualAttributes.Length);
-            Assert.IsTrue(_attributesBytes.SequenceEqual(actualAttributes));
-
-            Assert.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
+using System;
+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;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests
+{
+    [TestClass]
+    public class SftpOpenRequestTest
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private Encoding _encoding;
+        private string _filename;
+        private byte[] _filenameBytes;
+        private Flags _flags;
+        private SftpFileAttributes _attributes;
+        private byte[] _attributesBytes;
+
+        [TestInitialize]
+        public void Init()
+        {
+            var random = new Random();
+
+            _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);
+            _flags = Flags.Read;
+            _attributes = SftpFileAttributes.Empty;
+            _attributesBytes = _attributes.GetBytes();
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var request = new SftpOpenRequest(_protocolVersion, _requestId, _filename, _encoding, _flags, null, null);
+
+            Assert.AreSame(_encoding, request.Encoding);
+            Assert.AreEqual(_filename, request.Filename);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.Open, request.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Complete_SftpHandleResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+            var handleActionInvocations = new List<SftpHandleResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            Action<SftpHandleResponse> handleAction = handleActionInvocations.Add;
+            var handleResponse = new SftpHandleResponse(_protocolVersion);
+
+            var request = new SftpOpenRequest(
+                _protocolVersion,
+                _requestId,
+                _filename,
+                _encoding,
+                _flags,
+                handleAction,
+                statusAction);
+
+            request.Complete(handleResponse);
+
+            Assert.AreEqual(0, statusActionInvocations.Count);
+            Assert.AreEqual(1, handleActionInvocations.Count);
+            Assert.AreSame(handleResponse, handleActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+            var handleActionInvocations = new List<SftpHandleResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            Action<SftpHandleResponse> handleAction = handleActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new SftpOpenRequest(
+                _protocolVersion,
+                _requestId,
+                _filename,
+                _encoding,
+                _flags,
+                handleAction,
+                statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+            Assert.AreEqual(0, handleActionInvocations.Count);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var request = new SftpOpenRequest(_protocolVersion, _requestId, _filename, _encoding, _flags, null, null);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // Filename length
+            expectedBytesLength += _filenameBytes.Length; // Filename
+            expectedBytesLength += 4; // Flags
+            expectedBytesLength += _attributesBytes.Length; // Attributes
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            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());
+            var actualPath = new byte[_filenameBytes.Length];
+            sshDataStream.Read(actualPath, 0, actualPath.Length);
+            Assert.IsTrue(_filenameBytes.SequenceEqual(actualPath));
+
+            Assert.AreEqual((uint) _flags, sshDataStream.ReadUInt32());
+
+            var actualAttributes = new byte[_attributesBytes.Length];
+            sshDataStream.Read(actualAttributes, 0, actualAttributes.Length);
+            Assert.IsTrue(_attributesBytes.SequenceEqual(actualAttributes));
+
+            Assert.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
 }

+ 109 - 109
src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadDirRequestTest.cs

@@ -1,110 +1,110 @@
-using System;
-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;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests
-{
-    [TestClass]
-    public class SftpReadDirRequestTest
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private byte[] _handle;
-
-        [TestInitialize]
-        public void Init()
-        {
-            var random = new Random();
-
-            _protocolVersion = (uint) random.Next(0, int.MaxValue);
-            _requestId = (uint) random.Next(0, int.MaxValue);
-            _handle = new byte[random.Next(1, 10)];
-            random.NextBytes(_handle);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var request = new SftpReadDirRequest(_protocolVersion, _requestId, _handle, null, null);
-
-            Assert.AreSame(_handle, request.Handle);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.ReadDir, request.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Complete_SftpAttrsResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-            var nameActionInvocations = new List<SftpNameResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            Action<SftpNameResponse> nameAction = nameActionInvocations.Add;
-            var nameResponse = new SftpNameResponse(_protocolVersion, Encoding.Unicode);
-
-            var request = new SftpReadDirRequest(_protocolVersion, _requestId, _handle, nameAction, statusAction);
-
-            request.Complete(nameResponse);
-
-            Assert.AreEqual(0, statusActionInvocations.Count);
-            Assert.AreEqual(1, nameActionInvocations.Count);
-            Assert.AreSame(nameResponse, nameActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-            var nameActionInvocations = new List<SftpNameResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            Action<SftpNameResponse> nameAction = nameActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new SftpReadDirRequest(_protocolVersion, _requestId, _handle, nameAction, statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-            Assert.AreEqual(0, nameActionInvocations.Count);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var request = new SftpReadDirRequest(_protocolVersion, _requestId, _handle, null, null);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // Handle length
-            expectedBytesLength += _handle.Length; // Handle
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            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());
-            var actualHandle = new byte[_handle.Length];
-            sshDataStream.Read(actualHandle, 0, actualHandle.Length);
-            Assert.IsTrue(_handle.SequenceEqual(actualHandle));
-
-            Assert.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
+using System;
+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;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests
+{
+    [TestClass]
+    public class SftpReadDirRequestTest
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private byte[] _handle;
+
+        [TestInitialize]
+        public void Init()
+        {
+            var random = new Random();
+
+            _protocolVersion = (uint) random.Next(0, int.MaxValue);
+            _requestId = (uint) random.Next(0, int.MaxValue);
+            _handle = new byte[random.Next(1, 10)];
+            random.NextBytes(_handle);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var request = new SftpReadDirRequest(_protocolVersion, _requestId, _handle, null, null);
+
+            Assert.AreSame(_handle, request.Handle);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.ReadDir, request.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Complete_SftpAttrsResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+            var nameActionInvocations = new List<SftpNameResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            Action<SftpNameResponse> nameAction = nameActionInvocations.Add;
+            var nameResponse = new SftpNameResponse(_protocolVersion, Encoding.Unicode);
+
+            var request = new SftpReadDirRequest(_protocolVersion, _requestId, _handle, nameAction, statusAction);
+
+            request.Complete(nameResponse);
+
+            Assert.AreEqual(0, statusActionInvocations.Count);
+            Assert.AreEqual(1, nameActionInvocations.Count);
+            Assert.AreSame(nameResponse, nameActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+            var nameActionInvocations = new List<SftpNameResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            Action<SftpNameResponse> nameAction = nameActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new SftpReadDirRequest(_protocolVersion, _requestId, _handle, nameAction, statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+            Assert.AreEqual(0, nameActionInvocations.Count);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var request = new SftpReadDirRequest(_protocolVersion, _requestId, _handle, null, null);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // Handle length
+            expectedBytesLength += _handle.Length; // Handle
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            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());
+            var actualHandle = new byte[_handle.Length];
+            sshDataStream.Read(actualHandle, 0, actualHandle.Length);
+            Assert.IsTrue(_handle.SequenceEqual(actualHandle));
+
+            Assert.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
 }

+ 127 - 127
src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadLinkRequestTest.cs

@@ -1,128 +1,128 @@
-using System;
-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;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests
-{
-    [TestClass]
-    public class SftpReadLinkRequestTest
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private Encoding _encoding;
-        private string _path;
-        private byte[] _pathBytes;
-
-        [TestInitialize]
-        public void Init()
-        {
-            var random = new Random();
-
-            _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);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var request = new SftpReadLinkRequest(_protocolVersion, _requestId, _path, _encoding, null, null);
-
-            Assert.AreSame(_encoding, request.Encoding);
-            Assert.AreEqual(_path, request.Path);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.ReadLink, request.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Complete_SftpNameResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-            var nameActionInvocations = new List<SftpNameResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            Action<SftpNameResponse> nameAction = nameActionInvocations.Add;
-            var nameResponse = new SftpNameResponse(_protocolVersion, Encoding.Unicode);
-
-            var request = new SftpReadLinkRequest(
-                _protocolVersion,
-                _requestId,
-                _path,
-                _encoding,
-                nameAction,
-                statusAction);
-
-            request.Complete(nameResponse);
-
-            Assert.AreEqual(0, statusActionInvocations.Count);
-            Assert.AreEqual(1, nameActionInvocations.Count);
-            Assert.AreSame(nameResponse, nameActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-            var nameActionInvocations = new List<SftpNameResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            Action<SftpNameResponse> nameAction = nameActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new SftpReadLinkRequest(
-                _protocolVersion,
-                _requestId,
-                _path,
-                _encoding,
-                nameAction,
-                statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-            Assert.AreEqual(0, nameActionInvocations.Count);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var request = new SftpReadLinkRequest(_protocolVersion, _requestId, _path, _encoding, null, null);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // Path length
-            expectedBytesLength += _pathBytes.Length; // Path
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            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());
-            var actualPath = new byte[_pathBytes.Length];
-            sshDataStream.Read(actualPath, 0, actualPath.Length);
-            Assert.IsTrue(_pathBytes.SequenceEqual(actualPath));
-
-            Assert.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
-
+using System;
+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;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests
+{
+    [TestClass]
+    public class SftpReadLinkRequestTest
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private Encoding _encoding;
+        private string _path;
+        private byte[] _pathBytes;
+
+        [TestInitialize]
+        public void Init()
+        {
+            var random = new Random();
+
+            _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);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var request = new SftpReadLinkRequest(_protocolVersion, _requestId, _path, _encoding, null, null);
+
+            Assert.AreSame(_encoding, request.Encoding);
+            Assert.AreEqual(_path, request.Path);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.ReadLink, request.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Complete_SftpNameResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+            var nameActionInvocations = new List<SftpNameResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            Action<SftpNameResponse> nameAction = nameActionInvocations.Add;
+            var nameResponse = new SftpNameResponse(_protocolVersion, Encoding.Unicode);
+
+            var request = new SftpReadLinkRequest(
+                _protocolVersion,
+                _requestId,
+                _path,
+                _encoding,
+                nameAction,
+                statusAction);
+
+            request.Complete(nameResponse);
+
+            Assert.AreEqual(0, statusActionInvocations.Count);
+            Assert.AreEqual(1, nameActionInvocations.Count);
+            Assert.AreSame(nameResponse, nameActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+            var nameActionInvocations = new List<SftpNameResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            Action<SftpNameResponse> nameAction = nameActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new SftpReadLinkRequest(
+                _protocolVersion,
+                _requestId,
+                _path,
+                _encoding,
+                nameAction,
+                statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+            Assert.AreEqual(0, nameActionInvocations.Count);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var request = new SftpReadLinkRequest(_protocolVersion, _requestId, _path, _encoding, null, null);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // Path length
+            expectedBytesLength += _pathBytes.Length; // Path
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            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());
+            var actualPath = new byte[_pathBytes.Length];
+            sshDataStream.Read(actualPath, 0, actualPath.Length);
+            Assert.IsTrue(_pathBytes.SequenceEqual(actualPath));
+
+            Assert.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
+
 }

+ 134 - 134
src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpReadRequestTest.cs

@@ -1,134 +1,134 @@
-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;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests
-{
-    [TestClass]
-    public class SftpReadRequestTest
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private byte[] _handle;
-        private ulong _offset;
-        private uint _length;
-
-        [TestInitialize]
-        public void Init()
-        {
-            var random = new Random();
-
-            _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);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var request = new SftpReadRequest(_protocolVersion, _requestId, _handle, _offset, _length, null, null);
-
-            Assert.AreSame(_handle, request.Handle);
-            Assert.AreEqual(_length, request.Length);
-            Assert.AreEqual(_offset, request.Offset);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.Read, request.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Complete_SftpDataResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-            var dataActionInvocations = new List<SftpDataResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            Action<SftpDataResponse> dataAction = dataActionInvocations.Add;
-            var dataResponse = new SftpDataResponse(_protocolVersion);
-
-            var request = new SftpReadRequest(
-                _protocolVersion,
-                _requestId,
-                _handle,
-                _offset,
-                _length,
-                dataAction,
-                statusAction);
-
-            request.Complete(dataResponse);
-
-            Assert.AreEqual(0, statusActionInvocations.Count);
-            Assert.AreEqual(1, dataActionInvocations.Count);
-            Assert.AreSame(dataResponse, dataActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-            var dataActionInvocations = new List<SftpDataResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            Action<SftpDataResponse> dataAction = dataActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new SftpReadRequest(
-                _protocolVersion,
-                _requestId,
-                _handle,
-                _offset,
-                _length,
-                dataAction,
-                statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-            Assert.AreEqual(0, dataActionInvocations.Count);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var request = new SftpReadRequest(_protocolVersion, _requestId, _handle, _offset, _length, null, null);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // Handle length
-            expectedBytesLength += _handle.Length; // Handle
-            expectedBytesLength += 8; // Offset
-            expectedBytesLength += 4; // Length
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            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());
-            var actualHandle = new byte[_handle.Length];
-            sshDataStream.Read(actualHandle, 0, actualHandle.Length);
-            Assert.IsTrue(_handle.SequenceEqual(actualHandle));
-
-            Assert.AreEqual(_offset, sshDataStream.ReadUInt64());
-            Assert.AreEqual(_length, sshDataStream.ReadUInt32());
-
-            Assert.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
-}
+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;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests
+{
+    [TestClass]
+    public class SftpReadRequestTest
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private byte[] _handle;
+        private ulong _offset;
+        private uint _length;
+
+        [TestInitialize]
+        public void Init()
+        {
+            var random = new Random();
+
+            _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);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var request = new SftpReadRequest(_protocolVersion, _requestId, _handle, _offset, _length, null, null);
+
+            Assert.AreSame(_handle, request.Handle);
+            Assert.AreEqual(_length, request.Length);
+            Assert.AreEqual(_offset, request.Offset);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.Read, request.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Complete_SftpDataResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+            var dataActionInvocations = new List<SftpDataResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            Action<SftpDataResponse> dataAction = dataActionInvocations.Add;
+            var dataResponse = new SftpDataResponse(_protocolVersion);
+
+            var request = new SftpReadRequest(
+                _protocolVersion,
+                _requestId,
+                _handle,
+                _offset,
+                _length,
+                dataAction,
+                statusAction);
+
+            request.Complete(dataResponse);
+
+            Assert.AreEqual(0, statusActionInvocations.Count);
+            Assert.AreEqual(1, dataActionInvocations.Count);
+            Assert.AreSame(dataResponse, dataActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+            var dataActionInvocations = new List<SftpDataResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            Action<SftpDataResponse> dataAction = dataActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new SftpReadRequest(
+                _protocolVersion,
+                _requestId,
+                _handle,
+                _offset,
+                _length,
+                dataAction,
+                statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+            Assert.AreEqual(0, dataActionInvocations.Count);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var request = new SftpReadRequest(_protocolVersion, _requestId, _handle, _offset, _length, null, null);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // Handle length
+            expectedBytesLength += _handle.Length; // Handle
+            expectedBytesLength += 8; // Offset
+            expectedBytesLength += 4; // Length
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            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());
+            var actualHandle = new byte[_handle.Length];
+            sshDataStream.Read(actualHandle, 0, actualHandle.Length);
+            Assert.IsTrue(_handle.SequenceEqual(actualHandle));
+
+            Assert.AreEqual(_offset, sshDataStream.ReadUInt64());
+            Assert.AreEqual(_length, sshDataStream.ReadUInt32());
+
+            Assert.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
+}

+ 142 - 142
src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRealPathRequestTest.cs

@@ -1,143 +1,143 @@
-using System;
-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;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests
-{
-    [TestClass]
-    public class SftpRealPathRequestTest
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private Encoding _encoding;
-        private string _path;
-        private byte[] _pathBytes;
-
-        [TestInitialize]
-        public void Init()
-        {
-            var random = new Random();
-
-            _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);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-            var nameActionInvocations = new List<SftpNameResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            Action<SftpNameResponse> nameAction = nameActionInvocations.Add;
-
-            var request = new SftpRealPathRequest(
-                _protocolVersion,
-                _requestId,
-                _path,
-                _encoding,
-                nameAction,
-                statusAction);
-
-            Assert.AreSame(_encoding, request.Encoding);
-            Assert.AreEqual(_path, request.Path);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.RealPath, request.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Complete_SftpNameResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-            var nameActionInvocations = new List<SftpNameResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            Action<SftpNameResponse> nameAction = nameActionInvocations.Add;
-            var nameResponse = new SftpNameResponse(_protocolVersion, Encoding.Unicode);
-
-            var request = new SftpRealPathRequest(_protocolVersion, _requestId, _path, _encoding, nameAction, statusAction);
-
-            request.Complete(nameResponse);
-
-            Assert.AreEqual(0, statusActionInvocations.Count);
-            Assert.AreEqual(1, nameActionInvocations.Count);
-            Assert.AreSame(nameResponse, nameActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-            var nameActionInvocations = new List<SftpNameResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            Action<SftpNameResponse> nameAction = nameActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new SftpRealPathRequest(
-                _protocolVersion,
-                _requestId,
-                _path,
-                _encoding,
-                nameAction,
-                statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-            Assert.AreEqual(0, nameActionInvocations.Count);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-            var nameActionInvocations = new List<SftpNameResponse>();
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            Action<SftpNameResponse> nameAction = nameActionInvocations.Add;
-            var request = new SftpRealPathRequest(
-                _protocolVersion,
-                _requestId,
-                _path,
-                _encoding,
-                nameAction,
-                statusAction);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // Path length
-            expectedBytesLength += _pathBytes.Length; // Path
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            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());
-            var actualPath = new byte[_pathBytes.Length];
-            sshDataStream.Read(actualPath, 0, actualPath.Length);
-            Assert.IsTrue(_pathBytes.SequenceEqual(actualPath));
-
-            Assert.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
+using System;
+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;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests
+{
+    [TestClass]
+    public class SftpRealPathRequestTest
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private Encoding _encoding;
+        private string _path;
+        private byte[] _pathBytes;
+
+        [TestInitialize]
+        public void Init()
+        {
+            var random = new Random();
+
+            _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);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+            var nameActionInvocations = new List<SftpNameResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            Action<SftpNameResponse> nameAction = nameActionInvocations.Add;
+
+            var request = new SftpRealPathRequest(
+                _protocolVersion,
+                _requestId,
+                _path,
+                _encoding,
+                nameAction,
+                statusAction);
+
+            Assert.AreSame(_encoding, request.Encoding);
+            Assert.AreEqual(_path, request.Path);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.RealPath, request.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Complete_SftpNameResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+            var nameActionInvocations = new List<SftpNameResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            Action<SftpNameResponse> nameAction = nameActionInvocations.Add;
+            var nameResponse = new SftpNameResponse(_protocolVersion, Encoding.Unicode);
+
+            var request = new SftpRealPathRequest(_protocolVersion, _requestId, _path, _encoding, nameAction, statusAction);
+
+            request.Complete(nameResponse);
+
+            Assert.AreEqual(0, statusActionInvocations.Count);
+            Assert.AreEqual(1, nameActionInvocations.Count);
+            Assert.AreSame(nameResponse, nameActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+            var nameActionInvocations = new List<SftpNameResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            Action<SftpNameResponse> nameAction = nameActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new SftpRealPathRequest(
+                _protocolVersion,
+                _requestId,
+                _path,
+                _encoding,
+                nameAction,
+                statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+            Assert.AreEqual(0, nameActionInvocations.Count);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+            var nameActionInvocations = new List<SftpNameResponse>();
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            Action<SftpNameResponse> nameAction = nameActionInvocations.Add;
+            var request = new SftpRealPathRequest(
+                _protocolVersion,
+                _requestId,
+                _path,
+                _encoding,
+                nameAction,
+                statusAction);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // Path length
+            expectedBytesLength += _pathBytes.Length; // Path
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            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());
+            var actualPath = new byte[_pathBytes.Length];
+            sshDataStream.Read(actualPath, 0, actualPath.Length);
+            Assert.IsTrue(_pathBytes.SequenceEqual(actualPath));
+
+            Assert.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
 }

+ 92 - 92
src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRemoveRequestTest.cs

@@ -1,93 +1,93 @@
-using System;
-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;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests
-{
-    [TestClass]
-    public class SftpRemoveRequestTest
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private Encoding _encoding;
-        private string _filename;
-        private byte[] _filenameBytes;
-
-        [TestInitialize]
-        public void Init()
-        {
-            var random = new Random();
-
-            _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);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var request = new SftpRemoveRequest(_protocolVersion, _requestId, _filename, _encoding, null);
-
-            Assert.AreSame(_encoding, request.Encoding);
-            Assert.AreEqual(_filename, request.Filename);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.Remove, request.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new SftpRemoveRequest(_protocolVersion, _requestId, _filename, _encoding, statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var request = new SftpRemoveRequest(_protocolVersion, _requestId, _filename, _encoding, null);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // Filename length
-            expectedBytesLength += _filenameBytes.Length; // Filename
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            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());
-            var actualFilename = new byte[_filenameBytes.Length];
-            sshDataStream.Read(actualFilename, 0, actualFilename.Length);
-            Assert.IsTrue(_filenameBytes.SequenceEqual(actualFilename));
-
-            Assert.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
+using System;
+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;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests
+{
+    [TestClass]
+    public class SftpRemoveRequestTest
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private Encoding _encoding;
+        private string _filename;
+        private byte[] _filenameBytes;
+
+        [TestInitialize]
+        public void Init()
+        {
+            var random = new Random();
+
+            _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);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var request = new SftpRemoveRequest(_protocolVersion, _requestId, _filename, _encoding, null);
+
+            Assert.AreSame(_encoding, request.Encoding);
+            Assert.AreEqual(_filename, request.Filename);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.Remove, request.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new SftpRemoveRequest(_protocolVersion, _requestId, _filename, _encoding, statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var request = new SftpRemoveRequest(_protocolVersion, _requestId, _filename, _encoding, null);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // Filename length
+            expectedBytesLength += _filenameBytes.Length; // Filename
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            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());
+            var actualFilename = new byte[_filenameBytes.Length];
+            sshDataStream.Read(actualFilename, 0, actualFilename.Length);
+            Assert.IsTrue(_filenameBytes.SequenceEqual(actualFilename));
+
+            Assert.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
 }

+ 104 - 104
src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRenameRequestTest.cs

@@ -1,105 +1,105 @@
-using System;
-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;
-using Renci.SshNet.Sftp.Responses;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests
-{
-    [TestClass]
-    public class SftpRenameRequestTest : TestBase
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private Encoding _encoding;
-        private string _oldPath;
-        private byte[] _oldPathBytes;
-        private string _newPath;
-        private byte[] _newPathBytes;
-
-        protected override void OnInit()
-        {
-            var random = new Random();
-
-            _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);
-            _newPath = random.Next().ToString(CultureInfo.InvariantCulture);
-            _newPathBytes = _encoding.GetBytes(_newPath);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var request = new SftpRenameRequest(_protocolVersion, _requestId, _oldPath, _newPath, _encoding, null);
-
-            Assert.AreSame(_encoding, request.Encoding);
-            Assert.AreEqual(_newPath, request.NewPath);
-            Assert.AreEqual(_oldPath, request.OldPath);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.Rename, request.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new SftpRenameRequest(_protocolVersion, _requestId, _oldPath, _newPath, _encoding, statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var request = new SftpRenameRequest(_protocolVersion, _requestId, _oldPath, _newPath, _encoding, null);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // OldPath length
-            expectedBytesLength += _oldPathBytes.Length; // OldPath
-            expectedBytesLength += 4; // NewPath length
-            expectedBytesLength += _newPathBytes.Length; // NewPath
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            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());
-            var actualOldPath = new byte[_oldPathBytes.Length];
-            sshDataStream.Read(actualOldPath, 0, actualOldPath.Length);
-            Assert.IsTrue(_oldPathBytes.SequenceEqual(actualOldPath));
-
-            Assert.AreEqual((uint) _newPathBytes.Length, sshDataStream.ReadUInt32());
-            var actualNewPath = new byte[_newPathBytes.Length];
-            sshDataStream.Read(actualNewPath, 0, actualNewPath.Length);
-            Assert.IsTrue(_newPathBytes.SequenceEqual(actualNewPath));
-
-            Assert.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
+using System;
+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;
+using Renci.SshNet.Sftp.Responses;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests
+{
+    [TestClass]
+    public class SftpRenameRequestTest : TestBase
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private Encoding _encoding;
+        private string _oldPath;
+        private byte[] _oldPathBytes;
+        private string _newPath;
+        private byte[] _newPathBytes;
+
+        protected override void OnInit()
+        {
+            var random = new Random();
+
+            _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);
+            _newPath = random.Next().ToString(CultureInfo.InvariantCulture);
+            _newPathBytes = _encoding.GetBytes(_newPath);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var request = new SftpRenameRequest(_protocolVersion, _requestId, _oldPath, _newPath, _encoding, null);
+
+            Assert.AreSame(_encoding, request.Encoding);
+            Assert.AreEqual(_newPath, request.NewPath);
+            Assert.AreEqual(_oldPath, request.OldPath);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.Rename, request.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new SftpRenameRequest(_protocolVersion, _requestId, _oldPath, _newPath, _encoding, statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var request = new SftpRenameRequest(_protocolVersion, _requestId, _oldPath, _newPath, _encoding, null);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // OldPath length
+            expectedBytesLength += _oldPathBytes.Length; // OldPath
+            expectedBytesLength += 4; // NewPath length
+            expectedBytesLength += _newPathBytes.Length; // NewPath
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            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());
+            var actualOldPath = new byte[_oldPathBytes.Length];
+            sshDataStream.Read(actualOldPath, 0, actualOldPath.Length);
+            Assert.IsTrue(_oldPathBytes.SequenceEqual(actualOldPath));
+
+            Assert.AreEqual((uint) _newPathBytes.Length, sshDataStream.ReadUInt32());
+            var actualNewPath = new byte[_newPathBytes.Length];
+            sshDataStream.Read(actualNewPath, 0, actualNewPath.Length);
+            Assert.IsTrue(_newPathBytes.SequenceEqual(actualNewPath));
+
+            Assert.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
 }

+ 95 - 95
src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpRmDirRequestTest.cs

@@ -1,96 +1,96 @@
-using System;
-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;
-using Renci.SshNet.Sftp.Responses;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests
-{
-    [TestClass]
-    public class SftpRmDirRequestTest
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private Encoding _encoding;
-        private string _path;
-        private byte[] _pathBytes;
-
-        [TestInitialize]
-        public void Init()
-        {
-            var random = new Random();
-
-            _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);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var request = new SftpRmDirRequest(_protocolVersion, _requestId, _path, _encoding, null);
-
-            Assert.AreSame(_encoding, request.Encoding);
-            Assert.AreEqual(_path, request.Path);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.RmDir, request.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new SftpRmDirRequest(_protocolVersion, _requestId, _path, _encoding, statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-            var nameActionInvocations = new List<SftpNameResponse>();
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            var request = new SftpRmDirRequest(_protocolVersion, _requestId, _path, _encoding, null);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // Path length
-            expectedBytesLength += _pathBytes.Length; // Path
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            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());
-            var actualPath = new byte[_pathBytes.Length];
-            sshDataStream.Read(actualPath, 0, actualPath.Length);
-            Assert.IsTrue(_pathBytes.SequenceEqual(actualPath));
-
-            Assert.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
+using System;
+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;
+using Renci.SshNet.Sftp.Responses;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests
+{
+    [TestClass]
+    public class SftpRmDirRequestTest
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private Encoding _encoding;
+        private string _path;
+        private byte[] _pathBytes;
+
+        [TestInitialize]
+        public void Init()
+        {
+            var random = new Random();
+
+            _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);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var request = new SftpRmDirRequest(_protocolVersion, _requestId, _path, _encoding, null);
+
+            Assert.AreSame(_encoding, request.Encoding);
+            Assert.AreEqual(_path, request.Path);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.RmDir, request.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new SftpRmDirRequest(_protocolVersion, _requestId, _path, _encoding, statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+            var nameActionInvocations = new List<SftpNameResponse>();
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            var request = new SftpRmDirRequest(_protocolVersion, _requestId, _path, _encoding, null);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // Path length
+            expectedBytesLength += _pathBytes.Length; // Path
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            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());
+            var actualPath = new byte[_pathBytes.Length];
+            sshDataStream.Read(actualPath, 0, actualPath.Length);
+            Assert.IsTrue(_pathBytes.SequenceEqual(actualPath));
+
+            Assert.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
 }

+ 106 - 106
src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSetStatRequestTest.cs

@@ -1,107 +1,107 @@
-using System;
-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;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests
-{
-    [TestClass]
-    public class SftpSetStatRequestTest
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private Encoding _encoding;
-        private string _path;
-        private byte[] _pathBytes;
-        private SftpFileAttributes _attributes;
-        private byte[] _attributesBytes;
-
-        [TestInitialize]
-        public void Init()
-        {
-            var random = new Random();
-
-            _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);
-            _attributes = SftpFileAttributes.Empty;
-            _attributesBytes = _attributes.GetBytes();
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var request = new SftpSetStatRequest(_protocolVersion, _requestId, _path, _encoding, _attributes, null);
-
-            Assert.AreSame(_encoding, request.Encoding);
-            Assert.AreEqual(_path, request.Path);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.SetStat, request.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new SftpSetStatRequest(
-                _protocolVersion,
-                _requestId,
-                _path,
-                _encoding,
-                _attributes,
-                statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var request = new SftpSetStatRequest(_protocolVersion, _requestId, _path, _encoding, _attributes, null);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // Path length
-            expectedBytesLength += _pathBytes.Length; // Path
-            expectedBytesLength += _attributesBytes.Length; // Attributes
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            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());
-            var actualPath = new byte[_pathBytes.Length];
-            sshDataStream.Read(actualPath, 0, actualPath.Length);
-            Assert.IsTrue(_pathBytes.SequenceEqual(actualPath));
-
-            var actualAttributes = new byte[_attributesBytes.Length];
-            sshDataStream.Read(actualAttributes, 0, actualAttributes.Length);
-            Assert.IsTrue(_attributesBytes.SequenceEqual(actualAttributes));
-
-            Assert.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
+using System;
+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;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests
+{
+    [TestClass]
+    public class SftpSetStatRequestTest
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private Encoding _encoding;
+        private string _path;
+        private byte[] _pathBytes;
+        private SftpFileAttributes _attributes;
+        private byte[] _attributesBytes;
+
+        [TestInitialize]
+        public void Init()
+        {
+            var random = new Random();
+
+            _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);
+            _attributes = SftpFileAttributes.Empty;
+            _attributesBytes = _attributes.GetBytes();
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var request = new SftpSetStatRequest(_protocolVersion, _requestId, _path, _encoding, _attributes, null);
+
+            Assert.AreSame(_encoding, request.Encoding);
+            Assert.AreEqual(_path, request.Path);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.SetStat, request.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new SftpSetStatRequest(
+                _protocolVersion,
+                _requestId,
+                _path,
+                _encoding,
+                _attributes,
+                statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var request = new SftpSetStatRequest(_protocolVersion, _requestId, _path, _encoding, _attributes, null);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // Path length
+            expectedBytesLength += _pathBytes.Length; // Path
+            expectedBytesLength += _attributesBytes.Length; // Attributes
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            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());
+            var actualPath = new byte[_pathBytes.Length];
+            sshDataStream.Read(actualPath, 0, actualPath.Length);
+            Assert.IsTrue(_pathBytes.SequenceEqual(actualPath));
+
+            var actualAttributes = new byte[_attributesBytes.Length];
+            sshDataStream.Read(actualAttributes, 0, actualAttributes.Length);
+            Assert.IsTrue(_attributesBytes.SequenceEqual(actualAttributes));
+
+            Assert.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
 }

+ 112 - 112
src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpStatRequestTest.cs

@@ -1,113 +1,113 @@
-using System;
-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;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests
-{
-    [TestClass]
-    public class SftpStatRequestTest
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private Encoding _encoding;
-        private string _path;
-        private byte[] _pathBytes;
-
-        [TestInitialize]
-        public void Init()
-        {
-            var random = new Random();
-
-            _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);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var request = new SftpStatRequest(_protocolVersion, _requestId, _path, _encoding, null, null);
-
-            Assert.AreSame(_encoding, request.Encoding);
-            Assert.AreEqual(_path, request.Path);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.Stat, request.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Complete_SftpAttrsResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-            var attrsActionInvocations = new List<SftpAttrsResponse>();
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            Action<SftpAttrsResponse> attrsAction = attrsActionInvocations.Add;
-            var attrsResponse = new SftpAttrsResponse(_protocolVersion);
-
-            var request = new SftpStatRequest(_protocolVersion, _requestId, _path, _encoding, attrsAction, statusAction);
-
-            request.Complete(attrsResponse);
-
-            Assert.AreEqual(0, statusActionInvocations.Count);
-            Assert.AreEqual(1, attrsActionInvocations.Count);
-            Assert.AreSame(attrsResponse, attrsActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-            var attrsActionInvocations = new List<SftpAttrsResponse>();
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            Action<SftpAttrsResponse> attrsAction = attrsActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new SftpStatRequest(_protocolVersion, _requestId, _path, _encoding, attrsAction, statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreEqual(0, attrsActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var request = new SftpStatRequest(_protocolVersion, _requestId, _path, _encoding, null, null);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // Path length
-            expectedBytesLength += _pathBytes.Length; // Path
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            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());
-            var actualPath = new byte[_pathBytes.Length];
-            sshDataStream.Read(actualPath, 0, actualPath.Length);
-            Assert.IsTrue(_pathBytes.SequenceEqual(actualPath));
-
-            Assert.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
+using System;
+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;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests
+{
+    [TestClass]
+    public class SftpStatRequestTest
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private Encoding _encoding;
+        private string _path;
+        private byte[] _pathBytes;
+
+        [TestInitialize]
+        public void Init()
+        {
+            var random = new Random();
+
+            _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);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var request = new SftpStatRequest(_protocolVersion, _requestId, _path, _encoding, null, null);
+
+            Assert.AreSame(_encoding, request.Encoding);
+            Assert.AreEqual(_path, request.Path);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.Stat, request.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Complete_SftpAttrsResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+            var attrsActionInvocations = new List<SftpAttrsResponse>();
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            Action<SftpAttrsResponse> attrsAction = attrsActionInvocations.Add;
+            var attrsResponse = new SftpAttrsResponse(_protocolVersion);
+
+            var request = new SftpStatRequest(_protocolVersion, _requestId, _path, _encoding, attrsAction, statusAction);
+
+            request.Complete(attrsResponse);
+
+            Assert.AreEqual(0, statusActionInvocations.Count);
+            Assert.AreEqual(1, attrsActionInvocations.Count);
+            Assert.AreSame(attrsResponse, attrsActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+            var attrsActionInvocations = new List<SftpAttrsResponse>();
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            Action<SftpAttrsResponse> attrsAction = attrsActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new SftpStatRequest(_protocolVersion, _requestId, _path, _encoding, attrsAction, statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreEqual(0, attrsActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var request = new SftpStatRequest(_protocolVersion, _requestId, _path, _encoding, null, null);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // Path length
+            expectedBytesLength += _pathBytes.Length; // Path
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            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());
+            var actualPath = new byte[_pathBytes.Length];
+            sshDataStream.Read(actualPath, 0, actualPath.Length);
+            Assert.IsTrue(_pathBytes.SequenceEqual(actualPath));
+
+            Assert.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
 }

+ 122 - 122
src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpSymLinkRequestTest.cs

@@ -1,123 +1,123 @@
-using System;
-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;
-using Renci.SshNet.Sftp.Responses;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests
-{
-    [TestClass]
-    public class SftpSymLinkRequestTest : TestBase
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private Encoding _encoding;
-        private string _newLinkPath;
-        private byte[] _newLinkPathBytes;
-        private string _existingPath;
-        private byte[] _existingPathBytes;
-
-        protected override void OnInit()
-        {
-            var random = new Random();
-
-            _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);
-            _existingPath = random.Next().ToString(CultureInfo.InvariantCulture);
-            _existingPathBytes = _encoding.GetBytes(_existingPath);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var request = new SftpSymLinkRequest(
-                _protocolVersion,
-                _requestId,
-                _newLinkPath,
-                _existingPath,
-                _encoding,
-                null);
-
-            Assert.AreSame(_encoding, request.Encoding);
-            Assert.AreEqual(_existingPath, request.ExistingPath);
-            Assert.AreEqual(_newLinkPath, request.NewLinkPath);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.SymLink, request.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new SftpSymLinkRequest(
-                _protocolVersion,
-                _requestId,
-                _newLinkPath,
-                _existingPath,
-                _encoding,
-                statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var request = new SftpSymLinkRequest(
-                _protocolVersion,
-                _requestId,
-                _newLinkPath,
-                _existingPath,
-                _encoding,
-                null);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // NewLinkPath length
-            expectedBytesLength += _newLinkPathBytes.Length; // NewLinkPath
-            expectedBytesLength += 4; // ExistingPath length
-            expectedBytesLength += _existingPathBytes.Length; // ExistingPath
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            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());
-            var actualNewLinkPath = new byte[_newLinkPathBytes.Length];
-            sshDataStream.Read(actualNewLinkPath, 0, actualNewLinkPath.Length);
-            Assert.IsTrue(_newLinkPathBytes.SequenceEqual(actualNewLinkPath));
-
-            Assert.AreEqual((uint) _existingPathBytes.Length, sshDataStream.ReadUInt32());
-            var actualExistingPath = new byte[_existingPathBytes.Length];
-            sshDataStream.Read(actualExistingPath, 0, actualExistingPath.Length);
-            Assert.IsTrue(_existingPathBytes.SequenceEqual(actualExistingPath));
-
-            Assert.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
+using System;
+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;
+using Renci.SshNet.Sftp.Responses;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests
+{
+    [TestClass]
+    public class SftpSymLinkRequestTest : TestBase
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private Encoding _encoding;
+        private string _newLinkPath;
+        private byte[] _newLinkPathBytes;
+        private string _existingPath;
+        private byte[] _existingPathBytes;
+
+        protected override void OnInit()
+        {
+            var random = new Random();
+
+            _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);
+            _existingPath = random.Next().ToString(CultureInfo.InvariantCulture);
+            _existingPathBytes = _encoding.GetBytes(_existingPath);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var request = new SftpSymLinkRequest(
+                _protocolVersion,
+                _requestId,
+                _newLinkPath,
+                _existingPath,
+                _encoding,
+                null);
+
+            Assert.AreSame(_encoding, request.Encoding);
+            Assert.AreEqual(_existingPath, request.ExistingPath);
+            Assert.AreEqual(_newLinkPath, request.NewLinkPath);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.SymLink, request.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new SftpSymLinkRequest(
+                _protocolVersion,
+                _requestId,
+                _newLinkPath,
+                _existingPath,
+                _encoding,
+                statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var request = new SftpSymLinkRequest(
+                _protocolVersion,
+                _requestId,
+                _newLinkPath,
+                _existingPath,
+                _encoding,
+                null);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // NewLinkPath length
+            expectedBytesLength += _newLinkPathBytes.Length; // NewLinkPath
+            expectedBytesLength += 4; // ExistingPath length
+            expectedBytesLength += _existingPathBytes.Length; // ExistingPath
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            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());
+            var actualNewLinkPath = new byte[_newLinkPathBytes.Length];
+            sshDataStream.Read(actualNewLinkPath, 0, actualNewLinkPath.Length);
+            Assert.IsTrue(_newLinkPathBytes.SequenceEqual(actualNewLinkPath));
+
+            Assert.AreEqual((uint) _existingPathBytes.Length, sshDataStream.ReadUInt32());
+            var actualExistingPath = new byte[_existingPathBytes.Length];
+            sshDataStream.Read(actualExistingPath, 0, actualExistingPath.Length);
+            Assert.IsTrue(_existingPathBytes.SequenceEqual(actualExistingPath));
+
+            Assert.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
 }

+ 96 - 96
src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpUnblockRequestTest.cs

@@ -1,96 +1,96 @@
-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;
-using Renci.SshNet.Sftp.Responses;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests
-{
-    [TestClass]
-    public class SftpUnblockRequestTest
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private byte[] _handle;
-        private ulong _offset;
-        private ulong _length;
-
-        [TestInitialize]
-        public void Init()
-        {
-            var random = new Random();
-
-            _protocolVersion = (uint)random.Next(0, int.MaxValue);
-            _requestId = (uint)random.Next(0, int.MaxValue);
-            _handle = new byte[random.Next(1, 10)];
-            random.NextBytes(_handle);
-            _offset = (ulong) random.Next(0, int.MaxValue);
-            _length = (ulong) random.Next(0, int.MaxValue);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var request = new SftpUnblockRequest(_protocolVersion, _requestId, _handle, _offset, _length, null);
-
-            Assert.AreSame(_handle, request.Handle);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.Unblock, request.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new SftpUnblockRequest(_protocolVersion, _requestId, _handle, _offset, _length, statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var request = new SftpUnblockRequest(_protocolVersion, _requestId, _handle, _offset, _length, null);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // Handle length
-            expectedBytesLength += _handle.Length; // Handle
-            expectedBytesLength += 8; // Offset
-            expectedBytesLength += 8; // Length
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            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());
-            var actualHandle = new byte[_handle.Length];
-            sshDataStream.Read(actualHandle, 0, actualHandle.Length);
-            Assert.IsTrue(_handle.SequenceEqual(actualHandle));
-
-            Assert.AreEqual(_offset, sshDataStream.ReadUInt64());
-            Assert.AreEqual(_length, sshDataStream.ReadUInt64());
-
-            Assert.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
-}
+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;
+using Renci.SshNet.Sftp.Responses;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests
+{
+    [TestClass]
+    public class SftpUnblockRequestTest
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private byte[] _handle;
+        private ulong _offset;
+        private ulong _length;
+
+        [TestInitialize]
+        public void Init()
+        {
+            var random = new Random();
+
+            _protocolVersion = (uint)random.Next(0, int.MaxValue);
+            _requestId = (uint)random.Next(0, int.MaxValue);
+            _handle = new byte[random.Next(1, 10)];
+            random.NextBytes(_handle);
+            _offset = (ulong) random.Next(0, int.MaxValue);
+            _length = (ulong) random.Next(0, int.MaxValue);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var request = new SftpUnblockRequest(_protocolVersion, _requestId, _handle, _offset, _length, null);
+
+            Assert.AreSame(_handle, request.Handle);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.Unblock, request.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new SftpUnblockRequest(_protocolVersion, _requestId, _handle, _offset, _length, statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var request = new SftpUnblockRequest(_protocolVersion, _requestId, _handle, _offset, _length, null);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // Handle length
+            expectedBytesLength += _handle.Length; // Handle
+            expectedBytesLength += 8; // Offset
+            expectedBytesLength += 8; // Length
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            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());
+            var actualHandle = new byte[_handle.Length];
+            sshDataStream.Read(actualHandle, 0, actualHandle.Length);
+            Assert.IsTrue(_handle.SequenceEqual(actualHandle));
+
+            Assert.AreEqual(_offset, sshDataStream.ReadUInt64());
+            Assert.AreEqual(_length, sshDataStream.ReadUInt64());
+
+            Assert.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
+}

+ 112 - 112
src/Renci.SshNet.Tests/Classes/Sftp/Requests/SftpWriteRequestTest.cs

@@ -1,112 +1,112 @@
-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;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Requests
-{
-    [TestClass]
-    public class SftpWriteRequestTest
-    {
-        private uint _protocolVersion;
-        private uint _requestId;
-        private byte[] _handle;
-        private ulong _offset;
-        private byte[] _data;
-        private int _length;
-
-        [TestInitialize]
-        public void Init()
-        {
-            var random = new Random();
-
-            _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);
-            _data = new byte[random.Next(5, 10)];
-            random.NextBytes(_data);
-            _length = random.Next(1, 4);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var request = new SftpWriteRequest(_protocolVersion, _requestId, _handle, _offset, _data, _length, null);
-
-            Assert.AreSame(_data, request.Data);
-            Assert.AreSame(_handle, request.Handle);
-            Assert.AreEqual(_length, request.Length);
-            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
-            Assert.AreEqual(_requestId, request.RequestId);
-            Assert.AreEqual(SftpMessageTypes.Write, request.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Complete_SftpStatusResponse()
-        {
-            var statusActionInvocations = new List<SftpStatusResponse>();
-            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
-            var statusResponse = new SftpStatusResponse(_protocolVersion);
-
-            var request = new SftpWriteRequest(
-                _protocolVersion,
-                _requestId,
-                _handle,
-                _offset,
-                _data,
-                _length,
-                statusAction);
-
-            request.Complete(statusResponse);
-
-            Assert.AreEqual(1, statusActionInvocations.Count);
-            Assert.AreSame(statusResponse, statusActionInvocations[0]);
-        }
-
-        [TestMethod]
-        public void GetBytes()
-        {
-            var request = new SftpWriteRequest(_protocolVersion, _requestId, _handle, _offset, _data, _length, null);
-
-            var bytes = request.GetBytes();
-
-            var expectedBytesLength = 0;
-            expectedBytesLength += 4; // Length
-            expectedBytesLength += 1; // Type
-            expectedBytesLength += 4; // RequestId
-            expectedBytesLength += 4; // Handle length
-            expectedBytesLength += _handle.Length; // Handle
-            expectedBytesLength += 8; // Offset
-            expectedBytesLength += 4; // Data length
-            expectedBytesLength += _length; // Data
-
-            Assert.AreEqual(expectedBytesLength, bytes.Length);
-
-            var sshDataStream = new SshDataStream(bytes);
-
-            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());
-            var actualHandle = new byte[_handle.Length];
-            sshDataStream.Read(actualHandle, 0, actualHandle.Length);
-            Assert.IsTrue(_handle.SequenceEqual(actualHandle));
-
-            Assert.AreEqual(_offset, sshDataStream.ReadUInt64());
-
-            Assert.AreEqual((uint) _length, sshDataStream.ReadUInt32());
-            var actualData = new byte[_length];
-            sshDataStream.Read(actualData, 0, actualData.Length);
-            Assert.IsTrue(_data.Take(_length).SequenceEqual(actualData));
-
-            Assert.IsTrue(sshDataStream.IsEndOfData);
-        }
-    }
-}
+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;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Requests
+{
+    [TestClass]
+    public class SftpWriteRequestTest
+    {
+        private uint _protocolVersion;
+        private uint _requestId;
+        private byte[] _handle;
+        private ulong _offset;
+        private byte[] _data;
+        private int _length;
+
+        [TestInitialize]
+        public void Init()
+        {
+            var random = new Random();
+
+            _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);
+            _data = new byte[random.Next(5, 10)];
+            random.NextBytes(_data);
+            _length = random.Next(1, 4);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var request = new SftpWriteRequest(_protocolVersion, _requestId, _handle, _offset, _data, _length, null);
+
+            Assert.AreSame(_data, request.Data);
+            Assert.AreSame(_handle, request.Handle);
+            Assert.AreEqual(_length, request.Length);
+            Assert.AreEqual(_protocolVersion, request.ProtocolVersion);
+            Assert.AreEqual(_requestId, request.RequestId);
+            Assert.AreEqual(SftpMessageTypes.Write, request.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Complete_SftpStatusResponse()
+        {
+            var statusActionInvocations = new List<SftpStatusResponse>();
+            Action<SftpStatusResponse> statusAction = statusActionInvocations.Add;
+            var statusResponse = new SftpStatusResponse(_protocolVersion);
+
+            var request = new SftpWriteRequest(
+                _protocolVersion,
+                _requestId,
+                _handle,
+                _offset,
+                _data,
+                _length,
+                statusAction);
+
+            request.Complete(statusResponse);
+
+            Assert.AreEqual(1, statusActionInvocations.Count);
+            Assert.AreSame(statusResponse, statusActionInvocations[0]);
+        }
+
+        [TestMethod]
+        public void GetBytes()
+        {
+            var request = new SftpWriteRequest(_protocolVersion, _requestId, _handle, _offset, _data, _length, null);
+
+            var bytes = request.GetBytes();
+
+            var expectedBytesLength = 0;
+            expectedBytesLength += 4; // Length
+            expectedBytesLength += 1; // Type
+            expectedBytesLength += 4; // RequestId
+            expectedBytesLength += 4; // Handle length
+            expectedBytesLength += _handle.Length; // Handle
+            expectedBytesLength += 8; // Offset
+            expectedBytesLength += 4; // Data length
+            expectedBytesLength += _length; // Data
+
+            Assert.AreEqual(expectedBytesLength, bytes.Length);
+
+            var sshDataStream = new SshDataStream(bytes);
+
+            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());
+            var actualHandle = new byte[_handle.Length];
+            sshDataStream.Read(actualHandle, 0, actualHandle.Length);
+            Assert.IsTrue(_handle.SequenceEqual(actualHandle));
+
+            Assert.AreEqual(_offset, sshDataStream.ReadUInt64());
+
+            Assert.AreEqual((uint) _length, sshDataStream.ReadUInt32());
+            var actualData = new byte[_length];
+            sshDataStream.Read(actualData, 0, actualData.Length);
+            Assert.IsTrue(_data.Take(_length).SequenceEqual(actualData));
+
+            Assert.IsTrue(sshDataStream.IsEndOfData);
+        }
+    }
+}

+ 89 - 89
src/Renci.SshNet.Tests/Classes/Sftp/Responses/ExtendedReplies/StatVfsReplyInfoTest.cs

@@ -1,90 +1,90 @@
-using System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Common;
-using Renci.SshNet.Sftp;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Responses
-{
-    [TestClass]
-    public class StatVfsReplyInfoTest
-    {
-        private Random _random;
-        private uint _responseId;
-        private ulong _bsize;
-        private ulong _frsize;
-        private ulong _blocks;
-        private ulong _bfree;
-        private ulong _bavail;
-        private ulong _files;
-        private ulong _ffree;
-        private ulong _favail;
-        private ulong _sid;
-        private ulong _namemax;
-
-        [TestInitialize]
-        public void Init()
-        {
-            _random = new Random();
-            _responseId = (uint) _random.Next(0, int.MaxValue);
-            _bsize = (ulong) _random.Next(0, int.MaxValue);
-            _frsize = (ulong)_random.Next(0, int.MaxValue);
-            _blocks = (ulong)_random.Next(0, int.MaxValue);
-            _bfree = (ulong)_random.Next(0, int.MaxValue);
-            _bavail = (ulong)_random.Next(0, int.MaxValue);
-            _files = (ulong)_random.Next(0, int.MaxValue);
-            _ffree = (ulong)_random.Next(0, int.MaxValue);
-            _favail = (ulong)_random.Next(0, int.MaxValue);
-            _sid = (ulong)_random.Next(0, int.MaxValue);
-            _namemax = (ulong)_random.Next(0, int.MaxValue);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var target = new StatVfsReplyInfo();
-
-            Assert.IsNull(target.Information);
-        }
-
-        [TestMethod]
-        public void Load()
-        {
-            var target = new StatVfsReplyInfo();
-
-            var sshDataStream = new SshDataStream(4 + 1 + 4 + 88);
-            sshDataStream.Write((uint) (sshDataStream.Capacity - 4));
-            sshDataStream.WriteByte((byte) SftpMessageTypes.ExtendedReply);
-            sshDataStream.Write(_responseId);
-            sshDataStream.Write(_bsize);
-            sshDataStream.Write(_frsize);
-            sshDataStream.Write(_blocks);
-            sshDataStream.Write(_bfree);
-            sshDataStream.Write(_bavail);
-            sshDataStream.Write(_files);
-            sshDataStream.Write(_ffree);
-            sshDataStream.Write(_favail);
-            sshDataStream.Write(_sid);
-            sshDataStream.Write((ulong) 0x1);
-            sshDataStream.Write(_namemax);
-
-            target.Load(sshDataStream.ToArray());
-
-            Assert.IsNotNull(target.Information);
-
-            var information = target.Information;
-            Assert.AreEqual(_bavail, information.AvailableBlocks);
-            Assert.AreEqual(_favail, information.AvailableNodes);
-            Assert.AreEqual(_frsize, information.BlockSize);
-            Assert.AreEqual(_bsize, information.FileSystemBlockSize);
-            Assert.AreEqual(_bfree, information.FreeBlocks);
-            Assert.AreEqual(_ffree, information.FreeNodes);
-            Assert.IsTrue(information.IsReadOnly);
-            Assert.AreEqual(_namemax, information.MaxNameLenght);
-            Assert.AreEqual(_sid, information.Sid);
-            Assert.IsTrue(information.SupportsSetUid);
-            Assert.AreEqual(_blocks, information.TotalBlocks);
-            Assert.AreEqual(_files, information.TotalNodes);
-        }
-    }
+using System;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Common;
+using Renci.SshNet.Sftp;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Responses
+{
+    [TestClass]
+    public class StatVfsReplyInfoTest
+    {
+        private Random _random;
+        private uint _responseId;
+        private ulong _bsize;
+        private ulong _frsize;
+        private ulong _blocks;
+        private ulong _bfree;
+        private ulong _bavail;
+        private ulong _files;
+        private ulong _ffree;
+        private ulong _favail;
+        private ulong _sid;
+        private ulong _namemax;
+
+        [TestInitialize]
+        public void Init()
+        {
+            _random = new Random();
+            _responseId = (uint) _random.Next(0, int.MaxValue);
+            _bsize = (ulong) _random.Next(0, int.MaxValue);
+            _frsize = (ulong)_random.Next(0, int.MaxValue);
+            _blocks = (ulong)_random.Next(0, int.MaxValue);
+            _bfree = (ulong)_random.Next(0, int.MaxValue);
+            _bavail = (ulong)_random.Next(0, int.MaxValue);
+            _files = (ulong)_random.Next(0, int.MaxValue);
+            _ffree = (ulong)_random.Next(0, int.MaxValue);
+            _favail = (ulong)_random.Next(0, int.MaxValue);
+            _sid = (ulong)_random.Next(0, int.MaxValue);
+            _namemax = (ulong)_random.Next(0, int.MaxValue);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var target = new StatVfsReplyInfo();
+
+            Assert.IsNull(target.Information);
+        }
+
+        [TestMethod]
+        public void Load()
+        {
+            var target = new StatVfsReplyInfo();
+
+            var sshDataStream = new SshDataStream(4 + 1 + 4 + 88);
+            sshDataStream.Write((uint) (sshDataStream.Capacity - 4));
+            sshDataStream.WriteByte((byte) SftpMessageTypes.ExtendedReply);
+            sshDataStream.Write(_responseId);
+            sshDataStream.Write(_bsize);
+            sshDataStream.Write(_frsize);
+            sshDataStream.Write(_blocks);
+            sshDataStream.Write(_bfree);
+            sshDataStream.Write(_bavail);
+            sshDataStream.Write(_files);
+            sshDataStream.Write(_ffree);
+            sshDataStream.Write(_favail);
+            sshDataStream.Write(_sid);
+            sshDataStream.Write((ulong) 0x1);
+            sshDataStream.Write(_namemax);
+
+            target.Load(sshDataStream.ToArray());
+
+            Assert.IsNotNull(target.Information);
+
+            var information = target.Information;
+            Assert.AreEqual(_bavail, information.AvailableBlocks);
+            Assert.AreEqual(_favail, information.AvailableNodes);
+            Assert.AreEqual(_frsize, information.BlockSize);
+            Assert.AreEqual(_bsize, information.FileSystemBlockSize);
+            Assert.AreEqual(_bfree, information.FreeBlocks);
+            Assert.AreEqual(_ffree, information.FreeNodes);
+            Assert.IsTrue(information.IsReadOnly);
+            Assert.AreEqual(_namemax, information.MaxNameLenght);
+            Assert.AreEqual(_sid, information.Sid);
+            Assert.IsTrue(information.SupportsSetUid);
+            Assert.AreEqual(_blocks, information.TotalBlocks);
+            Assert.AreEqual(_files, information.TotalNodes);
+        }
+    }
 }

+ 73 - 73
src/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpAttrsResponseTest.cs

@@ -1,73 +1,73 @@
-using System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Common;
-using Renci.SshNet.Sftp;
-using Renci.SshNet.Sftp.Responses;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Responses
-{
-    [TestClass]
-    public class SftpAttrsResponseTest
-    {
-        private Random _random;
-        private uint _protocolVersion;
-        private uint _responseId;
-
-        [TestInitialize]
-        public void Init()
-        {
-            _random = new Random();
-            _protocolVersion = (uint) _random.Next(0, int.MaxValue);
-            _responseId = (uint)_random.Next(0, int.MaxValue);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var target = new SftpAttrsResponse(_protocolVersion);
-
-            Assert.IsNull(target.Attributes);
-            Assert.AreEqual(_protocolVersion, target.ProtocolVersion);
-            Assert.AreEqual((uint) 0, target.ResponseId);
-            Assert.AreEqual(SftpMessageTypes.Attrs, target.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Load()
-        {
-            var target = new SftpAttrsResponse(_protocolVersion);
-            var attributes = CreateSftpFileAttributes();
-            var attributesBytes = attributes.GetBytes();
-
-            var sshDataStream = new SshDataStream(4 + 1 + 4 + attributesBytes.Length);
-            sshDataStream.Position = 4; // skip 4 bytes for SSH packet length
-            sshDataStream.WriteByte((byte) SftpMessageTypes.Attrs);
-            sshDataStream.Write(_responseId);
-            sshDataStream.Write(attributesBytes, 0, attributesBytes.Length);
-
-            target.Load(sshDataStream.ToArray());
-
-            Assert.IsNotNull(target.Attributes);
-            Assert.AreEqual(_protocolVersion, target.ProtocolVersion);
-            Assert.AreEqual(_responseId, target.ResponseId);
-            Assert.AreEqual(SftpMessageTypes.Attrs, target.SftpMessageType);
-
-            // check attributes in detail
-            Assert.AreEqual(attributes.GroupId, target.Attributes.GroupId);
-            Assert.AreEqual(attributes.LastWriteTime, target.Attributes.LastWriteTime);
-            Assert.AreEqual(attributes.LastWriteTime, target.Attributes.LastWriteTime);
-            Assert.AreEqual(attributes.UserId, target.Attributes.UserId);
-        }
-
-        private SftpFileAttributes CreateSftpFileAttributes()
-        {
-            var attributes = SftpFileAttributes.Empty;
-            attributes.GroupId = _random.Next();
-            attributes.LastAccessTime = new DateTime(2014, 8, 23, 17, 43, 50, DateTimeKind.Local);
-            attributes.LastWriteTime = new DateTime(2013, 7, 22, 16, 40, 42, DateTimeKind.Local);
-            attributes.UserId = _random.Next();
-            return attributes;
-        }
-    }
-}
+using System;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Common;
+using Renci.SshNet.Sftp;
+using Renci.SshNet.Sftp.Responses;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Responses
+{
+    [TestClass]
+    public class SftpAttrsResponseTest
+    {
+        private Random _random;
+        private uint _protocolVersion;
+        private uint _responseId;
+
+        [TestInitialize]
+        public void Init()
+        {
+            _random = new Random();
+            _protocolVersion = (uint) _random.Next(0, int.MaxValue);
+            _responseId = (uint)_random.Next(0, int.MaxValue);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var target = new SftpAttrsResponse(_protocolVersion);
+
+            Assert.IsNull(target.Attributes);
+            Assert.AreEqual(_protocolVersion, target.ProtocolVersion);
+            Assert.AreEqual((uint) 0, target.ResponseId);
+            Assert.AreEqual(SftpMessageTypes.Attrs, target.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Load()
+        {
+            var target = new SftpAttrsResponse(_protocolVersion);
+            var attributes = CreateSftpFileAttributes();
+            var attributesBytes = attributes.GetBytes();
+
+            var sshDataStream = new SshDataStream(4 + 1 + 4 + attributesBytes.Length);
+            sshDataStream.Position = 4; // skip 4 bytes for SSH packet length
+            sshDataStream.WriteByte((byte) SftpMessageTypes.Attrs);
+            sshDataStream.Write(_responseId);
+            sshDataStream.Write(attributesBytes, 0, attributesBytes.Length);
+
+            target.Load(sshDataStream.ToArray());
+
+            Assert.IsNotNull(target.Attributes);
+            Assert.AreEqual(_protocolVersion, target.ProtocolVersion);
+            Assert.AreEqual(_responseId, target.ResponseId);
+            Assert.AreEqual(SftpMessageTypes.Attrs, target.SftpMessageType);
+
+            // check attributes in detail
+            Assert.AreEqual(attributes.GroupId, target.Attributes.GroupId);
+            Assert.AreEqual(attributes.LastWriteTime, target.Attributes.LastWriteTime);
+            Assert.AreEqual(attributes.LastWriteTime, target.Attributes.LastWriteTime);
+            Assert.AreEqual(attributes.UserId, target.Attributes.UserId);
+        }
+
+        private SftpFileAttributes CreateSftpFileAttributes()
+        {
+            var attributes = SftpFileAttributes.Empty;
+            attributes.GroupId = _random.Next();
+            attributes.LastAccessTime = new DateTime(2014, 8, 23, 17, 43, 50, DateTimeKind.Local);
+            attributes.LastWriteTime = new DateTime(2013, 7, 22, 16, 40, 42, DateTimeKind.Local);
+            attributes.UserId = _random.Next();
+            return attributes;
+        }
+    }
+}

+ 60 - 60
src/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpDataResponseTest.cs

@@ -1,60 +1,60 @@
-using System;
-using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Common;
-using Renci.SshNet.Sftp;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Responses
-{
-    [TestClass]
-    public class SftpDataResponseTest
-    {
-        private Random _random;
-        private uint _protocolVersion;
-        private uint _responseId;
-        private byte[] _data;
-
-        [TestInitialize]
-        public void Init()
-        {
-            _random = new Random();
-            _protocolVersion = (uint) _random.Next(0, int.MaxValue);
-            _responseId = (uint) _random.Next(0, int.MaxValue);
-            _data = new byte[_random.Next(10, 100)];
-            _random.NextBytes(_data);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var target = new SftpDataResponse(_protocolVersion);
-
-            Assert.IsNull(target.Data);
-            Assert.AreEqual(_protocolVersion, target.ProtocolVersion);
-            Assert.AreEqual((uint) 0, target.ResponseId);
-            Assert.AreEqual(SftpMessageTypes.Data, target.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Load()
-        {
-            var target = new SftpDataResponse(_protocolVersion);
-
-            var sshDataStream = new SshDataStream(4 + 1 + 4 + _data.Length);
-            sshDataStream.Position = 4; // skip 4 bytes for SSH packet length
-            sshDataStream.WriteByte((byte)SftpMessageTypes.Attrs);
-            sshDataStream.Write(_responseId);
-            sshDataStream.Write((uint) _data.Length);
-            sshDataStream.Write(_data, 0, _data.Length);
-
-            target.Load(sshDataStream.ToArray());
-
-            Assert.IsNotNull(target.Data);
-            Assert.IsTrue(target.Data.SequenceEqual(_data));
-            Assert.AreEqual(_protocolVersion, target.ProtocolVersion);
-            Assert.AreEqual(_responseId, target.ResponseId);
-            Assert.AreEqual(SftpMessageTypes.Data, target.SftpMessageType);
-        }
-    }
-}
+using System;
+using System.Linq;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Common;
+using Renci.SshNet.Sftp;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Responses
+{
+    [TestClass]
+    public class SftpDataResponseTest
+    {
+        private Random _random;
+        private uint _protocolVersion;
+        private uint _responseId;
+        private byte[] _data;
+
+        [TestInitialize]
+        public void Init()
+        {
+            _random = new Random();
+            _protocolVersion = (uint) _random.Next(0, int.MaxValue);
+            _responseId = (uint) _random.Next(0, int.MaxValue);
+            _data = new byte[_random.Next(10, 100)];
+            _random.NextBytes(_data);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var target = new SftpDataResponse(_protocolVersion);
+
+            Assert.IsNull(target.Data);
+            Assert.AreEqual(_protocolVersion, target.ProtocolVersion);
+            Assert.AreEqual((uint) 0, target.ResponseId);
+            Assert.AreEqual(SftpMessageTypes.Data, target.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Load()
+        {
+            var target = new SftpDataResponse(_protocolVersion);
+
+            var sshDataStream = new SshDataStream(4 + 1 + 4 + _data.Length);
+            sshDataStream.Position = 4; // skip 4 bytes for SSH packet length
+            sshDataStream.WriteByte((byte)SftpMessageTypes.Attrs);
+            sshDataStream.Write(_responseId);
+            sshDataStream.Write((uint) _data.Length);
+            sshDataStream.Write(_data, 0, _data.Length);
+
+            target.Load(sshDataStream.ToArray());
+
+            Assert.IsNotNull(target.Data);
+            Assert.IsTrue(target.Data.SequenceEqual(_data));
+            Assert.AreEqual(_protocolVersion, target.ProtocolVersion);
+            Assert.AreEqual(_responseId, target.ResponseId);
+            Assert.AreEqual(SftpMessageTypes.Data, target.SftpMessageType);
+        }
+    }
+}

+ 102 - 102
src/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpExtendedReplyResponseTest.cs

@@ -1,103 +1,103 @@
-using System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Common;
-using Renci.SshNet.Sftp;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Responses
-{
-    [TestClass]
-    public class SftpExtendedReplyResponseTest
-    {
-        private Random _random;
-        private uint _protocolVersion;
-        private uint _responseId;
-
-        [TestInitialize]
-        public void Init()
-        {
-            _random = new Random();
-            _protocolVersion = (uint) _random.Next(0, int.MaxValue);
-            _responseId = (uint) _random.Next(0, int.MaxValue);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var target = new SftpExtendedReplyResponse(_protocolVersion);
-
-            Assert.AreEqual(_protocolVersion, target.ProtocolVersion);
-            Assert.AreEqual((uint) 0, target.ResponseId);
-            Assert.AreEqual(SftpMessageTypes.ExtendedReply, target.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Load()
-        {
-            var target = new SftpExtendedReplyResponse(_protocolVersion);
-
-            var sshDataStream = new SshDataStream(4 + 1 + 4);
-            sshDataStream.Position = 4; // skip 4 bytes for SSH packet length
-            sshDataStream.WriteByte((byte) SftpMessageTypes.ExtendedReply);
-            sshDataStream.Write(_responseId);
-
-            target.Load(sshDataStream.ToArray());
-
-            Assert.AreEqual(_protocolVersion, target.ProtocolVersion);
-            Assert.AreEqual(_responseId, target.ResponseId);
-            Assert.AreEqual(SftpMessageTypes.ExtendedReply, target.SftpMessageType);
-        }
-
-        [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 sshDataStream = new SshDataStream(4 + 1 + 4 + 88);
-            sshDataStream.Position = 4; // skip 4 bytes for SSH packet length
-            sshDataStream.WriteByte((byte) SftpMessageTypes.Attrs);
-            sshDataStream.Write(_responseId);
-            sshDataStream.Write(bsize);
-            sshDataStream.Write(frsize);
-            sshDataStream.Write(blocks);
-            sshDataStream.Write(bfree);
-            sshDataStream.Write(bavail);
-            sshDataStream.Write(files);
-            sshDataStream.Write(ffree);
-            sshDataStream.Write(favail);
-            sshDataStream.Write(sid);
-            sshDataStream.Write((ulong) 0x2);
-            sshDataStream.Write(namemax);
-
-            var target = new SftpExtendedReplyResponse(_protocolVersion);
-            target.Load(sshDataStream.ToArray());
-
-            var reply = target.GetReply<StatVfsReplyInfo>();
-            Assert.IsNotNull(reply);
-
-            var information = reply.Information;
-            Assert.IsNotNull(information);
-            Assert.AreEqual(bavail, information.AvailableBlocks);
-            Assert.AreEqual(favail, information.AvailableNodes);
-            Assert.AreEqual(frsize, information.BlockSize);
-            Assert.AreEqual(bsize, information.FileSystemBlockSize);
-            Assert.AreEqual(bfree, information.FreeBlocks);
-            Assert.AreEqual(ffree, information.FreeNodes);
-            Assert.IsFalse(information.IsReadOnly);
-            Assert.AreEqual(namemax, information.MaxNameLenght);
-            Assert.AreEqual(sid, information.Sid);
-            Assert.IsFalse(information.SupportsSetUid);
-            Assert.AreEqual(blocks, information.TotalBlocks);
-            Assert.AreEqual(files, information.TotalNodes);
-        }
-    }
+using System;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Common;
+using Renci.SshNet.Sftp;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Responses
+{
+    [TestClass]
+    public class SftpExtendedReplyResponseTest
+    {
+        private Random _random;
+        private uint _protocolVersion;
+        private uint _responseId;
+
+        [TestInitialize]
+        public void Init()
+        {
+            _random = new Random();
+            _protocolVersion = (uint) _random.Next(0, int.MaxValue);
+            _responseId = (uint) _random.Next(0, int.MaxValue);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var target = new SftpExtendedReplyResponse(_protocolVersion);
+
+            Assert.AreEqual(_protocolVersion, target.ProtocolVersion);
+            Assert.AreEqual((uint) 0, target.ResponseId);
+            Assert.AreEqual(SftpMessageTypes.ExtendedReply, target.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Load()
+        {
+            var target = new SftpExtendedReplyResponse(_protocolVersion);
+
+            var sshDataStream = new SshDataStream(4 + 1 + 4);
+            sshDataStream.Position = 4; // skip 4 bytes for SSH packet length
+            sshDataStream.WriteByte((byte) SftpMessageTypes.ExtendedReply);
+            sshDataStream.Write(_responseId);
+
+            target.Load(sshDataStream.ToArray());
+
+            Assert.AreEqual(_protocolVersion, target.ProtocolVersion);
+            Assert.AreEqual(_responseId, target.ResponseId);
+            Assert.AreEqual(SftpMessageTypes.ExtendedReply, target.SftpMessageType);
+        }
+
+        [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 sshDataStream = new SshDataStream(4 + 1 + 4 + 88);
+            sshDataStream.Position = 4; // skip 4 bytes for SSH packet length
+            sshDataStream.WriteByte((byte) SftpMessageTypes.Attrs);
+            sshDataStream.Write(_responseId);
+            sshDataStream.Write(bsize);
+            sshDataStream.Write(frsize);
+            sshDataStream.Write(blocks);
+            sshDataStream.Write(bfree);
+            sshDataStream.Write(bavail);
+            sshDataStream.Write(files);
+            sshDataStream.Write(ffree);
+            sshDataStream.Write(favail);
+            sshDataStream.Write(sid);
+            sshDataStream.Write((ulong) 0x2);
+            sshDataStream.Write(namemax);
+
+            var target = new SftpExtendedReplyResponse(_protocolVersion);
+            target.Load(sshDataStream.ToArray());
+
+            var reply = target.GetReply<StatVfsReplyInfo>();
+            Assert.IsNotNull(reply);
+
+            var information = reply.Information;
+            Assert.IsNotNull(information);
+            Assert.AreEqual(bavail, information.AvailableBlocks);
+            Assert.AreEqual(favail, information.AvailableNodes);
+            Assert.AreEqual(frsize, information.BlockSize);
+            Assert.AreEqual(bsize, information.FileSystemBlockSize);
+            Assert.AreEqual(bfree, information.FreeBlocks);
+            Assert.AreEqual(ffree, information.FreeNodes);
+            Assert.IsFalse(information.IsReadOnly);
+            Assert.AreEqual(namemax, information.MaxNameLenght);
+            Assert.AreEqual(sid, information.Sid);
+            Assert.IsFalse(information.SupportsSetUid);
+            Assert.AreEqual(blocks, information.TotalBlocks);
+            Assert.AreEqual(files, information.TotalNodes);
+        }
+    }
 }

+ 60 - 60
src/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpHandleResponseTest.cs

@@ -1,60 +1,60 @@
- using System;
-using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Common;
-using Renci.SshNet.Sftp;
-using Renci.SshNet.Sftp.Responses;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Responses
-{
-    [TestClass]
-    public class SftpHandleResponseTest
-    {
-        private Random _random;
-        private uint _protocolVersion;
-        private uint _responseId;
-        private byte[] _handle;
-
-        [TestInitialize]
-        public void Init()
-        {
-            _random = new Random();
-            _protocolVersion = (uint) _random.Next(0, int.MaxValue);
-            _responseId = (uint) _random.Next(0, int.MaxValue);
-            _handle = new byte[_random.Next(1, 10)];
-            _random.NextBytes(_handle);
-        }
-
-        [TestMethod]
-        public void Constructor()
-        {
-            var target = new SftpHandleResponse(_protocolVersion);
-
-            Assert.IsNull(target.Handle);
-            Assert.AreEqual(_protocolVersion, target.ProtocolVersion);
-            Assert.AreEqual((uint) 0, target.ResponseId);
-            Assert.AreEqual(SftpMessageTypes.Handle, target.SftpMessageType);
-        }
-
-        [TestMethod]
-        public void Load()
-        {
-            var target = new SftpHandleResponse(_protocolVersion);
-
-            var sshDataStream = new SshDataStream(4 + 1 + 4 + _handle.Length);
-            sshDataStream.Position = 4; // skip 4 bytes for SSH packet length
-            sshDataStream.WriteByte((byte) SftpMessageTypes.Handle);
-            sshDataStream.Write(_responseId);
-            sshDataStream.Write((uint) _handle.Length);
-            sshDataStream.Write(_handle, 0, _handle.Length);
-
-            target.Load(sshDataStream.ToArray());
-
-            Assert.IsNotNull(target.Handle);
-            Assert.IsTrue(target.Handle.SequenceEqual(_handle));
-            Assert.AreEqual(_protocolVersion, target.ProtocolVersion);
-            Assert.AreEqual(_responseId, target.ResponseId);
-            Assert.AreEqual(SftpMessageTypes.Handle, target.SftpMessageType);
-        }
-    }
-}
+ using System;
+using System.Linq;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Common;
+using Renci.SshNet.Sftp;
+using Renci.SshNet.Sftp.Responses;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Responses
+{
+    [TestClass]
+    public class SftpHandleResponseTest
+    {
+        private Random _random;
+        private uint _protocolVersion;
+        private uint _responseId;
+        private byte[] _handle;
+
+        [TestInitialize]
+        public void Init()
+        {
+            _random = new Random();
+            _protocolVersion = (uint) _random.Next(0, int.MaxValue);
+            _responseId = (uint) _random.Next(0, int.MaxValue);
+            _handle = new byte[_random.Next(1, 10)];
+            _random.NextBytes(_handle);
+        }
+
+        [TestMethod]
+        public void Constructor()
+        {
+            var target = new SftpHandleResponse(_protocolVersion);
+
+            Assert.IsNull(target.Handle);
+            Assert.AreEqual(_protocolVersion, target.ProtocolVersion);
+            Assert.AreEqual((uint) 0, target.ResponseId);
+            Assert.AreEqual(SftpMessageTypes.Handle, target.SftpMessageType);
+        }
+
+        [TestMethod]
+        public void Load()
+        {
+            var target = new SftpHandleResponse(_protocolVersion);
+
+            var sshDataStream = new SshDataStream(4 + 1 + 4 + _handle.Length);
+            sshDataStream.Position = 4; // skip 4 bytes for SSH packet length
+            sshDataStream.WriteByte((byte) SftpMessageTypes.Handle);
+            sshDataStream.Write(_responseId);
+            sshDataStream.Write((uint) _handle.Length);
+            sshDataStream.Write(_handle, 0, _handle.Length);
+
+            target.Load(sshDataStream.ToArray());
+
+            Assert.IsNotNull(target.Handle);
+            Assert.IsTrue(target.Handle.SequenceEqual(_handle));
+            Assert.AreEqual(_protocolVersion, target.ProtocolVersion);
+            Assert.AreEqual(_responseId, target.ResponseId);
+            Assert.AreEqual(SftpMessageTypes.Handle, target.SftpMessageType);
+        }
+    }
+}

+ 9 - 9
src/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpNameResponseTest.cs

@@ -1,10 +1,10 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Responses
-{
-    [TestClass]
-    public class SftpNameResponseTest : TestBase
-    {
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Responses
+{
+    [TestClass]
+    public class SftpNameResponseTest : TestBase
+    {
+    }
 }

+ 9 - 9
src/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpStatusResponseTest.cs

@@ -1,10 +1,10 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Responses
-{
-    [TestClass]
-    public class SftpStatusResponseTest : TestBase
-    {
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Responses
+{
+    [TestClass]
+    public class SftpStatusResponseTest : TestBase
+    {
+    }
 }

+ 9 - 9
src/Renci.SshNet.Tests/Classes/Sftp/Responses/SftpVersionResponseTest.cs

@@ -1,10 +1,10 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Sftp.Responses
-{
-    [TestClass]
-    public class SftpVersionResponseTest : TestBase
-    {
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Sftp.Responses
+{
+    [TestClass]
+    public class SftpVersionResponseTest : TestBase
+    {
+    }
 }

+ 27 - 27
src/Renci.SshNet.Tests/Classes/Sftp/SftpDownloadAsyncResultTest.cs

@@ -1,27 +1,27 @@
-using System;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Sftp;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests.Classes.Sftp
-{
-    /// <summary>
-    ///This is a test class for SftpDownloadAsyncResultTest and is intended
-    ///to contain all SftpDownloadAsyncResultTest Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class SftpDownloadAsyncResultTest : TestBase
-    {
-        /// <summary>
-        ///A test for SftpDownloadAsyncResult Constructor
-        ///</summary>
-        [TestMethod()]
-        public void SftpDownloadAsyncResultConstructorTest()
-        {
-            AsyncCallback asyncCallback = null; // TODO: Initialize to an appropriate value
-            object state = null; // TODO: Initialize to an appropriate value
-            SftpDownloadAsyncResult target = new SftpDownloadAsyncResult(asyncCallback, state);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-    }
-}
+using System;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Sftp;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests.Classes.Sftp
+{
+    /// <summary>
+    ///This is a test class for SftpDownloadAsyncResultTest and is intended
+    ///to contain all SftpDownloadAsyncResultTest Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class SftpDownloadAsyncResultTest : TestBase
+    {
+        /// <summary>
+        ///A test for SftpDownloadAsyncResult Constructor
+        ///</summary>
+        [TestMethod()]
+        public void SftpDownloadAsyncResultConstructorTest()
+        {
+            AsyncCallback asyncCallback = null; // TODO: Initialize to an appropriate value
+            object state = null; // TODO: Initialize to an appropriate value
+            SftpDownloadAsyncResult target = new SftpDownloadAsyncResult(asyncCallback, state);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+    }
+}

+ 237 - 237
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileAttributesTest.cs

@@ -1,237 +1,237 @@
-using Renci.SshNet.Sftp;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using System;
-using Renci.SshNet.Tests.Common;
-
-namespace Renci.SshNet.Tests
-{
-    /// <summary>
-    ///This is a test class for SftpFileAttributesTest and is intended
-    ///to contain all SftpFileAttributesTest Unit Tests
-    ///</summary>
-    [TestClass()]
-    public class SftpFileAttributesTest : TestBase
-    {
-        /// <summary>
-        ///A test for SetPermissions
-        ///</summary>
-        [TestMethod()]
-        public void SetPermissionsTest()
-        {
-            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
-            short mode = 0; // TODO: Initialize to an appropriate value
-            target.SetPermissions(mode);
-            Assert.Inconclusive("A method that does not return a value cannot be verified.");
-        }
-
-        /// <summary>
-        ///A test for GroupCanExecute
-        ///</summary>
-        [TestMethod()]
-        public void GroupCanExecuteTest()
-        {
-            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
-            bool expected = false; // TODO: Initialize to an appropriate value
-            bool actual;
-            target.GroupCanExecute = expected;
-            actual = target.GroupCanExecute;
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for GroupCanRead
-        ///</summary>
-        [TestMethod()]
-        public void GroupCanReadTest()
-        {
-            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
-            bool expected = false; // TODO: Initialize to an appropriate value
-            bool actual;
-            target.GroupCanRead = expected;
-            actual = target.GroupCanRead;
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for GroupCanWrite
-        ///</summary>
-        [TestMethod()]
-        public void GroupCanWriteTest()
-        {
-            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
-            bool expected = false; // TODO: Initialize to an appropriate value
-            bool actual;
-            target.GroupCanWrite = expected;
-            actual = target.GroupCanWrite;
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for GroupId
-        ///</summary>
-        [TestMethod()]
-        public void GroupIdTest()
-        {
-            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            target.GroupId = expected;
-            actual = target.GroupId;
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for LastAccessTime
-        ///</summary>
-        [TestMethod()]
-        public void LastAccessTimeTest()
-        {
-            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
-            DateTime expected = new DateTime(); // TODO: Initialize to an appropriate value
-            DateTime actual;
-            target.LastAccessTime = expected;
-            actual = target.LastAccessTime;
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for LastWriteTime
-        ///</summary>
-        [TestMethod()]
-        public void LastWriteTimeTest()
-        {
-            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
-            DateTime expected = new DateTime(); // TODO: Initialize to an appropriate value
-            DateTime actual;
-            target.LastWriteTime = expected;
-            actual = target.LastWriteTime;
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for OthersCanExecute
-        ///</summary>
-        [TestMethod()]
-        public void OthersCanExecuteTest()
-        {
-            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
-            bool expected = false; // TODO: Initialize to an appropriate value
-            bool actual;
-            target.OthersCanExecute = expected;
-            actual = target.OthersCanExecute;
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for OthersCanRead
-        ///</summary>
-        [TestMethod()]
-        public void OthersCanReadTest()
-        {
-            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
-            bool expected = false; // TODO: Initialize to an appropriate value
-            bool actual;
-            target.OthersCanRead = expected;
-            actual = target.OthersCanRead;
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for OthersCanWrite
-        ///</summary>
-        [TestMethod()]
-        public void OthersCanWriteTest()
-        {
-            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
-            bool expected = false; // TODO: Initialize to an appropriate value
-            bool actual;
-            target.OthersCanWrite = expected;
-            actual = target.OthersCanWrite;
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for OwnerCanExecute
-        ///</summary>
-        [TestMethod()]
-        public void OwnerCanExecuteTest()
-        {
-            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
-            bool expected = false; // TODO: Initialize to an appropriate value
-            bool actual;
-            target.OwnerCanExecute = expected;
-            actual = target.OwnerCanExecute;
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for OwnerCanRead
-        ///</summary>
-        [TestMethod()]
-        public void OwnerCanReadTest()
-        {
-            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
-            bool expected = false; // TODO: Initialize to an appropriate value
-            bool actual;
-            target.OwnerCanRead = expected;
-            actual = target.OwnerCanRead;
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for OwnerCanWrite
-        ///</summary>
-        [TestMethod()]
-        public void OwnerCanWriteTest()
-        {
-            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
-            bool expected = false; // TODO: Initialize to an appropriate value
-            bool actual;
-            target.OwnerCanWrite = expected;
-            actual = target.OwnerCanWrite;
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for Size
-        ///</summary>
-        [TestMethod()]
-        public void SizeTest()
-        {
-            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
-            long expected = 0; // TODO: Initialize to an appropriate value
-            long actual;
-            target.Size = expected;
-            actual = target.Size;
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for UserId
-        ///</summary>
-        [TestMethod()]
-        public void UserIdTest()
-        {
-            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
-            int expected = 0; // TODO: Initialize to an appropriate value
-            int actual;
-            target.UserId = expected;
-            actual = target.UserId;
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-    }
-}
+using Renci.SshNet.Sftp;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using System;
+using Renci.SshNet.Tests.Common;
+
+namespace Renci.SshNet.Tests
+{
+    /// <summary>
+    ///This is a test class for SftpFileAttributesTest and is intended
+    ///to contain all SftpFileAttributesTest Unit Tests
+    ///</summary>
+    [TestClass()]
+    public class SftpFileAttributesTest : TestBase
+    {
+        /// <summary>
+        ///A test for SetPermissions
+        ///</summary>
+        [TestMethod()]
+        public void SetPermissionsTest()
+        {
+            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
+            short mode = 0; // TODO: Initialize to an appropriate value
+            target.SetPermissions(mode);
+            Assert.Inconclusive("A method that does not return a value cannot be verified.");
+        }
+
+        /// <summary>
+        ///A test for GroupCanExecute
+        ///</summary>
+        [TestMethod()]
+        public void GroupCanExecuteTest()
+        {
+            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
+            bool expected = false; // TODO: Initialize to an appropriate value
+            bool actual;
+            target.GroupCanExecute = expected;
+            actual = target.GroupCanExecute;
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for GroupCanRead
+        ///</summary>
+        [TestMethod()]
+        public void GroupCanReadTest()
+        {
+            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
+            bool expected = false; // TODO: Initialize to an appropriate value
+            bool actual;
+            target.GroupCanRead = expected;
+            actual = target.GroupCanRead;
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for GroupCanWrite
+        ///</summary>
+        [TestMethod()]
+        public void GroupCanWriteTest()
+        {
+            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
+            bool expected = false; // TODO: Initialize to an appropriate value
+            bool actual;
+            target.GroupCanWrite = expected;
+            actual = target.GroupCanWrite;
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for GroupId
+        ///</summary>
+        [TestMethod()]
+        public void GroupIdTest()
+        {
+            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            target.GroupId = expected;
+            actual = target.GroupId;
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for LastAccessTime
+        ///</summary>
+        [TestMethod()]
+        public void LastAccessTimeTest()
+        {
+            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
+            DateTime expected = new DateTime(); // TODO: Initialize to an appropriate value
+            DateTime actual;
+            target.LastAccessTime = expected;
+            actual = target.LastAccessTime;
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for LastWriteTime
+        ///</summary>
+        [TestMethod()]
+        public void LastWriteTimeTest()
+        {
+            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
+            DateTime expected = new DateTime(); // TODO: Initialize to an appropriate value
+            DateTime actual;
+            target.LastWriteTime = expected;
+            actual = target.LastWriteTime;
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for OthersCanExecute
+        ///</summary>
+        [TestMethod()]
+        public void OthersCanExecuteTest()
+        {
+            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
+            bool expected = false; // TODO: Initialize to an appropriate value
+            bool actual;
+            target.OthersCanExecute = expected;
+            actual = target.OthersCanExecute;
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for OthersCanRead
+        ///</summary>
+        [TestMethod()]
+        public void OthersCanReadTest()
+        {
+            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
+            bool expected = false; // TODO: Initialize to an appropriate value
+            bool actual;
+            target.OthersCanRead = expected;
+            actual = target.OthersCanRead;
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for OthersCanWrite
+        ///</summary>
+        [TestMethod()]
+        public void OthersCanWriteTest()
+        {
+            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
+            bool expected = false; // TODO: Initialize to an appropriate value
+            bool actual;
+            target.OthersCanWrite = expected;
+            actual = target.OthersCanWrite;
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for OwnerCanExecute
+        ///</summary>
+        [TestMethod()]
+        public void OwnerCanExecuteTest()
+        {
+            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
+            bool expected = false; // TODO: Initialize to an appropriate value
+            bool actual;
+            target.OwnerCanExecute = expected;
+            actual = target.OwnerCanExecute;
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for OwnerCanRead
+        ///</summary>
+        [TestMethod()]
+        public void OwnerCanReadTest()
+        {
+            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
+            bool expected = false; // TODO: Initialize to an appropriate value
+            bool actual;
+            target.OwnerCanRead = expected;
+            actual = target.OwnerCanRead;
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for OwnerCanWrite
+        ///</summary>
+        [TestMethod()]
+        public void OwnerCanWriteTest()
+        {
+            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
+            bool expected = false; // TODO: Initialize to an appropriate value
+            bool actual;
+            target.OwnerCanWrite = expected;
+            actual = target.OwnerCanWrite;
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for Size
+        ///</summary>
+        [TestMethod()]
+        public void SizeTest()
+        {
+            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
+            long expected = 0; // TODO: Initialize to an appropriate value
+            long actual;
+            target.Size = expected;
+            actual = target.Size;
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for UserId
+        ///</summary>
+        [TestMethod()]
+        public void UserIdTest()
+        {
+            SftpFileAttributes target = SftpFileAttributes.Empty; // TODO: Initialize to an appropriate value
+            int expected = 0; // TODO: Initialize to an appropriate value
+            int actual;
+            target.UserId = expected;
+            actual = target.UserId;
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+    }
+}

+ 74 - 74
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessRead.cs

@@ -1,74 +1,74 @@
-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
-{
-    [TestClass]
-    public class SftpFileStreamTest_CanRead_Closed_FileAccessRead
-    {
-        private Mock<ISftpSession> _sftpSessionMock;
-        private string _path;
-        private SftpFileStream _sftpFileStream;
-        private byte[] _handle;
-        private SftpFileAttributes _fileAttributes;
-        private uint _bufferSize;
-        private uint _readBufferSize;
-        private uint _writeBufferSize;
-        private bool _actual;
-
-        [TestInitialize]
-        public void Setup()
-        {
-            Arrange();
-            Act();
-        }
-
-        protected void Arrange()
-        {
-            var random = new Random();
-            _path = random.Next().ToString(CultureInfo.InvariantCulture);
-            _handle = new[] {(byte) random.Next(byte.MinValue, byte.MaxValue)};
-            _fileAttributes = SftpFileAttributes.Empty;
-            _bufferSize = (uint) random.Next(0, 1000);
-            _readBufferSize = (uint) random.Next(0, 1000);
-            _writeBufferSize = (uint) random.Next(0, 1000);
-
-            _sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
-
-            var sequence = new MockSequence();
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Truncate, true))
-                .Returns(_handle);
-            _sftpSessionMock.InSequence(sequence).Setup(p => p.RequestFStat(_handle)).Returns(_fileAttributes);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.CalculateOptimalReadLength(_bufferSize))
-                .Returns(_readBufferSize);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.CalculateOptimalWriteLength(_bufferSize, _handle))
-                .Returns(_writeBufferSize);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.IsOpen)
-                .Returns(true);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.RequestClose(_handle));
-
-            _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Read, (int)_bufferSize);
-            _sftpFileStream.Close();
-        }
-
-        protected void Act()
-        {
-            _actual = _sftpFileStream.CanRead;
-        }
-
-        [TestMethod]
-        public void CanReadShouldReturnFalse()
-        {
-            Assert.IsFalse(_actual);
-        }
-    }
-}
+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
+{
+    [TestClass]
+    public class SftpFileStreamTest_CanRead_Closed_FileAccessRead
+    {
+        private Mock<ISftpSession> _sftpSessionMock;
+        private string _path;
+        private SftpFileStream _sftpFileStream;
+        private byte[] _handle;
+        private SftpFileAttributes _fileAttributes;
+        private uint _bufferSize;
+        private uint _readBufferSize;
+        private uint _writeBufferSize;
+        private bool _actual;
+
+        [TestInitialize]
+        public void Setup()
+        {
+            Arrange();
+            Act();
+        }
+
+        protected void Arrange()
+        {
+            var random = new Random();
+            _path = random.Next().ToString(CultureInfo.InvariantCulture);
+            _handle = new[] {(byte) random.Next(byte.MinValue, byte.MaxValue)};
+            _fileAttributes = SftpFileAttributes.Empty;
+            _bufferSize = (uint) random.Next(0, 1000);
+            _readBufferSize = (uint) random.Next(0, 1000);
+            _writeBufferSize = (uint) random.Next(0, 1000);
+
+            _sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
+
+            var sequence = new MockSequence();
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Truncate, true))
+                .Returns(_handle);
+            _sftpSessionMock.InSequence(sequence).Setup(p => p.RequestFStat(_handle)).Returns(_fileAttributes);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.CalculateOptimalReadLength(_bufferSize))
+                .Returns(_readBufferSize);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.CalculateOptimalWriteLength(_bufferSize, _handle))
+                .Returns(_writeBufferSize);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.IsOpen)
+                .Returns(true);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.RequestClose(_handle));
+
+            _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Read, (int)_bufferSize);
+            _sftpFileStream.Close();
+        }
+
+        protected void Act()
+        {
+            _actual = _sftpFileStream.CanRead;
+        }
+
+        [TestMethod]
+        public void CanReadShouldReturnFalse()
+        {
+            Assert.IsFalse(_actual);
+        }
+    }
+}

+ 74 - 74
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessReadWrite.cs

@@ -1,74 +1,74 @@
-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
-{
-    [TestClass]
-    public class SftpFileStreamTest_CanRead_Closed_FileAccessReadWrite
-    {
-        private Mock<ISftpSession> _sftpSessionMock;
-        private string _path;
-        private SftpFileStream _sftpFileStream;
-        private byte[] _handle;
-        private SftpFileAttributes _fileAttributes;
-        private uint _bufferSize;
-        private uint _readBufferSize;
-        private uint _writeBufferSize;
-        private bool _actual;
-
-        [TestInitialize]
-        public void Setup()
-        {
-            Arrange();
-            Act();
-        }
-
-        protected void Arrange()
-        {
-            var random = new Random();
-            _path = random.Next().ToString(CultureInfo.InvariantCulture);
-            _handle = new[] {(byte) random.Next(byte.MinValue, byte.MaxValue)};
-            _fileAttributes = SftpFileAttributes.Empty;
-            _bufferSize = (uint) random.Next(0, 1000);
-            _readBufferSize = (uint) random.Next(0, 1000);
-            _writeBufferSize = (uint) random.Next(0, 1000);
-
-            _sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
-
-            var sequence = new MockSequence();
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Write | Flags.Truncate, true))
-                .Returns(_handle);
-            _sftpSessionMock.InSequence(sequence).Setup(p => p.RequestFStat(_handle)).Returns(_fileAttributes);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.CalculateOptimalReadLength(_bufferSize))
-                .Returns(_readBufferSize);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.CalculateOptimalWriteLength(_bufferSize, _handle))
-                .Returns(_writeBufferSize);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.IsOpen)
-                .Returns(true);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.RequestClose(_handle));
-
-            _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.ReadWrite, (int)_bufferSize);
-            _sftpFileStream.Close();
-        }
-
-        protected void Act()
-        {
-            _actual = _sftpFileStream.CanRead;
-        }
-
-        [TestMethod]
-        public void CanReadShouldReturnFalse()
-        {
-            Assert.IsFalse(_actual);
-        }
-    }
-}
+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
+{
+    [TestClass]
+    public class SftpFileStreamTest_CanRead_Closed_FileAccessReadWrite
+    {
+        private Mock<ISftpSession> _sftpSessionMock;
+        private string _path;
+        private SftpFileStream _sftpFileStream;
+        private byte[] _handle;
+        private SftpFileAttributes _fileAttributes;
+        private uint _bufferSize;
+        private uint _readBufferSize;
+        private uint _writeBufferSize;
+        private bool _actual;
+
+        [TestInitialize]
+        public void Setup()
+        {
+            Arrange();
+            Act();
+        }
+
+        protected void Arrange()
+        {
+            var random = new Random();
+            _path = random.Next().ToString(CultureInfo.InvariantCulture);
+            _handle = new[] {(byte) random.Next(byte.MinValue, byte.MaxValue)};
+            _fileAttributes = SftpFileAttributes.Empty;
+            _bufferSize = (uint) random.Next(0, 1000);
+            _readBufferSize = (uint) random.Next(0, 1000);
+            _writeBufferSize = (uint) random.Next(0, 1000);
+
+            _sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
+
+            var sequence = new MockSequence();
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Write | Flags.Truncate, true))
+                .Returns(_handle);
+            _sftpSessionMock.InSequence(sequence).Setup(p => p.RequestFStat(_handle)).Returns(_fileAttributes);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.CalculateOptimalReadLength(_bufferSize))
+                .Returns(_readBufferSize);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.CalculateOptimalWriteLength(_bufferSize, _handle))
+                .Returns(_writeBufferSize);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.IsOpen)
+                .Returns(true);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.RequestClose(_handle));
+
+            _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.ReadWrite, (int)_bufferSize);
+            _sftpFileStream.Close();
+        }
+
+        protected void Act()
+        {
+            _actual = _sftpFileStream.CanRead;
+        }
+
+        [TestMethod]
+        public void CanReadShouldReturnFalse()
+        {
+            Assert.IsFalse(_actual);
+        }
+    }
+}

+ 74 - 74
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Closed_FileAccessWrite.cs

@@ -1,74 +1,74 @@
-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
-{
-    [TestClass]
-    public class SftpFileStreamTest_CanRead_Closed_FileAccessWrite
-    {
-        private Mock<ISftpSession> _sftpSessionMock;
-        private string _path;
-        private SftpFileStream _sftpFileStream;
-        private byte[] _handle;
-        private SftpFileAttributes _fileAttributes;
-        private uint _bufferSize;
-        private uint _readBufferSize;
-        private uint _writeBufferSize;
-        private bool _actual;
-
-        [TestInitialize]
-        public void Setup()
-        {
-            Arrange();
-            Act();
-        }
-
-        protected void Arrange()
-        {
-            var random = new Random();
-            _path = random.Next().ToString(CultureInfo.InvariantCulture);
-            _handle = new[] {(byte) random.Next(byte.MinValue, byte.MaxValue)};
-            _fileAttributes = SftpFileAttributes.Empty;
-            _bufferSize = (uint) random.Next(0, 1000);
-            _readBufferSize = (uint) random.Next(0, 1000);
-            _writeBufferSize = (uint) random.Next(0, 1000);
-
-            _sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
-
-            var sequence = new MockSequence();
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.RequestOpen(_path, Flags.Write | Flags.Truncate, true))
-                .Returns(_handle);
-            _sftpSessionMock.InSequence(sequence).Setup(p => p.RequestFStat(_handle)).Returns(_fileAttributes);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.CalculateOptimalReadLength(_bufferSize))
-                .Returns(_readBufferSize);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.CalculateOptimalWriteLength(_bufferSize, _handle))
-                .Returns(_writeBufferSize);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.IsOpen)
-                .Returns(true);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.RequestClose(_handle));
-
-            _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Write, (int)_bufferSize);
-            _sftpFileStream.Close();
-        }
-
-        protected void Act()
-        {
-            _actual = _sftpFileStream.CanRead;
-        }
-
-        [TestMethod]
-        public void CanReadShouldReturnFalse()
-        {
-            Assert.IsFalse(_actual);
-        }
-    }
-}
+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
+{
+    [TestClass]
+    public class SftpFileStreamTest_CanRead_Closed_FileAccessWrite
+    {
+        private Mock<ISftpSession> _sftpSessionMock;
+        private string _path;
+        private SftpFileStream _sftpFileStream;
+        private byte[] _handle;
+        private SftpFileAttributes _fileAttributes;
+        private uint _bufferSize;
+        private uint _readBufferSize;
+        private uint _writeBufferSize;
+        private bool _actual;
+
+        [TestInitialize]
+        public void Setup()
+        {
+            Arrange();
+            Act();
+        }
+
+        protected void Arrange()
+        {
+            var random = new Random();
+            _path = random.Next().ToString(CultureInfo.InvariantCulture);
+            _handle = new[] {(byte) random.Next(byte.MinValue, byte.MaxValue)};
+            _fileAttributes = SftpFileAttributes.Empty;
+            _bufferSize = (uint) random.Next(0, 1000);
+            _readBufferSize = (uint) random.Next(0, 1000);
+            _writeBufferSize = (uint) random.Next(0, 1000);
+
+            _sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
+
+            var sequence = new MockSequence();
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.RequestOpen(_path, Flags.Write | Flags.Truncate, true))
+                .Returns(_handle);
+            _sftpSessionMock.InSequence(sequence).Setup(p => p.RequestFStat(_handle)).Returns(_fileAttributes);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.CalculateOptimalReadLength(_bufferSize))
+                .Returns(_readBufferSize);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.CalculateOptimalWriteLength(_bufferSize, _handle))
+                .Returns(_writeBufferSize);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.IsOpen)
+                .Returns(true);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.RequestClose(_handle));
+
+            _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Write, (int)_bufferSize);
+            _sftpFileStream.Close();
+        }
+
+        protected void Act()
+        {
+            _actual = _sftpFileStream.CanRead;
+        }
+
+        [TestMethod]
+        public void CanReadShouldReturnFalse()
+        {
+            Assert.IsFalse(_actual);
+        }
+    }
+}

+ 74 - 74
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessRead.cs

@@ -1,74 +1,74 @@
-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
-{
-    [TestClass]
-    public class SftpFileStreamTest_CanRead_Disposed_FileAccessRead
-    {
-        private Mock<ISftpSession> _sftpSessionMock;
-        private string _path;
-        private SftpFileStream _sftpFileStream;
-        private byte[] _handle;
-        private SftpFileAttributes _fileAttributes;
-        private uint _bufferSize;
-        private uint _readBufferSize;
-        private uint _writeBufferSize;
-        private bool _actual;
-
-        [TestInitialize]
-        public void Setup()
-        {
-            Arrange();
-            Act();
-        }
-
-        protected void Arrange()
-        {
-            var random = new Random();
-            _path = random.Next().ToString(CultureInfo.InvariantCulture);
-            _handle = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) };
-            _fileAttributes = SftpFileAttributes.Empty;
-            _bufferSize = (uint)random.Next(0, 1000);
-            _readBufferSize = (uint)random.Next(0, 1000);
-            _writeBufferSize = (uint)random.Next(0, 1000);
-
-            _sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
-
-            var sequence = new MockSequence();
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Truncate, true))
-                .Returns(_handle);
-            _sftpSessionMock.InSequence(sequence).Setup(p => p.RequestFStat(_handle)).Returns(_fileAttributes);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.CalculateOptimalReadLength(_bufferSize))
-                .Returns(_readBufferSize);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.CalculateOptimalWriteLength(_bufferSize, _handle))
-                .Returns(_writeBufferSize);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.IsOpen)
-                .Returns(true);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.RequestClose(_handle));
-
-            _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Read, (int)_bufferSize);
-            _sftpFileStream.Dispose();
-        }
-
-        protected void Act()
-        {
-            _actual = _sftpFileStream.CanRead;
-        }
-
-        [TestMethod]
-        public void CanReadShouldReturnFalse()
-        {
-            Assert.IsFalse(_actual);
-        }
-    }
-}
+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
+{
+    [TestClass]
+    public class SftpFileStreamTest_CanRead_Disposed_FileAccessRead
+    {
+        private Mock<ISftpSession> _sftpSessionMock;
+        private string _path;
+        private SftpFileStream _sftpFileStream;
+        private byte[] _handle;
+        private SftpFileAttributes _fileAttributes;
+        private uint _bufferSize;
+        private uint _readBufferSize;
+        private uint _writeBufferSize;
+        private bool _actual;
+
+        [TestInitialize]
+        public void Setup()
+        {
+            Arrange();
+            Act();
+        }
+
+        protected void Arrange()
+        {
+            var random = new Random();
+            _path = random.Next().ToString(CultureInfo.InvariantCulture);
+            _handle = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) };
+            _fileAttributes = SftpFileAttributes.Empty;
+            _bufferSize = (uint)random.Next(0, 1000);
+            _readBufferSize = (uint)random.Next(0, 1000);
+            _writeBufferSize = (uint)random.Next(0, 1000);
+
+            _sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
+
+            var sequence = new MockSequence();
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Truncate, true))
+                .Returns(_handle);
+            _sftpSessionMock.InSequence(sequence).Setup(p => p.RequestFStat(_handle)).Returns(_fileAttributes);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.CalculateOptimalReadLength(_bufferSize))
+                .Returns(_readBufferSize);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.CalculateOptimalWriteLength(_bufferSize, _handle))
+                .Returns(_writeBufferSize);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.IsOpen)
+                .Returns(true);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.RequestClose(_handle));
+
+            _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Read, (int)_bufferSize);
+            _sftpFileStream.Dispose();
+        }
+
+        protected void Act()
+        {
+            _actual = _sftpFileStream.CanRead;
+        }
+
+        [TestMethod]
+        public void CanReadShouldReturnFalse()
+        {
+            Assert.IsFalse(_actual);
+        }
+    }
+}

+ 74 - 74
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessReadWrite.cs

@@ -1,74 +1,74 @@
-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
-{
-    [TestClass]
-    public class SftpFileStreamTest_CanRead_Disposed_FileAccessReadWrite
-    {
-        private Mock<ISftpSession> _sftpSessionMock;
-        private string _path;
-        private SftpFileStream _sftpFileStream;
-        private byte[] _handle;
-        private SftpFileAttributes _fileAttributes;
-        private uint _bufferSize;
-        private uint _readBufferSize;
-        private uint _writeBufferSize;
-        private bool _actual;
-
-        [TestInitialize]
-        public void Setup()
-        {
-            Arrange();
-            Act();
-        }
-
-        protected void Arrange()
-        {
-            var random = new Random();
-            _path = random.Next().ToString(CultureInfo.InvariantCulture);
-            _handle = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) };
-            _fileAttributes = SftpFileAttributes.Empty;
-            _bufferSize = (uint)random.Next(0, 1000);
-            _readBufferSize = (uint)random.Next(0, 1000);
-            _writeBufferSize = (uint)random.Next(0, 1000);
-
-            _sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
-
-            var sequence = new MockSequence();
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Write | Flags.Truncate, true))
-                .Returns(_handle);
-            _sftpSessionMock.InSequence(sequence).Setup(p => p.RequestFStat(_handle)).Returns(_fileAttributes);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.CalculateOptimalReadLength(_bufferSize))
-                .Returns(_readBufferSize);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.CalculateOptimalWriteLength(_bufferSize, _handle))
-                .Returns(_writeBufferSize);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.IsOpen)
-                .Returns(true);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.RequestClose(_handle));
-
-            _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.ReadWrite, (int)_bufferSize);
-            _sftpFileStream.Dispose();
-        }
-
-        protected void Act()
-        {
-            _actual = _sftpFileStream.CanRead;
-        }
-
-        [TestMethod]
-        public void CanReadShouldReturnFalse()
-        {
-            Assert.IsFalse(_actual);
-        }
-    }
-}
+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
+{
+    [TestClass]
+    public class SftpFileStreamTest_CanRead_Disposed_FileAccessReadWrite
+    {
+        private Mock<ISftpSession> _sftpSessionMock;
+        private string _path;
+        private SftpFileStream _sftpFileStream;
+        private byte[] _handle;
+        private SftpFileAttributes _fileAttributes;
+        private uint _bufferSize;
+        private uint _readBufferSize;
+        private uint _writeBufferSize;
+        private bool _actual;
+
+        [TestInitialize]
+        public void Setup()
+        {
+            Arrange();
+            Act();
+        }
+
+        protected void Arrange()
+        {
+            var random = new Random();
+            _path = random.Next().ToString(CultureInfo.InvariantCulture);
+            _handle = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) };
+            _fileAttributes = SftpFileAttributes.Empty;
+            _bufferSize = (uint)random.Next(0, 1000);
+            _readBufferSize = (uint)random.Next(0, 1000);
+            _writeBufferSize = (uint)random.Next(0, 1000);
+
+            _sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
+
+            var sequence = new MockSequence();
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Write | Flags.Truncate, true))
+                .Returns(_handle);
+            _sftpSessionMock.InSequence(sequence).Setup(p => p.RequestFStat(_handle)).Returns(_fileAttributes);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.CalculateOptimalReadLength(_bufferSize))
+                .Returns(_readBufferSize);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.CalculateOptimalWriteLength(_bufferSize, _handle))
+                .Returns(_writeBufferSize);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.IsOpen)
+                .Returns(true);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.RequestClose(_handle));
+
+            _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.ReadWrite, (int)_bufferSize);
+            _sftpFileStream.Dispose();
+        }
+
+        protected void Act()
+        {
+            _actual = _sftpFileStream.CanRead;
+        }
+
+        [TestMethod]
+        public void CanReadShouldReturnFalse()
+        {
+            Assert.IsFalse(_actual);
+        }
+    }
+}

+ 74 - 74
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_Disposed_FileAccessWrite.cs

@@ -1,74 +1,74 @@
-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
-{
-    [TestClass]
-    public class SftpFileStreamTest_CanRead_Disposed_FileAccessWrite
-    {
-        private Mock<ISftpSession> _sftpSessionMock;
-        private string _path;
-        private SftpFileStream _sftpFileStream;
-        private byte[] _handle;
-        private SftpFileAttributes _fileAttributes;
-        private uint _bufferSize;
-        private uint _readBufferSize;
-        private uint _writeBufferSize;
-        private bool _actual;
-
-        [TestInitialize]
-        public void Setup()
-        {
-            Arrange();
-            Act();
-        }
-
-        protected void Arrange()
-        {
-            var random = new Random();
-            _path = random.Next().ToString(CultureInfo.InvariantCulture);
-            _handle = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) };
-            _fileAttributes = SftpFileAttributes.Empty;
-            _bufferSize = (uint)random.Next(0, 1000);
-            _readBufferSize = (uint)random.Next(0, 1000);
-            _writeBufferSize = (uint)random.Next(0, 1000);
-
-            _sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
-
-            var sequence = new MockSequence();
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.RequestOpen(_path, Flags.Write | Flags.Truncate, true))
-                .Returns(_handle);
-            _sftpSessionMock.InSequence(sequence).Setup(p => p.RequestFStat(_handle)).Returns(_fileAttributes);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.CalculateOptimalReadLength(_bufferSize))
-                .Returns(_readBufferSize);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.CalculateOptimalWriteLength(_bufferSize, _handle))
-                .Returns(_writeBufferSize);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.IsOpen)
-                .Returns(true);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.RequestClose(_handle));
-
-            _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Write, (int)_bufferSize);
-            _sftpFileStream.Dispose();
-        }
-
-        protected void Act()
-        {
-            _actual = _sftpFileStream.CanRead;
-        }
-
-        [TestMethod]
-        public void CanReadShouldReturnFalse()
-        {
-            Assert.IsFalse(_actual);
-        }
-    }
-}
+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
+{
+    [TestClass]
+    public class SftpFileStreamTest_CanRead_Disposed_FileAccessWrite
+    {
+        private Mock<ISftpSession> _sftpSessionMock;
+        private string _path;
+        private SftpFileStream _sftpFileStream;
+        private byte[] _handle;
+        private SftpFileAttributes _fileAttributes;
+        private uint _bufferSize;
+        private uint _readBufferSize;
+        private uint _writeBufferSize;
+        private bool _actual;
+
+        [TestInitialize]
+        public void Setup()
+        {
+            Arrange();
+            Act();
+        }
+
+        protected void Arrange()
+        {
+            var random = new Random();
+            _path = random.Next().ToString(CultureInfo.InvariantCulture);
+            _handle = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) };
+            _fileAttributes = SftpFileAttributes.Empty;
+            _bufferSize = (uint)random.Next(0, 1000);
+            _readBufferSize = (uint)random.Next(0, 1000);
+            _writeBufferSize = (uint)random.Next(0, 1000);
+
+            _sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
+
+            var sequence = new MockSequence();
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.RequestOpen(_path, Flags.Write | Flags.Truncate, true))
+                .Returns(_handle);
+            _sftpSessionMock.InSequence(sequence).Setup(p => p.RequestFStat(_handle)).Returns(_fileAttributes);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.CalculateOptimalReadLength(_bufferSize))
+                .Returns(_readBufferSize);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.CalculateOptimalWriteLength(_bufferSize, _handle))
+                .Returns(_writeBufferSize);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.IsOpen)
+                .Returns(true);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.RequestClose(_handle));
+
+            _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Write, (int)_bufferSize);
+            _sftpFileStream.Dispose();
+        }
+
+        protected void Act()
+        {
+            _actual = _sftpFileStream.CanRead;
+        }
+
+        [TestMethod]
+        public void CanReadShouldReturnFalse()
+        {
+            Assert.IsFalse(_actual);
+        }
+    }
+}

+ 73 - 73
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_SessionOpen_FileAccessRead.cs

@@ -1,73 +1,73 @@
-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
-{
-    [TestClass]
-    public class SftpFileStreamTest_CanRead_SessionOpen_FileAccessRead
-    {
-        private Mock<ISftpSession> _sftpSessionMock;
-        private string _path;
-        private SftpFileStream _sftpFileStream;
-        private byte[] _handle;
-        private SftpFileAttributes _fileAttributes;
-        private uint _bufferSize;
-        private uint _readBufferSize;
-        private uint _writeBufferSize;
-        private bool _actual;
-
-        [TestInitialize]
-        public void Setup()
-        {
-            Arrange();
-            Act();
-        }
-
-        protected void Arrange()
-        {
-            var random = new Random();
-            _path = random.Next().ToString(CultureInfo.InvariantCulture);
-            _handle = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) };
-            _fileAttributes = SftpFileAttributes.Empty;
-            _bufferSize = (uint)random.Next(0, 1000);
-            _readBufferSize = (uint)random.Next(0, 1000);
-            _writeBufferSize = (uint)random.Next(0, 1000);
-
-            _sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
-
-            var sequence = new MockSequence();
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Truncate, true))
-                .Returns(_handle);
-            _sftpSessionMock.InSequence(sequence).Setup(p => p.RequestFStat(_handle)).Returns(_fileAttributes);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.CalculateOptimalReadLength(_bufferSize))
-                .Returns(_readBufferSize);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.CalculateOptimalWriteLength(_bufferSize, _handle))
-                .Returns(_writeBufferSize);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.IsOpen)
-                .Returns(true);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.RequestClose(_handle));
-
-            _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Read, (int)_bufferSize);
-        }
-
-        protected void Act()
-        {
-            _actual = _sftpFileStream.CanRead;
-        }
-
-        [TestMethod]
-        public void CanReadShouldReturnTrue()
-        {
-            Assert.IsTrue(_actual);
-        }
-    }
-}
+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
+{
+    [TestClass]
+    public class SftpFileStreamTest_CanRead_SessionOpen_FileAccessRead
+    {
+        private Mock<ISftpSession> _sftpSessionMock;
+        private string _path;
+        private SftpFileStream _sftpFileStream;
+        private byte[] _handle;
+        private SftpFileAttributes _fileAttributes;
+        private uint _bufferSize;
+        private uint _readBufferSize;
+        private uint _writeBufferSize;
+        private bool _actual;
+
+        [TestInitialize]
+        public void Setup()
+        {
+            Arrange();
+            Act();
+        }
+
+        protected void Arrange()
+        {
+            var random = new Random();
+            _path = random.Next().ToString(CultureInfo.InvariantCulture);
+            _handle = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) };
+            _fileAttributes = SftpFileAttributes.Empty;
+            _bufferSize = (uint)random.Next(0, 1000);
+            _readBufferSize = (uint)random.Next(0, 1000);
+            _writeBufferSize = (uint)random.Next(0, 1000);
+
+            _sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
+
+            var sequence = new MockSequence();
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Truncate, true))
+                .Returns(_handle);
+            _sftpSessionMock.InSequence(sequence).Setup(p => p.RequestFStat(_handle)).Returns(_fileAttributes);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.CalculateOptimalReadLength(_bufferSize))
+                .Returns(_readBufferSize);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.CalculateOptimalWriteLength(_bufferSize, _handle))
+                .Returns(_writeBufferSize);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.IsOpen)
+                .Returns(true);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.RequestClose(_handle));
+
+            _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Read, (int)_bufferSize);
+        }
+
+        protected void Act()
+        {
+            _actual = _sftpFileStream.CanRead;
+        }
+
+        [TestMethod]
+        public void CanReadShouldReturnTrue()
+        {
+            Assert.IsTrue(_actual);
+        }
+    }
+}

+ 73 - 73
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_SessionOpen_FileAccessReadWrite.cs

@@ -1,73 +1,73 @@
-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
-{
-    [TestClass]
-    public class SftpFileStreamTest_CanRead_SessionOpen_FileAccessReadWrite
-    {
-        private Mock<ISftpSession> _sftpSessionMock;
-        private string _path;
-        private SftpFileStream _sftpFileStream;
-        private byte[] _handle;
-        private SftpFileAttributes _fileAttributes;
-        private uint _bufferSize;
-        private uint _readBufferSize;
-        private uint _writeBufferSize;
-        private bool _actual;
-
-        [TestInitialize]
-        public void Setup()
-        {
-            Arrange();
-            Act();
-        }
-
-        protected void Arrange()
-        {
-            var random = new Random();
-            _path = random.Next().ToString(CultureInfo.InvariantCulture);
-            _handle = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) };
-            _fileAttributes = SftpFileAttributes.Empty;
-            _bufferSize = (uint)random.Next(0, 1000);
-            _readBufferSize = (uint)random.Next(0, 1000);
-            _writeBufferSize = (uint)random.Next(0, 1000);
-
-            _sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
-
-            var sequence = new MockSequence();
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Write | Flags.Truncate, true))
-                .Returns(_handle);
-            _sftpSessionMock.InSequence(sequence).Setup(p => p.RequestFStat(_handle)).Returns(_fileAttributes);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.CalculateOptimalReadLength(_bufferSize))
-                .Returns(_readBufferSize);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.CalculateOptimalWriteLength(_bufferSize, _handle))
-                .Returns(_writeBufferSize);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.IsOpen)
-                .Returns(true);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.RequestClose(_handle));
-
-            _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.ReadWrite, (int)_bufferSize);
-        }
-
-        protected void Act()
-        {
-            _actual = _sftpFileStream.CanRead;
-        }
-
-        [TestMethod]
-        public void CanReadShouldReturnTrue()
-        {
-            Assert.IsTrue(_actual);
-        }
-    }
-}
+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
+{
+    [TestClass]
+    public class SftpFileStreamTest_CanRead_SessionOpen_FileAccessReadWrite
+    {
+        private Mock<ISftpSession> _sftpSessionMock;
+        private string _path;
+        private SftpFileStream _sftpFileStream;
+        private byte[] _handle;
+        private SftpFileAttributes _fileAttributes;
+        private uint _bufferSize;
+        private uint _readBufferSize;
+        private uint _writeBufferSize;
+        private bool _actual;
+
+        [TestInitialize]
+        public void Setup()
+        {
+            Arrange();
+            Act();
+        }
+
+        protected void Arrange()
+        {
+            var random = new Random();
+            _path = random.Next().ToString(CultureInfo.InvariantCulture);
+            _handle = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) };
+            _fileAttributes = SftpFileAttributes.Empty;
+            _bufferSize = (uint)random.Next(0, 1000);
+            _readBufferSize = (uint)random.Next(0, 1000);
+            _writeBufferSize = (uint)random.Next(0, 1000);
+
+            _sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
+
+            var sequence = new MockSequence();
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Write | Flags.Truncate, true))
+                .Returns(_handle);
+            _sftpSessionMock.InSequence(sequence).Setup(p => p.RequestFStat(_handle)).Returns(_fileAttributes);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.CalculateOptimalReadLength(_bufferSize))
+                .Returns(_readBufferSize);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.CalculateOptimalWriteLength(_bufferSize, _handle))
+                .Returns(_writeBufferSize);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.IsOpen)
+                .Returns(true);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.RequestClose(_handle));
+
+            _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.ReadWrite, (int)_bufferSize);
+        }
+
+        protected void Act()
+        {
+            _actual = _sftpFileStream.CanRead;
+        }
+
+        [TestMethod]
+        public void CanReadShouldReturnTrue()
+        {
+            Assert.IsTrue(_actual);
+        }
+    }
+}

+ 73 - 73
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanRead_SessionOpen_FileAccessWrite.cs

@@ -1,73 +1,73 @@
-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
-{
-    [TestClass]
-    public class SftpFileStreamTest_CanRead_SessionOpen_FileAccessWrite
-    {
-        private Mock<ISftpSession> _sftpSessionMock;
-        private string _path;
-        private SftpFileStream _sftpFileStream;
-        private byte[] _handle;
-        private SftpFileAttributes _fileAttributes;
-        private uint _bufferSize;
-        private uint _readBufferSize;
-        private uint _writeBufferSize;
-        private bool _actual;
-
-        [TestInitialize]
-        public void Setup()
-        {
-            Arrange();
-            Act();
-        }
-
-        protected void Arrange()
-        {
-            var random = new Random();
-            _path = random.Next().ToString(CultureInfo.InvariantCulture);
-            _handle = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) };
-            _fileAttributes = SftpFileAttributes.Empty;
-            _bufferSize = (uint)random.Next(0, 1000);
-            _readBufferSize = (uint)random.Next(0, 1000);
-            _writeBufferSize = (uint)random.Next(0, 1000);
-
-            _sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
-
-            var sequence = new MockSequence();
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.RequestOpen(_path, Flags.Write | Flags.Truncate, true))
-                .Returns(_handle);
-            _sftpSessionMock.InSequence(sequence).Setup(p => p.RequestFStat(_handle)).Returns(_fileAttributes);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.CalculateOptimalReadLength(_bufferSize))
-                .Returns(_readBufferSize);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.CalculateOptimalWriteLength(_bufferSize, _handle))
-                .Returns(_writeBufferSize);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.IsOpen)
-                .Returns(true);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.RequestClose(_handle));
-
-            _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Write, (int)_bufferSize);
-        }
-
-        protected void Act()
-        {
-            _actual = _sftpFileStream.CanRead;
-        }
-
-        [TestMethod]
-        public void CanReadShouldReturnFalse()
-        {
-            Assert.IsFalse(_actual);
-        }
-    }
-}
+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
+{
+    [TestClass]
+    public class SftpFileStreamTest_CanRead_SessionOpen_FileAccessWrite
+    {
+        private Mock<ISftpSession> _sftpSessionMock;
+        private string _path;
+        private SftpFileStream _sftpFileStream;
+        private byte[] _handle;
+        private SftpFileAttributes _fileAttributes;
+        private uint _bufferSize;
+        private uint _readBufferSize;
+        private uint _writeBufferSize;
+        private bool _actual;
+
+        [TestInitialize]
+        public void Setup()
+        {
+            Arrange();
+            Act();
+        }
+
+        protected void Arrange()
+        {
+            var random = new Random();
+            _path = random.Next().ToString(CultureInfo.InvariantCulture);
+            _handle = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) };
+            _fileAttributes = SftpFileAttributes.Empty;
+            _bufferSize = (uint)random.Next(0, 1000);
+            _readBufferSize = (uint)random.Next(0, 1000);
+            _writeBufferSize = (uint)random.Next(0, 1000);
+
+            _sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
+
+            var sequence = new MockSequence();
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.RequestOpen(_path, Flags.Write | Flags.Truncate, true))
+                .Returns(_handle);
+            _sftpSessionMock.InSequence(sequence).Setup(p => p.RequestFStat(_handle)).Returns(_fileAttributes);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.CalculateOptimalReadLength(_bufferSize))
+                .Returns(_readBufferSize);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.CalculateOptimalWriteLength(_bufferSize, _handle))
+                .Returns(_writeBufferSize);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.IsOpen)
+                .Returns(true);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.RequestClose(_handle));
+
+            _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Write, (int)_bufferSize);
+        }
+
+        protected void Act()
+        {
+            _actual = _sftpFileStream.CanRead;
+        }
+
+        [TestMethod]
+        public void CanReadShouldReturnFalse()
+        {
+            Assert.IsFalse(_actual);
+        }
+    }
+}

+ 74 - 74
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessRead.cs

@@ -1,74 +1,74 @@
-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
-{
-    [TestClass]
-    public class SftpFileStreamTest_CanWrite_Closed_FileAccessRead
-    {
-        private Mock<ISftpSession> _sftpSessionMock;
-        private string _path;
-        private SftpFileStream _sftpFileStream;
-        private byte[] _handle;
-        private SftpFileAttributes _fileAttributes;
-        private uint _bufferSize;
-        private uint _readBufferSize;
-        private uint _writeBufferSize;
-        private bool _actual;
-
-        [TestInitialize]
-        public void Setup()
-        {
-            Arrange();
-            Act();
-        }
-
-        protected void Arrange()
-        {
-            var random = new Random();
-            _path = random.Next().ToString(CultureInfo.InvariantCulture);
-            _handle = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) };
-            _fileAttributes = SftpFileAttributes.Empty;
-            _bufferSize = (uint)random.Next(0, 1000);
-            _readBufferSize = (uint)random.Next(0, 1000);
-            _writeBufferSize = (uint)random.Next(0, 1000);
-
-            _sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
-
-            var sequence = new MockSequence();
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Truncate, true))
-                .Returns(_handle);
-            _sftpSessionMock.InSequence(sequence).Setup(p => p.RequestFStat(_handle)).Returns(_fileAttributes);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.CalculateOptimalReadLength(_bufferSize))
-                .Returns(_readBufferSize);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.CalculateOptimalWriteLength(_bufferSize, _handle))
-                .Returns(_writeBufferSize);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.IsOpen)
-                .Returns(true);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.RequestClose(_handle));
-
-            _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Read, (int)_bufferSize);
-            _sftpFileStream.Close();
-        }
-
-        protected void Act()
-        {
-            _actual = _sftpFileStream.CanWrite;
-        }
-
-        [TestMethod]
-        public void CanWriteShouldReturnFalse()
-        {
-            Assert.IsFalse(_actual);
-        }
-    }
-}
+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
+{
+    [TestClass]
+    public class SftpFileStreamTest_CanWrite_Closed_FileAccessRead
+    {
+        private Mock<ISftpSession> _sftpSessionMock;
+        private string _path;
+        private SftpFileStream _sftpFileStream;
+        private byte[] _handle;
+        private SftpFileAttributes _fileAttributes;
+        private uint _bufferSize;
+        private uint _readBufferSize;
+        private uint _writeBufferSize;
+        private bool _actual;
+
+        [TestInitialize]
+        public void Setup()
+        {
+            Arrange();
+            Act();
+        }
+
+        protected void Arrange()
+        {
+            var random = new Random();
+            _path = random.Next().ToString(CultureInfo.InvariantCulture);
+            _handle = new[] { (byte)random.Next(byte.MinValue, byte.MaxValue) };
+            _fileAttributes = SftpFileAttributes.Empty;
+            _bufferSize = (uint)random.Next(0, 1000);
+            _readBufferSize = (uint)random.Next(0, 1000);
+            _writeBufferSize = (uint)random.Next(0, 1000);
+
+            _sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
+
+            var sequence = new MockSequence();
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Truncate, true))
+                .Returns(_handle);
+            _sftpSessionMock.InSequence(sequence).Setup(p => p.RequestFStat(_handle)).Returns(_fileAttributes);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.CalculateOptimalReadLength(_bufferSize))
+                .Returns(_readBufferSize);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.CalculateOptimalWriteLength(_bufferSize, _handle))
+                .Returns(_writeBufferSize);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.IsOpen)
+                .Returns(true);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.RequestClose(_handle));
+
+            _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.Read, (int)_bufferSize);
+            _sftpFileStream.Close();
+        }
+
+        protected void Act()
+        {
+            _actual = _sftpFileStream.CanWrite;
+        }
+
+        [TestMethod]
+        public void CanWriteShouldReturnFalse()
+        {
+            Assert.IsFalse(_actual);
+        }
+    }
+}

+ 74 - 74
src/Renci.SshNet.Tests/Classes/Sftp/SftpFileStreamTest_CanWrite_Closed_FileAccessReadWrite.cs

@@ -1,74 +1,74 @@
-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
-{
-    [TestClass]
-    public class SftpFileStreamTest_CanWrite_Closed_FileAccessReadWrite
-    {
-        private Mock<ISftpSession> _sftpSessionMock;
-        private string _path;
-        private SftpFileStream _sftpFileStream;
-        private byte[] _handle;
-        private SftpFileAttributes _fileAttributes;
-        private uint _bufferSize;
-        private uint _readBufferSize;
-        private uint _writeBufferSize;
-        private bool _actual;
-
-        [TestInitialize]
-        public void Setup()
-        {
-            Arrange();
-            Act();
-        }
-
-        protected void Arrange()
-        {
-            var random = new Random();
-            _path = random.Next().ToString(CultureInfo.InvariantCulture);
-            _handle = new[] {(byte) random.Next(byte.MinValue, byte.MaxValue)};
-            _fileAttributes = SftpFileAttributes.Empty;
-            _bufferSize = (uint)random.Next(0, 1000);
-            _readBufferSize = (uint)random.Next(0, 1000);
-            _writeBufferSize = (uint)random.Next(0, 1000);
-
-            _sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
-
-            var sequence = new MockSequence();
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Write | Flags.Truncate, true))
-                .Returns(_handle);
-            _sftpSessionMock.InSequence(sequence).Setup(p => p.RequestFStat(_handle)).Returns(_fileAttributes);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.CalculateOptimalReadLength(_bufferSize))
-                .Returns(_readBufferSize);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.CalculateOptimalWriteLength(_bufferSize, _handle))
-                .Returns(_writeBufferSize);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.IsOpen)
-                .Returns(true);
-            _sftpSessionMock.InSequence(sequence)
-                .Setup(p => p.RequestClose(_handle));
-
-            _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.ReadWrite, (int)_bufferSize);
-            _sftpFileStream.Close();
-        }
-
-        protected void Act()
-        {
-            _actual = _sftpFileStream.CanWrite;
-        }
-
-        [TestMethod]
-        public void CanWriteShouldReturnFalse()
-        {
-            Assert.IsFalse(_actual);
-        }
-    }
-}
+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
+{
+    [TestClass]
+    public class SftpFileStreamTest_CanWrite_Closed_FileAccessReadWrite
+    {
+        private Mock<ISftpSession> _sftpSessionMock;
+        private string _path;
+        private SftpFileStream _sftpFileStream;
+        private byte[] _handle;
+        private SftpFileAttributes _fileAttributes;
+        private uint _bufferSize;
+        private uint _readBufferSize;
+        private uint _writeBufferSize;
+        private bool _actual;
+
+        [TestInitialize]
+        public void Setup()
+        {
+            Arrange();
+            Act();
+        }
+
+        protected void Arrange()
+        {
+            var random = new Random();
+            _path = random.Next().ToString(CultureInfo.InvariantCulture);
+            _handle = new[] {(byte) random.Next(byte.MinValue, byte.MaxValue)};
+            _fileAttributes = SftpFileAttributes.Empty;
+            _bufferSize = (uint)random.Next(0, 1000);
+            _readBufferSize = (uint)random.Next(0, 1000);
+            _writeBufferSize = (uint)random.Next(0, 1000);
+
+            _sftpSessionMock = new Mock<ISftpSession>(MockBehavior.Strict);
+
+            var sequence = new MockSequence();
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.RequestOpen(_path, Flags.Read | Flags.Write | Flags.Truncate, true))
+                .Returns(_handle);
+            _sftpSessionMock.InSequence(sequence).Setup(p => p.RequestFStat(_handle)).Returns(_fileAttributes);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.CalculateOptimalReadLength(_bufferSize))
+                .Returns(_readBufferSize);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.CalculateOptimalWriteLength(_bufferSize, _handle))
+                .Returns(_writeBufferSize);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.IsOpen)
+                .Returns(true);
+            _sftpSessionMock.InSequence(sequence)
+                .Setup(p => p.RequestClose(_handle));
+
+            _sftpFileStream = new SftpFileStream(_sftpSessionMock.Object, _path, FileMode.Create, FileAccess.ReadWrite, (int)_bufferSize);
+            _sftpFileStream.Close();
+        }
+
+        protected void Act()
+        {
+            _actual = _sftpFileStream.CanWrite;
+        }
+
+        [TestMethod]
+        public void CanWriteShouldReturnFalse()
+        {
+            Assert.IsFalse(_actual);
+        }
+    }
+}

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