diff --git a/src/YouTrackSharp.Specs/Specs/IssueManagementSpecs.cs b/src/YouTrackSharp.Specs/Specs/IssueManagementSpecs.cs index f4affe55..77c96cbf 100644 --- a/src/YouTrackSharp.Specs/Specs/IssueManagementSpecs.cs +++ b/src/YouTrackSharp.Specs/Specs/IssueManagementSpecs.cs @@ -297,20 +297,39 @@ public class when_searching_for_an_issue_given_some_text : AuthenticatedYouTrack static IEnumerable issues; } - [Subject(typeof(IssueManagement))] - public class when_getting_issue_count_by_search_string : AuthenticatedYouTrackConnectionForIssue - { - Because of = () => - { - count = issueManagement.GetIssueCount("some new issue"); - }; + [Subject(typeof(IssueManagement))] + public class when_getting_issue_count_by_search_string : AuthenticatedYouTrackConnectionForIssue + { + Because of = () => + { + count = issueManagement.GetIssueCount("some new issue"); + }; - It should_return_number_of_matching_issues = () => - { - count.ShouldBeGreaterThan(0); - }; + It should_return_number_of_matching_issues = () => + { + count.ShouldBeGreaterThan(0); + }; - static int count; - } + static int count; + } + + [Subject(typeof(IssueManagement))] + public class when_deleting_a_comment : AuthenticatedYouTrackConnectionForIssue + { + Because of = () => + { + oldCount = issueManagement.GetCommentsForIssue("SB-1").Count(); + issueManagement.DeleteComment("SB-1", "100-01", false); + }; + + It should_be_less_comments_than_before = () => + { + newCount = issueManagement.GetCommentsForIssue("SB-1").Count(); + newCount.ShouldBeLessThan(oldCount); + }; + + static int oldCount; + static int newCount; + } } \ No newline at end of file diff --git a/src/YouTrackSharp/Issues/IssueManagement.cs b/src/YouTrackSharp/Issues/IssueManagement.cs index 52227d32..ada70868 100644 --- a/src/YouTrackSharp/Issues/IssueManagement.cs +++ b/src/YouTrackSharp/Issues/IssueManagement.cs @@ -246,5 +246,10 @@ public void Delete(string id) { _connection.Delete(string.Format("issue/{0}", id)); } + + public void DeleteComment(string issueId, string commentId, bool deletePermanently) + { + _connection.Delete(string.Format("issue/{0}/comment/{1}?permanently={2}", issueId, commentId, deletePermanently)); + } } } \ No newline at end of file