Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added ability to delete a comment.
  • Loading branch information
mwgriffiths88 committed Jun 27, 2014
1 parent ce094a0 commit 81803cb
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 13 deletions.
45 changes: 32 additions & 13 deletions src/YouTrackSharp.Specs/Specs/IssueManagementSpecs.cs
Expand Up @@ -297,20 +297,39 @@ public class when_searching_for_an_issue_given_some_text : AuthenticatedYouTrack
static IEnumerable<Issue> 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;
}

}
5 changes: 5 additions & 0 deletions src/YouTrackSharp/Issues/IssueManagement.cs
Expand Up @@ -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));
}
}
}

0 comments on commit 81803cb

Please sign in to comment.