public void TestShowVolume()
        {
            IBlockStorageProvider provider = new CloudBlockStorageProvider(Bootstrapper.Settings.TestIdentity);
            IEnumerable <Volume>  volumes  = provider.ListVolumes();

            Assert.IsNotNull(volumes);
            if (!volumes.Any())
            {
                Assert.Inconclusive("The test could not proceed because the specified account and/or region does not appear to contain any configured volumes.");
            }

            foreach (Volume volume in volumes)
            {
                Assert.IsNotNull(volume);
                Assert.IsFalse(string.IsNullOrEmpty(volume.Id));
                Volume showVolume = provider.ShowVolume(volume.Id);
                Assert.IsNotNull(showVolume);
                Assert.AreEqual(volume.AvailabilityZone, showVolume.AvailabilityZone);
                Assert.AreEqual(volume.CreatedAt, showVolume.CreatedAt);
                Assert.AreEqual(volume.DisplayDescription, showVolume.DisplayDescription);
                Assert.AreEqual(volume.DisplayName, showVolume.DisplayName);
                Assert.AreEqual(volume.Id, showVolume.Id);
                Assert.AreEqual(volume.Size, showVolume.Size);
                Assert.AreEqual(volume.SnapshotId, showVolume.SnapshotId);
                Assert.IsNotNull(volume.Status);
                Assert.AreEqual(volume.VolumeType, showVolume.VolumeType);
            }
        }
        public void TestBasicVolumeFeatures()
        {
            IBlockStorageProvider provider = new CloudBlockStorageProvider(Bootstrapper.Settings.TestIdentity);
            string displayName             = UnitTestVolumePrefix + Path.GetRandomFileName();
            Volume result = provider.CreateVolume(MinimumVolumeSize, displayName: displayName);

            Assert.IsNotNull(result);
            Assert.IsNotNull(result.Id);

            Console.WriteLine(JsonConvert.SerializeObject(result, Formatting.Indented));

            Volume updated = provider.WaitForVolumeAvailable(result.Id);

            Assert.IsNotNull(updated);
            Assert.AreEqual(result.Id, updated.Id);
            Assert.AreEqual(VolumeState.Available, updated.Status);

            bool deleted = provider.DeleteVolume(result.Id);

            Assert.IsTrue(deleted);

            deleted = provider.WaitForVolumeDeleted(result.Id);
            Assert.IsTrue(deleted);

            try
            {
                provider.ShowVolume(result.Id);
                Assert.Fail("Expected an exception after a volume is deleted.");
            }
            catch (ItemNotFoundException)
            {
                // this makes the most sense
            }
            catch (UserNotAuthorizedException)
            {
                // this is allowed by the interface, and some providers could report it for security reasons
            }
            catch (ResponseException)
            {
                // this is allowed by the interface
            }
        }
        public void Should_Return_Test_Volume()
        {
            var provider = new CloudBlockStorageProvider();

            var volumeListResponse = provider.ListVolumes(identity: _testIdentity);

            if (volumeListResponse != null && volumeListResponse.Any())
            {
                var testVolume = volumeListResponse.FirstOrDefault(x => x.DisplayName == volumeDisplayName);
                if (testVolume == null)
                {
                    Assert.Fail("Could not retrieve test volume.");
                }
                var singleVolumeResponse = provider.ShowVolume(testVolume.Id, identity: _testIdentity);
                Assert.IsNotNull(singleVolumeResponse);
                Assert.IsTrue(singleVolumeResponse.Id == testVolume.Id);
            }
            else
            {
                Assert.Fail("No volumes present to query.");
            }
        }
        public void Should_Return_Test_Volume()
        {
            var provider = new CloudBlockStorageProvider();

            var volumeListResponse = provider.ListVolumes(identity: _testIdentity);
            if (volumeListResponse != null && volumeListResponse.Any())
            {
                var testVolume = volumeListResponse.FirstOrDefault(x => x.DisplayName == volumeDisplayName);
                if (testVolume == null)
                {
                    Assert.Fail("Could not retrieve test volume.");
                }
                var singleVolumeResponse = provider.ShowVolume(testVolume.Id, identity: _testIdentity);
                Assert.IsNotNull(singleVolumeResponse);
                Assert.IsTrue(singleVolumeResponse.Id == testVolume.Id);
            }
            else
            {
                Assert.Fail("No volumes present to query.");
            }
        }
        public void TestBasicVolumeFeatures()
        {
            IBlockStorageProvider provider = new CloudBlockStorageProvider(Bootstrapper.Settings.TestIdentity);
            string displayName = UnitTestVolumePrefix + Path.GetRandomFileName();
            Volume result = provider.CreateVolume(MinimumVolumeSize, displayName: displayName);
            Assert.IsNotNull(result);
            Assert.IsNotNull(result.Id);

            Console.WriteLine(JsonConvert.SerializeObject(result, Formatting.Indented));

            Volume updated = provider.WaitForVolumeAvailable(result.Id);
            Assert.IsNotNull(updated);
            Assert.AreEqual(result.Id, updated.Id);
            Assert.AreEqual(VolumeState.Available, updated.Status);

            bool deleted = provider.DeleteVolume(result.Id);
            Assert.IsTrue(deleted);

            deleted = provider.WaitForVolumeDeleted(result.Id);
            Assert.IsTrue(deleted);

            try
            {
                provider.ShowVolume(result.Id);
                Assert.Fail("Expected an exception after a volume is deleted.");
            }
            catch (ItemNotFoundException)
            {
                // this makes the most sense
            }
            catch (UserNotAuthorizedException)
            {
                // this is allowed by the interface, and some providers could report it for security reasons
            }
            catch (ResponseException)
            {
                // this is allowed by the interface
            }
        }
        public void TestShowVolume()
        {
            IBlockStorageProvider provider = new CloudBlockStorageProvider(Bootstrapper.Settings.TestIdentity);
            IEnumerable<Volume> volumes = provider.ListVolumes();
            Assert.IsNotNull(volumes);
            if (!volumes.Any())
                Assert.Inconclusive("The test could not proceed because the specified account and/or region does not appear to contain any configured volumes.");

            foreach (Volume volume in volumes)
            {
                Assert.IsNotNull(volume);
                Assert.IsFalse(string.IsNullOrEmpty(volume.Id));
                Volume showVolume = provider.ShowVolume(volume.Id);
                Assert.IsNotNull(showVolume);
                Assert.AreEqual(volume.AvailabilityZone, showVolume.AvailabilityZone);
                Assert.AreEqual(volume.CreatedAt, showVolume.CreatedAt);
                Assert.AreEqual(volume.DisplayDescription, showVolume.DisplayDescription);
                Assert.AreEqual(volume.DisplayName, showVolume.DisplayName);
                Assert.AreEqual(volume.Id, showVolume.Id);
                Assert.AreEqual(volume.Size, showVolume.Size);
                Assert.AreEqual(volume.SnapshotId, showVolume.SnapshotId);
                Assert.IsNotNull(volume.Status);
                Assert.AreEqual(volume.VolumeType, showVolume.VolumeType);
            }
        }