mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-04 11:24:44 +00:00
Added ApiOption overloads to methods on IRepositoryCommitsClient (#1247)
* Added ApiOptions overloads for RepositoryCommitClient methods * Added overloads to Reactive clients * Integration tests in progress * Integration test addition in progress * More integration tests added * Added Ensure things * Minor changes * Minor changes * Few changes * Tried to fix errors * Tried to fix errors * Fixed a few things * Fixed integration tests * Tidying up * Added public keyword * Added unit tests for GetAll() in normal and reactive methods * Minor changes * Changed the class name * Fixed the unit test
This commit is contained in:
committed by
Brendan Forster
parent
4ae6000ac1
commit
43f6cfe28b
@@ -0,0 +1,75 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Octokit.Reactive;
|
||||
using System.Reactive.Linq;
|
||||
using Xunit;
|
||||
|
||||
namespace Octokit.Tests.Integration.Reactive
|
||||
{
|
||||
public class ObservableRepositoryCommitsClientTests
|
||||
{
|
||||
public class TheGetAllMethod
|
||||
{
|
||||
readonly ObservableRepositoryCommitsClient _repositoryCommitsClient;
|
||||
|
||||
public TheGetAllMethod()
|
||||
{
|
||||
var client = Helper.GetAuthenticatedClient();
|
||||
_repositoryCommitsClient = new ObservableRepositoryCommitsClient(client);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanGetCorrectCountOfCommitsWithoutStart()
|
||||
{
|
||||
var options = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
PageCount = 1
|
||||
};
|
||||
|
||||
var commits = await _repositoryCommitsClient.GetAll("shiftkey", "ReactiveGit", options).ToList();
|
||||
Assert.Equal(5, commits.Count);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanGetCorrectCountOfCommitsWithStart()
|
||||
{
|
||||
var options = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
PageCount = 1,
|
||||
StartPage = 2
|
||||
};
|
||||
|
||||
var commits = await _repositoryCommitsClient.GetAll("shiftkey", "ReactiveGit", options).ToList();
|
||||
Assert.Equal(5, commits.Count);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsDistinctResultsBasedOnStart()
|
||||
{
|
||||
var startOptions = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
PageCount = 1,
|
||||
};
|
||||
|
||||
var skipStartOptions = new ApiOptions
|
||||
{
|
||||
PageSize = 5,
|
||||
PageCount = 1,
|
||||
StartPage = 2
|
||||
};
|
||||
|
||||
var firstCommit = await _repositoryCommitsClient.GetAll("shiftkey", "ReactiveGit", startOptions).ToList();
|
||||
var secondCommit = await _repositoryCommitsClient.GetAll("shiftkey", "ReactiveGit", skipStartOptions).ToList();
|
||||
|
||||
Assert.NotEqual(firstCommit[0].Sha, secondCommit[0].Sha);
|
||||
Assert.NotEqual(firstCommit[1].Sha, secondCommit[1].Sha);
|
||||
Assert.NotEqual(firstCommit[2].Sha, secondCommit[2].Sha);
|
||||
Assert.NotEqual(firstCommit[3].Sha, secondCommit[3].Sha);
|
||||
Assert.NotEqual(firstCommit[4].Sha, secondCommit[4].Sha);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ using Octokit.Reactive;
|
||||
using Octokit.Tests.Integration;
|
||||
using Xunit;
|
||||
|
||||
public class ObservableRepositoryDeployKeysClientTests : IDisposable
|
||||
public class ObservableRespositoryDeployKeysClientTests : IDisposable
|
||||
{
|
||||
const string _key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDB8IE5+RppLpeW+6lqo0fpfvMunKg6W4bhYCfVJIOYbpKoHP95nTUMZPBT++9NLeB4/YsuNTCrrpnpjc4f2IVpGvloRiVXjAzoJk9QIL6uzn1zRFdvaxSJ3Urhe9LcLHcIgccgZgSdWGzaZI3xtMvGC4diwWNsPjvVc/RyDM/MPqAim0X5XVOQwEFsSsUSraezJ+VgYMYzLYBcKWW0B86HVVhL4ZtmcY/RN2544bljnzw2M3aQvXNPTvkuiUoqLOI+5/qzZ8PfkruO55YtweEd0lkY6oZvrBPMD6dLODEqMHb4tD6htx60wSipNqjPwpOMpzp0Bk3G909unVXi6Fw5";
|
||||
const string _keyTitle = "octokit@github";
|
||||
@@ -14,7 +14,7 @@ public class ObservableRepositoryDeployKeysClientTests : IDisposable
|
||||
Repository _repository;
|
||||
string _owner;
|
||||
|
||||
public ObservableRepositoryDeployKeysClientTests()
|
||||
public ObservableRespositoryDeployKeysClientTests()
|
||||
{
|
||||
var github = Helper.GetAuthenticatedClient();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user