示例#1
0
        public async Task GetCommentsAsync_WithValidReponse_AreEqual()
        {
            var client   = new MashapeClient(ClientId, ClientSecret, MashapeKey);
            var endpoint = new AccountEndpoint(client);

            var comments = await endpoint.GetCommentsAsync("sarah", CommentSortOrder.Best);

            Assert.AreEqual(50, comments.Count());
        }
示例#2
0
        public async Task GetCommentsAsync_AreEqual()
        {
            var client   = new ImgurClient(ClientId, ClientSecret);
            var endpoint = new AccountEndpoint(client);

            var comments = await endpoint.GetCommentsAsync("sarah", CommentSortOrder.Best);

            Assert.AreEqual(50, comments.Count());
        }
        public async Task GetCommentsAsync_AreEqual()
        {
            var client   = new ImgurClient(ClientId, ClientSecret, OAuth2Token);
            var endpoint = new AccountEndpoint(client);

            var comments = await endpoint.GetCommentsAsync();

            Assert.IsTrue(comments.Count() >= 2);
        }
        public async Task GetCommentsAsync_WithValidReponse_AreEqual()
        {
            var client   = new MashapeClient(ClientId, ClientSecret, MashapeKey, await GetOAuth2Token());
            var endpoint = new AccountEndpoint(client);

            var comments = await endpoint.GetCommentsAsync();

            Assert.IsTrue(comments.Count() >= 2);
        }
示例#5
0
        public async Task GetCommentsAsync_WithUsernameNull_ThrowsArgumentNullException()
        {
            var client   = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client);

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

            Assert.NotNull(exception);
            Assert.IsType <ArgumentNullException>(exception);
        }
示例#6
0
        public async Task GetCommentsAsync_Equal()
        {
            var mockUrl      = "https://api.imgur.com/3/account/bob/comments/worst/2";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockAccountEndpointResponses.GetComments)
            };

            var client   = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var comments = await endpoint.GetCommentsAsync("bob", CommentSortOrder.Worst, 2).ConfigureAwait(false);

            Assert.Equal(50, comments.Count());
        }
示例#7
0
        public async Task GetCommentsAsync_AreEqual()
        {
            var fakeHttpMessageHandler = new FakeHttpMessageHandler();
            var fakeResponse           = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(AccountEndpointResponses.GetCommentsResponse)
            };

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

            var client   = new ImgurClient("123", "1234");
            var endpoint = new AccountEndpoint(client, new HttpClient(fakeHttpMessageHandler));
            var comments = await endpoint.GetCommentsAsync("bob", CommentSortOrder.Worst, 2);

            Assert.AreEqual(50, comments.Count());
        }
示例#8
0
 public async Task GetCommentsAsync_WithUsernameNull_ThrowsArgumentNullException()
 {
     var client   = new ImgurClient("123", "1234");
     var endpoint = new AccountEndpoint(client);
     await endpoint.GetCommentsAsync(null);
 }