Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hnrkndrssn committed Mar 23, 2015
1 parent 2427ab6 commit 189ae42
Show file tree
Hide file tree
Showing 41 changed files with 195 additions and 195 deletions.
2 changes: 1 addition & 1 deletion Octokit.Tests.Integration/Clients/AssigneesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public async Task CanCheckAssignees()
public async Task CanListAssignees()
{
// Repository owner is always an assignee
var assignees = await _gitHubClient.Issue.Assignee.GetForRepository(_owner, _repository.Name);
var assignees = await _gitHubClient.Issue.Assignee.GetAllForRepository(_owner, _repository.Name);
Assert.True(assignees.Any(u => u.Login == Helper.UserName));
}

Expand Down
4 changes: 2 additions & 2 deletions Octokit.Tests.Integration/Clients/EventsClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class TheGetUserPerformedMethod
public async Task ReturnsACollection()
{
var github = Helper.GetAuthenticatedClient();
var events = await github.Activity.Events.GetUserPerformed("shiftkey");
var events = await github.Activity.Events.GetAllUserPerformed("shiftkey");
Assert.NotEmpty(events);
}
}
Expand All @@ -25,7 +25,7 @@ public class EventPayloads
public EventPayloads()
{
var github = Helper.GetAuthenticatedClient();
_events = github.Activity.Events.GetUserPerformed("shiftkey").Result;
_events = github.Activity.Events.GetAllUserPerformed("shiftkey").Result;
}

[IntegrationTest]
Expand Down
6 changes: 3 additions & 3 deletions Octokit.Tests.Integration/Clients/FollowersClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public async Task ReturnsUsersTheCurrentUserIsFollowing()
{
await _github.User.Followers.Follow("alfhenrik");

var following = await _github.User.Followers.GetFollowingForCurrent();
var following = await _github.User.Followers.GetAllFollowingForCurrent();

Assert.NotNull(following);
Assert.True(following.Any(f => f.Login == "alfhenrik"));
Expand All @@ -30,7 +30,7 @@ public async Task ReturnsUsersTheCurrentUserIsFollowing()
[IntegrationTest]
public async Task ReturnsUsersTheUserIsFollowing()
{
var following = await _github.User.Followers.GetFollowing("alfhenrik");
var following = await _github.User.Followers.GetAllFollowing("alfhenrik");

Assert.NotNull(following);
Assert.NotEmpty(following);
Expand Down Expand Up @@ -69,7 +69,7 @@ public async Task ChecksIfIsFollowingUserWhenNotFollowingUser()
public async Task FollowUserNotBeingFollowedByTheUser()
{
var result = await _github.User.Followers.Follow("alfhenrik");
var following = await _github.User.Followers.GetFollowingForCurrent();
var following = await _github.User.Followers.GetAllFollowingForCurrent();

Assert.True(result);
Assert.NotEmpty(following);
Expand Down
32 changes: 16 additions & 16 deletions Octokit.Tests.Integration/Clients/IssuesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public async Task CanCreateRetrieveAndCloseIssue()
Assert.NotNull(issue);

var retrieved = await _issuesClient.Get(owner, _repository.Name, issue.Number);
var all = await _issuesClient.GetForRepository(owner, _repository.Name);
var all = await _issuesClient.GetAllForRepository(owner, _repository.Name);
Assert.NotNull(retrieved);
Assert.True(all.Any(i => i.Number == retrieved.Number));
}
Expand Down Expand Up @@ -64,7 +64,7 @@ public async Task CanListOpenIssuesWithDefaultSort()
await _issuesClient.Update(owner, _repository.Name, closed.Number,
new IssueUpdate { State = ItemState.Closed });

var issues = await _issuesClient.GetForRepository(owner, _repository.Name);
var issues = await _issuesClient.GetAllForRepository(owner, _repository.Name);

Assert.Equal(3, issues.Count);
Assert.Equal("A test issue3", issues[0].Title);
Expand All @@ -90,7 +90,7 @@ public async Task CanListIssuesWithAscendingSort()
await _issuesClient.Update(owner, _repository.Name, closed.Number,
new IssueUpdate { State = ItemState.Closed });

var issues = await _issuesClient.GetForRepository(owner, _repository.Name,
var issues = await _issuesClient.GetAllForRepository(owner, _repository.Name,
new RepositoryIssueRequest {SortDirection = SortDirection.Ascending});

Assert.Equal(3, issues.Count);
Expand All @@ -112,7 +112,7 @@ public async Task CanListClosedIssues()
await _issuesClient.Update(owner, _repository.Name, closed.Number,
new IssueUpdate { State = ItemState.Closed });

var issues = await _issuesClient.GetForRepository(owner, _repository.Name,
var issues = await _issuesClient.GetAllForRepository(owner, _repository.Name,
new RepositoryIssueRequest { State = ItemState.Closed });

Assert.Equal(1, issues.Count);
Expand All @@ -129,7 +129,7 @@ public async Task CanListMilestoneIssues()
await _issuesClient.Create(owner, _repository.Name, newIssue1);
await _issuesClient.Create(owner, _repository.Name, newIssue2);

var issues = await _issuesClient.GetForRepository(owner, _repository.Name,
var issues = await _issuesClient.GetAllForRepository(owner, _repository.Name,
new RepositoryIssueRequest { Milestone = milestone.Number.ToString(CultureInfo.InvariantCulture) });

Assert.Equal(1, issues.Count);
Expand All @@ -151,7 +151,7 @@ public async Task CanRetrieveAllIssues()
await _issuesClient.Update(owner, _repository.Name, issue4.Number,
new IssueUpdate { State = ItemState.Closed });

var retrieved = await _issuesClient.GetForRepository(owner, _repository.Name,
var retrieved = await _issuesClient.GetAllForRepository(owner, _repository.Name,
new RepositoryIssueRequest { State = ItemState.All });

Assert.True(retrieved.Count >= 4);
Expand All @@ -170,18 +170,18 @@ public async Task CanFilterByAssigned()
await _issuesClient.Create(owner, _repository.Name, newIssue1);
await _issuesClient.Create(owner, _repository.Name, newIssue2);

var allIssues = await _issuesClient.GetForRepository(owner, _repository.Name,
var allIssues = await _issuesClient.GetAllForRepository(owner, _repository.Name,
new RepositoryIssueRequest());

Assert.Equal(2, allIssues.Count);

var assignedIssues = await _issuesClient.GetForRepository(owner, _repository.Name,
var assignedIssues = await _issuesClient.GetAllForRepository(owner, _repository.Name,
new RepositoryIssueRequest { Assignee = owner });

Assert.Equal(1, assignedIssues.Count);
Assert.Equal("An assigned issue", assignedIssues[0].Title);

var unassignedIssues = await _issuesClient.GetForRepository(owner, _repository.Name,
var unassignedIssues = await _issuesClient.GetAllForRepository(owner, _repository.Name,
new RepositoryIssueRequest { Assignee = "none" });

Assert.Equal(1, unassignedIssues.Count);
Expand All @@ -197,17 +197,17 @@ public async Task CanFilterByCreator()
await _issuesClient.Create(owner, _repository.Name, newIssue1);
await _issuesClient.Create(owner, _repository.Name, newIssue2);

var allIssues = await _issuesClient.GetForRepository(owner, _repository.Name,
var allIssues = await _issuesClient.GetAllForRepository(owner, _repository.Name,
new RepositoryIssueRequest());

Assert.Equal(2, allIssues.Count);

var issuesCreatedByOwner = await _issuesClient.GetForRepository(owner, _repository.Name,
var issuesCreatedByOwner = await _issuesClient.GetAllForRepository(owner, _repository.Name,
new RepositoryIssueRequest { Creator = owner });

Assert.Equal(2, issuesCreatedByOwner.Count);

var issuesCreatedByExternalUser = await _issuesClient.GetForRepository(owner, _repository.Name,
var issuesCreatedByExternalUser = await _issuesClient.GetAllForRepository(owner, _repository.Name,
new RepositoryIssueRequest { Creator = "shiftkey" });

Assert.Equal(0, issuesCreatedByExternalUser.Count);
Expand All @@ -222,17 +222,17 @@ public async Task CanFilterByMentioned()
await _issuesClient.Create(owner, _repository.Name, newIssue1);
await _issuesClient.Create(owner, _repository.Name, newIssue2);

var allIssues = await _issuesClient.GetForRepository(owner, _repository.Name,
var allIssues = await _issuesClient.GetAllForRepository(owner, _repository.Name,
new RepositoryIssueRequest());

Assert.Equal(2, allIssues.Count);

var mentionsWithShiftkey = await _issuesClient.GetForRepository(owner, _repository.Name,
var mentionsWithShiftkey = await _issuesClient.GetAllForRepository(owner, _repository.Name,
new RepositoryIssueRequest { Mentioned = "shiftkey" });

Assert.Equal(1, mentionsWithShiftkey.Count);

var mentionsWithHaacked = await _issuesClient.GetForRepository(owner, _repository.Name,
var mentionsWithHaacked = await _issuesClient.GetAllForRepository(owner, _repository.Name,
new RepositoryIssueRequest { Mentioned = "haacked" });

Assert.Equal(0, mentionsWithHaacked.Count);
Expand All @@ -244,7 +244,7 @@ public async Task FilteringByInvalidAccountThrowsError()
var owner = _repository.Owner.Login;

await AssertEx.Throws<ApiValidationException>(
async () => await _issuesClient.GetForRepository(owner, _repository.Name,
async () => await _issuesClient.GetAllForRepository(owner, _repository.Name,
new RepositoryIssueRequest { Assignee = "some-random-account" }));
}

Expand Down
8 changes: 4 additions & 4 deletions Octokit.Tests.Integration/Clients/IssuesEventsClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ public async Task CanListEventInfoForAnIssue()
var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
var issue = await _issuesClient.Create(_repositoryOwner, _repositoryName, newIssue);

var issueEventInfo = await _issuesEventsClientClient.GetForIssue(_repositoryOwner, _repositoryName, issue.Number);
var issueEventInfo = await _issuesEventsClientClient.GetAllForIssue(_repositoryOwner, _repositoryName, issue.Number);
Assert.Empty(issueEventInfo);

var closed = _issuesClient.Update(_repositoryOwner, _repository.Name, issue.Number, new IssueUpdate { State = ItemState.Closed })
.Result;
Assert.NotNull(closed);
issueEventInfo = await _issuesEventsClientClient.GetForIssue(_repositoryOwner, _repositoryName, issue.Number);
issueEventInfo = await _issuesEventsClientClient.GetAllForIssue(_repositoryOwner, _repositoryName, issue.Number);

Assert.Equal(1, issueEventInfo.Count);
Assert.Equal(EventInfoState.Closed, issueEventInfo[0].Event);
Expand Down Expand Up @@ -71,7 +71,7 @@ public async Task CanListIssueEventsForARepository()
.Result;
Assert.NotNull(closed2);

var issueEvents = await _issuesEventsClientClient.GetForRepository(_repositoryOwner, _repositoryName);
var issueEvents = await _issuesEventsClientClient.GetAllForRepository(_repositoryOwner, _repositoryName);

Assert.Equal(3, issueEvents.Count);
Assert.Equal(2, issueEvents.Count(issueEvent => issueEvent.Issue.Body == "Everything's coming up Millhouse"));
Expand All @@ -85,7 +85,7 @@ public async Task CanRetrieveIssueEventById()
var closed = _issuesClient.Update(_repositoryOwner, _repository.Name, issue.Number, new IssueUpdate { State = ItemState.Closed })
.Result;
Assert.NotNull(closed);
var issueEvents = await _issuesEventsClientClient.GetForRepository(_repositoryOwner, _repositoryName);
var issueEvents = await _issuesEventsClientClient.GetAllForRepository(_repositoryOwner, _repositoryName);
int issueEventId = issueEvents[0].Id;

var issueEventLookupById = await _issuesEventsClientClient.Get(_repositoryOwner, _repositoryName, issueEventId);
Expand Down
8 changes: 4 additions & 4 deletions Octokit.Tests.Integration/Clients/IssuesLabelsClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ public async Task CanListLabelsForAnIssue()
var label = await _issuesLabelsClient.Create(_repositoryOwner, _repository.Name, newLabel);
var issue = await _issuesClient.Create(_repositoryOwner, _repositoryName, newIssue);

var issueLabelsInfo = await _issuesLabelsClient.GetForIssue(_repositoryOwner, _repositoryName, issue.Number);
var issueLabelsInfo = await _issuesLabelsClient.GetAllForIssue(_repositoryOwner, _repositoryName, issue.Number);
Assert.Empty(issueLabelsInfo);

var issueUpdate = new IssueUpdate();
issueUpdate.AddLabel(label.Name);
var updated = await _issuesClient.Update(_repositoryOwner, _repository.Name, issue.Number, issueUpdate);
Assert.NotNull(updated);
issueLabelsInfo = await _issuesLabelsClient.GetForIssue(_repositoryOwner, _repositoryName, issue.Number);
issueLabelsInfo = await _issuesLabelsClient.GetAllForIssue(_repositoryOwner, _repositoryName, issue.Number);

Assert.Equal(1, issueLabelsInfo.Count);
Assert.Equal(newLabel.Color, issueLabelsInfo[0].Color);
Expand All @@ -54,12 +54,12 @@ public async Task CanListIssueLabelsForARepository()
var newLabel1 = new NewLabel("test label 1", "FFFFFF");
var newLabel2 = new NewLabel("test label 2", "FFFFFF");

var originalIssueLabels = await _issuesLabelsClient.GetForRepository(_repositoryOwner, _repositoryName);
var originalIssueLabels = await _issuesLabelsClient.GetAllForRepository(_repositoryOwner, _repositoryName);

await _issuesLabelsClient.Create(_repositoryOwner, _repository.Name, newLabel1);
await _issuesLabelsClient.Create(_repositoryOwner, _repository.Name, newLabel2);

var issueLabels = await _issuesLabelsClient.GetForRepository(_repositoryOwner, _repositoryName);
var issueLabels = await _issuesLabelsClient.GetAllForRepository(_repositoryOwner, _repositoryName);

Assert.Equal(originalIssueLabels.Count + 2, issueLabels.Count);
}
Expand Down
10 changes: 5 additions & 5 deletions Octokit.Tests.Integration/Clients/MilestonesClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public async Task CanRetrieveOneMilestone()
[IntegrationTest]
public async Task CanListEmptyMilestones()
{
var milestones = await _milestonesClient.GetForRepository(_repositoryOwner, _repositoryName);
var milestones = await _milestonesClient.GetAllForRepository(_repositoryOwner, _repositoryName);

Assert.Empty(milestones);
}
Expand All @@ -54,7 +54,7 @@ public async Task CanListMilestonesWithDefaultSortByDueDateAsc()
await _milestonesClient.Create(_repositoryOwner, _repositoryName, milestone2);
await _milestonesClient.Create(_repositoryOwner, _repositoryName, milestone3);

var milestones = await _milestonesClient.GetForRepository(_repositoryOwner, _repositoryName);
var milestones = await _milestonesClient.GetAllForRepository(_repositoryOwner, _repositoryName);
Assert.Equal(2, milestones.Count);
Assert.Equal("milestone 1", milestones[0].Title);
Assert.Equal("milestone 2", milestones[1].Title);
Expand All @@ -70,7 +70,7 @@ public async Task CanListMilestonesWithSortByDueDateDesc()
await _milestonesClient.Create(_repositoryOwner, _repositoryName, milestone2);
await _milestonesClient.Create(_repositoryOwner, _repositoryName, milestone3);

var milestones = await _milestonesClient.GetForRepository(_repositoryOwner, _repositoryName,
var milestones = await _milestonesClient.GetAllForRepository(_repositoryOwner, _repositoryName,
new MilestoneRequest { SortDirection = SortDirection.Descending });
Assert.Equal(2, milestones.Count);
Assert.Equal("milestone 2", milestones[0].Title);
Expand All @@ -87,7 +87,7 @@ public async Task CanListClosedMilestones()
await _milestonesClient.Create(_repositoryOwner, _repositoryName, milestone2);
await _milestonesClient.Create(_repositoryOwner, _repositoryName, milestone3);

var milestones = await _milestonesClient.GetForRepository(_repositoryOwner, _repositoryName,
var milestones = await _milestonesClient.GetAllForRepository(_repositoryOwner, _repositoryName,
new MilestoneRequest { State = ItemState.Closed });

Assert.Equal(1, milestones.Count);
Expand All @@ -107,7 +107,7 @@ await _gitHubClient.Issue.Update(owner, _repository.Name, issue1.Number,
await _gitHubClient.Issue.Update(owner, _repository.Name, issue2.Number,
new IssueUpdate { State = ItemState.Closed });

var retrieved = await _gitHubClient.Issue.GetForRepository(owner, _repository.Name,
var retrieved = await _gitHubClient.Issue.GetAllForRepository(owner, _repository.Name,
new RepositoryIssueRequest { State = ItemState.Closed });

Assert.True(retrieved.Count >= 2);
Expand Down
6 changes: 3 additions & 3 deletions Octokit.Tests.Integration/Clients/MiscellaneousClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public async Task GetsAllTheEmojis()
{
var github = Helper.GetAuthenticatedClient();

var emojis = await github.Miscellaneous.GetEmojis();
var emojis = await github.Miscellaneous.GetAllEmojis();

Assert.True(emojis.Count > 1);
}
Expand All @@ -37,7 +37,7 @@ public async Task ReturnsListOfGitIgnoreTemplates()
{
var github = Helper.GetAuthenticatedClient();

var result = await github.Miscellaneous.GetGitIgnoreTemplates();
var result = await github.Miscellaneous.GetAllGitIgnoreTemplates();

Assert.True(result.Count > 2);
}
Expand All @@ -50,7 +50,7 @@ public async Task CanRetrieveListOfLicenses()
{
var github = Helper.GetAuthenticatedClient();

var result = await github.Miscellaneous.GetLicenses();
var result = await github.Miscellaneous.GetAllLicenses();

Assert.True(result.Count > 2);
Assert.Contains(result, license => license.Key == "mit");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public async Task CanGetForRepository()

await CreateComments(commentsToCreate, position, _repository.Name, pullRequest.Sha, pullRequest.Number);

var pullRequestComments = await _client.GetForRepository(Helper.UserName, _repository.Name);
var pullRequestComments = await _client.GetAllForRepository(Helper.UserName, _repository.Name);

AssertComments(pullRequestComments, commentsToCreate, position);
}
Expand All @@ -153,7 +153,7 @@ public async Task CanGetForRepositoryAscendingSort()

await CreateComments(commentsToCreate, position, _repository.Name, pullRequest.Sha, pullRequest.Number);

var pullRequestComments = await _client.GetForRepository(Helper.UserName, _repository.Name, new PullRequestReviewCommentRequest { Direction = SortDirection.Ascending });
var pullRequestComments = await _client.GetAllForRepository(Helper.UserName, _repository.Name, new PullRequestReviewCommentRequest { Direction = SortDirection.Ascending });

Assert.Equal(pullRequestComments.Select(x => x.Body), commentsToCreate);
}
Expand All @@ -168,7 +168,7 @@ public async Task CanGetForRepositoryDescendingSort()

await CreateComments(commentsToCreate, position, _repository.Name, pullRequest.Sha, pullRequest.Number);

var pullRequestComments = await _client.GetForRepository(Helper.UserName, _repository.Name, new PullRequestReviewCommentRequest { Direction = SortDirection.Descending });
var pullRequestComments = await _client.GetAllForRepository(Helper.UserName, _repository.Name, new PullRequestReviewCommentRequest { Direction = SortDirection.Descending });

Assert.Equal(pullRequestComments.Select(x => x.Body), commentsToCreate.Reverse());
}
Expand Down
Loading

0 comments on commit 189ae42

Please sign in to comment.