public async Task <Response <CommunityGallery> > GetAsync(string subscriptionId, string location, string publicGalleryName, CancellationToken cancellationToken = default)
        {
            if (subscriptionId == null)
            {
                throw new ArgumentNullException(nameof(subscriptionId));
            }
            if (location == null)
            {
                throw new ArgumentNullException(nameof(location));
            }
            if (publicGalleryName == null)
            {
                throw new ArgumentNullException(nameof(publicGalleryName));
            }

            using var message = CreateGetRequest(subscriptionId, location, publicGalleryName);
            await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);

            switch (message.Response.Status)
            {
            case 200:
            {
                CommunityGallery value = default;
                using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);

                value = CommunityGallery.DeserializeCommunityGallery(document.RootElement);
                return(Response.FromValue(value, message.Response));
            }
예제 #2
0
        public void CommunityGallery_Get_Tests()
        {
            using (MockContext context = MockContext.Start(this.GetType()))
            {
                EnsureClientsInitialized(context);

                CommunityGallery communityGalleryOut = m_CrpClient.CommunityGalleries.Get(galleryAccessLocation, PublicGalleryName);
                Trace.TraceInformation("Got the community gallery {0} which is shared to public.", PublicGalleryName);
                Assert.NotNull(communityGalleryOut);
                ValidateCommunityGallery(communityGalleryOut);
            }
        }
예제 #3
0
        private void ValidateCommunityGallery(CommunityGallery communityGallery)
        {
            string expectedId = "/CommunityGalleries/" + PublicGalleryName;

            Assert.Equal(expectedId, communityGallery.UniqueId);
        }