Exemple #1
0
        public void DownloadFileFromWorkingDirAndRenameTest()
        {
            var localWriteDir = Environment.ExpandEnvironmentVariables(LocalWorkingDir);
            FtpDownloadAction ftpDownloadAction = new FtpDownloadAction
            {
                Id               = PluginUtilities.GetUniqueId(),
                LoggingService   = ServicesContainer.ServicesProvider.GetLoggingService(nameof(FtpDownloadAction)),
                Host             = FtpTestCredentials.Host,
                Username         = FtpTestCredentials.User,
                Password         = FtpTestCredentials.Password,
                Port             = FtpTestCredentials.Port,
                DirectoryPath    = LocalDownloadDir,
                RemoteWorkingDir = "test"
            };

            ftpDownloadAction.RenameDownloaded        = true;
            ftpDownloadAction.RenameDownloadedNewName = "ROUTINDO_";
            var fileNamePath = CreateTestFile(localWriteDir);

            var actionResult = ftpDownloadAction.Execute(ArgumentCollection.New()
                                                         .WithArgument(FtpDownloadActionExecutionArgs.RemoteFilesCollection, new List <string>()
            {
                Path.GetFileName(fileNamePath)
            })
                                                         );

            Assert.IsNotNull(actionResult);
            Assert.IsTrue(actionResult.Result);
        }
Exemple #2
0
        public void DownloadFileTest()
        {
            var localWriteDir = Path.GetDirectoryName(Environment.ExpandEnvironmentVariables(LocalWorkingDir));
            FtpDownloadAction ftpDownloadAction = new FtpDownloadAction()
            {
                Id             = PluginUtilities.GetUniqueId(),
                LoggingService = ServicesContainer.ServicesProvider.GetLoggingService(nameof(FtpDownloadAction))
            };

            ftpDownloadAction.Host          = FtpTestCredentials.Host;
            ftpDownloadAction.Username      = FtpTestCredentials.User;
            ftpDownloadAction.Password      = FtpTestCredentials.Password;
            ftpDownloadAction.Port          = FtpTestCredentials.Port;
            ftpDownloadAction.DirectoryPath = LocalDownloadDir;

            var fileNamePath = CreateTestFile(localWriteDir);

            var actionResult = ftpDownloadAction.Execute(ArgumentCollection.New()
                                                         .WithArgument(FtpDownloadActionExecutionArgs.RemoteFilesCollection, new List <string>()
            {
                Path.GetFileName(fileNamePath)
            })
                                                         );

            Assert.IsNotNull(actionResult);
            Assert.IsTrue(actionResult.Result);
        }