Merge pull request #309 from lbargaoanu/branches-integration-test

Integration test for get branches.
This commit is contained in:
Brendan Forster
2014-01-16 08:11:09 -08:00
2 changed files with 40 additions and 0 deletions
@@ -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);
}
}
}
@@ -59,6 +59,7 @@
<ItemGroup>
<Compile Include="Clients\AssigneesClientTests.cs" />
<Compile Include="Clients\BlobClientTests.cs" />
<Compile Include="Clients\BranchesClientTests.cs" />
<Compile Include="Clients\CommitsClientTests.cs" />
<Compile Include="Clients\CommitStatusClientTests.cs" />
<Compile Include="Clients\EventsClientTests.cs" />