public void TestUploadToLANServer() { byte[] data = DeliveryStrategy.ConvertToSource("blah"); SftpDelivery sftp = new SftpDelivery() { Source = data, Hostname = ConfigurationManager.AppSettings["SftpHostname"], Destination = string.Concat(ConfigurationManager.AppSettings["SftpDestinationPath"], "TestFile.csv"), Username = ConfigurationManager.AppSettings["SftpLogin"], /* The key below was generated just for testing */ KeyFile = Keyfile, Password = string.Empty, }; bool result = sftp.Put(); Assert.IsTrue(result, "File upload failed."); }
private void SetKeyFile(Mock<ISftpClient> mock, SftpDelivery sftp) { sftp.KeyFile = Keyfile; mock.SetupProperty(m => m.KeyFiles); }
private SftpDelivery InitializeDelivery(Mock<ISftpClient> sftpMock, string filename) { byte[] data = FilePathDelivery.ConvertToSource("blah"); SftpDelivery sftp = new SftpDelivery(sftpMock.Object) { SaveFileCopy = true, Context = new ApplicationContext {BaseDirectory = AppDomain.CurrentDomain.BaseDirectory}, Source = data, Destination = string.Concat(ConfigurationManager.AppSettings["SftpDestinationPath"], filename), }; // set the underlying destination (after template expansion has been applied) sftpMock.SetupProperty(m => m.Destination, sftp.Destination); return sftp; }