Exemple #1
0
        public async Task DownloadFileAsyncTest()
        {
            // Upload a new file
            var filename = await FileHelper.UploadTestFileAsync();

            var downloadTo = FileHelper.GenerateNewDownloadFilePath();
            // Download the file
            var handler = new FileDownload(filename);

            handler.DownloadCompleted += (s, e) =>
            {
                Console.WriteLine("Download completed. Downloaded {0} bytes.", e.Result.Length);
            };
            handler.DownloadProgressChanged += (s, e) =>
            {
                Console.WriteLine("Downloading {0} bytes out of {1}.", e.BytesReceived, e.TotalBytesToReceive);
            };
            await handler.DownloadFileAsync(downloadTo);

            Assert.IsTrue(FileHelper.Md5ChecksumMatch(downloadTo));
        }
 public async Task DownloadFileAsyncTest()
 {
     // Upload a new file
     var filename = await FileHelper.UploadTestFileAsync();
     var downloadTo = FileHelper.GenerateNewDownloadFilePath();
     // Download the file
     var handler = new FileDownload(filename);
     handler.DownloadCompleted += (s, e) =>
     {
         Console.WriteLine("Download completed. Downloaded {0} bytes.", e.Result.Length);
     };
     handler.DownloadProgressChanged += (s, e) =>
     {
         Console.WriteLine("Downloading {0} bytes out of {1}.", e.BytesReceived, e.TotalBytesToReceive);
     };
     await handler.DownloadFileAsync(downloadTo);
     Assert.IsTrue(FileHelper.Md5ChecksumMatch(downloadTo));
 }