mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-08 12:42:32 +00:00
Add the IntegrationTests for the ObservableCommitStatusClient
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user