public void UploadFileTest_privateKeyConnection_canUploadFile() { // arrange ConnectivitySettings connectivitySettings = SftpTestsHelperRoutines.CreateConnectivitySettingsFromConfig(); string physicalPathToPrivateKeyFile = SftpTestsHelperRoutines.GetTestFilesPath() + connectivitySettings.PrivateKeyPath; connectivitySettings.PrivateKeyPath = physicalPathToPrivateKeyFile; DotNetSftpClient dotNetSftpClient = new DotNetSftpClient(connectivitySettings, testLogger); dotNetSftpClient.CreateConnection(); // act/assert - 'assert' as in no exceptions are thrown string newTempFilePath = Path.GetTempFileName(); TransferSettings transferSettings = new TransferSettings() { TransferType = 'u', DestinationPath = string.Empty, SourcePath = newTempFilePath }; // act/assert - 'assert' as in no exceptions are thrown using (dotNetSftpClient) { dotNetSftpClient.Upload(transferSettings); } }
public void UploadFileTest_usernamePasswordConnection_canUploadFile() { // arrange ConnectivitySettings connectivitySettings = SftpTestsHelperRoutines.CreateConnectivitySettingsFromConfig(); connectivitySettings.PrivateKeyPath = String.Empty; // clear private key path, so we only connect via username/password DotNetSftpClient dotNetSftpClient = new DotNetSftpClient(connectivitySettings, testLogger); dotNetSftpClient.CreateConnection(); string newTempFilePath = Path.GetTempFileName(); TransferSettings transferSettings = new TransferSettings() { TransferType = 'u', DestinationPath = " ", SourcePath = newTempFilePath }; // act/assert - 'assert' as in no exceptions are thrown using (dotNetSftpClient) { dotNetSftpClient.Upload(transferSettings); } }