Skip to content

Commit 9eb27c0

Browse files
authored
(GH-365) Add method to close comment thread (#366)
1 parent f5a5503 commit 9eb27c0

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/Cake.AzureDevOps.Tests/Repos/PullRequest/AzureDevOpsPullRequestTests.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,6 +681,20 @@ public void Should_Resolve_Comment_Thread()
681681
// ?? Nothing to validate here since the method returns void
682682
}
683683

684+
[Fact]
685+
public void Should_Resolve_Close_Thread()
686+
{
687+
// Given
688+
var fixture = new PullRequestFixture(BasePullRequestFixture.ValidAzureDevOpsUrl, 21);
689+
var pullRequest = new AzureDevOpsPullRequest(fixture.Log, fixture.Settings, fixture.GitClientFactory);
690+
691+
// When
692+
pullRequest.CloseCommentThread(123);
693+
694+
// Then
695+
// ?? Nothing to validate here since the method returns void
696+
}
697+
684698
[Fact]
685699
public void Should_Not_Throw_If_Null_Is_Returned()
686700
{

src/Cake.AzureDevOps/Repos/PullRequest/AzureDevOpsPullRequest.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,15 @@ public void ActivateCommentThread(int threadId)
573573
this.SetCommentThreadStatus(threadId, CommentThreadStatus.Active);
574574
}
575575

576+
/// <summary>
577+
/// Sets the pull request comment thread to <see cref="CommentThreadStatus.Closed"/>.
578+
/// </summary>
579+
/// <param name="threadId">The Id of the comment thread.</param>
580+
public void CloseCommentThread(int threadId)
581+
{
582+
this.SetCommentThreadStatus(threadId, CommentThreadStatus.Closed);
583+
}
584+
576585
/// <summary>
577586
/// Creates a new comment thread with a single comment in the pull request.
578587
/// </summary>

0 commit comments

Comments
 (0)