Exemplo n.º 1
0
        public void DownloadDirectoryProgressTest()
        {
            var directoryName     = UtilityMethods.GenerateName(@"DownloadDirectoryTest");
            var progressValidator = new DirectoryProgressValidator <DownloadDirectoryProgressArgs>();

            progressValidator.Validate = (progress, lastProgress) =>
            {
                if (lastProgress != null)
                {
                    Assert.IsTrue(progress.NumberOfFilesDownloaded >= lastProgress.NumberOfFilesDownloaded);
                    Assert.IsTrue(progress.TransferredBytes > lastProgress.TransferredBytes);
                    if (progress.NumberOfFilesDownloaded == lastProgress.NumberOfFilesDownloaded)
                    {
                        Assert.IsTrue(progress.TransferredBytes - lastProgress.TransferredBytes >= 100 * KILO_SIZE);
                    }
                }

                if (progress.NumberOfFilesDownloaded == progress.TotalNumberOfFiles)
                {
                    Assert.AreEqual(progress.TransferredBytes, progress.TotalBytes);
                    progressValidator.IsProgressEventComplete = true;
                }

                Console.WriteLine(progress.ToString());
            };

            DownloadDirectory(directoryName, progressValidator);
            progressValidator.AssertOnCompletion();
        }
Exemplo n.º 2
0
        public void UploadDirectoryWithProgressTracker()
        {
            var progressValidator = new DirectoryProgressValidator <UploadDirectoryProgressArgs>();

            ConfigureProgressValidator(progressValidator);

            UploadDirectory(10 * MEG_SIZE, progressValidator, true, false);
            progressValidator.AssertOnCompletion();
        }
        public void UploadDirectoryWithProgressTracker()
        {
            var directoryName     = UtilityMethods.GenerateName("UploadDirectoryTest");
            var progressValidator = new DirectoryProgressValidator <UploadDirectoryProgressArgs>();

            ConfigureProgressValidator(progressValidator);

            UploadDirectory(directoryName, 10 * MEG_SIZE, progressValidator, true, false);
            progressValidator.AssertOnCompletion();
        }
Exemplo n.º 4
0
        public void DownloadDirectoryProgressTest()
        {
            var directoryName     = UtilityMethods.GenerateName(@"DownloadDirectoryTest");
            var progressValidator = new DirectoryProgressValidator <DownloadDirectoryProgressArgs>();

            ConfigureProgressValidator(progressValidator);

            DownloadDirectory(directoryName, progressValidator);
            progressValidator.AssertOnCompletion();
        }
Exemplo n.º 5
0
        public void DownloadDirectoryProgressTest()
        {
            // disable clock skew testing, this is a multithreaded test
            using (RetryUtilities.DisableClockSkewCorrection())
            {
                var progressValidator = new DirectoryProgressValidator <DownloadDirectoryProgressArgs>();
                ConfigureProgressValidator(progressValidator);

                DownloadDirectory(progressValidator);
                progressValidator.AssertOnCompletion();
            }
        }
Exemplo n.º 6
0
        public async Task DownloadDirectoryProgressTest()
        {
            // disable clock skew testing, this is a multithreaded test
            var directoryName     = UtilityMethods.GenerateName(@"DownloadDirectoryTest");
            var progressValidator = new DirectoryProgressValidator <DownloadDirectoryProgressArgs>();

            ConfigureProgressValidator(progressValidator);

            await DownloadDirectoryAsync(directoryName, progressValidator).ConfigureAwait(false);

            progressValidator.AssertOnCompletion();
        }
Exemplo n.º 7
0
        public void UploadDirectoryWithProgressTracker()
        {
            var directoryName     = UtilityMethods.GenerateName("UploadDirectoryTest");
            var progressValidator = new DirectoryProgressValidator <UploadDirectoryProgressArgs>();

            progressValidator.Validate = (progress, lastProgress) =>
            {
                Assert.IsFalse(string.IsNullOrEmpty(progress.CurrentFile));
                Assert.IsTrue(progress.TotalNumberOfBytesForCurrentFile > 0);
                Assert.IsTrue(progress.TransferredBytesForCurrentFile > 0);

                if (lastProgress != null)
                {
                    Assert.IsTrue(progress.NumberOfFilesUploaded >= lastProgress.NumberOfFilesUploaded);
                    Assert.IsTrue(progress.TransferredBytes > lastProgress.TransferredBytes);
                    if (progress.NumberOfFilesUploaded == lastProgress.NumberOfFilesUploaded)
                    {
                        Assert.IsTrue(progress.TransferredBytes - lastProgress.TransferredBytes >= 100 * KILO_SIZE);
                    }
                    else
                    {
                        Assert.AreEqual(progress.TransferredBytesForCurrentFile, progress.TotalNumberOfBytesForCurrentFile);
                    }
                }

                if (progress.NumberOfFilesUploaded == progress.TotalNumberOfFiles)
                {
                    Assert.AreEqual(progress.TransferredBytes, progress.TotalBytes);
                    progressValidator.IsProgressEventComplete = true;
                }

                Console.Write("\t{0} : {1}/{2}\t", progress.CurrentFile,
                              progress.TransferredBytesForCurrentFile, progress.TotalNumberOfBytesForCurrentFile);
                Console.WriteLine(progress.ToString());
            };
            UploadDirectory(directoryName, 10 * MEG_SIZE, progressValidator, true, false);

            progressValidator.AssertOnCompletion();
        }