public GetAlbumImageAsync ( string imageId, string albumId ) : Task |
||
imageId | string | The image id. |
albumId | string | The album id. |
Résultat | Task |
public async Task<IImage> GetAlbumImageAsync(string imageId, string albumId)
{
if (string.IsNullOrWhiteSpace(imageId))
throw new ArgumentNullException(nameof(imageId));
if (string.IsNullOrWhiteSpace(albumId))
throw new ArgumentNullException(nameof(albumId));
var url = $"album/{albumId}/image/{imageId}";
using (var request = RequestBuilder.CreateRequest(HttpMethod.Get, url))
{
var returnImage = await SendRequestAsync<Image>(request).ConfigureAwait(false);
return returnImage;
}
}
public async Task GetAlbumImageAsync_WithImageNull_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234"); var endpoint = new AlbumEndpoint(client); var exception = await Record.ExceptionAsync( async () => await endpoint.GetAlbumImageAsync("PioAxs8", null).ConfigureAwait(false)) .ConfigureAwait(false); Assert.NotNull(exception); Assert.IsType<ArgumentNullException>(exception); }