public void TestShowSnapshot()
        {
            IBlockStorageProvider  provider  = Bootstrapper.CreateBlockStorageProvider();
            IEnumerable <Snapshot> snapshots = provider.ListSnapshots();

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

            Console.WriteLine("Snapshots");
            foreach (Snapshot snapshot in snapshots)
            {
                Assert.IsNotNull(snapshot);
                Assert.IsFalse(string.IsNullOrEmpty(snapshot.Id));
                Snapshot showSnapshot = provider.ShowSnapshot(snapshot.Id);
                Assert.IsNotNull(showSnapshot);
                Assert.AreEqual(snapshot.CreatedAt, showSnapshot.CreatedAt);
                Assert.AreEqual(snapshot.DisplayDescription, showSnapshot.DisplayDescription);
                Assert.AreEqual(snapshot.DisplayName, showSnapshot.DisplayName);
                Assert.AreEqual(snapshot.Id, showSnapshot.Id);
                Assert.AreEqual(snapshot.Size, showSnapshot.Size);
                //Assert.AreEqual(snapshot.Status, showSnapshot.Status);
                Assert.AreEqual(snapshot.VolumeId, showSnapshot.VolumeId);
            }
        }
        public void TestBasicSnapshotFeatures()
        {
            IBlockStorageProvider provider = Bootstrapper.CreateBlockStorageProvider();

            //
            // Volume setup...
            //

            string volumeDisplayName = UnitTestVolumePrefix + Path.GetRandomFileName();

            VolumeType ssdType = GetSsdVolumeTypeOrDefault(provider);

            if (ssdType != null)
            {
                Console.WriteLine("Using an SSD volume to improve snapshot test performance.");
            }
            else
            {
                Console.WriteLine("No SSD volume type is available for the snapshot test... falling back to the default.");
            }

            Volume result = provider.CreateVolume(MinimumVolumeSize, displayName: volumeDisplayName, volumeType: ssdType != null ? ssdType.Id : null);

            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);

            //
            // Snapshot testing
            //

            string   snapshotDisplayName = UnitTestSnapshotPrefix + Path.GetRandomFileName();
            Snapshot snapshot            = provider.CreateSnapshot(result.Id, displayName: snapshotDisplayName);

            Assert.IsNotNull(snapshot);
            Assert.IsNotNull(snapshot.Id);

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

            Snapshot updatedSnapshot = provider.WaitForSnapshotAvailable(snapshot.Id);

            Assert.IsNotNull(updatedSnapshot);
            Assert.AreEqual(snapshot.Id, updatedSnapshot.Id);
            Assert.AreEqual(SnapshotState.Available, updatedSnapshot.Status);

            bool deleted = provider.DeleteSnapshot(snapshot.Id);

            Assert.IsTrue(deleted);

            deleted = provider.WaitForSnapshotDeleted(snapshot.Id);
            Assert.IsTrue(deleted);

            try
            {
                provider.ShowSnapshot(snapshot.Id);
                Assert.Fail("Expected an exception after a snapshot 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
            }

            //
            // Volume cleanup...
            //

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

            Assert.IsTrue(deletedVolume);

            deletedVolume = provider.WaitForVolumeDeleted(result.Id);
            Assert.IsTrue(deletedVolume);
        }