public GetNotificationAsync ( string notificationId ) : Task |
||
notificationId | string | The notification id. |
return | Task |
public async Task<INotification> GetNotificationAsync(string notificationId)
{
if (string.IsNullOrWhiteSpace(notificationId))
throw new ArgumentNullException(nameof(notificationId));
if (ApiClient.OAuth2Token == null)
throw new ArgumentNullException(nameof(ApiClient.OAuth2Token), OAuth2RequiredExceptionMessage);
var url = $"notification/{notificationId}";
using (var request = RequestBuilder.CreateRequest(HttpMethod.Get, url))
{
var notification = await SendRequestAsync<Notification>(request).ConfigureAwait(false);
return notification;
}
}
public async Task GetNotificationAsync_WithIdNull_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234", MockOAuth2Token); var endpoint = new NotificationEndpoint(client); var exception = await Record.ExceptionAsync( async () => await endpoint.GetNotificationAsync(null).ConfigureAwait(false)) .ConfigureAwait(false); Assert.NotNull(exception); Assert.IsType<ArgumentNullException>(exception); }