Files
octokit.net/Octokit.Tests.Integration/Reactive/ObservableGistCommentsClientTests.cs
Ryan Gribble 3c818934b8 Release v0.24 - A Sight For Sore Eyes (#1539)
* Add release notes and bump version to 0.24

* run "build FormatCode" to fix up whitespace/formatting issues

* Fix failing Ssh key tests due to "validation exception".  This key must be in use on github (under another user, most likely from these tests failing).  Changed to a new SSH key and tweaked tests to reduce chance of a key being created and not destroyed

* Assignee and Assignees cant both be specified on NewIssue.  We missed this one in the PR.  Marked Assignee as [Obsolete] and fixed tests to use Assignees

* Fix a couple of Reactions tests that were calling the wrong client methods

* Fix timeline tests - looks like the response class has changed shape a bit, it now has an Issue object in the payload and Id field isnt present (leaving Id field there in case other timeline events do use it)

* Fix some following tests that require the test user to follow more than 1 other user

* Unskip these Event tests now because apparently they work!

* add breaking changes notes

* Update ApiErrorMessageSafe to return null for empty and whitespace strings (#1540)

* return null if ApiError.Message is empty or whitespace

* Uncomment test, which now passes

* update release notes to include PR1540

* Add "Bot" AccountType, was causing a deserialization exception when running the integration test "SearchForExcludedLanguage" (#1541)

* Update to include PR1541

* add bullets to make release notes easier to read

* markup additional code mentions in notes

* Fix grammar

fields => field
2017-01-17 18:56:55 +10:00

87 lines
2.8 KiB
C#

using System.Reactive.Linq;
using System.Threading.Tasks;
using Octokit.Reactive;
using Xunit;
namespace Octokit.Tests.Integration.Reactive
{
public class ObservableGistCommentsClientTests
{
public class TheGetAllForGistMethod
{
readonly ObservableGistCommentsClient _gistCommentsClient;
const string gistId = "7783a2c14a15a2e3c93b";
public TheGetAllForGistMethod()
{
var github = Helper.GetAuthenticatedClient();
_gistCommentsClient = new ObservableGistCommentsClient(github);
}
[IntegrationTest]
public async Task ReturnsGistComments()
{
var comments = await _gistCommentsClient.GetAllForGist(gistId).ToList();
Assert.NotEmpty(comments);
}
[IntegrationTest]
public async Task ReturnsCorrectCountOfGistCommentsWithoutStart()
{
var options = new ApiOptions
{
PageSize = 5,
PageCount = 1
};
var comments = await _gistCommentsClient.GetAllForGist(gistId, options).ToList();
Assert.Equal(5, comments.Count);
}
[IntegrationTest]
public async Task ReturnsCorrectCountOfGistCommentsWithStart()
{
var options = new ApiOptions
{
PageSize = 4,
PageCount = 1,
StartPage = 2
};
var comments = await _gistCommentsClient.GetAllForGist(gistId, options).ToList();
Assert.Equal(4, comments.Count);
}
[IntegrationTest]
public async Task ReturnsDistinctResultsBasedOnStartPage()
{
var startOptions = new ApiOptions
{
PageSize = 4,
PageCount = 1
};
var firstCommentsPage = await _gistCommentsClient.GetAllForGist(gistId, startOptions).ToList();
var skipStartOptions = new ApiOptions
{
PageSize = 4,
PageCount = 1,
StartPage = 2
};
var secondCommentsPage = await _gistCommentsClient.GetAllForGist(gistId, skipStartOptions).ToList();
Assert.NotEqual(firstCommentsPage[0].Id, secondCommentsPage[0].Id);
Assert.NotEqual(firstCommentsPage[1].Id, secondCommentsPage[1].Id);
Assert.NotEqual(firstCommentsPage[2].Id, secondCommentsPage[2].Id);
Assert.NotEqual(firstCommentsPage[3].Id, secondCommentsPage[3].Id);
}
}
}
}