UpdateImageAsync() public method

Updates the title or description of an image. You can only update an image you own and is associated with your account. For an anonymous image, {id} must be the image's deletehash.
/// Thrown when a null reference is passed to a method that does not accept it as a /// valid argument. /// Thrown when an error is found in a response from an Imgur endpoint. Thrown when an error is found in a response from a Mashape endpoint.
public UpdateImageAsync ( string imageId, string title = null, string description = null ) : Task
imageId string The image id.
title string The title of the image.
description string The description of the image.
return Task
コード例 #1
0
        public async Task UpdateImageAsync_WithImage_AreEqual(IImage actualImage)
        {
            var client = new ImgurClient(ClientId, ClientSecret);
            var endpoint = new ImageEndpoint(client);

            var expected = await endpoint.UpdateImageAsync(actualImage.DeleteHash, "Ti", "De");

            Assert.IsTrue(expected);
        }
コード例 #2
0
        public async Task UpdateImageAsync_WithIdNull_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234");
            var endpoint = new ImageEndpoint(client);

            var exception =
                await
                    Record.ExceptionAsync(
                        async () => await endpoint.UpdateImageAsync(null).ConfigureAwait(false))
                        .ConfigureAwait(false);
            Assert.NotNull(exception);
            Assert.IsType<ArgumentNullException>(exception);
        }
コード例 #3
0
        public async Task UpdateImageAsync_Equal()
        {
            var mockUrl = "https://api.imgur.com/3/image/123xyj";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockImageEndpointResponses.Imgur.UpdateImage)
            };

            var client = new ImgurClient("123", "1234");
            var endpoint = new ImageEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var updated = await endpoint.UpdateImageAsync("123xyj").ConfigureAwait(false);

            Assert.Equal(true, updated);
        }