Exemple #1
0
 public void Execute(string ftpUri, string path = null, string username = null, string password = null)
 {
     Console.WriteLine("Getting size...");
     try
     {
         using (var ftp = new FileTransferProtocol(ftpUri, path, username, password))
         {
             ftp.GetSize();
             Console.Write(ftp.RequestStatus);
         }
     }
     catch (Exception exception)
     {
         Console.WriteLine($"{ftpUri} get size error -> {exception.Message}");
     }
 }
        public void CheckGetSize()
        {
            string ftp_uri = $"{Config.Server_Address}/renamed_zip_file.zip";

            try
            {
                using (var ftp = new FileTransferProtocol(ftp_uri, null, Config.Username, Config.Password))
                {
                    ftp.GetSize();
                    Assert.That(ftp.RequestStatusCode == FtpStatusCode.FileStatus);
                }
            }
            catch (Exception exception)
            {
                if (exception is WebException)
                {
                    Assert.Fail(exception.Message);
                }
            }
        }