public async Task GetCommentCountAsync_WithValidReponse_AreEqual()
        {
            var client   = new ImgurClient(ClientId, ClientSecret, OAuth2Token);
            var endpoint = new AccountEndpoint(client);

            var commentCount = await endpoint.GetCommentCountAsync();

            Assert.IsTrue(commentCount > 1);
        }
Beispiel #2
0
        public async Task GetCommentCountAsync_WithValidReponse_AreEqual()
        {
            var client   = new MashapeClient(ClientId, ClientSecret, MashapeKey);
            var endpoint = new AccountEndpoint(client);

            var commentCount = await endpoint.GetCommentCountAsync("sarah");

            Assert.IsTrue(commentCount > 100);
        }
Beispiel #3
0
        public async Task GetCommentCountAsync_AreEqual()
        {
            var client   = new ImgurClient(ClientId, ClientSecret);
            var endpoint = new AccountEndpoint(client);

            var commentCount = await endpoint.GetCommentCountAsync("sarah");

            Assert.IsTrue(commentCount > 100);
        }
Beispiel #4
0
        public async Task GetCommentCountAsync_WithUsernameNull_ThrowsArgumentNullException()
        {
            var client   = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client);

            var exception =
                await
                Record.ExceptionAsync(
                    async() => await endpoint.GetCommentCountAsync(null).ConfigureAwait(false))
                .ConfigureAwait(false);

            Assert.NotNull(exception);
            Assert.IsType <ArgumentNullException>(exception);
        }
Beispiel #5
0
        public async Task GetCommentCountAsync_NotNull()
        {
            var mockUrl      = "https://api.imgur.com/3/account/sarah/comments/count";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockAccountEndpointResponses.GetCommentCount)
            };

            var client   = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var count    = await endpoint.GetCommentCountAsync("sarah").ConfigureAwait(false);

            Assert.Equal(count, 1500);
        }
Beispiel #6
0
        public async Task GetCommentCountAsync_IsNotNull()
        {
            var fakeHttpMessageHandler = new FakeHttpMessageHandler();
            var fakeResponse           = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(AccountEndpointResponses.GetCommentCountResponse)
            };

            fakeHttpMessageHandler.AddFakeResponse(new Uri("https://api.imgur.com/3/account/sarah/comments/count"),
                                                   fakeResponse);

            var client   = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client, new HttpClient(fakeHttpMessageHandler));
            var count    = await endpoint.GetCommentCountAsync("sarah");

            Assert.AreEqual(count, 1500);
        }
Beispiel #7
0
 public async Task GetCommentCountAsync_WithUsernameNull_ThrowsArgumentNullException()
 {
     var client   = new ImgurClient("123", "1234");
     var endpoint = new AccountEndpoint(client);
     await endpoint.GetCommentCountAsync(null);
 }