Skip to content

Commit

Permalink
Add integration tests for *MigrationsClient
Browse files Browse the repository at this point in the history
  • Loading branch information
hnrkndrssn committed Feb 23, 2019
1 parent a9934e3 commit 1154a78
Showing 1 changed file with 55 additions and 1 deletion.
56 changes: 55 additions & 1 deletion Octokit.Tests.Integration/Clients/MigrationsClientTests.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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()
{
Expand Down

0 comments on commit 1154a78

Please sign in to comment.