/// <summary> /// Converts a <see cref="AzureDevOpsPullRequestCommentThread"/> from Azure DevOps to a <see cref="IPullRequestDiscussionThread"/> as used in this addin. /// </summary> /// <param name="thread">Azure DevOps thread to convert.</param> /// <returns>Converted thread.</returns> public static IPullRequestDiscussionThread ToPullRequestDiscussionThread(this AzureDevOpsPullRequestCommentThread thread) { thread.NotNull(nameof(thread)); return(new PullRequestDiscussionThread( thread.Id, thread.Status.ToPullRequestDiscussionStatus(), thread.FilePath, thread.Comments.Select(x => x.ToPullRequestDiscussionComment())) { CommentSource = thread.GetCommentSource(), Resolution = thread.Status.ToPullRequestDiscussionResolution(), }); }
/// <summary> /// Checks if the custom comment source value used to decorate comments created by this addin /// has a specific value. /// </summary> /// <param name="thread">Thread to check.</param> /// <param name="value">Value to check for.</param> /// <returns><c>True</c> if the value is identical, <c>False</c> otherwise.</returns> public static bool IsCommentSource(this AzureDevOpsPullRequestCommentThread thread, string value) { thread.NotNull(nameof(thread)); return(thread.GetCommentSource() == value); }