コード例 #1
0
        public async Task GetRepliesAsync_True()
        {
            var mockUrl      = "https://api.imgur.com/3/comment/539556821/replies";
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockCommentEndpointResponses.GetCommentReplies)
            };

            var client   = new ImgurClient("123", "1234");
            var endpoint = new CommentEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var comments = await endpoint.GetRepliesAsync(539556821).ConfigureAwait(false);

            Assert.True(comments.Children.Count() == 7);
        }
コード例 #2
0
        public async Task GetRepliesAsync_IsTrue()
        {
            var fakeHttpMessageHandler = new FakeHttpMessageHandler();
            var fakeResponse           = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(CommentEndpointResponses.GetCommentReplies)
            };

            fakeHttpMessageHandler.AddFakeResponse(new Uri("https://api.imgur.com/3/comment/539556821/replies"),
                                                   fakeResponse);

            var client   = new ImgurClient("123", "1234");
            var endpoint = new CommentEndpoint(client, new HttpClient(fakeHttpMessageHandler));
            var comments = await endpoint.GetRepliesAsync("539556821");

            Assert.IsTrue(comments.Children.Count() == 7);
        }
コード例 #3
0
 public async Task GetRepliesAsync_WithIdNull_ThrowsArgumentNullException()
 {
     var client   = new ImgurClient("123", "1234");
     var endpoint = new CommentEndpoint(client);
     await endpoint.GetRepliesAsync(null);
 }