コード例 #1
0
        public async Task ListIncompleteParts()
        {
            await CreateTempBucketAsync(async bucket =>
            {
                InitiateMultipartUploadResponse initResp = await ObjectClient.InitiateMultipartUploadAsync(bucket, nameof(ListIncompleteParts)).ConfigureAwait(false);

                byte[] file = new byte[5 * 1024];

                using (MemoryStream ms = new MemoryStream(file))
                    await ObjectClient.UploadPartAsync(bucket, nameof(ListIncompleteParts), 1, initResp.UploadId, ms).ConfigureAwait(false);

                ListMultipartUploadsResponse listResp = await BucketClient.ListMultipartUploadsAsync(bucket).ConfigureAwait(false);

                Assert.Equal(bucket, listResp.Bucket);
                Assert.Equal("ListIncompleteParts", listResp.NextKeyMarker);
                Assert.NotEmpty(listResp.NextUploadIdMarker);
                Assert.Equal(1000, listResp.MaxUploads);
                Assert.False(listResp.IsTruncated);

                S3Upload upload = Assert.Single(listResp.Uploads);

                Assert.Equal(listResp.NextKeyMarker, upload.Name);
                Assert.Equal(listResp.NextUploadIdMarker, upload.UploadId);
                Assert.Equal(TestConstants.TestUsername, upload.Initiator.Name);
                Assert.Equal(StorageClass.Standard, upload.StorageClass);
                Assert.Equal(DateTime.UtcNow, upload.Initiated.DateTime, TimeSpan.FromSeconds(5));
            }).ConfigureAwait(false);
        }