Add Events URL to the Issue class.

This commit is contained in:
Henrik Andersson
2015-09-18 23:22:29 +10:00
parent 69e528889f
commit 0600ffdb03
3 changed files with 27 additions and 1 deletions
@@ -351,6 +351,25 @@ public class IssuesClientTests : IDisposable
Assert.Empty(updatedIssue.Labels);
}
[IntegrationTest]
public async Task CanAccessUrls()
{
var expctedUri = "https://api.github.com/repos/{0}/{1}/issues/{2}/{3}";
var owner = _repository.Owner.Login;
var newIssue = new NewIssue("A test issue")
{
Body = "A new unassigned issue",
};
var issue = await _issuesClient.Create(owner, _repository.Name, newIssue);
Assert.NotNull(issue.CommentsUrl);
Assert.Equal(new Uri(string.Format(expctedUri, owner, _repository.Name, issue.Number, "comments")), issue.CommentsUrl);
Assert.NotNull(issue.EventsUrl);
Assert.Equal(new Uri(string.Format(expctedUri, owner, _repository.Name, issue.Number, "events")), issue.EventsUrl);
}
public void Dispose()
{
Helper.DeleteRepo(_repository);
@@ -238,6 +238,7 @@ namespace Octokit.Tests.Clients
Assert.Equal(new Uri("https://api.github.com/repos/octokit-net-test/public-repo-20131022050247078/issues/1"), response.Body.Url);
Assert.Equal(new Uri("https://github.com/octokit-net-test/public-repo-20131022050247078/issues/1"), response.Body.HtmlUrl);
Assert.Equal(new Uri("https://api.github.com/repos/octokit-net-test/public-repo-20131022050247078/issues/1/comments"), response.Body.CommentsUrl);
Assert.Equal(new Uri("https://api.github.com/repos/octokit-net-test/public-repo-20131022050247078/issues/1/events"), response.Body.EventsUrl);
}
}
}
+7 -1
View File
@@ -10,11 +10,12 @@ namespace Octokit
{
public Issue() { }
public Issue(Uri url, Uri htmlUrl, Uri commentsUrl, int number, ItemState state, string title, string body, User user, IReadOnlyList<Label> labels, User assignee, Milestone milestone, int comments, PullRequest pullRequest, DateTimeOffset? closedAt, DateTimeOffset createdAt, DateTimeOffset? updatedAt)
public Issue(Uri url, Uri htmlUrl, Uri commentsUrl, Uri eventsUrl, int number, ItemState state, string title, string body, User user, IReadOnlyList<Label> labels, User assignee, Milestone milestone, int comments, PullRequest pullRequest, DateTimeOffset? closedAt, DateTimeOffset createdAt, DateTimeOffset? updatedAt)
{
Url = url;
HtmlUrl = htmlUrl;
CommentsUrl = commentsUrl;
EventsUrl = eventsUrl;
Number = number;
State = state;
Title = title;
@@ -45,6 +46,11 @@ namespace Octokit
/// </summary>
public Uri CommentsUrl { get; protected set; }
/// <summary>
/// The Events URL of this issue.
/// </summary>
public Uri EventsUrl { get; protected set; }
/// <summary>
/// The issue number.
/// </summary>