2
0
Эх сурвалжийг харах

Mark integration tests as such.

drieseng 9 жил өмнө
parent
commit
ffd9675203

+ 108 - 106
src/Renci.SshNet.Tests/Classes/ScpClientTest.NET40.cs

@@ -1,107 +1,109 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Common;
-using Renci.SshNet.Tests.Properties;
-using System.IO;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace Renci.SshNet.Tests.Classes
-{
-    /// <summary>
-    /// Provides SCP client functionality.
-    /// </summary>
-    public partial class ScpClientTest
-    {
-        [TestMethod]
-        [TestCategory("Scp")]
-        public void Test_Scp_File_20_Parallel_Upload_Download()
-        {
-            using (var scp = new ScpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
-            {
-                scp.Connect();
-
-                var uploadFilenames = new string[20];
-                for (int i = 0; i < uploadFilenames.Length; i++)
-                {
-                    uploadFilenames[i] = Path.GetTempFileName();
-                    this.CreateTestFile(uploadFilenames[i], 1);
-                }
-
-                Parallel.ForEach(uploadFilenames,
-                    (filename) =>
-                    {
-                        scp.Upload(new FileInfo(filename), Path.GetFileName(filename));
-                    });
-
-                Parallel.ForEach(uploadFilenames,
-                    (filename) =>
-                    {
-                        scp.Download(Path.GetFileName(filename), new FileInfo(string.Format("{0}.down", filename)));
-                    });
-
-                var result = from file in uploadFilenames
-                             where
-                                 CalculateMD5(file) == CalculateMD5(string.Format("{0}.down", file))
-                             select file;
-
-                scp.Disconnect();
-
-                Assert.IsTrue(result.Count() == uploadFilenames.Length);
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("Scp")]
-        public void Test_Scp_File_Upload_Download_Events()
-        {
-            using (var scp = new ScpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
-            {
-                scp.Connect();
-
-                var uploadFilenames = new string[10];
-
-                for (int i = 0; i < uploadFilenames.Length; i++)
-                {
-                    uploadFilenames[i] = Path.GetTempFileName();
-                    this.CreateTestFile(uploadFilenames[i], 1);
-                }
-
-                var uploadedFiles = uploadFilenames.ToDictionary((filename) => Path.GetFileName(filename), (filename) => 0L);
-                var downloadedFiles = uploadFilenames.ToDictionary((filename) => string.Format("{0}.down", Path.GetFileName(filename)), (filename) => 0L);
-
-                scp.Uploading += delegate(object sender, ScpUploadEventArgs e)
-                {
-                    uploadedFiles[e.Filename] = e.Uploaded;
-                };
-
-                scp.Downloading += delegate(object sender, ScpDownloadEventArgs e)
-                {
-                    downloadedFiles[string.Format("{0}.down", e.Filename)] = e.Downloaded;
-                };
-
-                Parallel.ForEach(uploadFilenames,
-                    (filename) =>
-                    {
-                        scp.Upload(new FileInfo(filename), Path.GetFileName(filename));
-                    });
-
-                Parallel.ForEach(uploadFilenames,
-                    (filename) =>
-                    {
-                        scp.Download(Path.GetFileName(filename), new FileInfo(string.Format("{0}.down", filename)));
-                    });
-
-                var result = from uf in uploadedFiles
-                             from df in downloadedFiles
-                             where
-                                 string.Format("{0}.down", uf.Key) == df.Key
-                                 && uf.Value == df.Value
-                             select uf;
-
-                scp.Disconnect();
-
-                Assert.IsTrue(result.Count() == uploadFilenames.Length && uploadFilenames.Length == uploadedFiles.Count && uploadedFiles.Count == downloadedFiles.Count);
-            }
-        }
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Common;
+using Renci.SshNet.Tests.Properties;
+using System.IO;
+using System.Linq;
+using System.Threading.Tasks;
+
+namespace Renci.SshNet.Tests.Classes
+{
+    /// <summary>
+    /// Provides SCP client functionality.
+    /// </summary>
+    public partial class ScpClientTest
+    {
+        [TestMethod]
+        [TestCategory("Scp")]
+        [TestCategory("integration")]
+        public void Test_Scp_File_20_Parallel_Upload_Download()
+        {
+            using (var scp = new ScpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
+            {
+                scp.Connect();
+
+                var uploadFilenames = new string[20];
+                for (int i = 0; i < uploadFilenames.Length; i++)
+                {
+                    uploadFilenames[i] = Path.GetTempFileName();
+                    this.CreateTestFile(uploadFilenames[i], 1);
+                }
+
+                Parallel.ForEach(uploadFilenames,
+                    (filename) =>
+                    {
+                        scp.Upload(new FileInfo(filename), Path.GetFileName(filename));
+                    });
+
+                Parallel.ForEach(uploadFilenames,
+                    (filename) =>
+                    {
+                        scp.Download(Path.GetFileName(filename), new FileInfo(string.Format("{0}.down", filename)));
+                    });
+
+                var result = from file in uploadFilenames
+                             where
+                                 CalculateMD5(file) == CalculateMD5(string.Format("{0}.down", file))
+                             select file;
+
+                scp.Disconnect();
+
+                Assert.IsTrue(result.Count() == uploadFilenames.Length);
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("Scp")]
+        [TestCategory("integration")]
+        public void Test_Scp_File_Upload_Download_Events()
+        {
+            using (var scp = new ScpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
+            {
+                scp.Connect();
+
+                var uploadFilenames = new string[10];
+
+                for (int i = 0; i < uploadFilenames.Length; i++)
+                {
+                    uploadFilenames[i] = Path.GetTempFileName();
+                    this.CreateTestFile(uploadFilenames[i], 1);
+                }
+
+                var uploadedFiles = uploadFilenames.ToDictionary((filename) => Path.GetFileName(filename), (filename) => 0L);
+                var downloadedFiles = uploadFilenames.ToDictionary((filename) => string.Format("{0}.down", Path.GetFileName(filename)), (filename) => 0L);
+
+                scp.Uploading += delegate(object sender, ScpUploadEventArgs e)
+                {
+                    uploadedFiles[e.Filename] = e.Uploaded;
+                };
+
+                scp.Downloading += delegate(object sender, ScpDownloadEventArgs e)
+                {
+                    downloadedFiles[string.Format("{0}.down", e.Filename)] = e.Downloaded;
+                };
+
+                Parallel.ForEach(uploadFilenames,
+                    (filename) =>
+                    {
+                        scp.Upload(new FileInfo(filename), Path.GetFileName(filename));
+                    });
+
+                Parallel.ForEach(uploadFilenames,
+                    (filename) =>
+                    {
+                        scp.Download(Path.GetFileName(filename), new FileInfo(string.Format("{0}.down", filename)));
+                    });
+
+                var result = from uf in uploadedFiles
+                             from df in downloadedFiles
+                             where
+                                 string.Format("{0}.down", uf.Key) == df.Key
+                                 && uf.Value == df.Value
+                             select uf;
+
+                scp.Disconnect();
+
+                Assert.IsTrue(result.Count() == uploadFilenames.Length && uploadFilenames.Length == uploadedFiles.Count && uploadedFiles.Count == downloadedFiles.Count);
+            }
+        }
+    }
 }

+ 430 - 425
src/Renci.SshNet.Tests/Classes/ScpClientTest.cs

@@ -1,426 +1,431 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Tests.Common;
-using Renci.SshNet.Tests.Properties;
-using System;
-using System.IO;
-using System.Linq;
-using System.Security.Cryptography;
-using System.Text;
-
-namespace Renci.SshNet.Tests.Classes
-{
-    /// <summary>
-    /// Provides SCP client functionality.
-    /// </summary>
-    [TestClass]
-    public partial class ScpClientTest : TestBase
-    {
-        [TestMethod]
-        [TestCategory("Scp")]
-        public void Test_Scp_File_Upload_Download()
-        {
-            RemoveAllFiles();
-
-            using (var scp = new ScpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
-            {
-                scp.Connect();
-
-                string uploadedFileName = Path.GetTempFileName();
-                string downloadedFileName = Path.GetTempFileName();
-
-                this.CreateTestFile(uploadedFileName, 1);
-
-                scp.Upload(new FileInfo(uploadedFileName), Path.GetFileName(uploadedFileName));
-
-                scp.Download(Path.GetFileName(uploadedFileName), new FileInfo(downloadedFileName));
-
-                //  Calculate MD5 value
-                var uploadedHash = CalculateMD5(uploadedFileName);
-                var downloadedHash = CalculateMD5(downloadedFileName);
-
-                File.Delete(uploadedFileName);
-                File.Delete(downloadedFileName);
-
-                scp.Disconnect();
-
-                Assert.AreEqual(uploadedHash, downloadedHash);
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("Scp")]
-        public void Test_Scp_Stream_Upload_Download()
-        {
-            RemoveAllFiles();
-
-            using (var scp = new ScpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
-            {
-                scp.Connect();
-
-                string uploadedFileName = Path.GetTempFileName();
-                string downloadedFileName = Path.GetTempFileName();
-
-                this.CreateTestFile(uploadedFileName, 1);
-
-                //  Calculate has value
-                using (var stream = File.OpenRead(uploadedFileName))
-                {
-                    scp.Upload(stream, Path.GetFileName(uploadedFileName));
-                }
-
-                using (var stream = File.OpenWrite(downloadedFileName))
-                {
-                    scp.Download(Path.GetFileName(uploadedFileName), stream);
-                }
-
-                //  Calculate MD5 value
-                var uploadedHash = CalculateMD5(uploadedFileName);
-                var downloadedHash = CalculateMD5(downloadedFileName);
-
-                File.Delete(uploadedFileName);
-                File.Delete(downloadedFileName);
-
-                scp.Disconnect();
-
-                Assert.AreEqual(uploadedHash, downloadedHash);
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("Scp")]
-        public void Test_Scp_10MB_File_Upload_Download()
-        {
-            RemoveAllFiles();
-
-            using (var scp = new ScpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
-            {
-                scp.Connect();
-
-                string uploadedFileName = Path.GetTempFileName();
-                string downloadedFileName = Path.GetTempFileName();
-
-                this.CreateTestFile(uploadedFileName, 10);
-
-                scp.Upload(new FileInfo(uploadedFileName), Path.GetFileName(uploadedFileName));
-
-                scp.Download(Path.GetFileName(uploadedFileName), new FileInfo(downloadedFileName));
-
-                //  Calculate MD5 value
-                var uploadedHash = CalculateMD5(uploadedFileName);
-                var downloadedHash = CalculateMD5(downloadedFileName);
-
-                File.Delete(uploadedFileName);
-                File.Delete(downloadedFileName);
-
-                scp.Disconnect();
-
-                Assert.AreEqual(uploadedHash, downloadedHash);
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("Scp")]
-        public void Test_Scp_10MB_Stream_Upload_Download()
-        {
-            RemoveAllFiles();
-
-            using (var scp = new ScpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
-            {
-                scp.Connect();
-
-                string uploadedFileName = Path.GetTempFileName();
-                string downloadedFileName = Path.GetTempFileName();
-
-                this.CreateTestFile(uploadedFileName, 10);
-
-                //  Calculate has value
-                using (var stream = File.OpenRead(uploadedFileName))
-                {
-                    scp.Upload(stream, Path.GetFileName(uploadedFileName));
-                }
-
-                using (var stream = File.OpenWrite(downloadedFileName))
-                {
-                    scp.Download(Path.GetFileName(uploadedFileName), stream);
-                }
-
-                //  Calculate MD5 value
-                var uploadedHash = CalculateMD5(uploadedFileName);
-                var downloadedHash = CalculateMD5(downloadedFileName);
-
-                File.Delete(uploadedFileName);
-                File.Delete(downloadedFileName);
-
-                scp.Disconnect();
-
-                Assert.AreEqual(uploadedHash, downloadedHash);
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("Scp")]
-        public void Test_Scp_Directory_Upload_Download()
-        {
-            RemoveAllFiles();
-
-            using (var scp = new ScpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
-            {
-                scp.Connect();
-
-                var uploadDirectory = Directory.CreateDirectory(string.Format("{0}\\{1}", Path.GetTempPath(), Path.GetRandomFileName()));
-                for (int i = 0; i < 3; i++)
-                {
-                    var subfolder = Directory.CreateDirectory(string.Format(@"{0}\folder_{1}", uploadDirectory.FullName, i));
-                    for (int j = 0; j < 5; j++)
-                    {
-                        this.CreateTestFile(string.Format(@"{0}\file_{1}", subfolder.FullName, j), 1);
-                    }
-                    this.CreateTestFile(string.Format(@"{0}\file_{1}", uploadDirectory.FullName, i), 1);
-                }
-
-                scp.Upload(uploadDirectory, "uploaded_dir");
-
-                var downloadDirectory = Directory.CreateDirectory(string.Format("{0}\\{1}", Path.GetTempPath(), Path.GetRandomFileName()));
-
-                scp.Download("uploaded_dir", downloadDirectory);
-
-                var uploadedFiles = uploadDirectory.GetFiles("*.*", System.IO.SearchOption.AllDirectories);
-                var downloadFiles = downloadDirectory.GetFiles("*.*", System.IO.SearchOption.AllDirectories);
-
-                var result = from f1 in uploadedFiles
-                             from f2 in downloadFiles
-                             where
-                                f1.FullName.Substring(uploadDirectory.FullName.Length) == f2.FullName.Substring(downloadDirectory.FullName.Length)
-                                && CalculateMD5(f1.FullName) == CalculateMD5(f2.FullName)
-                             select f1;
-
-                var counter = result.Count();
-
-                scp.Disconnect();
-
-                Assert.IsTrue(counter == uploadedFiles.Length && uploadedFiles.Length == downloadFiles.Length);
-            }
-        }
-
-        /// <summary>
-        ///A test for OperationTimeout
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void OperationTimeoutTest()
-        {
-            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
-            ScpClient target = new ScpClient(connectionInfo); // TODO: Initialize to an appropriate value
-            TimeSpan expected = new TimeSpan(); // TODO: Initialize to an appropriate value
-            TimeSpan actual;
-            target.OperationTimeout = expected;
-            actual = target.OperationTimeout;
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for BufferSize
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void BufferSizeTest()
-        {
-            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
-            ScpClient target = new ScpClient(connectionInfo); // TODO: Initialize to an appropriate value
-            uint expected = 0; // TODO: Initialize to an appropriate value
-            uint actual;
-            target.BufferSize = expected;
-            actual = target.BufferSize;
-            Assert.AreEqual(expected, actual);
-            Assert.Inconclusive("Verify the correctness of this test method.");
-        }
-
-        /// <summary>
-        ///A test for Upload
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void UploadTest()
-        {
-            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
-            ScpClient target = new ScpClient(connectionInfo); // TODO: Initialize to an appropriate value
-            DirectoryInfo directoryInfo = null; // TODO: Initialize to an appropriate value
-            string filename = string.Empty; // TODO: Initialize to an appropriate value
-            target.Upload(directoryInfo, filename);
-            Assert.Inconclusive("A method that does not return a value cannot be verified.");
-        }
-
-        /// <summary>
-        ///A test for Upload
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void UploadTest1()
-        {
-            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
-            ScpClient target = new ScpClient(connectionInfo); // TODO: Initialize to an appropriate value
-            FileInfo fileInfo = null; // TODO: Initialize to an appropriate value
-            string filename = string.Empty; // TODO: Initialize to an appropriate value
-            target.Upload(fileInfo, filename);
-            Assert.Inconclusive("A method that does not return a value cannot be verified.");
-        }
-
-        /// <summary>
-        ///A test for Upload
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void UploadTest2()
-        {
-            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
-            ScpClient target = new ScpClient(connectionInfo); // TODO: Initialize to an appropriate value
-            Stream source = null; // TODO: Initialize to an appropriate value
-            string filename = string.Empty; // TODO: Initialize to an appropriate value
-            target.Upload(source, filename);
-            Assert.Inconclusive("A method that does not return a value cannot be verified.");
-        }
-
-        /// <summary>
-        ///A test for Download
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DownloadTest()
-        {
-            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
-            ScpClient target = new ScpClient(connectionInfo); // TODO: Initialize to an appropriate value
-            string directoryName = string.Empty; // TODO: Initialize to an appropriate value
-            DirectoryInfo directoryInfo = null; // TODO: Initialize to an appropriate value
-            target.Download(directoryName, directoryInfo);
-            Assert.Inconclusive("A method that does not return a value cannot be verified.");
-        }
-
-        /// <summary>
-        ///A test for Download
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DownloadTest1()
-        {
-            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
-            ScpClient target = new ScpClient(connectionInfo); // TODO: Initialize to an appropriate value
-            string filename = string.Empty; // TODO: Initialize to an appropriate value
-            FileInfo fileInfo = null; // TODO: Initialize to an appropriate value
-            target.Download(filename, fileInfo);
-            Assert.Inconclusive("A method that does not return a value cannot be verified.");
-        }
-
-        /// <summary>
-        ///A test for Download
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void DownloadTest2()
-        {
-            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
-            ScpClient target = new ScpClient(connectionInfo); // TODO: Initialize to an appropriate value
-            string filename = string.Empty; // TODO: Initialize to an appropriate value
-            Stream destination = null; // TODO: Initialize to an appropriate value
-            target.Download(filename, destination);
-            Assert.Inconclusive("A method that does not return a value cannot be verified.");
-        }
-
-        /// <summary>
-        ///A test for ScpClient Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void ScpClientConstructorTest()
-        {
-            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
-            ScpClient target = new ScpClient(host, username, keyFiles);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for ScpClient Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void ScpClientConstructorTest1()
-        {
-            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
-            ScpClient target = new ScpClient(host, port, username, keyFiles);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for ScpClient Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void ScpClientConstructorTest2()
-        {
-            string host = string.Empty; // TODO: Initialize to an appropriate value
-            string username = string.Empty; // TODO: Initialize to an appropriate value
-            string password = string.Empty; // TODO: Initialize to an appropriate value
-            ScpClient target = new ScpClient(host, username, password);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for ScpClient Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void ScpClientConstructorTest3()
-        {
-            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
-            string password = string.Empty; // TODO: Initialize to an appropriate value
-            ScpClient target = new ScpClient(host, port, username, password);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        /// <summary>
-        ///A test for ScpClient Constructor
-        ///</summary>
-        [TestMethod]
-        [Ignore] // placeholder for actual test
-        public void ScpClientConstructorTest4()
-        {
-            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
-            ScpClient target = new ScpClient(connectionInfo);
-            Assert.Inconclusive("TODO: Implement code to verify target");
-        }
-
-        protected static string CalculateMD5(string fileName)
-        {
-            using (var file = new FileStream(fileName, FileMode.Open))
-            {
-                var md5 = new MD5CryptoServiceProvider();
-                byte[] retVal = md5.ComputeHash(file);
-                file.Close();
-
-                var sb = new StringBuilder();
-                for (var i = 0; i < retVal.Length; i++)
-                {
-                    sb.Append(i.ToString("x2"));
-                }
-                return sb.ToString();
-            }
-        }
-
-        private static void RemoveAllFiles()
-        {
-            using (var client = new SshClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
-            {
-                client.Connect();
-                client.RunCommand("rm -rf *");
-                client.Disconnect();
-            }
-        }
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Tests.Common;
+using Renci.SshNet.Tests.Properties;
+using System;
+using System.IO;
+using System.Linq;
+using System.Security.Cryptography;
+using System.Text;
+
+namespace Renci.SshNet.Tests.Classes
+{
+    /// <summary>
+    /// Provides SCP client functionality.
+    /// </summary>
+    [TestClass]
+    public partial class ScpClientTest : TestBase
+    {
+        [TestMethod]
+        [TestCategory("Scp")]
+        [TestCategory("integration")]
+        public void Test_Scp_File_Upload_Download()
+        {
+            RemoveAllFiles();
+
+            using (var scp = new ScpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
+            {
+                scp.Connect();
+
+                string uploadedFileName = Path.GetTempFileName();
+                string downloadedFileName = Path.GetTempFileName();
+
+                this.CreateTestFile(uploadedFileName, 1);
+
+                scp.Upload(new FileInfo(uploadedFileName), Path.GetFileName(uploadedFileName));
+
+                scp.Download(Path.GetFileName(uploadedFileName), new FileInfo(downloadedFileName));
+
+                //  Calculate MD5 value
+                var uploadedHash = CalculateMD5(uploadedFileName);
+                var downloadedHash = CalculateMD5(downloadedFileName);
+
+                File.Delete(uploadedFileName);
+                File.Delete(downloadedFileName);
+
+                scp.Disconnect();
+
+                Assert.AreEqual(uploadedHash, downloadedHash);
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("Scp")]
+        [TestCategory("integration")]
+        public void Test_Scp_Stream_Upload_Download()
+        {
+            RemoveAllFiles();
+
+            using (var scp = new ScpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
+            {
+                scp.Connect();
+
+                string uploadedFileName = Path.GetTempFileName();
+                string downloadedFileName = Path.GetTempFileName();
+
+                this.CreateTestFile(uploadedFileName, 1);
+
+                //  Calculate has value
+                using (var stream = File.OpenRead(uploadedFileName))
+                {
+                    scp.Upload(stream, Path.GetFileName(uploadedFileName));
+                }
+
+                using (var stream = File.OpenWrite(downloadedFileName))
+                {
+                    scp.Download(Path.GetFileName(uploadedFileName), stream);
+                }
+
+                //  Calculate MD5 value
+                var uploadedHash = CalculateMD5(uploadedFileName);
+                var downloadedHash = CalculateMD5(downloadedFileName);
+
+                File.Delete(uploadedFileName);
+                File.Delete(downloadedFileName);
+
+                scp.Disconnect();
+
+                Assert.AreEqual(uploadedHash, downloadedHash);
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("Scp")]
+        [TestCategory("integration")]
+        public void Test_Scp_10MB_File_Upload_Download()
+        {
+            RemoveAllFiles();
+
+            using (var scp = new ScpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
+            {
+                scp.Connect();
+
+                string uploadedFileName = Path.GetTempFileName();
+                string downloadedFileName = Path.GetTempFileName();
+
+                this.CreateTestFile(uploadedFileName, 10);
+
+                scp.Upload(new FileInfo(uploadedFileName), Path.GetFileName(uploadedFileName));
+
+                scp.Download(Path.GetFileName(uploadedFileName), new FileInfo(downloadedFileName));
+
+                //  Calculate MD5 value
+                var uploadedHash = CalculateMD5(uploadedFileName);
+                var downloadedHash = CalculateMD5(downloadedFileName);
+
+                File.Delete(uploadedFileName);
+                File.Delete(downloadedFileName);
+
+                scp.Disconnect();
+
+                Assert.AreEqual(uploadedHash, downloadedHash);
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("Scp")]
+        [TestCategory("integration")]
+        public void Test_Scp_10MB_Stream_Upload_Download()
+        {
+            RemoveAllFiles();
+
+            using (var scp = new ScpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
+            {
+                scp.Connect();
+
+                string uploadedFileName = Path.GetTempFileName();
+                string downloadedFileName = Path.GetTempFileName();
+
+                this.CreateTestFile(uploadedFileName, 10);
+
+                //  Calculate has value
+                using (var stream = File.OpenRead(uploadedFileName))
+                {
+                    scp.Upload(stream, Path.GetFileName(uploadedFileName));
+                }
+
+                using (var stream = File.OpenWrite(downloadedFileName))
+                {
+                    scp.Download(Path.GetFileName(uploadedFileName), stream);
+                }
+
+                //  Calculate MD5 value
+                var uploadedHash = CalculateMD5(uploadedFileName);
+                var downloadedHash = CalculateMD5(downloadedFileName);
+
+                File.Delete(uploadedFileName);
+                File.Delete(downloadedFileName);
+
+                scp.Disconnect();
+
+                Assert.AreEqual(uploadedHash, downloadedHash);
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("Scp")]
+        [TestCategory("integration")]
+        public void Test_Scp_Directory_Upload_Download()
+        {
+            RemoveAllFiles();
+
+            using (var scp = new ScpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
+            {
+                scp.Connect();
+
+                var uploadDirectory = Directory.CreateDirectory(string.Format("{0}\\{1}", Path.GetTempPath(), Path.GetRandomFileName()));
+                for (int i = 0; i < 3; i++)
+                {
+                    var subfolder = Directory.CreateDirectory(string.Format(@"{0}\folder_{1}", uploadDirectory.FullName, i));
+                    for (int j = 0; j < 5; j++)
+                    {
+                        this.CreateTestFile(string.Format(@"{0}\file_{1}", subfolder.FullName, j), 1);
+                    }
+                    this.CreateTestFile(string.Format(@"{0}\file_{1}", uploadDirectory.FullName, i), 1);
+                }
+
+                scp.Upload(uploadDirectory, "uploaded_dir");
+
+                var downloadDirectory = Directory.CreateDirectory(string.Format("{0}\\{1}", Path.GetTempPath(), Path.GetRandomFileName()));
+
+                scp.Download("uploaded_dir", downloadDirectory);
+
+                var uploadedFiles = uploadDirectory.GetFiles("*.*", System.IO.SearchOption.AllDirectories);
+                var downloadFiles = downloadDirectory.GetFiles("*.*", System.IO.SearchOption.AllDirectories);
+
+                var result = from f1 in uploadedFiles
+                             from f2 in downloadFiles
+                             where
+                                f1.FullName.Substring(uploadDirectory.FullName.Length) == f2.FullName.Substring(downloadDirectory.FullName.Length)
+                                && CalculateMD5(f1.FullName) == CalculateMD5(f2.FullName)
+                             select f1;
+
+                var counter = result.Count();
+
+                scp.Disconnect();
+
+                Assert.IsTrue(counter == uploadedFiles.Length && uploadedFiles.Length == downloadFiles.Length);
+            }
+        }
+
+        /// <summary>
+        ///A test for OperationTimeout
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void OperationTimeoutTest()
+        {
+            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
+            ScpClient target = new ScpClient(connectionInfo); // TODO: Initialize to an appropriate value
+            TimeSpan expected = new TimeSpan(); // TODO: Initialize to an appropriate value
+            TimeSpan actual;
+            target.OperationTimeout = expected;
+            actual = target.OperationTimeout;
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for BufferSize
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void BufferSizeTest()
+        {
+            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
+            ScpClient target = new ScpClient(connectionInfo); // TODO: Initialize to an appropriate value
+            uint expected = 0; // TODO: Initialize to an appropriate value
+            uint actual;
+            target.BufferSize = expected;
+            actual = target.BufferSize;
+            Assert.AreEqual(expected, actual);
+            Assert.Inconclusive("Verify the correctness of this test method.");
+        }
+
+        /// <summary>
+        ///A test for Upload
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void UploadTest()
+        {
+            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
+            ScpClient target = new ScpClient(connectionInfo); // TODO: Initialize to an appropriate value
+            DirectoryInfo directoryInfo = null; // TODO: Initialize to an appropriate value
+            string filename = string.Empty; // TODO: Initialize to an appropriate value
+            target.Upload(directoryInfo, filename);
+            Assert.Inconclusive("A method that does not return a value cannot be verified.");
+        }
+
+        /// <summary>
+        ///A test for Upload
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void UploadTest1()
+        {
+            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
+            ScpClient target = new ScpClient(connectionInfo); // TODO: Initialize to an appropriate value
+            FileInfo fileInfo = null; // TODO: Initialize to an appropriate value
+            string filename = string.Empty; // TODO: Initialize to an appropriate value
+            target.Upload(fileInfo, filename);
+            Assert.Inconclusive("A method that does not return a value cannot be verified.");
+        }
+
+        /// <summary>
+        ///A test for Upload
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void UploadTest2()
+        {
+            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
+            ScpClient target = new ScpClient(connectionInfo); // TODO: Initialize to an appropriate value
+            Stream source = null; // TODO: Initialize to an appropriate value
+            string filename = string.Empty; // TODO: Initialize to an appropriate value
+            target.Upload(source, filename);
+            Assert.Inconclusive("A method that does not return a value cannot be verified.");
+        }
+
+        /// <summary>
+        ///A test for Download
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DownloadTest()
+        {
+            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
+            ScpClient target = new ScpClient(connectionInfo); // TODO: Initialize to an appropriate value
+            string directoryName = string.Empty; // TODO: Initialize to an appropriate value
+            DirectoryInfo directoryInfo = null; // TODO: Initialize to an appropriate value
+            target.Download(directoryName, directoryInfo);
+            Assert.Inconclusive("A method that does not return a value cannot be verified.");
+        }
+
+        /// <summary>
+        ///A test for Download
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DownloadTest1()
+        {
+            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
+            ScpClient target = new ScpClient(connectionInfo); // TODO: Initialize to an appropriate value
+            string filename = string.Empty; // TODO: Initialize to an appropriate value
+            FileInfo fileInfo = null; // TODO: Initialize to an appropriate value
+            target.Download(filename, fileInfo);
+            Assert.Inconclusive("A method that does not return a value cannot be verified.");
+        }
+
+        /// <summary>
+        ///A test for Download
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void DownloadTest2()
+        {
+            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
+            ScpClient target = new ScpClient(connectionInfo); // TODO: Initialize to an appropriate value
+            string filename = string.Empty; // TODO: Initialize to an appropriate value
+            Stream destination = null; // TODO: Initialize to an appropriate value
+            target.Download(filename, destination);
+            Assert.Inconclusive("A method that does not return a value cannot be verified.");
+        }
+
+        /// <summary>
+        ///A test for ScpClient Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void ScpClientConstructorTest()
+        {
+            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
+            ScpClient target = new ScpClient(host, username, keyFiles);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for ScpClient Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void ScpClientConstructorTest1()
+        {
+            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
+            ScpClient target = new ScpClient(host, port, username, keyFiles);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for ScpClient Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void ScpClientConstructorTest2()
+        {
+            string host = string.Empty; // TODO: Initialize to an appropriate value
+            string username = string.Empty; // TODO: Initialize to an appropriate value
+            string password = string.Empty; // TODO: Initialize to an appropriate value
+            ScpClient target = new ScpClient(host, username, password);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for ScpClient Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void ScpClientConstructorTest3()
+        {
+            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
+            string password = string.Empty; // TODO: Initialize to an appropriate value
+            ScpClient target = new ScpClient(host, port, username, password);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        /// <summary>
+        ///A test for ScpClient Constructor
+        ///</summary>
+        [TestMethod]
+        [Ignore] // placeholder for actual test
+        public void ScpClientConstructorTest4()
+        {
+            ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
+            ScpClient target = new ScpClient(connectionInfo);
+            Assert.Inconclusive("TODO: Implement code to verify target");
+        }
+
+        protected static string CalculateMD5(string fileName)
+        {
+            using (var file = new FileStream(fileName, FileMode.Open))
+            {
+                var md5 = new MD5CryptoServiceProvider();
+                byte[] retVal = md5.ComputeHash(file);
+                file.Close();
+
+                var sb = new StringBuilder();
+                for (var i = 0; i < retVal.Length; i++)
+                {
+                    sb.Append(i.ToString("x2"));
+                }
+                return sb.ToString();
+            }
+        }
+
+        private static void RemoveAllFiles()
+        {
+            using (var client = new SshClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
+            {
+                client.Connect();
+                client.RunCommand("rm -rf *");
+                client.Disconnect();
+            }
+        }
+    }
 }

+ 138 - 140
src/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_FileInfoAndPath_SendExecRequestReturnsFalse.cs

@@ -1,140 +1,138 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.IO;
-using System.Linq;
-using System.Text;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Moq;
-using Renci.SshNet.Channels;
-using Renci.SshNet.Common;
-
-namespace Renci.SshNet.Tests.Classes
-{
-    [TestClass]
-    public class ScpClientTest_Upload_FileInfoAndPath_SendExecRequestReturnsFalse
-    {
-        private Mock<IServiceFactory> _serviceFactoryMock;
-        private Mock<ISession> _sessionMock;
-        private Mock<IChannelSession> _channelSessionMock;
-        private Mock<PipeStream> _pipeStreamMock;
-        private ConnectionInfo _connectionInfo;
-        private ScpClient _scpClient;
-        private FileInfo _fileInfo;
-        private string _path;
-        private string _fileName;
-        private IList<ScpUploadEventArgs> _uploadingRegister;
-        private SshException _actualException;
-
-        [TestInitialize]
-        public void Setup()
-        {
-            Arrange();
-            Act();
-        }
-
-        [TestCleanup]
-        public void Cleanup()
-        {
-            if (_fileName != null)
-            {
-                File.Delete(_fileName);
-                _fileName = null;
-            }
-        }
-
-        protected void Arrange()
-        {
-            var random = new Random();
-            _fileName = CreateTemporaryFile(new byte[] {1});
-            _connectionInfo = new ConnectionInfo("host", 22, "user", new PasswordAuthenticationMethod("user", "pwd"));
-            _fileInfo = new FileInfo(_fileName);
-            _path = random.Next().ToString(CultureInfo.InvariantCulture);
-            _uploadingRegister = new List<ScpUploadEventArgs>();
-
-            _serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
-            _sessionMock = new Mock<ISession>(MockBehavior.Strict);
-            _channelSessionMock = new Mock<IChannelSession>(MockBehavior.Strict);
-            _pipeStreamMock = new Mock<PipeStream>(MockBehavior.Strict);
-
-            var sequence = new MockSequence();
-            _serviceFactoryMock.InSequence(sequence)
-                .Setup(p => p.CreateSession(_connectionInfo))
-                .Returns(_sessionMock.Object);
-            _sessionMock.InSequence(sequence).Setup(p => p.Connect());
-            _serviceFactoryMock.InSequence(sequence).Setup(p => p.CreatePipeStream()).Returns(_pipeStreamMock.Object);
-            _sessionMock.InSequence(sequence).Setup(p => p.CreateChannelSession()).Returns(_channelSessionMock.Object);
-            _channelSessionMock.InSequence(sequence).Setup(p => p.Open());
-            _channelSessionMock.InSequence(sequence)
-                .Setup(
-                    p => p.SendExecRequest(string.Format("scp -t \"{0}\"", _path))).Returns(false);
-            _channelSessionMock.InSequence(sequence).Setup(p => p.Dispose());
-            _pipeStreamMock.As<IDisposable>().InSequence(sequence).Setup(p => p.Dispose());
-
-            _scpClient = new ScpClient(_connectionInfo, false, _serviceFactoryMock.Object);
-            _scpClient.Uploading += (sender, args) => _uploadingRegister.Add(args);
-            _scpClient.Connect();
-        }
-
-        protected virtual void Act()
-        {
-            try
-            {
-                _scpClient.Upload(_fileInfo, _path);
-                Assert.Fail();
-            }
-            catch (SshException ex)
-            {
-                _actualException = ex;
-            }
-        }
-
-        [TestMethod]
-        public void UploadShouldHaveThrownSshException()
-        {
-            Assert.IsNotNull(_actualException);
-            Assert.IsNull(_actualException.InnerException);
-            Assert.AreEqual("Secure copy execution request was rejected by the server. Please consult the server logs.", _actualException.Message);
-        }
-
-        [TestMethod]
-        public void SendExecREquestOnChannelSessionShouldBeInvokedOnce()
-        {
-            _channelSessionMock.Verify(p => p.SendExecRequest(string.Format("scp -t \"{0}\"", _path)), Times.Once);
-        }
-
-        [TestMethod]
-        public void CloseOnChannelShouldNeverBeInvoked()
-        {
-            _channelSessionMock.Verify(p => p.Close(), Times.Never);
-        }
-
-        [TestMethod]
-        public void DisposeOnChannelShouldBeInvokedOnce()
-        {
-            _channelSessionMock.Verify(p => p.Dispose(), Times.Once);
-        }
-
-        [TestMethod]
-        public void DisposeOnPipeStreamShouldBeInvokedOnce()
-        {
-            _pipeStreamMock.As<IDisposable>().Verify(p => p.Dispose(), Times.Once);
-        }
-
-        [TestMethod]
-        public void UploadingShouldNeverHaveFired()
-        {
-            Assert.AreEqual(0, _uploadingRegister.Count);
-        }
-
-        private string CreateTemporaryFile(byte[] content)
-        {
-            var tempFile = Path.GetTempFileName();
-            using (var fs = File.OpenWrite(tempFile))
-            {
-                fs.Write(content, 0, content.Length);
-            }
-            return tempFile;
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Moq;
+using Renci.SshNet.Channels;
+using Renci.SshNet.Common;
+
+namespace Renci.SshNet.Tests.Classes
+{
+    [TestClass]
+    public class ScpClientTest_Upload_FileInfoAndPath_SendExecRequestReturnsFalse
+    {
+        private Mock<IServiceFactory> _serviceFactoryMock;
+        private Mock<ISession> _sessionMock;
+        private Mock<IChannelSession> _channelSessionMock;
+        private Mock<PipeStream> _pipeStreamMock;
+        private ConnectionInfo _connectionInfo;
+        private ScpClient _scpClient;
+        private FileInfo _fileInfo;
+        private string _path;
+        private string _fileName;
+        private IList<ScpUploadEventArgs> _uploadingRegister;
+        private SshException _actualException;
+
+        [TestInitialize]
+        public void Setup()
+        {
+            Arrange();
+            Act();
+        }
+
+        [TestCleanup]
+        public void Cleanup()
+        {
+            if (_fileName != null)
+            {
+                File.Delete(_fileName);
+                _fileName = null;
+            }
+        }
+
+        protected void Arrange()
+        {
+            var random = new Random();
+            _fileName = CreateTemporaryFile(new byte[] {1});
+            _connectionInfo = new ConnectionInfo("host", 22, "user", new PasswordAuthenticationMethod("user", "pwd"));
+            _fileInfo = new FileInfo(_fileName);
+            _path = random.Next().ToString(CultureInfo.InvariantCulture);
+            _uploadingRegister = new List<ScpUploadEventArgs>();
+
+            _serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
+            _sessionMock = new Mock<ISession>(MockBehavior.Strict);
+            _channelSessionMock = new Mock<IChannelSession>(MockBehavior.Strict);
+            _pipeStreamMock = new Mock<PipeStream>(MockBehavior.Strict);
+
+            var sequence = new MockSequence();
+            _serviceFactoryMock.InSequence(sequence)
+                .Setup(p => p.CreateSession(_connectionInfo))
+                .Returns(_sessionMock.Object);
+            _sessionMock.InSequence(sequence).Setup(p => p.Connect());
+            _serviceFactoryMock.InSequence(sequence).Setup(p => p.CreatePipeStream()).Returns(_pipeStreamMock.Object);
+            _sessionMock.InSequence(sequence).Setup(p => p.CreateChannelSession()).Returns(_channelSessionMock.Object);
+            _channelSessionMock.InSequence(sequence).Setup(p => p.Open());
+            _channelSessionMock.InSequence(sequence)
+                .Setup(
+                    p => p.SendExecRequest(string.Format("scp -t \"{0}\"", _path))).Returns(false);
+            _channelSessionMock.InSequence(sequence).Setup(p => p.Dispose());
+            _pipeStreamMock.As<IDisposable>().InSequence(sequence).Setup(p => p.Dispose());
+
+            _scpClient = new ScpClient(_connectionInfo, false, _serviceFactoryMock.Object);
+            _scpClient.Uploading += (sender, args) => _uploadingRegister.Add(args);
+            _scpClient.Connect();
+        }
+
+        protected virtual void Act()
+        {
+            try
+            {
+                _scpClient.Upload(_fileInfo, _path);
+                Assert.Fail();
+            }
+            catch (SshException ex)
+            {
+                _actualException = ex;
+            }
+        }
+
+        [TestMethod]
+        public void UploadShouldHaveThrownSshException()
+        {
+            Assert.IsNotNull(_actualException);
+            Assert.IsNull(_actualException.InnerException);
+            Assert.AreEqual("Secure copy execution request was rejected by the server. Please consult the server logs.", _actualException.Message);
+        }
+
+        [TestMethod]
+        public void SendExecREquestOnChannelSessionShouldBeInvokedOnce()
+        {
+            _channelSessionMock.Verify(p => p.SendExecRequest(string.Format("scp -t \"{0}\"", _path)), Times.Once);
+        }
+
+        [TestMethod]
+        public void CloseOnChannelShouldNeverBeInvoked()
+        {
+            _channelSessionMock.Verify(p => p.Close(), Times.Never);
+        }
+
+        [TestMethod]
+        public void DisposeOnChannelShouldBeInvokedOnce()
+        {
+            _channelSessionMock.Verify(p => p.Dispose(), Times.Once);
+        }
+
+        [TestMethod]
+        public void DisposeOnPipeStreamShouldBeInvokedOnce()
+        {
+            _pipeStreamMock.As<IDisposable>().Verify(p => p.Dispose(), Times.Once);
+        }
+
+        [TestMethod]
+        public void UploadingShouldNeverHaveFired()
+        {
+            Assert.AreEqual(0, _uploadingRegister.Count);
+        }
+
+        private string CreateTemporaryFile(byte[] content)
+        {
+            var tempFile = Path.GetTempFileName();
+            using (var fs = File.OpenWrite(tempFile))
+            {
+                fs.Write(content, 0, content.Length);
+            }
+            return tempFile;
+        }
+    }
+}

+ 189 - 188
src/Renci.SshNet.Tests/Classes/ScpClientTest_Upload_FileInfoAndPath_Success.cs

@@ -1,188 +1,189 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.IO;
-using System.Linq;
-using System.Text;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Moq;
-using Renci.SshNet.Channels;
-using Renci.SshNet.Common;
-
-namespace Renci.SshNet.Tests.Classes
-{
-    [TestClass]
-    public class ScpClientTest_Upload_FileInfoAndPath_Success
-    {
-        private Mock<IServiceFactory> _serviceFactoryMock;
-        private Mock<ISession> _sessionMock;
-        private Mock<IChannelSession> _channelSessionMock;
-        private Mock<PipeStream> _pipeStreamMock;
-        private ConnectionInfo _connectionInfo;
-        private ScpClient _scpClient;
-        private FileInfo _fileInfo;
-        private string _path;
-        private int _bufferSize;
-        private byte[] _fileContent;
-        private string _fileName;
-        private int _fileSize;
-        private IList<ScpUploadEventArgs> _uploadingRegister;
-        [TestInitialize]
-        public void Setup()
-        {
-            Arrange();
-            Act();
-        }
-
-        [TestCleanup]
-        public void Cleanup()
-        {
-            if (_fileName != null)
-            {
-                File.Delete(_fileName);
-                _fileName = null;
-            }
-        }
-
-        protected void Arrange()
-        {
-            var random = new Random();
-            _bufferSize = random.Next(5, 15);
-            _fileSize = _bufferSize + 2; //force uploading 2 chunks
-            _fileContent = CreateContent(_fileSize);
-            _fileName = CreateTemporaryFile(_fileContent);
-            _connectionInfo = new ConnectionInfo("host", 22, "user", new PasswordAuthenticationMethod("user", "pwd"));
-            _fileInfo = new FileInfo(_fileName);
-            _path = random.Next().ToString(CultureInfo.InvariantCulture);
-            _uploadingRegister = new List<ScpUploadEventArgs>();
-
-            _serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
-            _sessionMock = new Mock<ISession>(MockBehavior.Strict);
-            _channelSessionMock = new Mock<IChannelSession>(MockBehavior.Strict);
-            _pipeStreamMock = new Mock<PipeStream>(MockBehavior.Strict);
-
-            var sequence = new MockSequence();
-            _serviceFactoryMock.InSequence(sequence)
-                .Setup(p => p.CreateSession(_connectionInfo))
-                .Returns(_sessionMock.Object);
-            _sessionMock.InSequence(sequence).Setup(p => p.Connect());
-            _serviceFactoryMock.InSequence(sequence).Setup(p => p.CreatePipeStream()).Returns(_pipeStreamMock.Object);
-            _sessionMock.InSequence(sequence).Setup(p => p.CreateChannelSession()).Returns(_channelSessionMock.Object);
-            _channelSessionMock.InSequence(sequence).Setup(p => p.Open());
-            _channelSessionMock.InSequence(sequence)
-                .Setup(
-                    p => p.SendExecRequest(string.Format("scp -t \"{0}\"", _path))).Returns(true);
-            for (var i = 0; i < random.Next(1, 3); i++)
-                _pipeStreamMock.InSequence(sequence).Setup(p => p.ReadByte()).Returns(-1);
-            _pipeStreamMock.InSequence(sequence).Setup(p => p.ReadByte()).Returns(0);
-            _channelSessionMock.InSequence(sequence).Setup(p => p.SendData(It.IsAny<byte[]>()));
-            for (var i = 0; i < random.Next(1, 3); i++)
-                _pipeStreamMock.InSequence(sequence).Setup(p => p.ReadByte()).Returns(-1);
-            _pipeStreamMock.InSequence(sequence).Setup(p => p.ReadByte()).Returns(0);
-            _channelSessionMock.InSequence(sequence)
-                .Setup(p => p.SendData(It.Is<byte[]>(b => b.SequenceEqual(CreateData(
-                                                                            string.Format("C0644 {0} {1}\n",
-                                                                                          _fileInfo.Length,
-                                                                                           Path.GetFileName(_fileName)
-                                                                                         )
-                                                                                     )))));
-            for (var i = 0; i < random.Next(1, 3); i++)
-                _pipeStreamMock.InSequence(sequence).Setup(p => p.ReadByte()).Returns(-1);
-            _pipeStreamMock.InSequence(sequence).Setup(p => p.ReadByte()).Returns(0);
-            _channelSessionMock.InSequence(sequence)
-                .Setup(
-                    p => p.SendData(It.Is<byte[]>(b => b.SequenceEqual(_fileContent.Take(_bufferSize))), 0, _bufferSize));
-            _channelSessionMock.InSequence(sequence)
-                .Setup(
-                    p => p.SendData(It.Is<byte[]>(b => b.Take(0, _fileContent.Length - _bufferSize).SequenceEqual(_fileContent.Take(_bufferSize, _fileContent.Length - _bufferSize))), 0, _fileContent.Length - _bufferSize));
-            _channelSessionMock.InSequence(sequence)
-                .Setup(
-                    p => p.SendData(It.Is<byte[]>(b => b.SequenceEqual(new byte[] { 0 }))));
-            for (var i = 0; i < random.Next(1, 3); i++)
-                _pipeStreamMock.InSequence(sequence).Setup(p => p.ReadByte()).Returns(-1);
-            _pipeStreamMock.InSequence(sequence).Setup(p => p.ReadByte()).Returns(0);
-            _channelSessionMock.InSequence(sequence).Setup(p => p.Close());
-            _channelSessionMock.InSequence(sequence).Setup(p => p.Dispose());
-            _pipeStreamMock.As<IDisposable>().InSequence(sequence).Setup(p => p.Dispose());
-
-            _scpClient = new ScpClient(_connectionInfo, false, _serviceFactoryMock.Object)
-                {
-                    BufferSize = (uint) _bufferSize
-                };
-            _scpClient.Uploading += (sender, args) => _uploadingRegister.Add(args);
-            _scpClient.Connect();
-        }
-
-        protected virtual void Act()
-        {
-            _scpClient.Upload(_fileInfo, _path);
-        }
-
-        [TestMethod]
-        public void SendExecRequestOnChannelSessionShouldBeInvokedOnce()
-        {
-            _channelSessionMock.Verify(p => p.SendExecRequest(string.Format("scp -t \"{0}\"", _path)), Times.Once);
-        }
-
-        [TestMethod]
-        public void CloseOnChannelShouldBeInvokedOnce()
-        {
-            _channelSessionMock.Verify(p => p.Close(), Times.Once);
-        }
-
-        [TestMethod]
-        public void DisposeOnChannelShouldBeInvokedOnce()
-        {
-            _channelSessionMock.Verify(p => p.Dispose(), Times.Once);
-        }
-
-        [TestMethod]
-        public void DisposeOnPipeStreamShouldBeInvokedOnce()
-        {
-            _pipeStreamMock.As<IDisposable>().Verify(p => p.Dispose(), Times.Once);
-        }
-
-        [TestMethod]
-        public void UploadingShouldHaveFiredTwice()
-        {
-            Assert.AreEqual(2, _uploadingRegister.Count);
-
-            var uploading = _uploadingRegister[0];
-            Assert.IsNotNull(uploading);
-            Assert.AreSame(_fileInfo.Name, uploading.Filename);
-            Assert.AreEqual(_fileSize, uploading.Size);
-            Assert.AreEqual(_bufferSize, uploading.Uploaded);
-
-            uploading = _uploadingRegister[1];
-            Assert.IsNotNull(uploading);
-            Assert.AreSame(_fileInfo.Name, uploading.Filename);
-            Assert.AreEqual(_fileSize, uploading.Size);
-            Assert.AreEqual(_fileSize, uploading.Uploaded);
-        }
-
-        private IEnumerable<byte> CreateData(string command)
-        {
-            return Encoding.Default.GetBytes(command);
-        }
-
-        private byte[] CreateContent(int length)
-        {
-            var random = new Random();
-            var content = new byte[length];
-
-            for (var i = 0; i < length; i++)
-                content[i] = (byte) random.Next(byte.MinValue, byte.MaxValue);
-            return content;
-        }
-
-        private string CreateTemporaryFile(byte[] content)
-        {
-            var tempFile = Path.GetTempFileName();
-            using (var fs = File.OpenWrite(tempFile))
-            {
-                fs.Write(content, 0, content.Length);
-            }
-            return tempFile;
-        }
-    }
-}
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Text;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Moq;
+using Renci.SshNet.Channels;
+using Renci.SshNet.Common;
+
+namespace Renci.SshNet.Tests.Classes
+{
+    [TestClass]
+    public class ScpClientTest_Upload_FileInfoAndPath_Success
+    {
+        private Mock<IServiceFactory> _serviceFactoryMock;
+        private Mock<ISession> _sessionMock;
+        private Mock<IChannelSession> _channelSessionMock;
+        private Mock<PipeStream> _pipeStreamMock;
+        private ConnectionInfo _connectionInfo;
+        private ScpClient _scpClient;
+        private FileInfo _fileInfo;
+        private string _path;
+        private int _bufferSize;
+        private byte[] _fileContent;
+        private string _fileName;
+        private int _fileSize;
+        private IList<ScpUploadEventArgs> _uploadingRegister;
+
+        [TestInitialize]
+        public void Setup()
+        {
+            Arrange();
+            Act();
+        }
+
+        [TestCleanup]
+        public void Cleanup()
+        {
+            if (_fileName != null)
+            {
+                File.Delete(_fileName);
+                _fileName = null;
+            }
+        }
+
+        protected void Arrange()
+        {
+            var random = new Random();
+            _bufferSize = random.Next(5, 15);
+            _fileSize = _bufferSize + 2; //force uploading 2 chunks
+            _fileContent = CreateContent(_fileSize);
+            _fileName = CreateTemporaryFile(_fileContent);
+            _connectionInfo = new ConnectionInfo("host", 22, "user", new PasswordAuthenticationMethod("user", "pwd"));
+            _fileInfo = new FileInfo(_fileName);
+            _path = random.Next().ToString(CultureInfo.InvariantCulture);
+            _uploadingRegister = new List<ScpUploadEventArgs>();
+
+            _serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
+            _sessionMock = new Mock<ISession>(MockBehavior.Strict);
+            _channelSessionMock = new Mock<IChannelSession>(MockBehavior.Strict);
+            _pipeStreamMock = new Mock<PipeStream>(MockBehavior.Strict);
+
+            var sequence = new MockSequence();
+            _serviceFactoryMock.InSequence(sequence)
+                .Setup(p => p.CreateSession(_connectionInfo))
+                .Returns(_sessionMock.Object);
+            _sessionMock.InSequence(sequence).Setup(p => p.Connect());
+            _serviceFactoryMock.InSequence(sequence).Setup(p => p.CreatePipeStream()).Returns(_pipeStreamMock.Object);
+            _sessionMock.InSequence(sequence).Setup(p => p.CreateChannelSession()).Returns(_channelSessionMock.Object);
+            _channelSessionMock.InSequence(sequence).Setup(p => p.Open());
+            _channelSessionMock.InSequence(sequence)
+                .Setup(
+                    p => p.SendExecRequest(string.Format("scp -t \"{0}\"", _path))).Returns(true);
+            for (var i = 0; i < random.Next(1, 3); i++)
+                _pipeStreamMock.InSequence(sequence).Setup(p => p.ReadByte()).Returns(-1);
+            _pipeStreamMock.InSequence(sequence).Setup(p => p.ReadByte()).Returns(0);
+            _channelSessionMock.InSequence(sequence).Setup(p => p.SendData(It.IsAny<byte[]>()));
+            for (var i = 0; i < random.Next(1, 3); i++)
+                _pipeStreamMock.InSequence(sequence).Setup(p => p.ReadByte()).Returns(-1);
+            _pipeStreamMock.InSequence(sequence).Setup(p => p.ReadByte()).Returns(0);
+            _channelSessionMock.InSequence(sequence)
+                .Setup(p => p.SendData(It.Is<byte[]>(b => b.SequenceEqual(CreateData(
+                                                                            string.Format("C0644 {0} {1}\n",
+                                                                                          _fileInfo.Length,
+                                                                                           Path.GetFileName(_fileName)
+                                                                                         )
+                                                                                     )))));
+            for (var i = 0; i < random.Next(1, 3); i++)
+                _pipeStreamMock.InSequence(sequence).Setup(p => p.ReadByte()).Returns(-1);
+            _pipeStreamMock.InSequence(sequence).Setup(p => p.ReadByte()).Returns(0);
+            _channelSessionMock.InSequence(sequence)
+                .Setup(
+                    p => p.SendData(It.Is<byte[]>(b => b.SequenceEqual(_fileContent.Take(_bufferSize))), 0, _bufferSize));
+            _channelSessionMock.InSequence(sequence)
+                .Setup(
+                    p => p.SendData(It.Is<byte[]>(b => b.Take(0, _fileContent.Length - _bufferSize).SequenceEqual(_fileContent.Take(_bufferSize, _fileContent.Length - _bufferSize))), 0, _fileContent.Length - _bufferSize));
+            _channelSessionMock.InSequence(sequence)
+                .Setup(
+                    p => p.SendData(It.Is<byte[]>(b => b.SequenceEqual(new byte[] { 0 }))));
+            for (var i = 0; i < random.Next(1, 3); i++)
+                _pipeStreamMock.InSequence(sequence).Setup(p => p.ReadByte()).Returns(-1);
+            _pipeStreamMock.InSequence(sequence).Setup(p => p.ReadByte()).Returns(0);
+            _channelSessionMock.InSequence(sequence).Setup(p => p.Close());
+            _channelSessionMock.InSequence(sequence).Setup(p => p.Dispose());
+            _pipeStreamMock.As<IDisposable>().InSequence(sequence).Setup(p => p.Dispose());
+
+            _scpClient = new ScpClient(_connectionInfo, false, _serviceFactoryMock.Object)
+                {
+                    BufferSize = (uint) _bufferSize
+                };
+            _scpClient.Uploading += (sender, args) => _uploadingRegister.Add(args);
+            _scpClient.Connect();
+        }
+
+        protected virtual void Act()
+        {
+            _scpClient.Upload(_fileInfo, _path);
+        }
+
+        [TestMethod]
+        public void SendExecRequestOnChannelSessionShouldBeInvokedOnce()
+        {
+            _channelSessionMock.Verify(p => p.SendExecRequest(string.Format("scp -t \"{0}\"", _path)), Times.Once);
+        }
+
+        [TestMethod]
+        public void CloseOnChannelShouldBeInvokedOnce()
+        {
+            _channelSessionMock.Verify(p => p.Close(), Times.Once);
+        }
+
+        [TestMethod]
+        public void DisposeOnChannelShouldBeInvokedOnce()
+        {
+            _channelSessionMock.Verify(p => p.Dispose(), Times.Once);
+        }
+
+        [TestMethod]
+        public void DisposeOnPipeStreamShouldBeInvokedOnce()
+        {
+            _pipeStreamMock.As<IDisposable>().Verify(p => p.Dispose(), Times.Once);
+        }
+
+        [TestMethod]
+        public void UploadingShouldHaveFiredTwice()
+        {
+            Assert.AreEqual(2, _uploadingRegister.Count);
+
+            var uploading = _uploadingRegister[0];
+            Assert.IsNotNull(uploading);
+            Assert.AreSame(_fileInfo.Name, uploading.Filename);
+            Assert.AreEqual(_fileSize, uploading.Size);
+            Assert.AreEqual(_bufferSize, uploading.Uploaded);
+
+            uploading = _uploadingRegister[1];
+            Assert.IsNotNull(uploading);
+            Assert.AreSame(_fileInfo.Name, uploading.Filename);
+            Assert.AreEqual(_fileSize, uploading.Size);
+            Assert.AreEqual(_fileSize, uploading.Uploaded);
+        }
+
+        private IEnumerable<byte> CreateData(string command)
+        {
+            return Encoding.Default.GetBytes(command);
+        }
+
+        private byte[] CreateContent(int length)
+        {
+            var random = new Random();
+            var content = new byte[length];
+
+            for (var i = 0; i < length; i++)
+                content[i] = (byte) random.Next(byte.MinValue, byte.MaxValue);
+            return content;
+        }
+
+        private string CreateTemporaryFile(byte[] content)
+        {
+            var tempFile = Path.GetTempFileName();
+            using (var fs = File.OpenWrite(tempFile))
+            {
+                fs.Write(content, 0, content.Length);
+            }
+            return tempFile;
+        }
+    }
+}

+ 90 - 84
src/Renci.SshNet.Tests/Classes/SftpClientTest.ChangeDirectory.cs

@@ -1,85 +1,91 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Common;
-using Renci.SshNet.Tests.Common;
-using Renci.SshNet.Tests.Properties;
-
-namespace Renci.SshNet.Tests.Classes
-{
-    /// <summary>
-    /// Implementation of the SSH File Transfer Protocol (SFTP) over SSH.
-    /// </summary>
-    public partial class SftpClientTest : TestBase
-    {
-        [TestMethod]
-        [TestCategory("Sftp")]
-        [ExpectedException(typeof(SftpPathNotFoundException))]
-        public void Test_Sftp_ChangeDirectory_Root_Dont_Exists()
-        {
-            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
-            {
-                sftp.Connect();
-                sftp.ChangeDirectory("/asdasd");
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("Sftp")]
-        [ExpectedException(typeof(SftpPathNotFoundException))]
-        public void Test_Sftp_ChangeDirectory_Root_With_Slash_Dont_Exists()
-        {
-            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
-            {
-                sftp.Connect();
-                sftp.ChangeDirectory("/asdasd/");
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("Sftp")]
-        [ExpectedException(typeof(SftpPathNotFoundException))]
-        public void Test_Sftp_ChangeDirectory_Subfolder_Dont_Exists()
-        {
-            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
-            {
-                sftp.Connect();
-                sftp.ChangeDirectory("/asdasd/sssddds");
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("Sftp")]
-        [ExpectedException(typeof(SftpPathNotFoundException))]
-        public void Test_Sftp_ChangeDirectory_Subfolder_With_Slash_Dont_Exists()
-        {
-            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
-            {
-                sftp.Connect();
-                sftp.ChangeDirectory("/asdasd/sssddds/");
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("Sftp")]
-        public void Test_Sftp_ChangeDirectory_Which_Exists()
-        {
-            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
-            {
-                sftp.Connect();
-                sftp.ChangeDirectory("/usr");
-                Assert.AreEqual("/usr", sftp.WorkingDirectory);
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("Sftp")]
-        public void Test_Sftp_ChangeDirectory_Which_Exists_With_Slash()
-        {
-            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
-            {
-                sftp.Connect();
-                sftp.ChangeDirectory("/usr/");
-                Assert.AreEqual("/usr", sftp.WorkingDirectory);
-            }
-        }
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Common;
+using Renci.SshNet.Tests.Common;
+using Renci.SshNet.Tests.Properties;
+
+namespace Renci.SshNet.Tests.Classes
+{
+    /// <summary>
+    /// Implementation of the SSH File Transfer Protocol (SFTP) over SSH.
+    /// </summary>
+    public partial class SftpClientTest : TestBase
+    {
+        [TestMethod]
+        [TestCategory("Sftp")]
+        [TestCategory("integration")]
+        [ExpectedException(typeof(SftpPathNotFoundException))]
+        public void Test_Sftp_ChangeDirectory_Root_Dont_Exists()
+        {
+            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
+            {
+                sftp.Connect();
+                sftp.ChangeDirectory("/asdasd");
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("Sftp")]
+        [TestCategory("integration")]
+        [ExpectedException(typeof(SftpPathNotFoundException))]
+        public void Test_Sftp_ChangeDirectory_Root_With_Slash_Dont_Exists()
+        {
+            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
+            {
+                sftp.Connect();
+                sftp.ChangeDirectory("/asdasd/");
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("Sftp")]
+        [TestCategory("integration")]
+        [ExpectedException(typeof(SftpPathNotFoundException))]
+        public void Test_Sftp_ChangeDirectory_Subfolder_Dont_Exists()
+        {
+            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
+            {
+                sftp.Connect();
+                sftp.ChangeDirectory("/asdasd/sssddds");
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("Sftp")]
+        [TestCategory("integration")]
+        [ExpectedException(typeof(SftpPathNotFoundException))]
+        public void Test_Sftp_ChangeDirectory_Subfolder_With_Slash_Dont_Exists()
+        {
+            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
+            {
+                sftp.Connect();
+                sftp.ChangeDirectory("/asdasd/sssddds/");
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("Sftp")]
+        [TestCategory("integration")]
+        public void Test_Sftp_ChangeDirectory_Which_Exists()
+        {
+            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
+            {
+                sftp.Connect();
+                sftp.ChangeDirectory("/usr");
+                Assert.AreEqual("/usr", sftp.WorkingDirectory);
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("Sftp")]
+        [TestCategory("integration")]
+        public void Test_Sftp_ChangeDirectory_Which_Exists_With_Slash()
+        {
+            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
+            {
+                sftp.Connect();
+                sftp.ChangeDirectory("/usr/");
+                Assert.AreEqual("/usr", sftp.WorkingDirectory);
+            }
+        }
+    }
 }

+ 104 - 100
src/Renci.SshNet.Tests/Classes/SftpClientTest.CreateDirectory.cs

@@ -1,101 +1,105 @@
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Renci.SshNet.Common;
-using Renci.SshNet.Tests.Common;
-using Renci.SshNet.Tests.Properties;
-using System;
-
-namespace Renci.SshNet.Tests.Classes
-{
-    /// <summary>
-    /// Implementation of the SSH File Transfer Protocol (SFTP) over SSH.
-    /// </summary>
-    public partial class SftpClientTest : TestBase
-    {
-        [TestMethod]
-        [TestCategory("Sftp")]
-        [ExpectedException(typeof(SshConnectionException))]
-        public void Test_Sftp_CreateDirectory_Without_Connecting()
-        {
-            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
-            {
-                sftp.CreateDirectory("test");
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("Sftp")]
-        public void Test_Sftp_CreateDirectory_In_Current_Location()
-        {
-            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
-            {
-                sftp.Connect();
-
-                sftp.CreateDirectory("test");
-
-                sftp.Disconnect();
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("Sftp")]
-        [ExpectedException(typeof(SftpPermissionDeniedException))]
-        public void Test_Sftp_CreateDirectory_In_Forbidden_Directory()
-        {
-            if (Resources.USERNAME == "root")
-                Assert.Fail("Must not run this test as root!");
-
-            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
-            {
-                sftp.Connect();
-
-                sftp.CreateDirectory("/sbin/test");
-
-                sftp.Disconnect();
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("Sftp")]
-        [ExpectedException(typeof(SftpPathNotFoundException))]
-        public void Test_Sftp_CreateDirectory_Invalid_Path()
-        {
-            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
-            {
-                sftp.Connect();
-
-                sftp.CreateDirectory("/abcdefg/abcefg");
-
-                sftp.Disconnect();
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("Sftp")]
-        [ExpectedException(typeof(SshException))]
-        public void Test_Sftp_CreateDirectory_Already_Exists()
-        {
-            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
-            {
-                sftp.Connect();
-
-                sftp.CreateDirectory("test");
-
-                sftp.CreateDirectory("test");
-
-                sftp.Disconnect();
-            }
-        }
-
-        [TestMethod]
-        [TestCategory("Sftp")]
-        [Description("Test passing null to CreateDirectory.")]
-        [ExpectedException(typeof(ArgumentException))]
-        public void Test_Sftp_CreateDirectory_Null()
-        {
-            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
-            {
-                sftp.CreateDirectory(null);
-            }
-        }
-    }
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Renci.SshNet.Common;
+using Renci.SshNet.Tests.Common;
+using Renci.SshNet.Tests.Properties;
+using System;
+
+namespace Renci.SshNet.Tests.Classes
+{
+    /// <summary>
+    /// Implementation of the SSH File Transfer Protocol (SFTP) over SSH.
+    /// </summary>
+    public partial class SftpClientTest : TestBase
+    {
+        [TestMethod]
+        [TestCategory("Sftp")]
+        [ExpectedException(typeof(SshConnectionException))]
+        public void Test_Sftp_CreateDirectory_Without_Connecting()
+        {
+            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
+            {
+                sftp.CreateDirectory("test");
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("Sftp")]
+        [TestCategory("integration")]
+        public void Test_Sftp_CreateDirectory_In_Current_Location()
+        {
+            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
+            {
+                sftp.Connect();
+
+                sftp.CreateDirectory("test");
+
+                sftp.Disconnect();
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("Sftp")]
+        [TestCategory("integration")]
+        [ExpectedException(typeof(SftpPermissionDeniedException))]
+        public void Test_Sftp_CreateDirectory_In_Forbidden_Directory()
+        {
+            if (Resources.USERNAME == "root")
+                Assert.Fail("Must not run this test as root!");
+
+            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
+            {
+                sftp.Connect();
+
+                sftp.CreateDirectory("/sbin/test");
+
+                sftp.Disconnect();
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("Sftp")]
+        [TestCategory("integration")]
+        [ExpectedException(typeof(SftpPathNotFoundException))]
+        public void Test_Sftp_CreateDirectory_Invalid_Path()
+        {
+            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
+            {
+                sftp.Connect();
+
+                sftp.CreateDirectory("/abcdefg/abcefg");
+
+                sftp.Disconnect();
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("Sftp")]
+        [TestCategory("integration")]
+        [ExpectedException(typeof(SshException))]
+        public void Test_Sftp_CreateDirectory_Already_Exists()
+        {
+            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
+            {
+                sftp.Connect();
+
+                sftp.CreateDirectory("test");
+
+                sftp.CreateDirectory("test");
+
+                sftp.Disconnect();
+            }
+        }
+
+        [TestMethod]
+        [TestCategory("Sftp")]
+        [Description("Test passing null to CreateDirectory.")]
+        [ExpectedException(typeof(ArgumentException))]
+        public void Test_Sftp_CreateDirectory_Null()
+        {
+            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
+            {
+                sftp.CreateDirectory(null);
+            }
+        }
+    }
 }