예제 #1
0
        public void DownFileSync_file_exists_yes()
        {
            IO.FileInfo    downloadedFile = new IO.FileInfo("C:\\temp\\Download\\" + Constants.Ftp.Files.File_1_1.Name);
            DownloaderFile df             = new DownloaderFile(Constants.Ftp.Files.File_1_1, downloadedFile);

            df.StartDownload(async: false);

            downloadedFile.Refresh();
            byte[] file_ftp = IO.File.ReadAllBytes(Constants.HDFtp.Files.File_1_1.FullName);
            byte[] file_hd  = IO.File.ReadAllBytes(downloadedFile.FullName);

            Assert.IsTrue(downloadedFile.Exists);
            Assert.IsTrue(StructuralComparisons.StructuralEqualityComparer.Equals(file_ftp, file_hd));
        }
예제 #2
0
        public void DownFileSync_file_exists_no()
        {
            IO.FileInfo    downloadedFile = new IO.FileInfo("C:\\temp\\download\\" + Constants.Ftp.Files.NotExists.Name);
            DownloaderFile df             = new DownloaderFile(Constants.Ftp.Files.NotExists, downloadedFile);

            try
            {
                df.StartDownload(async: false);
                Assert.IsTrue(false);
            }
            catch (Exception e)
            {
                Assert.IsTrue(e is System.Net.WebException);
                Assert.IsTrue(true);
            }
        }