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