/// <summary> /// Initializes a new instance of the <see cref="PullRequestDiscussionThread"/> class. /// </summary> /// <param name="id">ID of the discussion thread.</param> /// <param name="status">A value if the thread is active or already fixed.</param> /// <param name="filePath">The path to the file where the message should be posted. /// The path needs to be relative to the repository root. /// Can be <c>null</c> if discussion is not related to a change in a file.</param> /// <param name="comments">All the comments of this thread.</param> public PullRequestDiscussionThread( int id, PullRequestDiscussionStatus status, FilePath filePath, IEnumerable <IPullRequestDiscussionComment> comments) { // ReSharper disable once PossibleMultipleEnumeration comments.NotNull(nameof(comments)); // File path needs to be relative to the repository root. if (filePath != null) { if (!filePath.IsRelative) { throw new ArgumentOutOfRangeException(nameof(filePath), "File path needs to be relative to the repository root."); } this.AffectedFileRelativePath = filePath; } this.Id = id; this.Status = status; // ReSharper disable once PossibleMultipleEnumeration this.comments.AddRange(comments); }
public void Should_Set_Correct_Status( CommentThreadStatus status, PullRequestDiscussionStatus expectedResult) { // Given var id = 123; var filePath = "/foo.cs"; var thread = new GitPullRequestCommentThread { Id = id, Status = status, ThreadContext = new CommentThreadContext() { FilePath = filePath }, Comments = new List <Comment>(), Properties = new PropertiesCollection() }; // When var result = thread.ToPullRequestDiscussionThread(); // Then result.Status.ShouldBe(expectedResult); }
public void Should_Return_Correct_Value( AzureDevOpsCommentThreadStatus status, PullRequestDiscussionStatus expectedResult) { // Given // When var result = status.ToPullRequestDiscussionStatus(); // Then result.ShouldBe(expectedResult); }
public void Should_Set_Status(PullRequestDiscussionStatus status) { // Given / When var thread = new PullRequestDiscussionThread( 1, status, "foo.cs", new List <IPullRequestDiscussionComment>()); // Then thread.Status.ShouldBe(status); }