mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-05 11:40:42 +00:00
added integration tests
This commit is contained in:
@@ -42,6 +42,76 @@ public class IssuesEventsClientTests : IDisposable
|
||||
Assert.Equal(EventInfoState.Closed, issueEventInfo[0].Event);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsCorrectCountOfEventInfosWithoutStart()
|
||||
{
|
||||
var newIssue = new NewIssue("issue 1") { Body = "A new unassigned issue" };
|
||||
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
|
||||
await _issuesClient.Lock(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
|
||||
await _issuesClient.Unlock(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
|
||||
await _issuesClient.Lock(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
|
||||
|
||||
var options = new ApiOptions
|
||||
{
|
||||
PageSize = 3,
|
||||
PageCount = 1
|
||||
};
|
||||
|
||||
var eventInfos = await _issuesEventsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, options);
|
||||
|
||||
Assert.Equal(3, eventInfos.Count);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsCorrectCountOfEventInfosWithStart()
|
||||
{
|
||||
var newIssue = new NewIssue("issue 1") { Body = "A new unassigned issue" };
|
||||
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
|
||||
await _issuesClient.Lock(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
|
||||
await _issuesClient.Unlock(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
|
||||
await _issuesClient.Lock(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
|
||||
|
||||
var options = new ApiOptions
|
||||
{
|
||||
PageSize = 2,
|
||||
PageCount = 1,
|
||||
StartPage = 2
|
||||
};
|
||||
|
||||
var eventInfos = await _issuesEventsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, options);
|
||||
|
||||
Assert.Equal(1, eventInfos.Count);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsDistinctResultsBasedOnStartPage()
|
||||
{
|
||||
var newIssue = new NewIssue("issue 1") { Body = "A new unassigned issue" };
|
||||
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
|
||||
await _issuesClient.Lock(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
|
||||
await _issuesClient.Unlock(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
|
||||
await _issuesClient.Lock(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
|
||||
|
||||
var startOptions = new ApiOptions
|
||||
{
|
||||
PageSize = 1,
|
||||
PageCount = 1
|
||||
};
|
||||
|
||||
var firstPage = await _issuesEventsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, startOptions);
|
||||
|
||||
var skipStartOptions = new ApiOptions
|
||||
{
|
||||
PageSize = 1,
|
||||
PageCount = 1,
|
||||
StartPage = 2
|
||||
};
|
||||
|
||||
var secondPage = await _issuesEventsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, skipStartOptions);
|
||||
|
||||
Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanListIssueEventsForARepository()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user