From 1154a78940c723a841c359ff19b99fefc72f589f Mon Sep 17 00:00:00 2001 From: Henrik Andersson Date: Sat, 23 Feb 2019 16:08:21 +1000 Subject: [PATCH] Add integration tests for *MigrationsClient --- .../Clients/MigrationsClientTests.cs | 56 ++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/Octokit.Tests.Integration/Clients/MigrationsClientTests.cs b/Octokit.Tests.Integration/Clients/MigrationsClientTests.cs index 3ed7d8bd09..d4556fadd1 100644 --- a/Octokit.Tests.Integration/Clients/MigrationsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/MigrationsClientTests.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Security.Cryptography; using System.Threading; using System.Threading.Tasks; using Octokit; @@ -68,6 +67,61 @@ public async Task CanGetAllMigrations() Assert.NotEqual(0, migrations.Count); } + [IntegrationTest] + public async Task ReturnsCorrectCountOfMigrationsWithoutStart() + { + var options = new ApiOptions + { + PageCount = 1, + PageSize = 1 + }; + + var migrations = await _gitHub.Migration.Migrations.GetAll(_orgName, options); + + Assert.Equal(1, migrations.Count); + } + + [IntegrationTest] + public async Task ReturnsCorrectCountOfMigrationsWithStart() + { + var options = new ApiOptions + { + PageCount = 1, + PageSize = 1, + StartPage = 2 + }; + + var migrations = await _gitHub.Migration.Migrations.GetAll(_orgName, options); + + Assert.Equal(1, migrations.Count); + } + + [IntegrationTest] + public async Task ReturnsDistinctMigrationsBasedOnStartPage() + { + var startOptions = new ApiOptions + { + PageCount = 1, + PageSize = 1, + StartPage = 1 + }; + + var firstPage = await _gitHub.Migration.Migrations.GetAll(_orgName, startOptions); + + var skipStartOptions = new ApiOptions + { + PageCount = 1, + PageSize = 1, + StartPage = 2 + }; + var secondPage = await _gitHub.Migration.Migrations.GetAll(_orgName, skipStartOptions); + + Assert.Equal(1, firstPage.Count); + Assert.Equal(1, secondPage.Count); + Assert.NotEqual(firstPage[0].Id, secondPage[0].Id); + Assert.NotEqual(firstPage[0].Repositories, secondPage[0].Repositories); + } + [IntegrationTest] public async Task CanGetMigration() {