public async Task ListBucketsAsync_lists_buckets_for_user() { // Arrange IBucketService classUnderTest = new BucketService(_s3BucketClient); // Act var response = await classUnderTest.ListBucketsAsync(); // Assert Assert.IsTrue(response.HttpStatusCode == System.Net.HttpStatusCode.OK); Assert.IsTrue(response.Buckets.Count > 0); }
public async Task <int> UploadToCloud() { // Listing buckets. var bucketService = new BucketService(access); var buckets = await bucketService.ListBucketsAsync(new ListBucketsOptions()); foreach (var b in buckets.Items) { Console.WriteLine(b.Name); } var restrictedBucketService = new BucketService(access); var newBucketName = "flureebucket"; var bucket = await restrictedBucketService.GetBucketAsync(newBucketName); var fileObject = await GetFlureeSnapshot("1585578518736.avro"); var uploadOperationRestricted = await objectService.UploadObjectAsync(bucket, fileObject.FileName, new UploadOptions(), fileObject.File, true); uploadOperationRestricted.UploadOperationProgressChanged += UploadOperationRestricted_UploadOperationProgressChanged; uploadOperationRestricted.UploadOperationEnded += UploadOperationRestricted_UploadOperationEnded; await uploadOperationRestricted.StartUploadAsync(); // Download a file from a bucket. var objects = await objectService.ListObjectsAsync(bucket, new ListObjectsOptions()); foreach (var obj in objects.Items) { //work with the objects Console.WriteLine($"Found {obj.Key} {obj.SystemMetaData.Created}"); //await objectService.DeleteObjectAsync(bucket, obj.Path); // var downloadSvc = await objectService.DownloadObjectAsync(bucket, obj.Path, false); // downloadSvc.DownloadOperationProgressChanged += DownloadOperation_DownloadOperationProgressChanged; // downloadSvc.DownloadOperationEnded += DownloadOperation_DownloadOperationEnded; // await downloadSvc.StartDownloadAsync(); } return(0); }