当前位置: 首页>>代码示例>>C#>>正文


C# CloudServersProvider.ListImagesWithDetails方法代码示例

本文整理汇总了C#中CloudServersProvider.ListImagesWithDetails方法的典型用法代码示例。如果您正苦于以下问题:C# CloudServersProvider.ListImagesWithDetails方法的具体用法?C# CloudServersProvider.ListImagesWithDetails怎么用?C# CloudServersProvider.ListImagesWithDetails使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CloudServersProvider的用法示例。


在下文中一共展示了CloudServersProvider.ListImagesWithDetails方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Should_Return_All_Images_With_Details_When_Using_A_Limit_Greater_Than_What_Actually_Exists

        public void Should_Return_All_Images_With_Details_When_Using_A_Limit_Greater_Than_What_Actually_Exists()
        {
            var provider = new CloudServersProvider(_testIdentity);
            var images = provider.ListImagesWithDetails(limit: _allImages.Count() * 2);

            Assert.IsTrue(images.Count() == _allImages.Count());
        }
开发者ID:surgicalcoder,项目名称:openstack.net,代码行数:7,代码来源:CloudServersTests.cs

示例2: Should_Return_At_Least_One_Image_With_Details_When_Searching_By_Valid_Change_Since_Date

        public void Should_Return_At_Least_One_Image_With_Details_When_Searching_By_Valid_Change_Since_Date()
        {
            var validImage = _allImages.First();
            var provider = new CloudServersProvider(_testIdentity);
            var images = provider.ListImagesWithDetails(changesSince: validImage.Updated.AddSeconds(-1));

            Assert.IsTrue(images.Any());
        }
开发者ID:surgicalcoder,项目名称:openstack.net,代码行数:8,代码来源:CloudServersTests.cs

示例3: Should_Return_Exactly_Two_Images_With_Details

        public void Should_Return_Exactly_Two_Images_With_Details()
        {
            var provider = new CloudServersProvider(_testIdentity);
            var images = provider.ListImagesWithDetails(limit: 2);

            Assert.IsTrue(images.Count() == 2);
        }
开发者ID:surgicalcoder,项目名称:openstack.net,代码行数:7,代码来源:CloudServersTests.cs

示例4: Should_Return_At_Least_One_Image_With_Details_When_Searching_By_Valid_Status

        public void Should_Return_At_Least_One_Image_With_Details_When_Searching_By_Valid_Status()
        {
            var validImage = _allImages.First();
            var provider = new CloudServersProvider(_testIdentity);
            var images = provider.ListImagesWithDetails(imageStatus: validImage.Status);

            Assert.IsTrue(images.Any());
        }
开发者ID:surgicalcoder,项目名称:openstack.net,代码行数:8,代码来源:CloudServersTests.cs

示例5: Should_Return_One_Image_With_Details_When_Searching_By_Valid_Id

        public void Should_Return_One_Image_With_Details_When_Searching_By_Valid_Id()
        {
            var validImage = _allImages.First(i => i.Server != null);
            var provider = new CloudServersProvider(_testIdentity);
            var images = provider.ListImagesWithDetails(server: validImage.Server.Id);

            Assert.IsTrue(images.Any());
        }
开发者ID:surgicalcoder,项目名称:openstack.net,代码行数:8,代码来源:CloudServersTests.cs

示例6: Should_Get_List_All_Images_With_Details

        public void Should_Get_List_All_Images_With_Details()
        {
            var provider = new CloudServersProvider(_testIdentity);
            _allImages = provider.ListImagesWithDetails(identity: _testIdentity);

            Assert.IsTrue(_allImages.Any());
        }
开发者ID:surgicalcoder,项目名称:openstack.net,代码行数:7,代码来源:CloudServersTests.cs

示例7: Should_Retrieve_Image_By_Name

        public void Should_Retrieve_Image_By_Name()
        {
            var provider = new CloudServersProvider(_testIdentity);
            var images = provider.ListImagesWithDetails();

            _testImage = images.First(i => i.Name == _testImageName);

            Assert.IsNotNull(_testImage);
        }
开发者ID:surgicalcoder,项目名称:openstack.net,代码行数:9,代码来源:CloudServersTests.cs

示例8: TestCreateImage

        public void TestCreateImage()
        {
            IComputeProvider provider = new CloudServersProvider(Bootstrapper.Settings.TestIdentity);

            /* Create the image
             */
            string imageName = UserComputeTests.UnitTestImagePrefix + Path.GetRandomFileName();
            bool imaged = provider.CreateImage(_server.Id, imageName);
            Assert.IsTrue(imaged);
            ServerImage[] images = provider.ListImagesWithDetails(server: _server.Id, imageName: imageName).ToArray();
            Assert.IsNotNull(images);
            Assert.AreEqual(1, images.Length);

            ServerImage image = images[0];
            Assert.AreEqual(imageName, image.Name);
            Assert.IsFalse(string.IsNullOrEmpty(image.Id));

            Assert.AreEqual(ImageState.Active, provider.WaitForImageActive(image.Id).Status);

            /* Test metadata operations on the image
             */
            Assert.IsTrue(provider.SetImageMetadataItem(image.Id, "Item 1", "Value"));
            Assert.AreEqual("Value", provider.GetImageMetadataItem(image.Id, "Item 1"));
            Assert.IsTrue(provider.SetImageMetadataItem(image.Id, "Item 2", "Value ²"));
            Assert.AreEqual("Value ²", provider.GetImageMetadataItem(image.Id, "Item 2"));

            // setting the same key overwrites the previous value
            Assert.IsTrue(provider.SetImageMetadataItem(image.Id, "Item 1", "Value 1"));
            Assert.AreEqual("Value 1", provider.GetImageMetadataItem(image.Id, "Item 1"));

            Assert.IsTrue(provider.DeleteImageMetadataItem(image.Id, "Item 1"));
            Assert.IsFalse(provider.ListImageMetadata(image.Id).ContainsKey("Item 1"));

            Metadata metadata = new Metadata()
            {
                { "Different", "Variables" },
            };

            Assert.IsTrue(provider.UpdateImageMetadata(image.Id, metadata));
            Metadata actual = provider.ListImageMetadata(image.Id);
            Assert.IsNotNull(actual);
            Assert.AreEqual(2, actual.Count);
            Assert.AreEqual("Value ²", actual["Item 2"]);
            Assert.AreEqual("Variables", actual["Different"]);

            // a slight tweak
            metadata["Different"] = "Values";
            Assert.IsTrue(provider.SetImageMetadata(image.Id, metadata));
            actual = provider.ListImageMetadata(image.Id);
            Assert.IsNotNull(actual);
            Assert.AreEqual(1, actual.Count);
            Assert.AreEqual("Values", actual["Different"]);

            Assert.IsTrue(provider.SetImageMetadata(image.Id, new Metadata()));
            Assert.AreEqual(0, provider.ListImageMetadata(image.Id).Count);

            /* Cleanup
             */
            bool deleted = provider.DeleteImage(images[0].Id);
            Assert.IsTrue(deleted);
            provider.WaitForImageDeleted(images[0].Id);
        }
开发者ID:nick-o,项目名称:openstack.net,代码行数:62,代码来源:UserServerTests.cs


注:本文中的CloudServersProvider.ListImagesWithDetails方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。