private bool WaitForTransition(FileAccessMode targetMode, TimeSpan timeout)
        {
            DateTime timeoutTime = DateTime.Now + timeout;

            if (GetBucketFileAccessModeRequest.IsTransitionState(targetMode))
            {
                throw new ArgumentException("Invalid target mode: " + targetMode);
            }

            this.TestContext.WriteLine(
                "Waiting for file access mode transition. Bucket:{0}, Target: {1}",
                this.bucketName, targetMode);

            while (true)
            {
                var request = new GetBucketFileAccessModeRequest()
                {
                    BucketName = this.bucketName
                };
                using (var response = client.GetBucketFileAccessMode(request))
                {
                    if (response.AccessMode == targetMode)
                    {
                        this.TestContext.WriteLine(
                            "Successful transition.  Target: {0}", targetMode);
                        return true;
                    }

                    if (DateTime.Now > timeoutTime)
                    {
                        this.TestContext.WriteLine(
                            "Timeout occurred waiting for transition.  Current: {0}, Target: {1}",
                            response.AccessMode, targetMode);
                        return false;
                    }
                }

                System.Threading.Thread.Sleep(TimeSpan.FromSeconds(5));
            }
        }
 public void TestGetBucketFileAccessMode()
 {
     var request = new GetBucketFileAccessModeRequest()
     {
         BucketName = this.bucketName
     };
     using (var response = client.GetBucketFileAccessMode(request))
     {
         Debug.WriteLine("AccessMode: " + response.AccessMode);
         Assert.AreEqual(FileAccessMode.Disabled, response.AccessMode);
     }
 }