Esempio n. 1
0
        public async Task Get()
        {
            var name  = Recording.GenerateAssetName("testGallery_");
            var image = await CreateGalleryImageAsync(name);

            GalleryImageResource image2 = await image.GetAsync();

            ResourceDataHelper.AssertGalleryImage(image.Data, image2.Data);
        }
Esempio n. 2
0
        public async Task CreateOrUpdate()
        {
            var collection = await GetGalleryImageCollectionAsync();

            var name = Recording.GenerateAssetName("testImage_");
            var lro  = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, BasicGalleryImageData);

            GalleryImageResource image = lro.Value;

            Assert.AreEqual(name, image.Data.Name);
        }
Esempio n. 3
0
        public async Task Get()
        {
            var collection = await GetGalleryImageCollectionAsync();

            var name = Recording.GenerateAssetName("testImage_");
            var lro  = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, BasicGalleryImageData);

            GalleryImageResource image1 = lro.Value;
            GalleryImageResource image2 = await collection.GetAsync(name);

            ResourceDataHelper.AssertGalleryImage(image1.Data, image2.Data);
        }
Esempio n. 4
0
        public async Task SetTags()
        {
            var name  = Recording.GenerateAssetName("testGallery_");
            var image = await CreateGalleryImageAsync(name);

            var tags = new Dictionary <string, string>()
            {
                { "key", "value" }
            };
            GalleryImageResource updatedGalleryImage = await image.SetTagsAsync(tags);

            Assert.AreEqual(tags, updatedGalleryImage.Data.Tags);
        }
Esempio n. 5
0
        public async Task Exists()
        {
            var collection = await GetGalleryImageCollectionAsync();

            var name = Recording.GenerateAssetName("testImage_");
            var lro  = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, BasicGalleryImageData);

            GalleryImageResource image = lro.Value;

            Assert.IsTrue(await collection.ExistsAsync(name));
            Assert.IsFalse(await collection.ExistsAsync(name + "1"));

            Assert.ThrowsAsync <ArgumentNullException>(async() => _ = await collection.ExistsAsync(null));
        }
Esempio n. 6
0
        public async Task Update()
        {
            var name  = Recording.GenerateAssetName("testGallery_");
            var image = await CreateGalleryImageAsync(name);

            var description = "This is a gallery for test";
            var update      = new PatchableGalleryImageData()
            {
                OSType      = OperatingSystemTypes.Linux, // We have to put this here, otherwise we get a 409 Changing property 'galleryImage.properties.osType' is not allowed.
                Description = description
            };
            var lro = await image.UpdateAsync(WaitUntil.Completed, update);

            GalleryImageResource updatedGalleryImage = lro.Value;

            Assert.AreEqual(description, updatedGalleryImage.Data.Description);
        }