-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #309 from lbargaoanu/branches-integration-test
Integration test for get branches.
- Loading branch information
Showing
2 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using System.Net.Http.Headers; | ||
using System.Threading.Tasks; | ||
using Octokit; | ||
using Octokit.Tests.Integration; | ||
using Xunit; | ||
|
||
public class BranchesClientTests | ||
{ | ||
public class TheGetBranchesMethod : IDisposable | ||
{ | ||
readonly Repository _repository; | ||
readonly GitHubClient _github; | ||
|
||
public TheGetBranchesMethod() | ||
{ | ||
_github = new GitHubClient(new ProductHeaderValue("OctokitTests")) | ||
{ | ||
Credentials = Helper.Credentials | ||
}; | ||
var repoName = Helper.MakeNameWithTimestamp("public-repo"); | ||
_repository = _github.Repository.Create(new NewRepository { Name = repoName, AutoInit = true }).Result; | ||
} | ||
|
||
[IntegrationTest] | ||
public async Task ReturnsBranches() | ||
{ | ||
var branches = await _github.Repository.GetAllBranches(_repository.Owner.Login, _repository.Name); | ||
|
||
Assert.NotEmpty(branches); | ||
Assert.Equal(branches[0].Name, "master"); | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
Helper.DeleteRepo(_repository); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters