public async Task TestRestXml()
{
using (var client = UtilityMethods.CreateClient<AmazonS3Client>())
{
var bucketName = await UtilityMethods.CreateBucketAsync(client, "TestRestXml_Async");
try
{
var buckets = (await client.ListBucketsAsync(new ListBucketsRequest())).Buckets;
Assert.NotNull(buckets);
Assert.NotEqual(0, buckets.Count);
Assert.Equal(1, buckets
.Count(b =>
string.Equals(bucketName, b.BucketName, StringComparison.OrdinalIgnoreCase)));
var fakeBucketName = "really-fake-bucket-that-shout-not-exist" + DateTime.Now.ToFileTime();
var as3e = await AssertExtensions.ExpectExceptionAsync<AmazonS3Exception>(client.DeleteBucketAsync(new DeleteBucketRequest
{
BucketName = fakeBucketName
}));
Assert.NotNull(as3e);
Assert.NotNull(as3e.Message);
//Assert.NotNull(aete.ErrorCode);
Assert.Equal(as3e.ErrorType, ErrorType.Sender);
}
finally
{
await UtilityMethods.DeleteBucketWithObjectsAsync(client, bucketName);
}
}
}