From 2930f301c7fd98a780f441e796d07fc70a47c3b5 Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Wed, 8 Jun 2016 17:59:05 +0700 Subject: [PATCH] added integration tests --- .../Clients/DeploymentsClientTests.cs | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/Octokit.Tests.Integration/Clients/DeploymentsClientTests.cs b/Octokit.Tests.Integration/Clients/DeploymentsClientTests.cs index 8cc015ff..bdf86e34 100644 --- a/Octokit.Tests.Integration/Clients/DeploymentsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/DeploymentsClientTests.cs @@ -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();