Example #1
0
        public async Task DownloadFileRangeByName()
        {
            using (var b = new TestBucket())
            {
                var u = await b.UploadFile("file0", "content0");

                var d = await b.DownloadFileByName(u.fileName, 3, null);

                Assert.AreEqual($"tent0", new StreamReader(d.content).ReadToEnd());
                await b.DeleteFileVersion(u.fileName, u.fileId);
            }
        }
Example #2
0
        public async Task DownloadFileByName()
        {
            using (var b = new TestBucket())
            {
                var uploadTasks = new[] { b.UploadFile("file0", "content0"), b.UploadFile("file1", "content1"), b.UploadFile("file2", "content2") };
                await Task.WhenAll(uploadTasks);

                var downloadTasks = uploadTasks.Select(u => b.DownloadFileByName(u.Result.fileName)).ToArray();
                await Task.WhenAll(downloadTasks);

                for (int i = 0; i < downloadTasks.Length; i++)
                {
                    Assert.AreEqual($"content{i}", new StreamReader(downloadTasks[i].Result.content).ReadToEnd());
                }

                var deleteTasks = uploadTasks.Select(u => b.DeleteFileVersion(u.Result.fileName, u.Result.fileId)).ToArray();
                await Task.WhenAll(deleteTasks);
            }
        }