mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-04 11:24:44 +00:00
Merge pull request #1563 from TattsGroup/fix-enum
Fix Issue Timeline exceptions by adding new EventInfoState values
This commit is contained in:
@@ -26,24 +26,15 @@ namespace Octokit.Tests.Integration.Clients
|
||||
[IntegrationTest]
|
||||
public async Task CanRetrieveTimelineForIssue()
|
||||
{
|
||||
var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
|
||||
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
|
||||
|
||||
var timelineEventInfos = await _issueTimelineClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
|
||||
Assert.Empty(timelineEventInfos);
|
||||
|
||||
var closed = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new IssueUpdate() { State = ItemState.Closed });
|
||||
Assert.NotNull(closed);
|
||||
|
||||
timelineEventInfos = await _issueTimelineClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
|
||||
Assert.Equal(1, timelineEventInfos.Count);
|
||||
Assert.Equal(EventInfoState.Closed, timelineEventInfos[0].Event);
|
||||
var timelineEventInfos = await _issueTimelineClient.GetAllForIssue("octokit", "octokit.net", 1503);
|
||||
Assert.NotEmpty(timelineEventInfos);
|
||||
Assert.NotEqual(0, timelineEventInfos.Count);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanRetrieveTimelineForIssueWithApiOptions()
|
||||
{
|
||||
var timelineEventInfos = await _issueTimelineClient.GetAllForIssue("octokit", "octokit.net", 1115);
|
||||
var timelineEventInfos = await _issueTimelineClient.GetAllForIssue("octokit", "octokit.net", 1503);
|
||||
Assert.NotEmpty(timelineEventInfos);
|
||||
Assert.NotEqual(1, timelineEventInfos.Count);
|
||||
|
||||
@@ -54,11 +45,47 @@ namespace Octokit.Tests.Integration.Clients
|
||||
StartPage = 1
|
||||
};
|
||||
|
||||
timelineEventInfos = await _issueTimelineClient.GetAllForIssue("octokit", "octokit.net", 1115, pageOptions);
|
||||
timelineEventInfos = await _issueTimelineClient.GetAllForIssue("octokit", "octokit.net", 1503, pageOptions);
|
||||
Assert.NotEmpty(timelineEventInfos);
|
||||
Assert.Equal(1, timelineEventInfos.Count);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanRetrieveTimelineForRecentIssues()
|
||||
{
|
||||
// Make sure we can deserialize the event timeline for recent closed PRs and open Issues in a heavy activity repository (microsoft/vscode)
|
||||
|
||||
// Search request
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
var search = new SearchIssuesRequest
|
||||
{
|
||||
PerPage = 20,
|
||||
Page = 1
|
||||
};
|
||||
search.Repos.Add("microsoft", "vscode");
|
||||
|
||||
// 20 most recent closed PRs
|
||||
search.Type = IssueTypeQualifier.PullRequest;
|
||||
search.State = ItemState.Closed;
|
||||
var pullRequestResults = await github.Search.SearchIssues(search);
|
||||
foreach (var pullRequest in pullRequestResults.Items)
|
||||
{
|
||||
var timelineEventInfos = await _issueTimelineClient.GetAllForIssue("microsoft", "vscode", pullRequest.Number);
|
||||
Assert.NotEmpty(timelineEventInfos);
|
||||
}
|
||||
|
||||
// 20 most recent open Issues
|
||||
search.Type = IssueTypeQualifier.Issue;
|
||||
search.State = ItemState.Open;
|
||||
var issueResults = await github.Search.SearchIssues(search);
|
||||
foreach (var issue in issueResults.Items)
|
||||
{
|
||||
var timelineEventInfos = await _issueTimelineClient.GetAllForIssue("microsoft", "vscode", issue.Number);
|
||||
|
||||
Assert.NotEmpty(timelineEventInfos);
|
||||
}
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanDeserializeRenameEvent()
|
||||
{
|
||||
|
||||
@@ -24,28 +24,16 @@ namespace Octokit.Tests.Integration.Reactive
|
||||
[IntegrationTest]
|
||||
public async Task CanRetrieveTimelineForIssue()
|
||||
{
|
||||
var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
|
||||
var observable = _client.Issue.Create(_context.Repository.Id, newIssue);
|
||||
var issue = await observable;
|
||||
|
||||
var observableTimeline = _client.Issue.Timeline.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
|
||||
var observableTimeline = _client.Issue.Timeline.GetAllForIssue("octokit", "octokit.net", 1503);
|
||||
var timelineEventInfos = await observableTimeline.ToList();
|
||||
Assert.Empty(timelineEventInfos);
|
||||
|
||||
observable = _client.Issue.Update(_context.Repository.Id, issue.Number, new IssueUpdate { State = ItemState.Closed });
|
||||
var closed = await observable;
|
||||
Assert.NotNull(closed);
|
||||
|
||||
observableTimeline = _client.Issue.Timeline.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
|
||||
timelineEventInfos = await observableTimeline.ToList();
|
||||
Assert.Equal(1, timelineEventInfos.Count);
|
||||
Assert.Equal(EventInfoState.Closed, timelineEventInfos[0].Event);
|
||||
Assert.NotEmpty(timelineEventInfos);
|
||||
Assert.NotEqual(0, timelineEventInfos.Count);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanRetrieveTimelineForIssueWithApiOptions()
|
||||
{
|
||||
var observableTimeline = _client.Issue.Timeline.GetAllForIssue("octokit", "octokit.net", 1115);
|
||||
var observableTimeline = _client.Issue.Timeline.GetAllForIssue("octokit", "octokit.net", 1503);
|
||||
var timelineEventInfos = await observableTimeline.ToList();
|
||||
Assert.NotEmpty(timelineEventInfos);
|
||||
Assert.NotEqual(1, timelineEventInfos.Count);
|
||||
@@ -56,7 +44,7 @@ namespace Octokit.Tests.Integration.Reactive
|
||||
PageCount = 1,
|
||||
StartPage = 1
|
||||
};
|
||||
observableTimeline = _client.Issue.Timeline.GetAllForIssue("octokit", "octokit.net", 1115, pageOptions);
|
||||
observableTimeline = _client.Issue.Timeline.GetAllForIssue("octokit", "octokit.net", 1503, pageOptions);
|
||||
timelineEventInfos = await observableTimeline.ToList();
|
||||
Assert.NotEmpty(timelineEventInfos);
|
||||
Assert.Equal(1, timelineEventInfos.Count);
|
||||
|
||||
@@ -204,6 +204,21 @@ namespace Octokit
|
||||
/// url of the reference's source.
|
||||
/// </summary>
|
||||
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Crossreferenced")]
|
||||
Crossreferenced
|
||||
Crossreferenced,
|
||||
|
||||
/// <summary>
|
||||
/// The issue was reveiewed.
|
||||
/// </summary>
|
||||
Reviewed,
|
||||
|
||||
/// <summary>
|
||||
/// A line comment was made.
|
||||
/// </summary>
|
||||
LineCommented,
|
||||
|
||||
/// <summary>
|
||||
/// A commit comment was made.
|
||||
/// </summary>
|
||||
CommitCommented
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user