public GetNotificationsAsync ( bool newNotifications = true ) : Task |
||
newNotifications | bool | false for all notifications, true for only non-viewed notification. Default is true. |
return | Task |
public async Task GetNotificationsAsync_NotNull() { var mockUrl = "https://api.imgur.com/3/notification?new=false"; var mockResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(MockNotificationEndpointResponses.GetNotifications) }; var client = new ImgurClient("123", "1234", MockOAuth2Token); var endpoint = new NotificationEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse))); var notifications = await endpoint.GetNotificationsAsync(false).ConfigureAwait(false); Assert.NotNull(notifications); Assert.NotNull(notifications.Messages); Assert.NotNull(notifications.Replies); }
public async Task GetNotificationsAsync_OAuth2Null_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234"); var endpoint = new NotificationEndpoint(client); var exception = await Record.ExceptionAsync( async () => await endpoint.GetNotificationsAsync().ConfigureAwait(false)) .ConfigureAwait(false); Assert.NotNull(exception); Assert.IsType<ArgumentNullException>(exception); }