public static void DeleteObjectHelper(AmazonS3Client client, string bucketName, string key, string versionId = null)
{
Exception responseException = null;
AutoResetEvent ars = new AutoResetEvent(false);
client.DeleteObjectsAsync(new DeleteObjectsRequest()
{
BucketName = bucketName,
Objects = new List<KeyVersion> { new KeyVersion() { Key = key, VersionId = versionId } }
}, (response) =>
{
responseException = response.Exception;
ars.Set();
}, new AsyncOptions { ExecuteCallbackOnMainThread = false });
ars.WaitOne();
Assert.IsNull(responseException);
}