added fixes in integration tests

This commit is contained in:
aedampir@gmail.com
2016-06-30 04:32:53 +07:00
parent 58d5ef8498
commit d68d00913a
@@ -1,11 +1,10 @@
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
using Xunit;
using Octokit.Tests.Integration.Helpers;
using Xunit;
public class IssuesEventsClientTests : IDisposable
{
@@ -34,8 +33,7 @@ public class IssuesEventsClientTests : IDisposable
var issueEventInfo = await _issuesEventsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
Assert.Empty(issueEventInfo);
var closed = _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new IssueUpdate { State = ItemState.Closed })
.Result;
var closed = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new IssueUpdate { State = ItemState.Closed });
Assert.NotNull(closed);
issueEventInfo = await _issuesEventsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
@@ -52,8 +50,7 @@ public class IssuesEventsClientTests : IDisposable
var issueEventInfo = await _issuesEventsClient.GetAllForIssue(_context.Repository.Id, issue.Number);
Assert.Empty(issueEventInfo);
var closed = _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new IssueUpdate { State = ItemState.Closed })
.Result;
var closed = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new IssueUpdate { State = ItemState.Closed });
Assert.NotNull(closed);
issueEventInfo = await _issuesEventsClient.GetAllForIssue(_context.Repository.Id, issue.Number);
@@ -159,7 +156,7 @@ public class IssuesEventsClientTests : IDisposable
};
var firstPage = await _issuesEventsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, startOptions);
var skipStartOptions = new ApiOptions
{
PageSize = 1,
@@ -188,7 +185,7 @@ public class IssuesEventsClientTests : IDisposable
};
var firstPage = await _issuesEventsClient.GetAllForIssue(_context.Repository.Id, issue.Number, startOptions);
var skipStartOptions = new ApiOptions
{
PageSize = 1,
@@ -209,21 +206,18 @@ public class IssuesEventsClientTests : IDisposable
var newIssue2 = new NewIssue("A test issue2") { Body = "A new unassigned issue" };
var issue1 = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue1);
Thread.Sleep(1000);
await Task.Delay(1000);
var issue2 = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue2);
Thread.Sleep(1000);
await Task.Delay(1000);
// close and open issue1
var closed1 = _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue1.Number, new IssueUpdate { State = ItemState.Closed })
.Result;
var closed1 = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue1.Number, new IssueUpdate { State = ItemState.Closed });
Assert.NotNull(closed1);
var reopened1 = _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue1.Number, new IssueUpdate { State = ItemState.Open })
.Result;
var reopened1 = _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue1.Number, new IssueUpdate { State = ItemState.Open });
Assert.NotNull(reopened1);
// close issue2
var closed2 = _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue2.Number, new IssueUpdate { State = ItemState.Closed })
.Result;
var closed2 = _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue2.Number, new IssueUpdate { State = ItemState.Closed });
Assert.NotNull(closed2);
var issueEvents = await _issuesEventsClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName);
@@ -240,21 +234,18 @@ public class IssuesEventsClientTests : IDisposable
var newIssue2 = new NewIssue("A test issue2") { Body = "A new unassigned issue" };
var issue1 = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue1);
Thread.Sleep(1000);
await Task.Delay(1000);
var issue2 = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue2);
Thread.Sleep(1000);
await Task.Delay(1000);
// close and open issue1
var closed1 = _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue1.Number, new IssueUpdate { State = ItemState.Closed })
.Result;
var closed1 = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue1.Number, new IssueUpdate { State = ItemState.Closed });
Assert.NotNull(closed1);
var reopened1 = _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue1.Number, new IssueUpdate { State = ItemState.Open })
.Result;
var reopened1 = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue1.Number, new IssueUpdate { State = ItemState.Open });
Assert.NotNull(reopened1);
// close issue2
var closed2 = _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue2.Number, new IssueUpdate { State = ItemState.Closed })
.Result;
var closed2 = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue2.Number, new IssueUpdate { State = ItemState.Closed });
Assert.NotNull(closed2);
var issueEvents = await _issuesEventsClient.GetAllForRepository(_context.Repository.Id);
@@ -408,8 +399,7 @@ public class IssuesEventsClientTests : IDisposable
{
var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
var closed = _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new IssueUpdate { State = ItemState.Closed })
.Result;
var closed = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new IssueUpdate { State = ItemState.Closed });
Assert.NotNull(closed);
var issueEvents = await _issuesEventsClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName);
int issueEventId = issueEvents[0].Id;
@@ -425,8 +415,7 @@ public class IssuesEventsClientTests : IDisposable
{
var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
var closed = _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new IssueUpdate { State = ItemState.Closed })
.Result;
var closed = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new IssueUpdate { State = ItemState.Closed });
Assert.NotNull(closed);
var issueEvents = await _issuesEventsClient.GetAllForRepository(_context.Repository.Id);
int issueEventId = issueEvents[0].Id;