added integration tests

This commit is contained in:
aedampir@gmail.com
2016-06-08 17:59:05 +07:00
parent da35ae04af
commit 2930f301c7
@@ -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();