Esempio n. 1
0
        public async Task DownloadFileRangeById()
        {
            using (var b = new TestBucket())
            {
                var u = await b.UploadFile("file0", "content0");

                var d = await b.DownloadFileById(u.fileId, 0, 3);

                Assert.AreEqual($"cont", new StreamReader(d.content).ReadToEnd());
                await b.DeleteFileVersion(u.fileName, u.fileId);
            }
        }
Esempio n. 2
0
        public async Task DownloadFileById()
        {
            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.DownloadFileById(u.Result.fileId)).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);
            }
        }