mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-20 22:25:12 +00:00
* Adding functionality to query installations for user * Rename method * Adding installation methods * Adding tests * Adding observable client methods * Adding InstallationResponse * Adding GitHub Apps Installations Client * Tweaking doc comments * Undoing unintentional changes and cleaning up * Reordering functions in clients to keep the same code look and feel * Making sure all methods are documented with their authentication requirements * Syntax error * Renaming methods and tests * Renaming property * Test cleanup * XmlDoc comment fixups and consistency * rename User -To-Server auth methods from xxxForUser to xxxForCurrentUser * rename GitHubAppsInstallationsClient to GitHubAppInstallationsClient to be consistent with single/plural naming conventions * make method order match the order on github docs site * tidy up usings * correct implementation of GetALlInstallationsForCurrent method to be consistent * Add missing unit and integration tests for ObservableGitHubAppsClient * fix renamed method in observable tests * Add EnsuresNonEmptyArguments tests and fixup asserts in GitHubAppsClient * Add tests for new Observable client methods and fixup Null/Empty asserts in Observable client * change non paginated call to call through to other method but with ApiOptions.None * add unit tests for observable client and fixup errors they found * add integration tests for new GitHubAppsClient methods, fixed an incorrect route that the tests found! * add integration tests for extra methods on observable client * add integration tests for new clients GitHubAppInstallationsClient and ObservableGitHubAppInstallationsClient * deprecate renamed method properly, to avoid breaking change
100 lines
3.3 KiB
C#
100 lines
3.3 KiB
C#
using System;
|
|
using System.Linq;
|
|
using NSubstitute;
|
|
using Octokit.Clients;
|
|
using Xunit;
|
|
|
|
namespace Octokit.Tests.Clients
|
|
{
|
|
public class GitHubAppInstallationsClientTests
|
|
{
|
|
public class TheCtor
|
|
{
|
|
[Fact]
|
|
public void EnsuresNonNullArguments()
|
|
{
|
|
Assert.Throws<ArgumentNullException>(() => new GitHubAppInstallationsClient(null));
|
|
}
|
|
}
|
|
|
|
public class TheGetAllRepositoriesForCurrentMethod
|
|
{
|
|
[Fact]
|
|
public void GetsFromCorrectUrl()
|
|
{
|
|
var connection = Substitute.For<IApiConnection>();
|
|
var client = new GitHubAppInstallationsClient(connection);
|
|
|
|
client.GetAllRepositoriesForCurrent();
|
|
|
|
connection.Received().GetAll<RepositoriesResponse>(
|
|
Arg.Is<Uri>(u => u.ToString() == "installation/repositories"),
|
|
null,
|
|
"application/vnd.github.machine-man-preview+json",
|
|
Args.ApiOptions);
|
|
}
|
|
|
|
[Fact]
|
|
public void GetsFromCorrectUrllWithApiOptions()
|
|
{
|
|
var connection = Substitute.For<IApiConnection>();
|
|
var client = new GitHubAppInstallationsClient(connection);
|
|
|
|
var options = new ApiOptions
|
|
{
|
|
PageSize = 1,
|
|
PageCount = 1,
|
|
StartPage = 1
|
|
};
|
|
|
|
client.GetAllRepositoriesForCurrent(options);
|
|
|
|
connection.Received().GetAll<RepositoriesResponse>(
|
|
Arg.Is<Uri>(u => u.ToString() == "installation/repositories"),
|
|
null,
|
|
"application/vnd.github.machine-man-preview+json",
|
|
options);
|
|
}
|
|
}
|
|
|
|
public class TheGetAllRepositoriesForCurrentUserMethod
|
|
{
|
|
[Fact]
|
|
public void GetsFromCorrectUrl()
|
|
{
|
|
var connection = Substitute.For<IApiConnection>();
|
|
var client = new GitHubAppInstallationsClient(connection);
|
|
|
|
client.GetAllRepositoriesForCurrentUser(1234);
|
|
|
|
connection.Received().GetAll<RepositoriesResponse>(
|
|
Arg.Is<Uri>(u => u.ToString() == "user/installations/1234/repositories"),
|
|
null,
|
|
"application/vnd.github.machine-man-preview+json",
|
|
Args.ApiOptions);
|
|
}
|
|
|
|
[Fact]
|
|
public void GetsFromCorrectUrllWithApiOptions()
|
|
{
|
|
var connection = Substitute.For<IApiConnection>();
|
|
var client = new GitHubAppInstallationsClient(connection);
|
|
|
|
var options = new ApiOptions
|
|
{
|
|
PageSize = 1,
|
|
PageCount = 1,
|
|
StartPage = 1
|
|
};
|
|
|
|
client.GetAllRepositoriesForCurrentUser(1234, options);
|
|
|
|
connection.Received().GetAll<RepositoriesResponse>(
|
|
Arg.Is<Uri>(u => u.ToString() == "user/installations/1234/repositories"),
|
|
null,
|
|
"application/vnd.github.machine-man-preview+json",
|
|
options);
|
|
}
|
|
}
|
|
}
|
|
} |