/// <summary>
        /// Uploads the diff.
        /// </summary>
        /// <param name="reviewRequest">The review request.</param>
        /// <param name="arguments">The arguments.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">arguments</exception>
        /// <exception cref="ReviewBoardAuthenticationException"></exception>
        public async Task UploadDiffAsync(ReviewBoardReviewRequest reviewRequest, ReviewBoardArguments arguments)
        {
            if (reviewRequest == null)
            {
                throw new ArgumentNullException("reviewRequest");
            }
            if (arguments == null)
            {
                throw new ArgumentNullException("arguments");
            }

            if (!Login(arguments))
            {
                throw new ReviewBoardAuthenticationException();
            }

            await AddReviewDiffAsync(reviewRequest.Id, arguments.BaseDirectory, arguments.DiffFile).ConfigureAwait(false);

            reviewRequest.Summary = arguments.Summary;
            reviewRequest.Description = arguments.Description;
            reviewRequest.Groups = arguments.Group;
            reviewRequest.Public = true;
            reviewRequest.BugsClosed = arguments.Bugs;

            await UpdateReviewRequestAsync(reviewRequest).ConfigureAwait(false);
        }
Beispiel #2
0
        /// <summary>
        /// Uploads the diff.
        /// </summary>
        /// <param name="reviewRequest">The review request.</param>
        /// <param name="arguments">The arguments.</param>
        /// <returns></returns>
        /// <exception cref="System.ArgumentNullException">arguments</exception>
        /// <exception cref="ReviewBoardAuthenticationException"></exception>
        public async Task UploadDiffAsync(ReviewBoardReviewRequest reviewRequest, ReviewBoardArguments arguments)
        {
            if (reviewRequest == null)
            {
                throw new ArgumentNullException("reviewRequest");
            }
            if (arguments == null)
            {
                throw new ArgumentNullException("arguments");
            }

            if (!Login(arguments))
            {
                throw new ReviewBoardAuthenticationException();
            }

            await AddReviewDiffAsync(reviewRequest.Id, arguments.BaseDirectory, arguments.DiffFile).ConfigureAwait(false);

            reviewRequest.Summary     = arguments.Summary;
            reviewRequest.Description = arguments.Description;
            reviewRequest.Groups      = arguments.Group;
            reviewRequest.Public      = true;
            reviewRequest.BugsClosed  = arguments.Bugs;

            await UpdateReviewRequestAsync(reviewRequest).ConfigureAwait(false);
        }
Beispiel #3
0
        private async Task UpdateReviewRequestAsync(ReviewBoardReviewRequest reviewRequest)
        {
            var request = new RestRequest
            {
                Resource = "review-requests/" + reviewRequest.Id + "/draft/",
                Method   = Method.PUT
            };

            request.AddParameter("summary", reviewRequest.Summary);
            request.AddParameter("public", reviewRequest.Public.ToString());
            request.AddParameter("target_groups", reviewRequest.Groups);
            request.AddParameter("description", reviewRequest.Description);

            if (!String.IsNullOrEmpty(reviewRequest.BugsClosed))
            {
                request.AddParameter("bugs_closed", reviewRequest.BugsClosed);
            }

            using (var tokenSource = new CancellationTokenSource())
            {
                tokenSource.CancelAfter(DefaultTimeout);
                var response = await ExecuteAsync(request, tokenSource.Token).ConfigureAwait(false);

                CheckResponse(response);
            }
        }
 public async Task UploadDiffAsync(ReviewBoardReviewRequest reviewRequest, ReviewBoardArguments arguments)
 {
     await Task.Delay(2000).ConfigureAwait(false);
 }
        private async Task UpdateReviewRequestAsync(ReviewBoardReviewRequest reviewRequest)
        {
            var request = new RestRequest
            {
                Resource = "review-requests/" + reviewRequest.Id + "/draft/",
                Method = Method.PUT
            };

            request.AddParameter("summary", reviewRequest.Summary);
            request.AddParameter("public", reviewRequest.Public.ToString());
            request.AddParameter("target_groups", reviewRequest.Groups);
            request.AddParameter("description", reviewRequest.Description);
            
            if (!String.IsNullOrEmpty(reviewRequest.BugsClosed))
            {
                request.AddParameter("bugs_closed", reviewRequest.BugsClosed);
            }

            using (var tokenSource = new CancellationTokenSource())
            {
                tokenSource.CancelAfter(DefaultTimeout);
                var response = await ExecuteAsync(request, tokenSource.Token).ConfigureAwait(false);
                CheckResponse(response);
            }
        }