public async Task GetCommentIdsAsync_WithValidReponse_AreEqual() { var client = new MashapeClient(ClientId, ClientSecret, MashapeKey); var endpoint = new AccountEndpoint(client); var comments = await endpoint.GetCommentIdsAsync("sarah"); Assert.AreEqual(50, comments.Count()); }
public async Task GetCommentIdsAsync_AreEqual() { var client = new ImgurClient(ClientId, ClientSecret); var endpoint = new AccountEndpoint(client); var comments = await endpoint.GetCommentIdsAsync("sarah"); Assert.AreEqual(50, comments.Count()); }
public async Task GetCommentIdsAsync_AreEqual() { var client = new ImgurClient(ClientId, ClientSecret, OAuth2Token); var endpoint = new AccountEndpoint(client); var comments = await endpoint.GetCommentIdsAsync(); Assert.IsTrue(comments.Count() > 1); }
public async Task GetCommentIdsAsync_WithValidReponse_AreEqual() { var client = new MashapeClient(ClientId, ClientSecret, MashapeKey, await GetOAuth2Token()); var endpoint = new AccountEndpoint(client); var comments = await endpoint.GetCommentIdsAsync(); Assert.IsTrue(comments.Count() > 1); }
public async Task GetCommentIdsAsync_WithUsernameNull_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234"); var endpoint = new AccountEndpoint(client); var exception = await Record.ExceptionAsync( async() => await endpoint.GetCommentIdsAsync(null).ConfigureAwait(false)) .ConfigureAwait(false); Assert.NotNull(exception); Assert.IsType <ArgumentNullException>(exception); }
public async Task GetCommentIdsAsync_Equal() { var mockUrl = "https://api.imgur.com/3/account/bob/comments/ids/worst/2"; var mockResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(MockAccountEndpointResponses.GetCommentIds) }; var client = new ImgurClient("123", "1234"); var endpoint = new AccountEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse))); var comments = await endpoint.GetCommentIdsAsync("bob", CommentSortOrder.Worst, 2).ConfigureAwait(false); Assert.Equal(50, comments.Count()); }
public async Task GetCommentIdsAsync_AreEqual() { var fakeHttpMessageHandler = new FakeHttpMessageHandler(); var fakeResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(AccountEndpointResponses.GetCommentIdsResponse) }; fakeHttpMessageHandler.AddFakeResponse(new Uri("https://api.imgur.com/3/account/bob/comments/ids/worst/2"), fakeResponse); var client = new ImgurClient("123", "1234"); var endpoint = new AccountEndpoint(client, new HttpClient(fakeHttpMessageHandler)); var comments = await endpoint.GetCommentIdsAsync("bob", CommentSortOrder.Worst, 2); Assert.AreEqual(50, comments.Count()); }
public async Task GetCommentIdsAsync_WithUsernameNull_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234"); var endpoint = new AccountEndpoint(client); await endpoint.GetCommentIdsAsync(null); }