public async Task GetPutBucketLockConfiguration(LockMode mode)
        {
            string tempBucketName = "testbucket-" + Guid.NewGuid();

            CreateBucketResponse createResp = await BucketClient.CreateBucketAsync(tempBucketName, req => req.EnableObjectLocking = true).ConfigureAwait(false);

            Assert.True(createResp.IsSuccess);

            PutBucketLockConfigurationResponse putResp = await BucketClient.PutBucketLockConfigurationAsync(tempBucketName, true, x =>
            {
                x.LockMode        = mode;
                x.LockRetainUntil = DateTimeOffset.UtcNow.AddDays(2);
            }).ConfigureAwait(false);

            Assert.True(putResp.IsSuccess);

            GetBucketLockConfigurationResponse getResp = await BucketClient.GetBucketLockConfigurationAsync(tempBucketName).ConfigureAwait(false);

            Assert.True(getResp.IsSuccess);

            Assert.Equal(mode, getResp.LockMode);
            Assert.Equal(DateTimeOffset.UtcNow.AddDays(2 - 1).DateTime, getResp.LockRetainUntil !.Value.DateTime, TimeSpan.FromMinutes(1));

            //Delete again to cleanup
            await BucketClient.DeleteBucketAsync(tempBucketName).ConfigureAwait(false);
        }
 public async Task GetWhenBucketLockIsDisabled()
 {
     await CreateTempBucketAsync(async x =>
     {
         GetBucketLockConfigurationResponse getResp = await BucketClient.GetBucketLockConfigurationAsync(x).ConfigureAwait(false);
         Assert.Equal(404, getResp.StatusCode);
     }).ConfigureAwait(false);
 }
        public async Task GetEmptyBucketLock()
        {
            string tempBucketName = "testbucket-" + Guid.NewGuid();

            CreateBucketResponse createResp = await BucketClient.CreateBucketAsync(tempBucketName, req => req.EnableObjectLocking = true).ConfigureAwait(false);

            Assert.True(createResp.IsSuccess);

            GetBucketLockConfigurationResponse getResp = await BucketClient.GetBucketLockConfigurationAsync(tempBucketName).ConfigureAwait(false);

            Assert.True(getResp.IsSuccess);

            Assert.Equal(LockMode.Unknown, getResp.LockMode);
            Assert.Null(getResp.LockRetainUntil);

            //Delete again to cleanup
            await BucketClient.DeleteBucketAsync(tempBucketName).ConfigureAwait(false);
        }