Inheritance: RequestBuilderBase
 public void CreateReplyRequest_WithCommentNull_ThrowsArgumentNullException()
 {
     var client = new ImgurClient("123", "1234");
     var requestBuilder = new CommentRequestBuilder();
     var url = $"{client.EndpointUrl}comment";
     requestBuilder.CreateReplyRequest(url, null, "xYxAbcD");
 }
 public void CreateCommentRequest_WithImageIdNull_ThrowsArgumentNullException()
 {
     var client = new ImgurClient("123", "1234");
     var requestBuilder = new CommentRequestBuilder();
     var url = $"{client.EndpointUrl}comment";
     requestBuilder.CreateCommentRequest(url, "Hello World", null, "ABCdef");
 }
        public void CreateCommentRequest_WithUrlNull_ThrowsArgumentNullException()
        {
            var requestBuilder = new CommentRequestBuilder();

            var exception =
                Record.Exception(() => requestBuilder.CreateCommentRequest(null, "Hello World!", "xYxAbcD", "ABCdef"));
            Assert.NotNull(exception);
            Assert.IsType<ArgumentNullException>(exception);

            var argNullException = (ArgumentNullException) exception;
            Assert.Equal(argNullException.ParamName, "url");
        }
        public void CreateCommentRequest_WithImageIdNull_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234");
            var requestBuilder = new CommentRequestBuilder();
            var mockUrl = $"{client.EndpointUrl}comment";

            var exception =
                Record.Exception(() => requestBuilder.CreateCommentRequest(mockUrl, "Hello World", null, "ABCdef"));
            Assert.NotNull(exception);
            Assert.IsType<ArgumentNullException>(exception);

            var argNullException = (ArgumentNullException) exception;
            Assert.Equal(argNullException.ParamName, "galleryItemId");
        }
        public async Task CreateReplyRequest_AreEqual()
        {
            var client = new ImgurClient("123", "1234");
            var requestBuilder = new CommentRequestBuilder();

            var url = $"{client.EndpointUrl}comment";
            var request = requestBuilder.CreateReplyRequest(url, "Hello World!", "xYxAbcD");

            Assert.IsNotNull(request);
            var expected = "image_id=xYxAbcD&comment=Hello+World%21";

            Assert.AreEqual(expected, await request.Content.ReadAsStringAsync());
            Assert.AreEqual("https://api.imgur.com/3/comment", request.RequestUri.ToString());
            Assert.AreEqual(HttpMethod.Post, request.Method);
        }
        public async Task CreateGalleryItemCommentRequest_Equal()
        {
            var client = new ImgurClient("123", "1234");
            var requestBuilder = new CommentRequestBuilder();

            var mockUrl = $"{client.EndpointUrl}gallery/XysioD/comment";
            var request = requestBuilder.CreateGalleryItemCommentRequest(mockUrl, "Hello World!");

            Assert.NotNull(request);
            var expected = "comment=Hello+World%21";

            Assert.Equal(expected, await request.Content.ReadAsStringAsync().ConfigureAwait(false));
            Assert.Equal("https://api.imgur.com/3/gallery/XysioD/comment", request.RequestUri.ToString());
            Assert.Equal(HttpMethod.Post, request.Method);
        }
        public async Task CreateCommentRequest_Equal()
        {
            var client = new ImgurClient("123", "1234");
            var requestBuilder = new CommentRequestBuilder();

            var mockUrl = $"{client.EndpointUrl}comment/XysioD";
            var request = requestBuilder.CreateCommentRequest(mockUrl, "Hello World!", "xYxAbcD", "ABCdef");

            Assert.NotNull(request);
            var expected = "image_id=xYxAbcD&comment=Hello+World%21&parent_id=ABCdef";

            Assert.Equal(expected, await request.Content.ReadAsStringAsync().ConfigureAwait(false));
            Assert.Equal("https://api.imgur.com/3/comment/XysioD", request.RequestUri.ToString());
            Assert.Equal(HttpMethod.Post, request.Method);
        }
        public async Task ReportItemRequest_Equal()
        {
            var client = new ImgurClient("123", "1234");
            var requestBuilder = new CommentRequestBuilder();

            var mockUrl = $"{client.EndpointUrl}comment/XysioD/report";
            var request = requestBuilder.ReportItemRequest(mockUrl, ReportReason.Abusive);

            Assert.NotNull(request);
            var expected = "reason=3";

            Assert.Equal(expected, await request.Content.ReadAsStringAsync().ConfigureAwait(false));
            Assert.Equal("https://api.imgur.com/3/comment/XysioD/report", request.RequestUri.ToString());
            Assert.Equal(HttpMethod.Post, request.Method);
        }
 public void CreateReplyRequest_WithUrlNull_ThrowsArgumentNullException()
 {
     var requestBuilder = new CommentRequestBuilder();
     requestBuilder.CreateReplyRequest(null, "Hello World!", "xYxAbcD");
 }
        public void VoteCommentRequest_AreEqual()
        {
            var client = new ImgurClient("123", "1234");
            var requestBuilder = new CommentRequestBuilder();

            var url = $"{client.EndpointUrl}comment/XysioD/vote/up";
            var request = requestBuilder.CreateRequest(HttpMethod.Post, url);

            Assert.IsNotNull(request);

            Assert.AreEqual("https://api.imgur.com/3/comment/XysioD/vote/up", request.RequestUri.ToString());
            Assert.AreEqual(HttpMethod.Post, request.Method);
        }
        public void CreateReplyRequest_WithCommentNull_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234");
            var requestBuilder = new CommentRequestBuilder();
            var mockUrl = $"{client.EndpointUrl}comment";

            var exception = Record.Exception(() => requestBuilder.CreateReplyRequest(mockUrl, null, "xYxAbcD"));
            Assert.NotNull(exception);
            Assert.IsType<ArgumentNullException>(exception);

            var argNullException = (ArgumentNullException) exception;
            Assert.Equal(argNullException.ParamName, "comment");
        }