public DeleteImageAsync ( string imageId, string username = "me" ) : Task |
||
imageId | string | The image id. |
username | string | The user account. Default: me |
리턴 | Task |
public async Task DeleteImageAsync_ThrowsImgurException() { var client = new MashapeClient(ClientId, ClientSecret, MashapeKey); var endpoint = new AccountEndpoint(client); var deleted = await endpoint.DeleteImageAsync("ra06GZN", "sarah"); Assert.IsTrue(deleted); }
public async Task DeleteImageAsync_WithDefaultUsernameAndOAuth2Null_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234", MockOAuth2Token); var endpoint = new AccountEndpoint(client); var exception = await Record.ExceptionAsync( async () => await endpoint.DeleteImageAsync("hbzm7Ge", null).ConfigureAwait(false)) .ConfigureAwait(false); Assert.NotNull(exception); Assert.IsType<ArgumentNullException>(exception); }
public async Task DeleteImageAsync_WithOAuth2TokenNull_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234"); var endpoint = new AccountEndpoint(client); var exception = await Record.ExceptionAsync( async () => await endpoint.DeleteImageAsync("yMgB7", "sarah").ConfigureAwait(false)) .ConfigureAwait(false); Assert.NotNull(exception); Assert.IsType<ArgumentNullException>(exception); }
public async Task DeleteImageAsync_NotNull() { var mockUrl = "https://api.imgur.com/3/account/sarah/image/hbzm7Ge"; var mockResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(MockAccountEndpointResponses.DeleteImage) }; var client = new ImgurClient("123", "1234", MockOAuth2Token); var endpoint = new AccountEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse))); var deleted = await endpoint.DeleteImageAsync("hbzm7Ge", "sarah").ConfigureAwait(false); Assert.True(deleted); }
public async Task DeleteImageAsync_WithValidReponse_ThrowsImgurException() { var client = new ImgurClient(ClientId, ClientSecret, await GetOAuth2Token()); var endpoint = new AccountEndpoint(client); var deleted = await endpoint.DeleteImageAsync("487153732"); Assert.IsTrue(deleted); }