Add the IntegrationTests for the ObservableCommitStatusClient

This commit is contained in:
Abdelkhalek Oussama Elhamer
2016-03-26 05:28:08 +01:00
parent a9014616ce
commit 761bee4a35
2 changed files with 89 additions and 0 deletions
@@ -141,6 +141,7 @@
<Compile Include="Reactive\ObservableAuthorizationsClientTests.cs" />
<Compile Include="Reactive\ObservableIssuesClientTests.cs" />
<Compile Include="Reactive\ObservableMilestonesClientTests.cs" />
<Compile Include="Reactive\ObservableCommitStatusClientTests.cs" />
<Compile Include="Reactive\ObservableReleaseClientTests.cs" />
<Compile Include="Reactive\ObservableRepositoriesClientTests.cs" />
<Compile Include="Clients\ReleasesClientTests.cs" />
@@ -0,0 +1,88 @@
using System.Reactive.Linq;
using System.Threading.Tasks;
using Octokit.Reactive;
using Xunit;
namespace Octokit.Tests.Integration.Reactive
{
public class ObservableCommitStatusClientTests
{
public class TheGetAllMethod
{
readonly ObservableCommitStatusClient _commitStatusClient;
const string owner = "octokit";
const string name = "octokit.net";
const string reference = "master";
public TheGetAllMethod()
{
var github = Helper.GetAuthenticatedClient();
_commitStatusClient = new ObservableCommitStatusClient(github);
}
[IntegrationTest]
public async Task ReturnCommitStatus()
{
var commitStatus = await _commitStatusClient.GetAll(owner, name, reference).ToList();
Assert.NotEmpty(commitStatus);
}
[IntegrationTest]
public async Task ReturnsCorrectCountOfCommitStatusWithoutStart()
{
var options = new ApiOptions
{
PageSize = 5,
PageCount = 1
};
var commitStatus = await _commitStatusClient.GetAll(owner, name ,reference , options).ToList();
Assert.Equal(5, commitStatus.Count);
}
[IntegrationTest]
public async Task ReturnsCorrectCountOfCommitStatusWithStart()
{
var options = new ApiOptions
{
PageSize = 5,
PageCount = 1,
StartPage = 1
};
var commitStatus = await _commitStatusClient.GetAll(owner, name, reference, options).ToList();
Assert.Equal(5, commitStatus.Count);
}
[IntegrationTest]
public async Task ReturnsDistinctResultsBasedOnStartPage()
{
var startOptions = new ApiOptions
{
PageSize = 5,
PageCount = 1
};
var firstPage = await _commitStatusClient.GetAll(owner, name, reference, startOptions).ToList();
var skipStartOptions = new ApiOptions
{
PageSize = 5,
PageCount = 1,
StartPage = 2
};
var secondPage = await _commitStatusClient.GetAll(owner, name, reference,skipStartOptions).ToList();
Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
Assert.NotEqual(firstPage[1].Id, secondPage[1].Id);
Assert.NotEqual(firstPage[2].Id, secondPage[2].Id);
Assert.NotEqual(firstPage[3].Id, secondPage[3].Id);
Assert.NotEqual(firstPage[4].Id, secondPage[4].Id);
}
}
}
}