Пример #1
0
        public void UpDataSync_file_exists_yes()
        {
            Ftp.DirectoryInfo ftpDir  = new Ftp.DirectoryInfo(Constants.Ftp.FTP_TestServer, "HDFtp/Upload");
            Ftp.FileInfo      ftpFile = new Ftp.FileInfo(ftpDir, "UploadTestFile");
            byte[]            file_hd = IO.File.ReadAllBytes(Constants.HD.Files.File_1_1.FullName);
            UploaderData      ud      = new UploaderData(ftpFile, file_hd);

            ud.StartUpload(async: false);

            byte[] file_ftp = IO.File.ReadAllBytes("C:\\temp\\HDFtp\\Upload\\UploadTestFile");

            Assert.IsTrue(StructuralComparisons.StructuralEqualityComparer.Equals(file_ftp, file_hd));
        }
Пример #2
0
        public void UpDataSync_file_exists_no()
        {
            Ftp.DirectoryInfo ftpDir  = new Ftp.DirectoryInfo(Constants.Ftp.FTP_TestServer, "HDFtp/Upload");
            Ftp.FileInfo      ftpFile = new Ftp.FileInfo(ftpDir, "UploadTestFile");

            try
            {
                byte[]       file_hd = IO.File.ReadAllBytes(Constants.HD.Files.NotExists.FullName);
                UploaderData ud      = new UploaderData(ftpFile, file_hd);
                ud.StartUpload(async: false);
                Assert.IsTrue(false);
            }
            catch (Exception e)
            {
                Assert.IsTrue(e is IO.FileNotFoundException);
                Assert.IsTrue(true);
            }
        }