mirror of
https://github.com/zoriya/octokit.net.git
synced 2026-06-06 20:13:40 +00:00
added integration tests
This commit is contained in:
@@ -85,6 +85,16 @@ public class DeploymentsClientTests : IDisposable
|
||||
Assert.NotNull(deployment);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task CanCreateDeploymentWithRepositoryId()
|
||||
{
|
||||
var newDeployment = new NewDeployment(_commit.Sha) { AutoMerge = false };
|
||||
|
||||
var deployment = await _deploymentsClient.Create(_context.Repository.Id, newDeployment);
|
||||
|
||||
Assert.NotNull(deployment);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsDeployments()
|
||||
{
|
||||
@@ -96,6 +106,17 @@ public class DeploymentsClientTests : IDisposable
|
||||
Assert.NotEmpty(deployments);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsDeploymentsWithRepositoryId()
|
||||
{
|
||||
var newDeployment = new NewDeployment(_commit.Sha) { AutoMerge = false };
|
||||
await _deploymentsClient.Create(_context.RepositoryOwner, _context.RepositoryName, newDeployment);
|
||||
|
||||
var deployments = await _deploymentsClient.GetAll(_context.Repository.Id);
|
||||
|
||||
Assert.NotEmpty(deployments);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsCorrectCountOfDeploymentsWithoutStart()
|
||||
{
|
||||
@@ -171,6 +192,38 @@ public class DeploymentsClientTests : IDisposable
|
||||
Assert.NotEqual(firstPage[2].Id, secondPage[2].Id);
|
||||
}
|
||||
|
||||
[IntegrationTest]
|
||||
public async Task ReturnsDistinctResultsBasedOnStartPageWithRepositoryId()
|
||||
{
|
||||
var commits = CreateCommits(6);
|
||||
foreach (var commit in commits)
|
||||
{
|
||||
var newDeployment = new NewDeployment(commit.Sha) { AutoMerge = false };
|
||||
await _deploymentsClient.Create(_context.Repository.Id, newDeployment);
|
||||
}
|
||||
|
||||
var startOptions = new ApiOptions
|
||||
{
|
||||
PageSize = 3,
|
||||
PageCount = 1
|
||||
};
|
||||
|
||||
var firstPage = await _deploymentsClient.GetAll(_context.Repository.Id, startOptions);
|
||||
|
||||
var skipStartOptions = new ApiOptions
|
||||
{
|
||||
PageSize = 3,
|
||||
PageCount = 1,
|
||||
StartPage = 2
|
||||
};
|
||||
|
||||
var secondPage = await _deploymentsClient.GetAll(_context.Repository.Id, skipStartOptions);
|
||||
|
||||
Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
|
||||
Assert.NotEqual(firstPage[1].Id, secondPage[1].Id);
|
||||
Assert.NotEqual(firstPage[2].Id, secondPage[2].Id);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_context.Dispose();
|
||||
|
||||
Reference in New Issue
Block a user