public async Task S3Service_Should_Delete_A_File_To_A_Bucket() { var bucketName = Guid.NewGuid().ToString(); await CreateTestBucket(bucketName); await UploadTestFile(bucketName : bucketName, key : Key); DeleteObjectResponse deleteObjectResponse = await AmazonS3.DeleteObjectAsync(bucketName, Key); Assert.Equal(HttpStatusCode.NoContent, deleteObjectResponse.HttpStatusCode); }
public async Task DeleteAsync(S3FileKey key) { if (key == null) { throw new ArgumentNullException(nameof(key)); } var request = new DeleteObjectRequest { BucketName = BucketNameConstructor.GetBucketName(key), Key = key.Key }; await AmazonS3.DeleteObjectAsync(request); }