protected async Task CreateTempBucketAsync(Func <string, Task> action) { string tempBucketName = "testbucket-" + Guid.NewGuid(); PutBucketResponse putResponse = await BucketClient.PutBucketAsync(tempBucketName, request => request.Region = Config.Region).ConfigureAwait(false); Assert.True(putResponse.IsSuccess); try { await(action?.Invoke(tempBucketName)).ConfigureAwait(false); } catch (Exception) { } DeleteBucketStatus errorCode = await BucketClient.DeleteBucketRecursiveAsync(tempBucketName).ConfigureAwait(false); Assert.Equal(DeleteBucketStatus.Ok, errorCode); }