mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-20 06:05:12 +00:00
Merge branch 'master' into pr-495ext
Conflicts: Octokit/Octokit-Mono.csproj Octokit/Octokit-MonoAndroid.csproj Octokit/Octokit-Monotouch.csproj Octokit/Octokit-Portable.csproj Octokit/Octokit-netcore45.csproj
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -73,7 +73,7 @@ nunit-*.xml
|
|||||||
packaging/
|
packaging/
|
||||||
tools/FAKE.Core
|
tools/FAKE.Core
|
||||||
tools/SourceLink.Fake
|
tools/SourceLink.Fake
|
||||||
tools/xunit.runners
|
tools/xunit.runner.console
|
||||||
*.ncrunch*
|
*.ncrunch*
|
||||||
*.GhostDoc.xml
|
*.GhostDoc.xml
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,53 @@ namespace Octokit.Reactive
|
|||||||
NewAuthorization newAuthorization,
|
NewAuthorization newAuthorization,
|
||||||
string twoFactorAuthenticationCode);
|
string twoFactorAuthenticationCode);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks the validity of an OAuth token without running afoul of normal rate limits for failed login attempts.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method requires authentication.
|
||||||
|
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#check-an-authorization">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="clientId">Client ID of the OAuth application for the token</param>
|
||||||
|
/// <param name="accessToken">The OAuth token to check</param>
|
||||||
|
/// <returns>The valid <see cref="ApplicationAuthorization"/>.</returns>
|
||||||
|
IObservable<ApplicationAuthorization> CheckApplicationAuthentication(string clientId, string accessToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets a valid OAuth token for an OAuth application without end user involvment.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method requires authentication.
|
||||||
|
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#reset-an-authorization">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="clientId">ClientID of the OAuth application for the token</param>
|
||||||
|
/// <param name="accessToken">The OAuth token to reset</param>
|
||||||
|
/// <returns>The valid <see cref="ApplicationAuthorization"/> with a new OAuth token</returns>
|
||||||
|
IObservable<ApplicationAuthorization> ResetApplicationAuthentication(string clientId, string accessToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Revokes a single OAuth token for an OAuth application.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method requires authentication.
|
||||||
|
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#revoke-an-authorization-for-an-application">API documentation for more information.</a>
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="clientId">ClientID of the OAuth application for the token</param>
|
||||||
|
/// <param name="accessToken">The OAuth token to revoke</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
IObservable<Unit> RevokeApplicationAuthentication(string clientId, string accessToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Revokes every OAuth token for an OAuth application.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method requires authentication.
|
||||||
|
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#revoke-all-authorizations-for-an-application">API documentation for more information.</a>
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="clientId">ClientID of the OAuth application for the token</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
IObservable<Unit> RevokeAllApplicationAuthentications(string clientId);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update the <see cref="Authorization"/> specified by the id.
|
/// Update the <see cref="Authorization"/> specified by the id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace Octokit.Reactive
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <returns>A <see cref="IObservable{User}"/> of <see cref="User"/>s that the authenticated user follows.</returns>
|
/// <returns>A <see cref="IObservable{User}"/> of <see cref="User"/>s that the authenticated user follows.</returns>
|
||||||
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
|
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
|
||||||
IObservable<User> GetFollowingForCurrent();
|
IObservable<User> GetAllFollowingForCurrent();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List who a user is following
|
/// List who a user is following
|
||||||
@@ -48,7 +48,7 @@ namespace Octokit.Reactive
|
|||||||
/// See the <a href="http://developer.github.com/v3/users/followers/#list-users-followed-by-another-user">API documentation</a> for more information.
|
/// See the <a href="http://developer.github.com/v3/users/followers/#list-users-followed-by-another-user">API documentation</a> for more information.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <returns>A <see cref="IObservable{User}"/> of <see cref="User"/>s that the passed user follows.</returns>
|
/// <returns>A <see cref="IObservable{User}"/> of <see cref="User"/>s that the passed user follows.</returns>
|
||||||
IObservable<User> GetFollowing(string login);
|
IObservable<User> GetAllFollowing(string login);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check if the authenticated user follows another user
|
/// Check if the authenticated user follows another user
|
||||||
|
|||||||
@@ -5,10 +5,50 @@ namespace Octokit.Reactive
|
|||||||
{
|
{
|
||||||
public interface IObservableMiscellaneousClient
|
public interface IObservableMiscellaneousClient
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all the emojis available to use on GitHub.
|
||||||
|
/// </summary>
|
||||||
|
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||||
|
/// <returns>An <see cref="IObservable{Emoji}"/> of emoji and their URI.</returns>
|
||||||
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate",
|
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate",
|
||||||
Justification = "Makes a network request")]
|
Justification = "Makes a network request")]
|
||||||
IObservable<Emoji> GetEmojis();
|
IObservable<Emoji> GetEmojis();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the rendered Markdown for the specified plain-text Markdown document.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="markdown">A plain-text Markdown document</param>
|
||||||
|
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||||
|
/// <returns>The rendered Markdown.</returns>
|
||||||
IObservable<string> RenderRawMarkdown(string markdown);
|
IObservable<string> RenderRawMarkdown(string markdown);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List all templates available to pass as an option when creating a repository.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>An observable list of gitignore template names.</returns>
|
||||||
|
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
|
||||||
|
IObservable<string> GetGitIgnoreTemplates();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the source for a single GitIgnore template
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="templateName">Returns the template source for the given template</param>
|
||||||
|
IObservable<GitIgnoreTemplate> GetGitIgnoreTemplate(string templateName);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a list of the licenses shown in the license picker on GitHub.com. This is not a comprehensive
|
||||||
|
/// list of all possible OSS licenses.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This is a PREVIEW API! Use it at your own risk.</remarks>
|
||||||
|
/// <returns>A list of licenses available on the site</returns>
|
||||||
|
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
|
||||||
|
IObservable<LicenseMetadata> GetLicenses();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a license based on the licence key such as "mit"
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <returns>A <see cref="License" /> that includes the license key, text, and attributes of the license.</returns>
|
||||||
|
IObservable<License> GetLicense(string key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,5 +96,16 @@ namespace Octokit.Reactive
|
|||||||
/// <param name="number">The pull request number</param>
|
/// <param name="number">The pull request number</param>
|
||||||
/// <returns>A collection of <see cref="PullRequestCommit"/> results</returns>
|
/// <returns>A collection of <see cref="PullRequestCommit"/> results</returns>
|
||||||
IObservable<PullRequestCommit> Commits(string owner, string name, int number);
|
IObservable<PullRequestCommit> Commits(string owner, string name, int number);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the list of files on a pull request.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>https://developer.github.com/v3/pulls/#list-pull-requests-files</remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="name">The name of the repository</param>
|
||||||
|
/// <param name="number">The pull request number</param>
|
||||||
|
/// <returns>A collection of <see cref="PullRequestFile"/> results</returns>
|
||||||
|
IObservable<PullRequestFile> Files(string owner, string name, int number);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,24 +98,6 @@ namespace Octokit.Reactive
|
|||||||
Justification = "Makes a network request")]
|
Justification = "Makes a network request")]
|
||||||
IObservable<Repository> GetAllForOrg(string organization);
|
IObservable<Repository> GetAllForOrg(string organization);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the HTML rendered README.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="owner">The owner of the repository</param>
|
|
||||||
/// <param name="name">The name of the repository</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[Obsolete("This method has been obsoleted by Content.GetReadme. Please use that instead.")]
|
|
||||||
IObservable<Readme> GetReadme(string owner, string name);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns just the HTML portion of the README without the surrounding HTML document.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="owner">The owner of the repository</param>
|
|
||||||
/// <param name="name">The name of the repository</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[Obsolete("This method has been obsoleted by Content.GetReadmeHtml. Please use that instead.")]
|
|
||||||
IObservable<string> GetReadmeHtml(string owner, string name);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A client for GitHub's Commit Status API.
|
/// A client for GitHub's Commit Status API.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -112,6 +112,81 @@ namespace Octokit.Reactive
|
|||||||
.ToObservable();
|
.ToObservable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks the validity of an OAuth token without running afoul of normal rate limits for failed login attempts.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method requires authentication.
|
||||||
|
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#check-an-authorization">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="clientId">Client ID of the OAuth application for the token</param>
|
||||||
|
/// <param name="accessToken">The OAuth token to check</param>
|
||||||
|
/// <returns>The valid <see cref="ApplicationAuthorization"/>.</returns>
|
||||||
|
public IObservable<ApplicationAuthorization> CheckApplicationAuthentication(string clientId, string accessToken)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString("clientId", clientId);
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString("accessToken", accessToken);
|
||||||
|
|
||||||
|
return _client.CheckApplicationAuthentication(clientId, accessToken)
|
||||||
|
.ToObservable();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets a valid OAuth token for an OAuth application without end user involvment.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method requires authentication.
|
||||||
|
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#reset-an-authorization">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="clientId">ClientID of the OAuth application for the token</param>
|
||||||
|
/// <param name="accessToken">The OAuth token to reset</param>
|
||||||
|
/// <returns>The valid <see cref="ApplicationAuthorization"/> with a new OAuth token</returns>
|
||||||
|
public IObservable<ApplicationAuthorization> ResetApplicationAuthentication(string clientId, string accessToken)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString("clientId", clientId);
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString("accessToken", accessToken);
|
||||||
|
|
||||||
|
return _client.ResetApplicationAuthentication(clientId, accessToken)
|
||||||
|
.ToObservable();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Revokes a single OAuth token for an OAuth application.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method requires authentication.
|
||||||
|
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#revoke-an-authorization-for-an-application">API documentation for more information.</a>
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="clientId">ClientID of the OAuth application for the token</param>
|
||||||
|
/// <param name="accessToken">The OAuth token to revoke</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IObservable<Unit> RevokeApplicationAuthentication(string clientId, string accessToken)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString("clientId", clientId);
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString("accessToken", accessToken);
|
||||||
|
|
||||||
|
return _client.RevokeApplicationAuthentication(clientId, accessToken)
|
||||||
|
.ToObservable();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Revokes every OAuth token for an OAuth application.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method requires authentication.
|
||||||
|
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#revoke-all-authorizations-for-an-application">API documentation for more information.</a>
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="clientId">ClientID of the OAuth application for the token</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public IObservable<Unit> RevokeAllApplicationAuthentications(string clientId)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString("clientId", clientId);
|
||||||
|
|
||||||
|
return _client.RevokeAllApplicationAuthentications(clientId)
|
||||||
|
.ToObservable();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update the <see cref="Authorization"/> specified by the id.
|
/// Update the <see cref="Authorization"/> specified by the id.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace Octokit.Reactive
|
|||||||
/// See the <a href="http://developer.github.com/v3/users/followers/#list-users-followed-by-another-user">API documentation</a> for more information.
|
/// See the <a href="http://developer.github.com/v3/users/followers/#list-users-followed-by-another-user">API documentation</a> for more information.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <returns>A <see cref="IObservable{User}"/> of <see cref="User"/>s that the authenticated user follows.</returns>
|
/// <returns>A <see cref="IObservable{User}"/> of <see cref="User"/>s that the authenticated user follows.</returns>
|
||||||
public IObservable<User> GetFollowingForCurrent()
|
public IObservable<User> GetAllFollowingForCurrent()
|
||||||
{
|
{
|
||||||
return _connection.GetAndFlattenAllPages<User>(ApiUrls.Following());
|
return _connection.GetAndFlattenAllPages<User>(ApiUrls.Following());
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ namespace Octokit.Reactive
|
|||||||
/// See the <a href="http://developer.github.com/v3/users/followers/#list-users-followed-by-another-user">API documentation</a> for more information.
|
/// See the <a href="http://developer.github.com/v3/users/followers/#list-users-followed-by-another-user">API documentation</a> for more information.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <returns>A <see cref="IObservable{User}"/> of <see cref="User"/>s that the passed user follows.</returns>
|
/// <returns>A <see cref="IObservable{User}"/> of <see cref="User"/>s that the passed user follows.</returns>
|
||||||
public IObservable<User> GetFollowing(string login)
|
public IObservable<User> GetAllFollowing(string login)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNullOrEmptyString(login, "login");
|
Ensure.ArgumentNotNullOrEmptyString(login, "login");
|
||||||
|
|
||||||
|
|||||||
@@ -15,14 +15,64 @@ namespace Octokit.Reactive
|
|||||||
_client = client;
|
_client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all the emojis available to use on GitHub.
|
||||||
|
/// </summary>
|
||||||
|
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||||
|
/// <returns>An <see cref="IObservable{Emoji}"/> of emoji and their URI.</returns>
|
||||||
public IObservable<Emoji> GetEmojis()
|
public IObservable<Emoji> GetEmojis()
|
||||||
{
|
{
|
||||||
return _client.GetEmojis().ToObservable().SelectMany(e => e);
|
return _client.GetEmojis().ToObservable().SelectMany(e => e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the rendered Markdown for the specified plain-text Markdown document.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="markdown">A plain-text Markdown document</param>
|
||||||
|
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||||
|
/// <returns>The rendered Markdown.</returns>
|
||||||
public IObservable<string> RenderRawMarkdown(string markdown)
|
public IObservable<string> RenderRawMarkdown(string markdown)
|
||||||
{
|
{
|
||||||
return _client.RenderRawMarkdown(markdown).ToObservable();
|
return _client.RenderRawMarkdown(markdown).ToObservable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List all templates available to pass as an option when creating a repository.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>An observable list of gitignore template names.</returns>
|
||||||
|
public IObservable<string> GetGitIgnoreTemplates()
|
||||||
|
{
|
||||||
|
return _client.GetGitIgnoreTemplates().ToObservable().SelectMany(t => t);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the source for a single GitIgnore template
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="templateName">Returns the template source for the given template</param>
|
||||||
|
public IObservable<GitIgnoreTemplate> GetGitIgnoreTemplate(string templateName)
|
||||||
|
{
|
||||||
|
return _client.GetGitIgnoreTemplate(templateName).ToObservable();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a list of the licenses shown in the license picker on GitHub.com. This is not a comprehensive
|
||||||
|
/// list of all possible OSS licenses.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This is a PREVIEW API! Use it at your own risk.</remarks>
|
||||||
|
/// <returns>A list of licenses available on the site</returns>
|
||||||
|
public IObservable<LicenseMetadata> GetLicenses()
|
||||||
|
{
|
||||||
|
return _client.GetLicenses().ToObservable().SelectMany(l => l);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a license based on the licence key such as "mit"
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <returns>A <see cref="License" /> that includes the license key, text, and attributes of the license.</returns>
|
||||||
|
public IObservable<License> GetLicense(string key)
|
||||||
|
{
|
||||||
|
return _client.GetLicense(key).ToObservable();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,5 +157,21 @@ namespace Octokit.Reactive
|
|||||||
|
|
||||||
return _connection.GetAndFlattenAllPages<PullRequestCommit>(ApiUrls.PullRequestCommits(owner, name, number));
|
return _connection.GetAndFlattenAllPages<PullRequestCommit>(ApiUrls.PullRequestCommits(owner, name, number));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the list of files on a pull request.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>https://developer.github.com/v3/pulls/#list-pull-requests-files</remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="name">The name of the repository</param>
|
||||||
|
/// <param name="number">The pull request number</param>
|
||||||
|
/// <returns>A collection of <see cref="PullRequestFile"/> results</returns>
|
||||||
|
public IObservable<PullRequestFile> Files(string owner, string name, int number)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||||
|
|
||||||
|
return _connection.GetAndFlattenAllPages<PullRequestFile>(ApiUrls.PullRequestFiles(owner, name, number));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -161,30 +161,6 @@ namespace Octokit.Reactive
|
|||||||
return _connection.GetAndFlattenAllPages<Repository>(ApiUrls.OrganizationRepositories(organization));
|
return _connection.GetAndFlattenAllPages<Repository>(ApiUrls.OrganizationRepositories(organization));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns the HTML rendered README.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="owner">The owner of the repository</param>
|
|
||||||
/// <param name="name">The name of the repository</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[Obsolete("This method has been obsoleted by Content.GetReadme. Please use that instead.")]
|
|
||||||
public IObservable<Readme> GetReadme(string owner, string name)
|
|
||||||
{
|
|
||||||
return _client.Content.GetReadme(owner, name).ToObservable();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns just the HTML portion of the README without the surrounding HTML document.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="owner">The owner of the repository</param>
|
|
||||||
/// <param name="name">The name of the repository</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[Obsolete("This method has been obsoleted by Content.GetReadmeHtml. Please use that instead.")]
|
|
||||||
public IObservable<string> GetReadmeHtml(string owner, string name)
|
|
||||||
{
|
|
||||||
return _client.Content.GetReadmeHtml(owner, name).ToObservable();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A client for GitHub's Commit Status API.
|
/// A client for GitHub's Commit Status API.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Octokit.Tests.Helpers;
|
using Octokit.Tests.Helpers;
|
||||||
@@ -36,6 +37,28 @@ namespace Octokit.Tests.Conventions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[MemberData("ResponseModelTypes")]
|
||||||
|
public void ResponseModelsHaveReadOnlyCollections(Type modelType)
|
||||||
|
{
|
||||||
|
foreach (var property in modelType.GetProperties())
|
||||||
|
{
|
||||||
|
var propertyType = property.PropertyType;
|
||||||
|
|
||||||
|
if (typeof(IEnumerable).IsAssignableFrom(propertyType))
|
||||||
|
{
|
||||||
|
// Let's skip arrays as well for now.
|
||||||
|
// There seems to be some special array handling in the Gist model.
|
||||||
|
if (propertyType == typeof(string) || propertyType.IsArray)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
AssertEx.IsReadOnlyCollection(propertyType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static IEnumerable<object[]> ModelTypes
|
public static IEnumerable<object[]> ModelTypes
|
||||||
{
|
{
|
||||||
get { return GetModelTypes(includeRequestModels: true).Select(type => new[] { type }); }
|
get { return GetModelTypes(includeRequestModels: true).Select(type => new[] { type }); }
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="..\packages\xunit.runner.visualstudio.0.99.9-build1021\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.0.99.9-build1021\build\net20\xunit.runner.visualstudio.props')" />
|
<Import Project="..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props')" />
|
||||||
<Import Project="..\packages\xunit.core.2.0.0-beta5-build2785\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid\xunit.core.props" Condition="Exists('..\packages\xunit.core.2.0.0-beta5-build2785\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid\xunit.core.props')" />
|
<Import Project="..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props" Condition="Exists('..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" />
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
<AssemblyName>Octokit.Tests.Conventions</AssemblyName>
|
<AssemblyName>Octokit.Tests.Conventions</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<NuGetPackageImportStamp>c9328b3d</NuGetPackageImportStamp>
|
<NuGetPackageImportStamp>2fbb7772</NuGetPackageImportStamp>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
@@ -44,14 +44,16 @@
|
|||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\Rx-Interfaces.2.2.5\lib\net45\System.Reactive.Interfaces.dll</HintPath>
|
<HintPath>..\packages\Rx-Interfaces.2.2.5\lib\net45\System.Reactive.Interfaces.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="xunit.abstractions">
|
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\xunit.abstractions.2.0.0-beta5-build2785\lib\net35\xunit.abstractions.dll</HintPath>
|
<HintPath>..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="xunit.assert">
|
<Reference Include="xunit.assert, Version=2.0.0.2929, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\xunit.assert.2.0.0-beta5-build2785\lib\portable-net45+aspnetcore50+win+wpa81+wp80+monoandroid+monotouch10\xunit.assert.dll</HintPath>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\packages\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="xunit.core">
|
<Reference Include="xunit.core, Version=2.0.0.2929, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\xunit.core.2.0.0-beta5-build2785\lib\portable-net45+aspnetcore50+win+wpa81+wp80+monotouch+monoandroid\xunit.core.dll</HintPath>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -94,8 +96,8 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('..\packages\xunit.core.2.0.0-beta5-build2785\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.0.0-beta5-build2785\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid\xunit.core.props'))" />
|
<Error Condition="!Exists('..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props'))" />
|
||||||
<Error Condition="!Exists('..\packages\xunit.runner.visualstudio.0.99.9-build1021\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.0.99.9-build1021\build\net20\xunit.runner.visualstudio.props'))" />
|
<Error Condition="!Exists('..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props'))" />
|
||||||
</Target>
|
</Target>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|||||||
@@ -2,9 +2,10 @@
|
|||||||
<packages>
|
<packages>
|
||||||
<package id="Rx-Core" version="2.2.5" targetFramework="net45" />
|
<package id="Rx-Core" version="2.2.5" targetFramework="net45" />
|
||||||
<package id="Rx-Interfaces" version="2.2.5" targetFramework="net45" />
|
<package id="Rx-Interfaces" version="2.2.5" targetFramework="net45" />
|
||||||
<package id="xunit" version="2.0.0-beta5-build2785" targetFramework="net45" />
|
<package id="xunit" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="xunit.abstractions" version="2.0.0-beta5-build2785" targetFramework="net45" />
|
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="xunit.assert" version="2.0.0-beta5-build2785" targetFramework="net45" />
|
<package id="xunit.assert" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="xunit.core" version="2.0.0-beta5-build2785" targetFramework="net45" />
|
<package id="xunit.core" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="xunit.runner.visualstudio" version="0.99.9-build1021" targetFramework="net45" />
|
<package id="xunit.extensibility.core" version="2.0.0" targetFramework="net45" />
|
||||||
|
<package id="xunit.runner.visualstudio" version="2.0.0" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -15,7 +15,7 @@ public class AssigneesClientTests
|
|||||||
_gitHubClient = Helper.GetAuthenticatedClient();
|
_gitHubClient = Helper.GetAuthenticatedClient();
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
|
|
||||||
_repository = _gitHubClient.Repository.Create(new NewRepository { Name = repoName }).Result;
|
_repository = _gitHubClient.Repository.Create(new NewRepository(repoName)).Result;
|
||||||
_owner = _repository.Owner.Login;
|
_owner = _repository.Owner.Login;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Octokit.Tests.Helpers;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Octokit.Tests.Integration.Clients
|
namespace Octokit.Tests.Integration.Clients
|
||||||
@@ -97,5 +98,117 @@ namespace Octokit.Tests.Integration.Clients
|
|||||||
|
|
||||||
await client.Authorization.Delete(created.Id);
|
await client.Authorization.Delete(created.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ApplicationTest]
|
||||||
|
public async Task CanCheckApplicationAuthentication()
|
||||||
|
{
|
||||||
|
var client = Helper.GetAuthenticatedClient();
|
||||||
|
var fingerprint = Helper.MakeNameWithTimestamp("authorization-testing");
|
||||||
|
var note = Helper.MakeNameWithTimestamp("Testing authentication");
|
||||||
|
var newAuthorization = new NewAuthorization(
|
||||||
|
note,
|
||||||
|
new[] { "user" },
|
||||||
|
fingerprint);
|
||||||
|
|
||||||
|
var created = await client.Authorization.GetOrCreateApplicationAuthentication(
|
||||||
|
Helper.ClientId,
|
||||||
|
Helper.ClientSecret,
|
||||||
|
newAuthorization);
|
||||||
|
|
||||||
|
var applicationClient = Helper.GetAuthenticatedApplicationClient();
|
||||||
|
var applicationAuthorization = await applicationClient.Authorization.CheckApplicationAuthentication(Helper.ClientId, created.Token);
|
||||||
|
|
||||||
|
Assert.NotNull(applicationAuthorization);
|
||||||
|
Assert.Equal(created.Token, applicationAuthorization.Token);
|
||||||
|
|
||||||
|
await client.Authorization.Delete(created.Id);
|
||||||
|
AssertEx.Throws<NotFoundException>(async () => await client.Authorization.Get(created.Id));
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApplicationTest]
|
||||||
|
public async Task CanResetApplicationAuthentication()
|
||||||
|
{
|
||||||
|
var client = Helper.GetAuthenticatedClient();
|
||||||
|
var fingerprint = Helper.MakeNameWithTimestamp("authorization-testing");
|
||||||
|
var note = Helper.MakeNameWithTimestamp("Testing authentication");
|
||||||
|
var newAuthorization = new NewAuthorization(
|
||||||
|
note,
|
||||||
|
new[] { "user" },
|
||||||
|
fingerprint);
|
||||||
|
|
||||||
|
var created = await client.Authorization.GetOrCreateApplicationAuthentication(
|
||||||
|
Helper.ClientId,
|
||||||
|
Helper.ClientSecret,
|
||||||
|
newAuthorization);
|
||||||
|
|
||||||
|
var applicationClient = Helper.GetAuthenticatedApplicationClient();
|
||||||
|
var applicationAuthorization = await applicationClient.Authorization.ResetApplicationAuthentication(Helper.ClientId, created.Token);
|
||||||
|
|
||||||
|
Assert.NotNull(applicationAuthorization);
|
||||||
|
Assert.NotEqual(created.Token, applicationAuthorization.Token);
|
||||||
|
|
||||||
|
await client.Authorization.Delete(created.Id);
|
||||||
|
AssertEx.Throws<NotFoundException>(async () => await client.Authorization.Get(created.Id));
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApplicationTest]
|
||||||
|
public async Task CanRevokeApplicationAuthentication()
|
||||||
|
{
|
||||||
|
var client = Helper.GetAuthenticatedClient();
|
||||||
|
var fingerprint = Helper.MakeNameWithTimestamp("authorization-testing");
|
||||||
|
var note = Helper.MakeNameWithTimestamp("Testing authentication");
|
||||||
|
var newAuthorization = new NewAuthorization(
|
||||||
|
note,
|
||||||
|
new[] { "user" },
|
||||||
|
fingerprint);
|
||||||
|
|
||||||
|
var created = await client.Authorization.GetOrCreateApplicationAuthentication(
|
||||||
|
Helper.ClientId,
|
||||||
|
Helper.ClientSecret,
|
||||||
|
newAuthorization);
|
||||||
|
|
||||||
|
var applicationClient = Helper.GetAuthenticatedApplicationClient();
|
||||||
|
await applicationClient.Authorization.RevokeApplicationAuthentication(Helper.ClientId, created.Token);
|
||||||
|
|
||||||
|
AssertEx.Throws<NotFoundException>(async () => await applicationClient.Authorization.CheckApplicationAuthentication(Helper.ClientId, created.Token));
|
||||||
|
AssertEx.Throws<NotFoundException>(async () => await client.Authorization.Get(created.Id));
|
||||||
|
}
|
||||||
|
|
||||||
|
[ApplicationTest]
|
||||||
|
public async Task CanRevokeAllApplicationAuthentications()
|
||||||
|
{
|
||||||
|
var client = Helper.GetAuthenticatedClient();
|
||||||
|
|
||||||
|
var fingerprint = Helper.MakeNameWithTimestamp("authorization-testing");
|
||||||
|
var note = Helper.MakeNameWithTimestamp("Testing authentication");
|
||||||
|
var token1 = await client.Authorization.GetOrCreateApplicationAuthentication(
|
||||||
|
Helper.ClientId,
|
||||||
|
Helper.ClientSecret,
|
||||||
|
new NewAuthorization(
|
||||||
|
note,
|
||||||
|
new[] { "user" },
|
||||||
|
fingerprint));
|
||||||
|
|
||||||
|
fingerprint = Helper.MakeNameWithTimestamp("authorization-testing-2");
|
||||||
|
note = Helper.MakeNameWithTimestamp("Testing authentication 2");
|
||||||
|
var token2 = await client.Authorization.GetOrCreateApplicationAuthentication(
|
||||||
|
Helper.ClientId,
|
||||||
|
Helper.ClientSecret,
|
||||||
|
new NewAuthorization(
|
||||||
|
note,
|
||||||
|
new[] { "user" },
|
||||||
|
fingerprint));
|
||||||
|
|
||||||
|
var applicationClient = Helper.GetAuthenticatedApplicationClient();
|
||||||
|
await applicationClient.Authorization.RevokeAllApplicationAuthentications(Helper.ClientId);
|
||||||
|
|
||||||
|
AssertEx.Throws<NotFoundException>(async () =>
|
||||||
|
await applicationClient.Authorization.CheckApplicationAuthentication(Helper.ClientId, token1.Token));
|
||||||
|
AssertEx.Throws<NotFoundException>(async () =>
|
||||||
|
await applicationClient.Authorization.CheckApplicationAuthentication(Helper.ClientId, token2.Token));
|
||||||
|
|
||||||
|
AssertEx.Throws<NotFoundException>(async () => await client.Authorization.Get(token1.Id));
|
||||||
|
AssertEx.Throws<NotFoundException>(async () => await client.Authorization.Get(token2.Id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class BlobClientTests : IDisposable
|
|||||||
_fixture = client.GitDatabase.Blob;
|
_fixture = client.GitDatabase.Blob;
|
||||||
|
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
_repository = client.Repository.Create(new NewRepository { Name = repoName, AutoInit = true }).Result;
|
_repository = client.Repository.Create(new NewRepository(repoName) { AutoInit = true }).Result;
|
||||||
_owner = _repository.Owner.Login;
|
_owner = _repository.Owner.Login;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class BranchesClientTests
|
|||||||
{
|
{
|
||||||
_github = Helper.GetAuthenticatedClient();
|
_github = Helper.GetAuthenticatedClient();
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
_repository = _github.Repository.Create(new NewRepository { Name = repoName, AutoInit = true }).Result;
|
_repository = _github.Repository.Create(new NewRepository(repoName) { AutoInit = true }).Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
[IntegrationTest]
|
[IntegrationTest]
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class CommitStatusClientTests
|
|||||||
_client = Helper.GetAuthenticatedClient();
|
_client = Helper.GetAuthenticatedClient();
|
||||||
|
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
_repository = _client.Repository.Create(new NewRepository { Name = repoName, AutoInit = true }).Result;
|
_repository = _client.Repository.Create(new NewRepository(repoName) { AutoInit = true }).Result;
|
||||||
_owner = _repository.Owner.Login;
|
_owner = _repository.Owner.Login;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class CommitsClientTests : IDisposable
|
|||||||
|
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
_fixture = _client.GitDatabase.Commit;
|
_fixture = _client.GitDatabase.Commit;
|
||||||
_repository = _client.Repository.Create(new NewRepository { Name = repoName, AutoInit = true }).Result;
|
_repository = _client.Repository.Create(new NewRepository(repoName) { AutoInit = true }).Result;
|
||||||
_owner = _repository.Owner.Login;
|
_owner = _repository.Owner.Login;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,9 +19,8 @@ public class DeploymentStatusClientTests : IDisposable
|
|||||||
|
|
||||||
_deploymentsClient = _gitHubClient.Repository.Deployment;
|
_deploymentsClient = _gitHubClient.Repository.Deployment;
|
||||||
|
|
||||||
var newRepository = new NewRepository
|
var newRepository = new NewRepository(Helper.MakeNameWithTimestamp("public-repo"))
|
||||||
{
|
{
|
||||||
Name = Helper.MakeNameWithTimestamp("public-repo"),
|
|
||||||
AutoInit = true
|
AutoInit = true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,11 @@ using Xunit;
|
|||||||
|
|
||||||
public class DeploymentsClientTests : IDisposable
|
public class DeploymentsClientTests : IDisposable
|
||||||
{
|
{
|
||||||
IGitHubClient _gitHubClient;
|
readonly IGitHubClient _gitHubClient;
|
||||||
IDeploymentsClient _deploymentsClient;
|
readonly IDeploymentsClient _deploymentsClient;
|
||||||
Repository _repository;
|
readonly Repository _repository;
|
||||||
Commit _commit;
|
readonly Commit _commit;
|
||||||
string _repositoryOwner;
|
readonly string _repositoryOwner;
|
||||||
|
|
||||||
public DeploymentsClientTests()
|
public DeploymentsClientTests()
|
||||||
{
|
{
|
||||||
@@ -18,9 +18,8 @@ public class DeploymentsClientTests : IDisposable
|
|||||||
|
|
||||||
_deploymentsClient = _gitHubClient.Repository.Deployment;
|
_deploymentsClient = _gitHubClient.Repository.Deployment;
|
||||||
|
|
||||||
var newRepository = new NewRepository
|
var newRepository = new NewRepository(Helper.MakeNameWithTimestamp("public-repo"))
|
||||||
{
|
{
|
||||||
Name = Helper.MakeNameWithTimestamp("public-repo"),
|
|
||||||
AutoInit = true
|
AutoInit = true
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class FollowersClientTests : IDisposable
|
|||||||
{
|
{
|
||||||
await _github.User.Followers.Follow("alfhenrik");
|
await _github.User.Followers.Follow("alfhenrik");
|
||||||
|
|
||||||
var following = await _github.User.Followers.GetFollowingForCurrent();
|
var following = await _github.User.Followers.GetAllFollowingForCurrent();
|
||||||
|
|
||||||
Assert.NotNull(following);
|
Assert.NotNull(following);
|
||||||
Assert.True(following.Any(f => f.Login == "alfhenrik"));
|
Assert.True(following.Any(f => f.Login == "alfhenrik"));
|
||||||
@@ -30,7 +30,7 @@ public class FollowersClientTests : IDisposable
|
|||||||
[IntegrationTest]
|
[IntegrationTest]
|
||||||
public async Task ReturnsUsersTheUserIsFollowing()
|
public async Task ReturnsUsersTheUserIsFollowing()
|
||||||
{
|
{
|
||||||
var following = await _github.User.Followers.GetFollowing("alfhenrik");
|
var following = await _github.User.Followers.GetAllFollowing("alfhenrik");
|
||||||
|
|
||||||
Assert.NotNull(following);
|
Assert.NotNull(following);
|
||||||
Assert.NotEmpty(following);
|
Assert.NotEmpty(following);
|
||||||
@@ -69,7 +69,7 @@ public class FollowersClientTests : IDisposable
|
|||||||
public async Task FollowUserNotBeingFollowedByTheUser()
|
public async Task FollowUserNotBeingFollowedByTheUser()
|
||||||
{
|
{
|
||||||
var result = await _github.User.Followers.Follow("alfhenrik");
|
var result = await _github.User.Followers.Follow("alfhenrik");
|
||||||
var following = await _github.User.Followers.GetFollowingForCurrent();
|
var following = await _github.User.Followers.GetAllFollowingForCurrent();
|
||||||
|
|
||||||
Assert.True(result);
|
Assert.True(result);
|
||||||
Assert.NotEmpty(following);
|
Assert.NotEmpty(following);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class IssuesClientTests : IDisposable
|
|||||||
_gitHubClient = Helper.GetAuthenticatedClient();
|
_gitHubClient = Helper.GetAuthenticatedClient();
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
_issuesClient = _gitHubClient.Issue;
|
_issuesClient = _gitHubClient.Issue;
|
||||||
_repository = _gitHubClient.Repository.Create(new NewRepository { Name = repoName }).Result;
|
_repository = _gitHubClient.Repository.Create(new NewRepository(repoName)).Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
[IntegrationTest]
|
[IntegrationTest]
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class IssuesEventsClientTests : IDisposable
|
|||||||
_issuesClient = _gitHubClient.Issue;
|
_issuesClient = _gitHubClient.Issue;
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
|
|
||||||
_repository = _gitHubClient.Repository.Create(new NewRepository { Name = repoName }).Result;
|
_repository = _gitHubClient.Repository.Create(new NewRepository(repoName)).Result;
|
||||||
_repositoryOwner = _repository.Owner.Login;
|
_repositoryOwner = _repository.Owner.Login;
|
||||||
_repositoryName = _repository.Name;
|
_repositoryName = _repository.Name;
|
||||||
}
|
}
|
||||||
@@ -94,6 +94,14 @@ public class IssuesEventsClientTests : IDisposable
|
|||||||
Assert.Equal(issueEvents[0].Event, issueEventLookupById.Event);
|
Assert.Equal(issueEvents[0].Event, issueEventLookupById.Event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IntegrationTest]
|
||||||
|
public async Task CanDeserializeUnsubscribeEvent()
|
||||||
|
{
|
||||||
|
var client = Helper.GetAuthenticatedClient();
|
||||||
|
var issue = await client.Issue.Events.Get("waffleio", "waffle.io", 142230057);
|
||||||
|
Assert.Equal(EventInfoState.Unsubscribed, issue.Event);
|
||||||
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
Helper.DeleteRepo(_repository);
|
Helper.DeleteRepo(_repository);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class IssuesLabelsClientTests : IDisposable
|
|||||||
_issuesClient = _gitHubClient.Issue;
|
_issuesClient = _gitHubClient.Issue;
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
|
|
||||||
_repository = _gitHubClient.Repository.Create(new NewRepository { Name = repoName }).Result;
|
_repository = _gitHubClient.Repository.Create(new NewRepository(repoName)).Result;
|
||||||
_repositoryOwner = _repository.Owner.Login;
|
_repositoryOwner = _repository.Owner.Login;
|
||||||
_repositoryName = _repository.Name;
|
_repositoryName = _repository.Name;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class MergingClientTests : IDisposable
|
|||||||
|
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
_fixture = _client.Repository.Merging;
|
_fixture = _client.Repository.Merging;
|
||||||
_repository = _client.Repository.Create(new NewRepository { Name = repoName, AutoInit = true }).Result;
|
_repository = _client.Repository.Create(new NewRepository(repoName) { AutoInit = true }).Result;
|
||||||
_owner = _repository.Owner.Login;
|
_owner = _repository.Owner.Login;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class MilestonesClientTests : IDisposable
|
|||||||
_milestonesClient = _gitHubClient.Issue.Milestone;
|
_milestonesClient = _gitHubClient.Issue.Milestone;
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
|
|
||||||
_repository = _gitHubClient.Repository.Create(new NewRepository { Name = repoName }).Result;
|
_repository = _gitHubClient.Repository.Create(new NewRepository(repoName)).Result;
|
||||||
_repositoryOwner = _repository.Owner.Login;
|
_repositoryOwner = _repository.Owner.Login;
|
||||||
_repositoryName = _repository.Name;
|
_repositoryName = _repository.Name;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,4 +29,45 @@ public class MiscellaneousClientTests
|
|||||||
Assert.Equal("<p>This is\n a <strong>test</strong></p>\n", result);
|
Assert.Equal("<p>This is\n a <strong>test</strong></p>\n", result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class TheGetGitIgnoreTemplatesMethod
|
||||||
|
{
|
||||||
|
[IntegrationTest]
|
||||||
|
public async Task ReturnsListOfGitIgnoreTemplates()
|
||||||
|
{
|
||||||
|
var github = Helper.GetAuthenticatedClient();
|
||||||
|
|
||||||
|
var result = await github.Miscellaneous.GetGitIgnoreTemplates();
|
||||||
|
|
||||||
|
Assert.True(result.Count > 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TheGetLicensesMethod
|
||||||
|
{
|
||||||
|
[IntegrationTest]
|
||||||
|
public async Task CanRetrieveListOfLicenses()
|
||||||
|
{
|
||||||
|
var github = Helper.GetAuthenticatedClient();
|
||||||
|
|
||||||
|
var result = await github.Miscellaneous.GetLicenses();
|
||||||
|
|
||||||
|
Assert.True(result.Count > 2);
|
||||||
|
Assert.Contains(result, license => license.Key == "mit");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TheGetLicenseMethod
|
||||||
|
{
|
||||||
|
[IntegrationTest]
|
||||||
|
public async Task CanRetrieveListOfLicenses()
|
||||||
|
{
|
||||||
|
var github = Helper.GetAuthenticatedClient();
|
||||||
|
|
||||||
|
var result = await github.Miscellaneous.GetLicense("mit");
|
||||||
|
|
||||||
|
Assert.Equal("mit", result.Key);
|
||||||
|
Assert.Equal("MIT License", result.Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ public class PullRequestReviewCommentsClientTests : IDisposable
|
|||||||
|
|
||||||
async Task<Repository> CreateRepository(string repoName)
|
async Task<Repository> CreateRepository(string repoName)
|
||||||
{
|
{
|
||||||
return await _gitHubClient.Repository.Create(new NewRepository { Name = repoName, AutoInit = true });
|
return await _gitHubClient.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Octokit;
|
using Octokit;
|
||||||
using Octokit.Tests.Integration;
|
using Octokit.Tests.Integration;
|
||||||
@@ -13,6 +14,7 @@ public class PullRequestsClientTests : IDisposable
|
|||||||
readonly IRepositoryCommentsClient _repositoryCommentsClient;
|
readonly IRepositoryCommentsClient _repositoryCommentsClient;
|
||||||
|
|
||||||
const string branchName = "my-branch";
|
const string branchName = "my-branch";
|
||||||
|
const string otherBranchName = "my-other-branch";
|
||||||
|
|
||||||
public PullRequestsClientTests()
|
public PullRequestsClientTests()
|
||||||
{
|
{
|
||||||
@@ -23,7 +25,7 @@ public class PullRequestsClientTests : IDisposable
|
|||||||
|
|
||||||
var repoName = Helper.MakeNameWithTimestamp("source-repo");
|
var repoName = Helper.MakeNameWithTimestamp("source-repo");
|
||||||
|
|
||||||
_repository = _client.Repository.Create(new NewRepository { Name = repoName, AutoInit = true }).Result;
|
_repository = _client.Repository.Create(new NewRepository(repoName) { AutoInit = true }).Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
[IntegrationTest]
|
[IntegrationTest]
|
||||||
@@ -129,6 +131,47 @@ public class PullRequestsClientTests : IDisposable
|
|||||||
Assert.Equal(1, pullRequests.Count);
|
Assert.Equal(1, pullRequests.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IntegrationTest]
|
||||||
|
public async Task CanSortPullRequests()
|
||||||
|
{
|
||||||
|
await CreateTheWorld();
|
||||||
|
|
||||||
|
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
|
||||||
|
var pullRequest = await _fixture.Create(Helper.UserName, _repository.Name, newPullRequest);
|
||||||
|
|
||||||
|
var newPullRequest2 = new NewPullRequest("another pull request", otherBranchName, "master");
|
||||||
|
var anotherPullRequest = await _fixture.Create(Helper.UserName, _repository.Name, newPullRequest2);
|
||||||
|
|
||||||
|
var updatePullRequest = new PullRequestUpdate { Body = "This is the body" };
|
||||||
|
await _fixture.Update(Helper.UserName, _repository.Name, pullRequest.Number, updatePullRequest);
|
||||||
|
|
||||||
|
var sortPullRequestsByUpdated = new PullRequestRequest { SortProperty = PullRequestSort.Updated, SortDirection = SortDirection.Ascending };
|
||||||
|
var pullRequests = await _fixture.GetForRepository(Helper.UserName, _repository.Name, sortPullRequestsByUpdated);
|
||||||
|
Assert.Equal(anotherPullRequest.Title, pullRequests[0].Title);
|
||||||
|
|
||||||
|
var sortPullRequestsByLongRunning = new PullRequestRequest { SortProperty = PullRequestSort.LongRunning };
|
||||||
|
var pullRequestsByLongRunning = await _fixture.GetForRepository(Helper.UserName, _repository.Name, sortPullRequestsByLongRunning);
|
||||||
|
Assert.Equal(pullRequest.Title, pullRequestsByLongRunning[0].Title);
|
||||||
|
}
|
||||||
|
|
||||||
|
[IntegrationTest]
|
||||||
|
public async Task CanSpecifyDirectionOfSort()
|
||||||
|
{
|
||||||
|
await CreateTheWorld();
|
||||||
|
|
||||||
|
var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
|
||||||
|
var pullRequest = await _fixture.Create(Helper.UserName, _repository.Name, newPullRequest);
|
||||||
|
|
||||||
|
var newPullRequest2 = new NewPullRequest("another pull request", otherBranchName, "master");
|
||||||
|
var anotherPullRequest = await _fixture.Create(Helper.UserName, _repository.Name, newPullRequest2);
|
||||||
|
|
||||||
|
var pullRequests = await _fixture.GetForRepository(Helper.UserName, _repository.Name, new PullRequestRequest { SortDirection = SortDirection.Ascending });
|
||||||
|
Assert.Equal(pullRequest.Title, pullRequests[0].Title);
|
||||||
|
|
||||||
|
var pullRequestsDescending = await _fixture.GetForRepository(Helper.UserName, _repository.Name, new PullRequestRequest());
|
||||||
|
Assert.Equal(anotherPullRequest.Title, pullRequestsDescending[0].Title);
|
||||||
|
}
|
||||||
|
|
||||||
[IntegrationTest]
|
[IntegrationTest]
|
||||||
public async Task IsNotMergedInitially()
|
public async Task IsNotMergedInitially()
|
||||||
{
|
{
|
||||||
@@ -218,6 +261,30 @@ public class PullRequestsClientTests : IDisposable
|
|||||||
Assert.Equal(1, result[1].Commit.CommentCount);
|
Assert.Equal(1, result[1].Commit.CommentCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[IntegrationTest]
|
||||||
|
public async Task CanBrowseFiles()
|
||||||
|
{
|
||||||
|
var expectedFiles = new List<PullRequestFile>
|
||||||
|
{
|
||||||
|
new PullRequestFile(null, "Octokit.Tests.Integration/Clients/ReferencesClientTests.cs", null, 8, 3, 11, null, null, null, null),
|
||||||
|
new PullRequestFile(null, "Octokit/Clients/ApiPagination.cs", null, 21, 6, 27, null, null, null, null),
|
||||||
|
new PullRequestFile(null, "Octokit/Helpers/IApiPagination.cs", null, 1, 1, 2, null, null, null, null),
|
||||||
|
new PullRequestFile(null, "Octokit/Http/ApiConnection.cs", null, 1, 1, 2, null, null, null, null)
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = await _fixture.Files("octokit", "octokit.net", 288);
|
||||||
|
|
||||||
|
Assert.Equal(4, result.Count);
|
||||||
|
Assert.True(expectedFiles.All(expectedFile => result.Any(file => file.FileName.Equals(expectedFile.FileName))));
|
||||||
|
foreach (var file in result)
|
||||||
|
{
|
||||||
|
var expectedFile = expectedFiles.Find(prf => file.FileName.Equals(prf.FileName));
|
||||||
|
Assert.Equal(expectedFile.Changes, file.Changes);
|
||||||
|
Assert.Equal(expectedFile.Additions, file.Additions);
|
||||||
|
Assert.Equal(expectedFile.Deletions, file.Deletions);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async Task CreateTheWorld()
|
async Task CreateTheWorld()
|
||||||
{
|
{
|
||||||
var master = await _client.GitDatabase.Reference.Get(Helper.UserName, _repository.Name, "heads/master");
|
var master = await _client.GitDatabase.Reference.Get(Helper.UserName, _repository.Name, "heads/master");
|
||||||
@@ -235,6 +302,11 @@ public class PullRequestsClientTests : IDisposable
|
|||||||
|
|
||||||
// create branch
|
// create branch
|
||||||
await _client.GitDatabase.Reference.Create(Helper.UserName, _repository.Name, new NewReference("refs/heads/my-branch", featureBranchCommit.Sha));
|
await _client.GitDatabase.Reference.Create(Helper.UserName, _repository.Name, new NewReference("refs/heads/my-branch", featureBranchCommit.Sha));
|
||||||
|
|
||||||
|
var otherFeatureBranchTree = await CreateTree(new Dictionary<string, string> { { "README.md", "I am overwriting this blob with something else" } });
|
||||||
|
var otherFeatureBranchCommit = await CreateCommit("this is the other commit to merge into the other pull request", otherFeatureBranchTree.Sha, newMaster.Sha);
|
||||||
|
|
||||||
|
await _client.GitDatabase.Reference.Create(Helper.UserName, _repository.Name, new NewReference("refs/heads/my-other-branch", otherFeatureBranchCommit.Sha));
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task<TreeResponse> CreateTree(IEnumerable<KeyValuePair<string, string>> treeContents)
|
async Task<TreeResponse> CreateTree(IEnumerable<KeyValuePair<string, string>> treeContents)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class ReferencesClientTests : IDisposable
|
|||||||
_fixture = _client.GitDatabase.Reference;
|
_fixture = _client.GitDatabase.Reference;
|
||||||
|
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
_repository = _client.Repository.Create(new NewRepository { Name = repoName, AutoInit = true }).Result;
|
_repository = _client.Repository.Create(new NewRepository(repoName) { AutoInit = true }).Result;
|
||||||
_owner = _repository.Owner.Login;
|
_owner = _repository.Owner.Login;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public class ReleasesClientTests
|
|||||||
_releaseClient = github.Release;
|
_releaseClient = github.Release;
|
||||||
|
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
_repository = github.Repository.Create(new NewRepository { Name = repoName, AutoInit = true }).Result;
|
_repository = github.Repository.Create(new NewRepository(repoName) { AutoInit = true }).Result;
|
||||||
_repositoryOwner = _repository.Owner.Login;
|
_repositoryOwner = _repository.Owner.Login;
|
||||||
_repositoryName = _repository.Name;
|
_repositoryName = _repository.Name;
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ public class ReleasesClientTests
|
|||||||
_releaseClient = github.Release;
|
_releaseClient = github.Release;
|
||||||
|
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
_repository = github.Repository.Create(new NewRepository { Name = repoName, AutoInit = true }).Result;
|
_repository = github.Repository.Create(new NewRepository(repoName) { AutoInit = true }).Result;
|
||||||
_repositoryOwner = _repository.Owner.Login;
|
_repositoryOwner = _repository.Owner.Login;
|
||||||
_repositoryName = _repository.Name;
|
_repositoryName = _repository.Name;
|
||||||
}
|
}
|
||||||
@@ -133,7 +133,7 @@ public class ReleasesClientTests
|
|||||||
_releaseClient = _github.Release;
|
_releaseClient = _github.Release;
|
||||||
|
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
_repository = _github.Repository.Create(new NewRepository { Name = repoName, AutoInit = true }).Result;
|
_repository = _github.Repository.Create(new NewRepository(repoName) { AutoInit = true }).Result;
|
||||||
_repositoryOwner = _repository.Owner.Login;
|
_repositoryOwner = _repository.Owner.Login;
|
||||||
_repositoryName = _repository.Name;
|
_repositoryName = _repository.Name;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public class RepositoriesClientTests
|
|||||||
var github = Helper.GetAuthenticatedClient();
|
var github = Helper.GetAuthenticatedClient();
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
|
|
||||||
var createdRepository = await github.Repository.Create(new NewRepository { Name = repoName });
|
var createdRepository = await github.Repository.Create(new NewRepository(repoName));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -58,9 +58,8 @@ public class RepositoriesClientTests
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
createdRepository = await github.Repository.Create(new NewRepository
|
createdRepository = await github.Repository.Create(new NewRepository(repoName)
|
||||||
{
|
{
|
||||||
Name = repoName,
|
|
||||||
Private = true
|
Private = true
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -84,9 +83,8 @@ public class RepositoriesClientTests
|
|||||||
|
|
||||||
var repoName = Helper.MakeNameWithTimestamp("repo-without-downloads");
|
var repoName = Helper.MakeNameWithTimestamp("repo-without-downloads");
|
||||||
|
|
||||||
var createdRepository = await github.Repository.Create(new NewRepository
|
var createdRepository = await github.Repository.Create(new NewRepository(repoName)
|
||||||
{
|
{
|
||||||
Name = repoName,
|
|
||||||
HasDownloads = false
|
HasDownloads = false
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -109,9 +107,8 @@ public class RepositoriesClientTests
|
|||||||
|
|
||||||
var repoName = Helper.MakeNameWithTimestamp("repo-without-issues");
|
var repoName = Helper.MakeNameWithTimestamp("repo-without-issues");
|
||||||
|
|
||||||
var createdRepository = await github.Repository.Create(new NewRepository
|
var createdRepository = await github.Repository.Create(new NewRepository(repoName)
|
||||||
{
|
{
|
||||||
Name = repoName,
|
|
||||||
HasIssues = false
|
HasIssues = false
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -134,9 +131,8 @@ public class RepositoriesClientTests
|
|||||||
|
|
||||||
var repoName = Helper.MakeNameWithTimestamp("repo-without-wiki");
|
var repoName = Helper.MakeNameWithTimestamp("repo-without-wiki");
|
||||||
|
|
||||||
var createdRepository = await github.Repository.Create(new NewRepository
|
var createdRepository = await github.Repository.Create(new NewRepository(repoName)
|
||||||
{
|
{
|
||||||
Name = repoName,
|
|
||||||
HasWiki = false
|
HasWiki = false
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -159,9 +155,8 @@ public class RepositoriesClientTests
|
|||||||
|
|
||||||
var repoName = Helper.MakeNameWithTimestamp("repo-with-description");
|
var repoName = Helper.MakeNameWithTimestamp("repo-with-description");
|
||||||
|
|
||||||
var createdRepository = await github.Repository.Create(new NewRepository
|
var createdRepository = await github.Repository.Create(new NewRepository(repoName)
|
||||||
{
|
{
|
||||||
Name = repoName,
|
|
||||||
Description = "theDescription"
|
Description = "theDescription"
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -184,9 +179,8 @@ public class RepositoriesClientTests
|
|||||||
|
|
||||||
var repoName = Helper.MakeNameWithTimestamp("repo-with-homepage");
|
var repoName = Helper.MakeNameWithTimestamp("repo-with-homepage");
|
||||||
|
|
||||||
var createdRepository = await github.Repository.Create(new NewRepository
|
var createdRepository = await github.Repository.Create(new NewRepository(repoName)
|
||||||
{
|
{
|
||||||
Name = repoName,
|
|
||||||
Homepage = "http://aUrl.to/nowhere"
|
Homepage = "http://aUrl.to/nowhere"
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -209,9 +203,8 @@ public class RepositoriesClientTests
|
|||||||
|
|
||||||
var repoName = Helper.MakeNameWithTimestamp("repo-with-autoinit");
|
var repoName = Helper.MakeNameWithTimestamp("repo-with-autoinit");
|
||||||
|
|
||||||
var createdRepository = await github.Repository.Create(new NewRepository
|
var createdRepository = await github.Repository.Create(new NewRepository(repoName)
|
||||||
{
|
{
|
||||||
Name = repoName,
|
|
||||||
AutoInit = true
|
AutoInit = true
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -234,9 +227,8 @@ public class RepositoriesClientTests
|
|||||||
var github = Helper.GetAuthenticatedClient();
|
var github = Helper.GetAuthenticatedClient();
|
||||||
var repoName = Helper.MakeNameWithTimestamp("repo-with-gitignore");
|
var repoName = Helper.MakeNameWithTimestamp("repo-with-gitignore");
|
||||||
|
|
||||||
var createdRepository = await github.Repository.Create(new NewRepository
|
var createdRepository = await github.Repository.Create(new NewRepository(repoName)
|
||||||
{
|
{
|
||||||
Name = repoName,
|
|
||||||
AutoInit = true,
|
AutoInit = true,
|
||||||
GitignoreTemplate = "VisualStudio"
|
GitignoreTemplate = "VisualStudio"
|
||||||
});
|
});
|
||||||
@@ -259,7 +251,7 @@ public class RepositoriesClientTests
|
|||||||
{
|
{
|
||||||
var github = Helper.GetAuthenticatedClient();
|
var github = Helper.GetAuthenticatedClient();
|
||||||
var repoName = Helper.MakeNameWithTimestamp("existing-repo");
|
var repoName = Helper.MakeNameWithTimestamp("existing-repo");
|
||||||
var repository = new NewRepository { Name = repoName };
|
var repository = new NewRepository(repoName);
|
||||||
var createdRepository = await github.Repository.Create(repository);
|
var createdRepository = await github.Repository.Create(repository);
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -298,7 +290,7 @@ public class RepositoriesClientTests
|
|||||||
.Select(x =>
|
.Select(x =>
|
||||||
{
|
{
|
||||||
var repoName = Helper.MakeNameWithTimestamp("private-repo-" + x);
|
var repoName = Helper.MakeNameWithTimestamp("private-repo-" + x);
|
||||||
var repository = new NewRepository { Name = repoName, Private = true };
|
var repository = new NewRepository(repoName) { Private = true };
|
||||||
return github.Repository.Create(repository);
|
return github.Repository.Create(repository);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -307,7 +299,7 @@ public class RepositoriesClientTests
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
await Assert.ThrowsAsync<PrivateRepositoryQuotaExceededException>(
|
await Assert.ThrowsAsync<PrivateRepositoryQuotaExceededException>(
|
||||||
() => github.Repository.Create(new NewRepository { Name = "x-private", Private = true }));
|
() => github.Repository.Create(new NewRepository("x-private") { Private = true }));
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@@ -328,7 +320,7 @@ public class RepositoriesClientTests
|
|||||||
|
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-org-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-org-repo");
|
||||||
|
|
||||||
var createdRepository = await github.Repository.Create(Helper.Organization, new NewRepository { Name = repoName });
|
var createdRepository = await github.Repository.Create(Helper.Organization, new NewRepository(repoName));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -358,7 +350,7 @@ public class RepositoriesClientTests
|
|||||||
|
|
||||||
var repoName = Helper.MakeNameWithTimestamp("existing-org-repo");
|
var repoName = Helper.MakeNameWithTimestamp("existing-org-repo");
|
||||||
|
|
||||||
var repository = new NewRepository { Name = repoName };
|
var repository = new NewRepository(repoName);
|
||||||
var createdRepository = await github.Repository.Create(Helper.Organization, repository);
|
var createdRepository = await github.Repository.Create(Helper.Organization, repository);
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -394,7 +386,7 @@ public class RepositoriesClientTests
|
|||||||
{
|
{
|
||||||
var github = Helper.GetAuthenticatedClient();
|
var github = Helper.GetAuthenticatedClient();
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
_repository = await github.Repository.Create(new NewRepository { Name = repoName, AutoInit = true });
|
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||||
var updatedName = Helper.MakeNameWithTimestamp("updated-repo");
|
var updatedName = Helper.MakeNameWithTimestamp("updated-repo");
|
||||||
var update = new RepositoryUpdate { Name = updatedName };
|
var update = new RepositoryUpdate { Name = updatedName };
|
||||||
|
|
||||||
@@ -408,7 +400,7 @@ public class RepositoriesClientTests
|
|||||||
{
|
{
|
||||||
var github = Helper.GetAuthenticatedClient();
|
var github = Helper.GetAuthenticatedClient();
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
_repository = await github.Repository.Create(new NewRepository { Name = repoName, AutoInit = true });
|
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||||
var update = new RepositoryUpdate { Name = repoName, Description = "Updated description" };
|
var update = new RepositoryUpdate { Name = repoName, Description = "Updated description" };
|
||||||
|
|
||||||
_repository = await github.Repository.Edit(Helper.UserName, repoName, update);
|
_repository = await github.Repository.Edit(Helper.UserName, repoName, update);
|
||||||
@@ -421,7 +413,7 @@ public class RepositoriesClientTests
|
|||||||
{
|
{
|
||||||
var github = Helper.GetAuthenticatedClient();
|
var github = Helper.GetAuthenticatedClient();
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
_repository = await github.Repository.Create(new NewRepository { Name = repoName, AutoInit = true });
|
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||||
var update = new RepositoryUpdate { Name = repoName, Homepage = "http://aUrl.to/nowhere" };
|
var update = new RepositoryUpdate { Name = repoName, Homepage = "http://aUrl.to/nowhere" };
|
||||||
|
|
||||||
_repository = await github.Repository.Edit(Helper.UserName, repoName, update);
|
_repository = await github.Repository.Edit(Helper.UserName, repoName, update);
|
||||||
@@ -441,7 +433,7 @@ public class RepositoriesClientTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
_repository = await github.Repository.Create(new NewRepository { Name = repoName, AutoInit = true });
|
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||||
var update = new RepositoryUpdate { Name = repoName, Private = true };
|
var update = new RepositoryUpdate { Name = repoName, Private = true };
|
||||||
|
|
||||||
_repository = await github.Repository.Edit(Helper.UserName, repoName, update);
|
_repository = await github.Repository.Edit(Helper.UserName, repoName, update);
|
||||||
@@ -454,7 +446,7 @@ public class RepositoriesClientTests
|
|||||||
{
|
{
|
||||||
var github = Helper.GetAuthenticatedClient();
|
var github = Helper.GetAuthenticatedClient();
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
_repository = await github.Repository.Create(new NewRepository { Name = repoName, AutoInit = true });
|
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||||
var update = new RepositoryUpdate { Name = repoName, HasDownloads = false };
|
var update = new RepositoryUpdate { Name = repoName, HasDownloads = false };
|
||||||
|
|
||||||
_repository = await github.Repository.Edit(Helper.UserName, repoName, update);
|
_repository = await github.Repository.Edit(Helper.UserName, repoName, update);
|
||||||
@@ -467,7 +459,7 @@ public class RepositoriesClientTests
|
|||||||
{
|
{
|
||||||
var github = Helper.GetAuthenticatedClient();
|
var github = Helper.GetAuthenticatedClient();
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
_repository = await github.Repository.Create(new NewRepository { Name = repoName, AutoInit = true });
|
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||||
var update = new RepositoryUpdate { Name = repoName, HasIssues = false };
|
var update = new RepositoryUpdate { Name = repoName, HasIssues = false };
|
||||||
|
|
||||||
_repository = await github.Repository.Edit(Helper.UserName, repoName, update);
|
_repository = await github.Repository.Edit(Helper.UserName, repoName, update);
|
||||||
@@ -480,7 +472,7 @@ public class RepositoriesClientTests
|
|||||||
{
|
{
|
||||||
var github = Helper.GetAuthenticatedClient();
|
var github = Helper.GetAuthenticatedClient();
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
_repository = await github.Repository.Create(new NewRepository { Name = repoName, AutoInit = true });
|
_repository = await github.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||||
var update = new RepositoryUpdate { Name = repoName, HasWiki = false };
|
var update = new RepositoryUpdate { Name = repoName, HasWiki = false };
|
||||||
|
|
||||||
_repository = await github.Repository.Edit(Helper.UserName, repoName, update);
|
_repository = await github.Repository.Edit(Helper.UserName, repoName, update);
|
||||||
@@ -502,7 +494,7 @@ public class RepositoriesClientTests
|
|||||||
var github = Helper.GetAuthenticatedClient();
|
var github = Helper.GetAuthenticatedClient();
|
||||||
|
|
||||||
var repoName = Helper.MakeNameWithTimestamp("repo-to-delete");
|
var repoName = Helper.MakeNameWithTimestamp("repo-to-delete");
|
||||||
await github.Repository.Create(new NewRepository { Name = repoName });
|
await github.Repository.Create(new NewRepository(repoName));
|
||||||
|
|
||||||
await github.Repository.Delete(Helper.UserName, repoName);
|
await github.Repository.Delete(Helper.UserName, repoName);
|
||||||
}
|
}
|
||||||
@@ -575,33 +567,6 @@ public class RepositoriesClientTests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TheGetReadmeMethod
|
|
||||||
{
|
|
||||||
[IntegrationTest]
|
|
||||||
public async Task ReturnsReadmeForSeeGit()
|
|
||||||
{
|
|
||||||
var github = Helper.GetAuthenticatedClient();
|
|
||||||
|
|
||||||
var readme = await github.Repository.GetReadme("octokit", "octokit.net");
|
|
||||||
Assert.Equal("README.md", readme.Name);
|
|
||||||
string readMeHtml = await readme.GetHtmlContent();
|
|
||||||
Assert.True(readMeHtml.StartsWith("<div class="));
|
|
||||||
Assert.Contains(@"data-path=""README.md"" id=""file""", readMeHtml);
|
|
||||||
Assert.Contains("Octokit - GitHub API Client Library for .NET", readMeHtml);
|
|
||||||
}
|
|
||||||
|
|
||||||
[IntegrationTest]
|
|
||||||
public async Task ReturnsReadmeHtmlForSeeGit()
|
|
||||||
{
|
|
||||||
var github = Helper.GetAuthenticatedClient();
|
|
||||||
|
|
||||||
var readmeHtml = await github.Repository.GetReadmeHtml("octokit", "octokit.net");
|
|
||||||
Assert.True(readmeHtml.StartsWith("<div class="));
|
|
||||||
Assert.Contains(@"data-path=""README.md"" id=""readme""", readmeHtml);
|
|
||||||
Assert.Contains("Octokit - GitHub API Client Library for .NET", readmeHtml);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class TheGetAllContributorsMethod
|
public class TheGetAllContributorsMethod
|
||||||
{
|
{
|
||||||
[IntegrationTest]
|
[IntegrationTest]
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public class RepositoryCommitsClientTests
|
|||||||
|
|
||||||
var repoName = Helper.MakeNameWithTimestamp("source-repo");
|
var repoName = Helper.MakeNameWithTimestamp("source-repo");
|
||||||
|
|
||||||
_repository = _client.Repository.Create(new NewRepository { Name = repoName, AutoInit = true }).Result;
|
_repository = _client.Repository.Create(new NewRepository(repoName) { AutoInit = true }).Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
[IntegrationTest]
|
[IntegrationTest]
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ namespace Octokit.Tests.Integration.Clients
|
|||||||
{
|
{
|
||||||
var fixture = client.Repository.Content;
|
var fixture = client.Repository.Content;
|
||||||
var repoName = Helper.MakeNameWithTimestamp("source-repo");
|
var repoName = Helper.MakeNameWithTimestamp("source-repo");
|
||||||
repository = await client.Repository.Create(new NewRepository { Name = repoName, AutoInit = true });
|
repository = await client.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||||
|
|
||||||
var file = await fixture.CreateFile(
|
var file = await fixture.CreateFile(
|
||||||
repository.Owner.Login,
|
repository.Owner.Login,
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public class RepositoryDeployKeysClientTests : IDisposable
|
|||||||
|
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
_fixture = client.Repository.DeployKeys;
|
_fixture = client.Repository.DeployKeys;
|
||||||
_repository = client.Repository.Create(new NewRepository { Name = repoName, AutoInit = true }).Result;
|
_repository = client.Repository.Create(new NewRepository(repoName) { AutoInit = true }).Result;
|
||||||
_owner = _repository.Owner.Login;
|
_owner = _repository.Owner.Login;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ namespace Octokit.Tests.Integration.Clients
|
|||||||
async Task<RepositorySummary> CreateRepository()
|
async Task<RepositorySummary> CreateRepository()
|
||||||
{
|
{
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
var repository = await _client.Repository.Create(new NewRepository { Name = repoName, AutoInit = true });
|
var repository = await _client.Repository.Create(new NewRepository(repoName) { AutoInit = true });
|
||||||
return new RepositorySummary
|
return new RepositorySummary
|
||||||
{
|
{
|
||||||
Owner = repository.Owner.Login,
|
Owner = repository.Owner.Login,
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class TreeClientTests : IDisposable
|
|||||||
_fixture = _client.GitDatabase.Tree;
|
_fixture = _client.GitDatabase.Tree;
|
||||||
|
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
_repository = _client.Repository.Create(new NewRepository { Name = repoName, AutoInit = true }).Result;
|
_repository = _client.Repository.Create(new NewRepository(repoName) { AutoInit = true }).Result;
|
||||||
_owner = _repository.Owner.Login;
|
_owner = _repository.Owner.Login;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Security.Policy;
|
||||||
|
|
||||||
namespace Octokit.Tests.Integration
|
namespace Octokit.Tests.Integration
|
||||||
{
|
{
|
||||||
@@ -25,6 +26,17 @@ namespace Octokit.Tests.Integration
|
|||||||
return new Credentials(githubUsername, githubPassword);
|
return new Credentials(githubUsername, githubPassword);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
static readonly Lazy<Credentials> _oauthApplicationCredentials = new Lazy<Credentials>(() =>
|
||||||
|
{
|
||||||
|
var applicationClientId = ClientId;
|
||||||
|
var applicationClientSecret = ClientSecret;
|
||||||
|
|
||||||
|
if (applicationClientId == null || applicationClientSecret == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return new Credentials(applicationClientId, applicationClientSecret);
|
||||||
|
});
|
||||||
|
|
||||||
static Helper()
|
static Helper()
|
||||||
{
|
{
|
||||||
// Force reading of environment variables.
|
// Force reading of environment variables.
|
||||||
@@ -38,6 +50,8 @@ namespace Octokit.Tests.Integration
|
|||||||
|
|
||||||
public static Credentials Credentials { get { return _credentialsThunk.Value; }}
|
public static Credentials Credentials { get { return _credentialsThunk.Value; }}
|
||||||
|
|
||||||
|
public static Credentials ApplicationCredentials { get { return _oauthApplicationCredentials.Value; } }
|
||||||
|
|
||||||
public static bool IsPaidAccount
|
public static bool IsPaidAccount
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -97,6 +111,14 @@ namespace Octokit.Tests.Integration
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static GitHubClient GetAuthenticatedApplicationClient()
|
||||||
|
{
|
||||||
|
return new GitHubClient(new ProductHeaderValue("OctokitTests"))
|
||||||
|
{
|
||||||
|
Credentials = ApplicationCredentials
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public static IGitHubClient GetAnonymousClient()
|
public static IGitHubClient GetAnonymousClient()
|
||||||
{
|
{
|
||||||
return new GitHubClient(new ProductHeaderValue("OctokitTests"));
|
return new GitHubClient(new ProductHeaderValue("OctokitTests"));
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
using Xunit.Abstractions;
|
using Xunit.Abstractions;
|
||||||
using Xunit.Sdk;
|
using Xunit.Sdk;
|
||||||
@@ -8,16 +9,23 @@ namespace Octokit.Tests.Integration
|
|||||||
{
|
{
|
||||||
public class ApplicationTestDiscoverer : IXunitTestCaseDiscoverer
|
public class ApplicationTestDiscoverer : IXunitTestCaseDiscoverer
|
||||||
{
|
{
|
||||||
public IEnumerable<IXunitTestCase> Discover(ITestMethod testMethod, IAttributeInfo factAttribute)
|
readonly IMessageSink diagnosticMessageSink;
|
||||||
|
|
||||||
|
public ApplicationTestDiscoverer(IMessageSink diagnosticMessageSink)
|
||||||
|
{
|
||||||
|
this.diagnosticMessageSink = diagnosticMessageSink;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public IEnumerable<IXunitTestCase> Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
|
||||||
{
|
{
|
||||||
if (String.IsNullOrWhiteSpace(Helper.ClientId)
|
if (String.IsNullOrWhiteSpace(Helper.ClientId)
|
||||||
&& String.IsNullOrWhiteSpace(Helper.ClientSecret))
|
&& String.IsNullOrWhiteSpace(Helper.ClientSecret))
|
||||||
{
|
{
|
||||||
yield return new SkipTestCase(testMethod,
|
return Enumerable.Empty<IXunitTestCase>();
|
||||||
"Environment variables are not set for this test - set OCTOKIT_CLIENTID and OCTOKIT_CLIENTSECRET");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
yield return new XunitTestCase(testMethod);
|
return new[] { new XunitTestCase(diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,13 +33,4 @@ namespace Octokit.Tests.Integration
|
|||||||
public class ApplicationTestAttribute : FactAttribute
|
public class ApplicationTestAttribute : FactAttribute
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SkipTestCase : XunitTestCase
|
|
||||||
{
|
|
||||||
public SkipTestCase(ITestMethod testMethod, string skipReason)
|
|
||||||
: base(testMethod)
|
|
||||||
{
|
|
||||||
SkipReason = skipReason;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,11 +8,18 @@ namespace Octokit.Tests.Integration
|
|||||||
{
|
{
|
||||||
public class IntegrationTestDiscoverer : IXunitTestCaseDiscoverer
|
public class IntegrationTestDiscoverer : IXunitTestCaseDiscoverer
|
||||||
{
|
{
|
||||||
public IEnumerable<IXunitTestCase> Discover(ITestMethod testMethod, IAttributeInfo factAttribute)
|
readonly IMessageSink diagnosticMessageSink;
|
||||||
|
|
||||||
|
public IntegrationTestDiscoverer(IMessageSink diagnosticMessageSink)
|
||||||
|
{
|
||||||
|
this.diagnosticMessageSink = diagnosticMessageSink;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<IXunitTestCase> Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
|
||||||
{
|
{
|
||||||
return Helper.Credentials == null
|
return Helper.Credentials == null
|
||||||
? Enumerable.Empty<IXunitTestCase>()
|
? Enumerable.Empty<IXunitTestCase>()
|
||||||
: new [] { new XunitTestCase(testMethod) };
|
: new[] { new XunitTestCase(diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,16 +8,21 @@ namespace Octokit.Tests.Integration
|
|||||||
{
|
{
|
||||||
public class OrganizationTestDiscoverer : IXunitTestCaseDiscoverer
|
public class OrganizationTestDiscoverer : IXunitTestCaseDiscoverer
|
||||||
{
|
{
|
||||||
public IEnumerable<IXunitTestCase> Discover(ITestMethod testMethod, IAttributeInfo factAttribute)
|
readonly IMessageSink diagnosticMessageSink;
|
||||||
|
|
||||||
|
public OrganizationTestDiscoverer(IMessageSink diagnosticMessageSink)
|
||||||
|
{
|
||||||
|
this.diagnosticMessageSink = diagnosticMessageSink;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<IXunitTestCase> Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
|
||||||
{
|
{
|
||||||
if (Helper.Organization == null)
|
if (Helper.Organization == null)
|
||||||
{
|
{
|
||||||
return Enumerable.Empty<IXunitTestCase>();
|
return Enumerable.Empty<IXunitTestCase>();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return new[] { new XunitTestCase(diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod) };
|
||||||
return new [] { new XunitTestCase(testMethod) };
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,14 @@ namespace Octokit.Tests.Integration
|
|||||||
{
|
{
|
||||||
public class PaidAccountTestDiscoverer : IXunitTestCaseDiscoverer
|
public class PaidAccountTestDiscoverer : IXunitTestCaseDiscoverer
|
||||||
{
|
{
|
||||||
public IEnumerable<IXunitTestCase> Discover(ITestMethod testMethod, IAttributeInfo factAttribute)
|
readonly IMessageSink diagnosticMessageSink;
|
||||||
|
|
||||||
|
public PaidAccountTestDiscoverer(IMessageSink diagnosticMessageSink)
|
||||||
|
{
|
||||||
|
this.diagnosticMessageSink = diagnosticMessageSink;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<IXunitTestCase> Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute)
|
||||||
{
|
{
|
||||||
if (Helper.Credentials == null)
|
if (Helper.Credentials == null)
|
||||||
return Enumerable.Empty<IXunitTestCase>();
|
return Enumerable.Empty<IXunitTestCase>();
|
||||||
@@ -16,7 +23,7 @@ namespace Octokit.Tests.Integration
|
|||||||
if (!Helper.IsPaidAccount)
|
if (!Helper.IsPaidAccount)
|
||||||
return Enumerable.Empty<IXunitTestCase>();
|
return Enumerable.Empty<IXunitTestCase>();
|
||||||
|
|
||||||
return new[] { new XunitTestCase(testMethod) };
|
return new[] { new XunitTestCase(diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="..\packages\xunit.runner.visualstudio.0.99.9-build1021\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.0.99.9-build1021\build\net20\xunit.runner.visualstudio.props')" />
|
<Import Project="..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props')" />
|
||||||
<Import Project="..\packages\xunit.core.2.0.0-beta5-build2785\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid\xunit.core.props" Condition="Exists('..\packages\xunit.core.2.0.0-beta5-build2785\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid\xunit.core.props')" />
|
<Import Project="..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props" Condition="Exists('..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" />
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
<AssemblyName>Octokit.Tests.Integration</AssemblyName>
|
<AssemblyName>Octokit.Tests.Integration</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<NuGetPackageImportStamp>89e72d09</NuGetPackageImportStamp>
|
<NuGetPackageImportStamp>884d959c</NuGetPackageImportStamp>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
@@ -53,18 +53,20 @@
|
|||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="xunit.abstractions">
|
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\xunit.abstractions.2.0.0-beta5-build2785\lib\net35\xunit.abstractions.dll</HintPath>
|
<HintPath>..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="xunit.assert">
|
<Reference Include="xunit.assert, Version=2.0.0.2929, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\xunit.assert.2.0.0-beta5-build2785\lib\portable-net45+aspnetcore50+win+wpa81+wp80+monoandroid+monotouch10\xunit.assert.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="xunit.core">
|
|
||||||
<HintPath>..\packages\xunit.core.2.0.0-beta5-build2785\lib\portable-net45+aspnetcore50+win+wpa81+wp80+monotouch+monoandroid\xunit.core.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="xunit.execution, Version=2.0.0.2785, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\packages\xunit.core.2.0.0-beta5-build2785\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid\xunit.execution.dll</HintPath>
|
<HintPath>..\packages\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="xunit.core, Version=2.0.0.2929, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="xunit.execution.desktop, Version=2.0.0.2929, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||||
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\packages\xunit.extensibility.execution.2.0.0\lib\net45\xunit.execution.desktop.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -148,8 +150,8 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('..\packages\xunit.core.2.0.0-beta5-build2785\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.0.0-beta5-build2785\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid\xunit.core.props'))" />
|
<Error Condition="!Exists('..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props'))" />
|
||||||
<Error Condition="!Exists('..\packages\xunit.runner.visualstudio.0.99.9-build1021\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.0.99.9-build1021\build\net20\xunit.runner.visualstudio.props'))" />
|
<Error Condition="!Exists('..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props'))" />
|
||||||
</Target>
|
</Target>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class ObservableIssuesClientTests : IDisposable
|
|||||||
|
|
||||||
_client = new ObservableIssuesClient(github);
|
_client = new ObservableIssuesClient(github);
|
||||||
_repoName = Helper.MakeNameWithTimestamp("public-repo");
|
_repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
var result = github.Repository.Create(new NewRepository { Name = _repoName }).Result;
|
var result = github.Repository.Create(new NewRepository(_repoName)).Result;
|
||||||
_createdRepository = result;
|
_createdRepository = result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public class ObservableRespositoryDeployKeysClientTests : IDisposable
|
|||||||
|
|
||||||
_client = new ObservableRepositoryDeployKeysClient(github);
|
_client = new ObservableRepositoryDeployKeysClient(github);
|
||||||
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
var repoName = Helper.MakeNameWithTimestamp("public-repo");
|
||||||
var result = github.Repository.Create(new NewRepository() { Name = repoName, AutoInit = true }).Result;
|
var result = github.Repository.Create(new NewRepository(repoName) { AutoInit = true }).Result;
|
||||||
_repository = result;
|
_repository = result;
|
||||||
_owner = _repository.Owner.Login;
|
_owner = _repository.Owner.Login;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,10 @@
|
|||||||
<assemblyIdentity name="System.Reactive.Linq" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
<assemblyIdentity name="System.Reactive.Linq" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-2.1.30214.0" newVersion="2.1.30214.0" />
|
<bindingRedirect oldVersion="0.0.0.0-2.1.30214.0" newVersion="2.1.30214.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="xunit.core" publicKeyToken="8d05b1bb7a6fdb6c" culture="neutral" />
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-2.0.0.2880" newVersion="2.0.0.2880" />
|
||||||
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -3,9 +3,11 @@
|
|||||||
<package id="Rx-Core" version="2.2.5" targetFramework="net45" />
|
<package id="Rx-Core" version="2.2.5" targetFramework="net45" />
|
||||||
<package id="Rx-Interfaces" version="2.2.5" targetFramework="net45" />
|
<package id="Rx-Interfaces" version="2.2.5" targetFramework="net45" />
|
||||||
<package id="Rx-Linq" version="2.2.5" targetFramework="net45" />
|
<package id="Rx-Linq" version="2.2.5" targetFramework="net45" />
|
||||||
<package id="xunit" version="2.0.0-beta5-build2785" targetFramework="net45" />
|
<package id="xunit" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="xunit.abstractions" version="2.0.0-beta5-build2785" targetFramework="net45" />
|
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="xunit.assert" version="2.0.0-beta5-build2785" targetFramework="net45" />
|
<package id="xunit.assert" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="xunit.core" version="2.0.0-beta5-build2785" targetFramework="net45" />
|
<package id="xunit.core" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="xunit.runner.visualstudio" version="0.99.9-build1021" targetFramework="net45" />
|
<package id="xunit.extensibility.core" version="2.0.0" targetFramework="net45" />
|
||||||
|
<package id="xunit.extensibility.execution" version="2.0.0" targetFramework="net45" />
|
||||||
|
<package id="xunit.runner.visualstudio" version="2.0.0" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -243,5 +243,114 @@ namespace Octokit.Tests.Clients
|
|||||||
Args.String); // NOTE: preview API
|
Args.String); // NOTE: preview API
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class TheCheckApplicationAuthenticationMethod
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public async Task ChecksApplicationAuthenticateAtCorrectUrl()
|
||||||
|
{
|
||||||
|
var client = Substitute.For<IApiConnection>();
|
||||||
|
var authEndpoint = new AuthorizationsClient(client);
|
||||||
|
|
||||||
|
authEndpoint.CheckApplicationAuthentication("clientId", "accessToken");
|
||||||
|
|
||||||
|
client.Received().Get<ApplicationAuthorization>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "applications/clientId/tokens/accessToken"),
|
||||||
|
null,
|
||||||
|
Arg.Any<string>());
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task EnsuresArgumentsNotNull()
|
||||||
|
{
|
||||||
|
var client = Substitute.For<IApiConnection>();
|
||||||
|
var authEndpoint = new AuthorizationsClient(client);
|
||||||
|
|
||||||
|
await AssertEx.Throws<ArgumentNullException>(async () => await authEndpoint.CheckApplicationAuthentication(null, "accessToken"));
|
||||||
|
await AssertEx.Throws<ArgumentException>(async () => await authEndpoint.CheckApplicationAuthentication("", "accessToken"));
|
||||||
|
await AssertEx.Throws<ArgumentNullException>(async () => await authEndpoint.CheckApplicationAuthentication("clientId", null));
|
||||||
|
await AssertEx.Throws<ArgumentException>(async () => await authEndpoint.CheckApplicationAuthentication("clientId", ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TheResetApplicationAuthenticationMethod
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public async Task ResetsApplicationAuthenticationAtCorrectUrl()
|
||||||
|
{
|
||||||
|
var client = Substitute.For<IApiConnection>();
|
||||||
|
var authEndpoint = new AuthorizationsClient(client);
|
||||||
|
|
||||||
|
authEndpoint.ResetApplicationAuthentication("clientId", "accessToken");
|
||||||
|
|
||||||
|
client.Received().Post<ApplicationAuthorization>(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "applications/clientId/tokens/accessToken"),
|
||||||
|
Args.Object);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task EnsuresArgumentsNotNull()
|
||||||
|
{
|
||||||
|
var client = Substitute.For<IApiConnection>();
|
||||||
|
var authEndpoint = new AuthorizationsClient(client);
|
||||||
|
|
||||||
|
await AssertEx.Throws<ArgumentNullException>(async () => await authEndpoint.ResetApplicationAuthentication(null, "accessToken"));
|
||||||
|
await AssertEx.Throws<ArgumentException>(async () => await authEndpoint.ResetApplicationAuthentication("", "accessToken"));
|
||||||
|
await AssertEx.Throws<ArgumentNullException>(async () => await authEndpoint.ResetApplicationAuthentication("clientId", null));
|
||||||
|
await AssertEx.Throws<ArgumentException>(async () => await authEndpoint.ResetApplicationAuthentication("clientId", ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TheRevokeApplicationAuthenticationMethod
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public async Task RevokesApplicatonAuthenticationAtCorrectUrl()
|
||||||
|
{
|
||||||
|
var client = Substitute.For<IApiConnection>();
|
||||||
|
var authEndpoint = new AuthorizationsClient(client);
|
||||||
|
|
||||||
|
authEndpoint.RevokeApplicationAuthentication("clientId", "accessToken");
|
||||||
|
|
||||||
|
client.Received().Delete(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "applications/clientId/tokens/accessToken"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task EnsuresArgumentsNotNull()
|
||||||
|
{
|
||||||
|
var client = Substitute.For<IApiConnection>();
|
||||||
|
var authEndpoint = new AuthorizationsClient(client);
|
||||||
|
|
||||||
|
await AssertEx.Throws<ArgumentNullException>(async () => await authEndpoint.RevokeApplicationAuthentication(null, "accessToken"));
|
||||||
|
await AssertEx.Throws<ArgumentException>(async () => await authEndpoint.RevokeApplicationAuthentication("", "accessToken"));
|
||||||
|
await AssertEx.Throws<ArgumentNullException>(async () => await authEndpoint.RevokeApplicationAuthentication("clientId", null));
|
||||||
|
await AssertEx.Throws<ArgumentException>(async () => await authEndpoint.RevokeApplicationAuthentication("clientId", ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TheRevokeAllApplicationAuthenticationsMethod
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public async Task RevokesAllApplicationAuthenticationsAtCorrectUrl()
|
||||||
|
{
|
||||||
|
var client = Substitute.For<IApiConnection>();
|
||||||
|
var authEndpoint = new AuthorizationsClient(client);
|
||||||
|
|
||||||
|
authEndpoint.RevokeAllApplicationAuthentications("clientId");
|
||||||
|
|
||||||
|
client.Received().Delete(
|
||||||
|
Arg.Is<Uri>(u => u.ToString() == "applications/clientId/tokens"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task EnsuresArgumentsNotNull()
|
||||||
|
{
|
||||||
|
var client = Substitute.For<IApiConnection>();
|
||||||
|
var authEndpoint = new AuthorizationsClient(client);
|
||||||
|
|
||||||
|
await AssertEx.Throws<ArgumentNullException>(async () => await authEndpoint.RevokeAllApplicationAuthentications(null));
|
||||||
|
await AssertEx.Throws<ArgumentException>(async () => await authEndpoint.RevokeAllApplicationAuthentications(""));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ namespace Octokit.Tests.Clients
|
|||||||
var connection = Substitute.For<IApiConnection>();
|
var connection = Substitute.For<IApiConnection>();
|
||||||
var client = new FollowersClient(connection);
|
var client = new FollowersClient(connection);
|
||||||
|
|
||||||
client.GetFollowingForCurrent();
|
client.GetAllFollowingForCurrent();
|
||||||
|
|
||||||
connection.Received().GetAll<User>(Arg.Is<Uri>(u => u.ToString() == "user/following"));
|
connection.Received().GetAll<User>(Arg.Is<Uri>(u => u.ToString() == "user/following"));
|
||||||
}
|
}
|
||||||
@@ -88,7 +88,7 @@ namespace Octokit.Tests.Clients
|
|||||||
var connection = Substitute.For<IApiConnection>();
|
var connection = Substitute.For<IApiConnection>();
|
||||||
var client = new FollowersClient(connection);
|
var client = new FollowersClient(connection);
|
||||||
|
|
||||||
client.GetFollowing("alfhenrik");
|
client.GetAllFollowing("alfhenrik");
|
||||||
|
|
||||||
connection.Received().GetAll<User>(Arg.Is<Uri>(u => u.ToString() == "users/alfhenrik/following"));
|
connection.Received().GetAll<User>(Arg.Is<Uri>(u => u.ToString() == "users/alfhenrik/following"));
|
||||||
}
|
}
|
||||||
@@ -99,8 +99,8 @@ namespace Octokit.Tests.Clients
|
|||||||
var connection = Substitute.For<IApiConnection>();
|
var connection = Substitute.For<IApiConnection>();
|
||||||
var client = new FollowersClient(connection);
|
var client = new FollowersClient(connection);
|
||||||
|
|
||||||
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetFollowing(null));
|
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetAllFollowing(null));
|
||||||
await Assert.ThrowsAsync<ArgumentException>(() => client.GetFollowing(""));
|
await Assert.ThrowsAsync<ArgumentException>(() => client.GetAllFollowing(""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,13 +55,15 @@ namespace Octokit.Tests.Clients
|
|||||||
var connection = Substitute.For<IApiConnection>();
|
var connection = Substitute.For<IApiConnection>();
|
||||||
var client = new PullRequestsClient(connection);
|
var client = new PullRequestsClient(connection);
|
||||||
|
|
||||||
client.GetForRepository("fake", "repo", new PullRequestRequest { Head = "user:ref-head", Base = "fake_base_branch" });
|
client.GetForRepository("fake", "repo", new PullRequestRequest { Head = "user:ref-head", Base = "fake_base_branch"});
|
||||||
|
|
||||||
connection.Received().GetAll<PullRequest>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/pulls"),
|
connection.Received().GetAll<PullRequest>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/pulls"),
|
||||||
Arg.Is<Dictionary<string, string>>(d => d.Count == 3
|
Arg.Is<Dictionary<string, string>>(d => d.Count == 5
|
||||||
&& d["head"] == "user:ref-head"
|
&& d["head"] == "user:ref-head"
|
||||||
&& d["state"] == "open"
|
&& d["state"] == "open"
|
||||||
&& d["base"] == "fake_base_branch"));
|
&& d["base"] == "fake_base_branch"
|
||||||
|
&& d["sort"] == "created"
|
||||||
|
&& d["direction"] == "desc"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,6 +221,33 @@ namespace Octokit.Tests.Clients
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class TheFilesMethod
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public async Task RequestsCorrectUrl()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new PullRequestsClient(connection);
|
||||||
|
|
||||||
|
await client.Files("fake", "repo", 42);
|
||||||
|
|
||||||
|
connection.Received()
|
||||||
|
.GetAll<PullRequestFile>(Arg.Is<Uri>(u => u.ToString() == "repos/fake/repo/pulls/42/files"));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task EnsuresArgumentsNotNull()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new PullRequestsClient(connection);
|
||||||
|
|
||||||
|
await AssertEx.Throws<ArgumentNullException>(() => client.Files(null, "name", 1));
|
||||||
|
await AssertEx.Throws<ArgumentNullException>(() => client.Files("owner", null, 1));
|
||||||
|
await AssertEx.Throws<ArgumentException>(() => client.Files("", "name", 1));
|
||||||
|
await AssertEx.Throws<ArgumentException>(() => client.Files("owner", "", 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public class TheCtor
|
public class TheCtor
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ namespace Octokit.Tests.Clients
|
|||||||
var client = new RepositoriesClient(Substitute.For<IApiConnection>());
|
var client = new RepositoriesClient(Substitute.For<IApiConnection>());
|
||||||
|
|
||||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.Create(null));
|
await AssertEx.Throws<ArgumentNullException>(async () => await client.Create(null));
|
||||||
await AssertEx.Throws<ArgumentException>(async () => await client.Create(new NewRepository { Name = null }));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -40,7 +39,7 @@ namespace Octokit.Tests.Clients
|
|||||||
var connection = Substitute.For<IApiConnection>();
|
var connection = Substitute.For<IApiConnection>();
|
||||||
var client = new RepositoriesClient(connection);
|
var client = new RepositoriesClient(connection);
|
||||||
|
|
||||||
client.Create(new NewRepository { Name = "aName" });
|
client.Create(new NewRepository("aName"));
|
||||||
|
|
||||||
connection.Received().Post<Repository>(Arg.Is<Uri>(u => u.ToString() == "user/repos"), Arg.Any<NewRepository>());
|
connection.Received().Post<Repository>(Arg.Is<Uri>(u => u.ToString() == "user/repos"), Arg.Any<NewRepository>());
|
||||||
}
|
}
|
||||||
@@ -50,7 +49,7 @@ namespace Octokit.Tests.Clients
|
|||||||
{
|
{
|
||||||
var connection = Substitute.For<IApiConnection>();
|
var connection = Substitute.For<IApiConnection>();
|
||||||
var client = new RepositoriesClient(connection);
|
var client = new RepositoriesClient(connection);
|
||||||
var newRepository = new NewRepository { Name = "aName" };
|
var newRepository = new NewRepository("aName");
|
||||||
|
|
||||||
client.Create(newRepository);
|
client.Create(newRepository);
|
||||||
|
|
||||||
@@ -60,7 +59,7 @@ namespace Octokit.Tests.Clients
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task ThrowsRepositoryExistsExceptionWhenRepositoryExistsForCurrentUser()
|
public async Task ThrowsRepositoryExistsExceptionWhenRepositoryExistsForCurrentUser()
|
||||||
{
|
{
|
||||||
var newRepository = new NewRepository { Name = "aName" };
|
var newRepository = new NewRepository("aName");
|
||||||
var response = Substitute.For<IResponse>();
|
var response = Substitute.For<IResponse>();
|
||||||
response.StatusCode.Returns((HttpStatusCode)422);
|
response.StatusCode.Returns((HttpStatusCode)422);
|
||||||
response.Body.Returns(@"{""message"":""Validation Failed"",""documentation_url"":"
|
response.Body.Returns(@"{""message"":""Validation Failed"",""documentation_url"":"
|
||||||
@@ -86,7 +85,7 @@ namespace Octokit.Tests.Clients
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task ThrowsExceptionWhenPrivateRepositoryQuotaExceeded()
|
public async Task ThrowsExceptionWhenPrivateRepositoryQuotaExceeded()
|
||||||
{
|
{
|
||||||
var newRepository = new NewRepository { Name = "aName", Private = true };
|
var newRepository = new NewRepository("aName") { Private = true };
|
||||||
var response = Substitute.For<IResponse>();
|
var response = Substitute.For<IResponse>();
|
||||||
response.StatusCode.Returns((HttpStatusCode)422);
|
response.StatusCode.Returns((HttpStatusCode)422);
|
||||||
response.Body.Returns(@"{""message"":""Validation Failed"",""documentation_url"":"
|
response.Body.Returns(@"{""message"":""Validation Failed"",""documentation_url"":"
|
||||||
@@ -115,9 +114,8 @@ namespace Octokit.Tests.Clients
|
|||||||
{
|
{
|
||||||
var client = new RepositoriesClient(Substitute.For<IApiConnection>());
|
var client = new RepositoriesClient(Substitute.For<IApiConnection>());
|
||||||
|
|
||||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.Create(null, new NewRepository { Name = "aName" }));
|
await AssertEx.Throws<ArgumentNullException>(async () => await client.Create(null, new NewRepository("aName")));
|
||||||
await AssertEx.Throws<ArgumentException>(async () => await client.Create("aLogin", null));
|
await AssertEx.Throws<ArgumentException>(async () => await client.Create("aLogin", null));
|
||||||
await AssertEx.Throws<ArgumentException>(async () => await client.Create("aLogin", new NewRepository { Name = null }));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
@@ -126,7 +124,7 @@ namespace Octokit.Tests.Clients
|
|||||||
var connection = Substitute.For<IApiConnection>();
|
var connection = Substitute.For<IApiConnection>();
|
||||||
var client = new RepositoriesClient(connection);
|
var client = new RepositoriesClient(connection);
|
||||||
|
|
||||||
await client.Create("theLogin", new NewRepository { Name = "aName" });
|
await client.Create("theLogin", new NewRepository("aName"));
|
||||||
|
|
||||||
connection.Received().Post<Repository>(
|
connection.Received().Post<Repository>(
|
||||||
Arg.Is<Uri>(u => u.ToString() == "orgs/theLogin/repos"),
|
Arg.Is<Uri>(u => u.ToString() == "orgs/theLogin/repos"),
|
||||||
@@ -138,7 +136,7 @@ namespace Octokit.Tests.Clients
|
|||||||
{
|
{
|
||||||
var connection = Substitute.For<IApiConnection>();
|
var connection = Substitute.For<IApiConnection>();
|
||||||
var client = new RepositoriesClient(connection);
|
var client = new RepositoriesClient(connection);
|
||||||
var newRepository = new NewRepository { Name = "aName" };
|
var newRepository = new NewRepository("aName");
|
||||||
|
|
||||||
await client.Create("aLogin", newRepository);
|
await client.Create("aLogin", newRepository);
|
||||||
|
|
||||||
@@ -148,7 +146,7 @@ namespace Octokit.Tests.Clients
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task ThrowsRepositoryExistsExceptionWhenRepositoryExistsForSpecifiedOrg()
|
public async Task ThrowsRepositoryExistsExceptionWhenRepositoryExistsForSpecifiedOrg()
|
||||||
{
|
{
|
||||||
var newRepository = new NewRepository { Name = "aName" };
|
var newRepository = new NewRepository("aName");
|
||||||
var response = Substitute.For<IResponse>();
|
var response = Substitute.For<IResponse>();
|
||||||
response.StatusCode.Returns((HttpStatusCode)422);
|
response.StatusCode.Returns((HttpStatusCode)422);
|
||||||
response.Body.Returns(@"{""message"":""Validation Failed"",""documentation_url"":"
|
response.Body.Returns(@"{""message"":""Validation Failed"",""documentation_url"":"
|
||||||
@@ -174,7 +172,7 @@ namespace Octokit.Tests.Clients
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task ThrowsValidationException()
|
public async Task ThrowsValidationException()
|
||||||
{
|
{
|
||||||
var newRepository = new NewRepository { Name = "aName" };
|
var newRepository = new NewRepository("aName");
|
||||||
var response = Substitute.For<IResponse>();
|
var response = Substitute.For<IResponse>();
|
||||||
response.StatusCode.Returns((HttpStatusCode)422);
|
response.StatusCode.Returns((HttpStatusCode)422);
|
||||||
response.Body.Returns(@"{""message"":""Validation Failed"",""documentation_url"":"
|
response.Body.Returns(@"{""message"":""Validation Failed"",""documentation_url"":"
|
||||||
@@ -194,7 +192,7 @@ namespace Octokit.Tests.Clients
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task ThrowsRepositoryExistsExceptionForEnterpriseInstance()
|
public async Task ThrowsRepositoryExistsExceptionForEnterpriseInstance()
|
||||||
{
|
{
|
||||||
var newRepository = new NewRepository { Name = "aName" };
|
var newRepository = new NewRepository("aName");
|
||||||
var response = Substitute.For<IResponse>();
|
var response = Substitute.For<IResponse>();
|
||||||
response.StatusCode.Returns((HttpStatusCode)422);
|
response.StatusCode.Returns((HttpStatusCode)422);
|
||||||
response.Body.Returns(@"{""message"":""Validation Failed"",""documentation_url"":"
|
response.Body.Returns(@"{""message"":""Validation Failed"",""documentation_url"":"
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace Octokit.Tests.Clients
|
|||||||
|
|
||||||
statisticsClient.GetCommitActivity("username", "repositoryName");
|
statisticsClient.GetCommitActivity("username", "repositoryName");
|
||||||
|
|
||||||
client.Received().GetQueuedOperation<IEnumerable<WeeklyCommitActivity>>(expectedEndPoint, Args.CancellationToken);
|
client.Received().GetQueuedOperation<IReadOnlyList<WeeklyCommitActivity>>(expectedEndPoint, Args.CancellationToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@@ -55,5 +55,14 @@ namespace Octokit.Tests.Helpers
|
|||||||
// The collection == null case is for .NET 4.0
|
// The collection == null case is for .NET 4.0
|
||||||
Assert.True(instance is IReadOnlyList<T> && (collection == null || collection.IsReadOnly));
|
Assert.True(instance is IReadOnlyList<T> && (collection == null || collection.IsReadOnly));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void IsReadOnlyCollection(Type type)
|
||||||
|
{
|
||||||
|
var isReadOnlyList = type.IsGenericType && type.GetGenericTypeDefinition() == typeof(IReadOnlyList<>);
|
||||||
|
|
||||||
|
var isReadOnlyDictionary = type.IsGenericType && type.GetGenericTypeDefinition() == typeof(IReadOnlyDictionary<,>);
|
||||||
|
|
||||||
|
Assert.True(isReadOnlyList || isReadOnlyDictionary);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
94
Octokit.Tests/Models/IssueEventTests.cs
Normal file
94
Octokit.Tests/Models/IssueEventTests.cs
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using Octokit;
|
||||||
|
using Octokit.Internal;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
|
||||||
|
public class IssueEventTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void CanDeserializeAnUnsubscribedIssueEvent()
|
||||||
|
{
|
||||||
|
const string json = @"{
|
||||||
|
""id"": 42,
|
||||||
|
""url"": ""https://api.github.com/repos/octocat/Hello-World/issues/events/42"",
|
||||||
|
""actor"": {
|
||||||
|
""login"": ""octocat"",
|
||||||
|
""id"": 1060,
|
||||||
|
""avatar_url"": ""https://avatars.githubusercontent.com/u/1?v=3"",
|
||||||
|
""gravatar_id"": """",
|
||||||
|
""url"": ""https://api.github.com/users/octocat"",
|
||||||
|
""html_url"": ""https://github.com/octocat"",
|
||||||
|
""followers_url"": ""https://api.github.com/users/octocat/followers"",
|
||||||
|
""following_url"": ""https://api.github.com/users/octocat/following{/other_user}"",
|
||||||
|
""gists_url"": ""https://api.github.com/users/octocat/gists{/gist_id}"",
|
||||||
|
""starred_url"": ""https://api.github.com/users/octocat/starred{/owner}{/repo}"",
|
||||||
|
""subscriptions_url"": ""https://api.github.com/users/octocat/subscriptions"",
|
||||||
|
""organizations_url"": ""https://api.github.com/users/octocat/orgs"",
|
||||||
|
""repos_url"": ""https://api.github.com/users/octocat/repos"",
|
||||||
|
""events_url"": ""https://api.github.com/users/octocat/events{/privacy}"",
|
||||||
|
""received_events_url"": ""https://api.github.com/users/octocat/received_events"",
|
||||||
|
""type"": ""User"",
|
||||||
|
""site_admin"": false
|
||||||
|
},
|
||||||
|
""event"": ""unsubscribed"",
|
||||||
|
""commit_id"": null,
|
||||||
|
""created_at"": ""2014-07-16T15:41:42Z"",
|
||||||
|
""issue"": {
|
||||||
|
""url"": ""https://api.github.com/repos/octocat/Hello-World/issues/1205"",
|
||||||
|
""labels_url"": ""https://api.github.com/repos/octocat/Hello-World/issues/1205/labels{/name}"",
|
||||||
|
""comments_url"": ""https://api.github.com/repos/octocat/Hello-World/issues/1205/comments"",
|
||||||
|
""events_url"": ""https://api.github.com/repos/octocat/Hello-World/issues/1205/events"",
|
||||||
|
""html_url"": ""https://github.com/octocat/Hello-World/issues/1205"",
|
||||||
|
""id"": 37995243,
|
||||||
|
""number"": 1205,
|
||||||
|
""title"": ""settings icon should not be visible on sidebar if you are not a collaborator for public repos (and should not be accessible at /settings)"",
|
||||||
|
""user"": {
|
||||||
|
""login"": ""ashumz"",
|
||||||
|
""id"": 100216,
|
||||||
|
""avatar_url"": ""https://avatars.githubusercontent.com/u/6?v=3"",
|
||||||
|
""gravatar_id"": """",
|
||||||
|
""url"": ""https://api.github.com/users/octocat"",
|
||||||
|
""html_url"": ""https://github.com/octocat"",
|
||||||
|
""followers_url"": ""https://api.github.com/users/octocat/followers"",
|
||||||
|
""following_url"": ""https://api.github.com/users/octocat/following{/other_user}"",
|
||||||
|
""gists_url"": ""https://api.github.com/users/octocat/gists{/gist_id}"",
|
||||||
|
""starred_url"": ""https://api.github.com/users/octocat/starred{/owner}{/repo}"",
|
||||||
|
""subscriptions_url"": ""https://api.github.com/users/octocat/subscriptions"",
|
||||||
|
""organizations_url"": ""https://api.github.com/users/octocat/orgs"",
|
||||||
|
""repos_url"": ""https://api.github.com/users/octocat/repos"",
|
||||||
|
""events_url"": ""https://api.github.com/users/octocat/events{/privacy}"",
|
||||||
|
""received_events_url"": ""https://api.github.com/users/octocat/received_events"",
|
||||||
|
""type"": ""User"",
|
||||||
|
""site_admin"": false
|
||||||
|
},
|
||||||
|
""labels"": [
|
||||||
|
{
|
||||||
|
""url"": ""https://api.github.com/repos/octocat/Hello-World/labels/bug"",
|
||||||
|
""name"": ""bug"",
|
||||||
|
""color"": ""fc2929""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
""url"": ""https://api.github.com/repos/octocat/Hello-World/labels/waffle:ready"",
|
||||||
|
""name"": ""octocat:ready"",
|
||||||
|
""color"": ""00c5fe""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
""state"": ""closed"",
|
||||||
|
""locked"": false,
|
||||||
|
""assignee"": null,
|
||||||
|
""milestone"": null,
|
||||||
|
""comments"": 0,
|
||||||
|
""created_at"": ""2014-07-16T15:39:21Z"",
|
||||||
|
""updated_at"": ""2014-07-16T22:16:37Z"",
|
||||||
|
""closed_at"": ""2014-07-16T22:16:37Z"",
|
||||||
|
""body"": ""body content""
|
||||||
|
}
|
||||||
|
}";
|
||||||
|
var serializer = new SimpleJsonSerializer();
|
||||||
|
var issueEvent = serializer.Deserialize<IssueEvent>(json);
|
||||||
|
|
||||||
|
Assert.NotNull(issueEvent);
|
||||||
|
Assert.Equal(EventInfoState.Unsubscribed, issueEvent.Event);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="..\packages\xunit.runner.visualstudio.0.99.9-build1021\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.0.99.9-build1021\build\net20\xunit.runner.visualstudio.props')" />
|
<Import Project="..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props')" />
|
||||||
<Import Project="..\packages\xunit.core.2.0.0-beta5-build2785\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid\xunit.core.props" Condition="Exists('..\packages\xunit.core.2.0.0-beta5-build2785\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid\xunit.core.props')" />
|
<Import Project="..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props" Condition="Exists('..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" />
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
<AssemblyName>Octokit.Tests-NetCore45</AssemblyName>
|
<AssemblyName>Octokit.Tests-NetCore45</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<NuGetPackageImportStamp>42c4ff23</NuGetPackageImportStamp>
|
<NuGetPackageImportStamp>f3747da2</NuGetPackageImportStamp>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
@@ -45,14 +45,16 @@
|
|||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
<Reference Include="System.XML" />
|
<Reference Include="System.XML" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="xunit.abstractions">
|
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\xunit.abstractions.2.0.0-beta5-build2785\lib\net35\xunit.abstractions.dll</HintPath>
|
<HintPath>..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="xunit.assert">
|
<Reference Include="xunit.assert, Version=2.0.0.2929, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\xunit.assert.2.0.0-beta5-build2785\lib\portable-net45+aspnetcore50+win+wpa81+wp80+monoandroid+monotouch10\xunit.assert.dll</HintPath>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\packages\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="xunit.core">
|
<Reference Include="xunit.core, Version=2.0.0.2929, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\xunit.core.2.0.0-beta5-build2785\lib\portable-net45+aspnetcore50+win+wpa81+wp80+monotouch+monoandroid\xunit.core.dll</HintPath>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -128,6 +130,7 @@
|
|||||||
<Compile Include="Models\DeploymentStatusTests.cs" />
|
<Compile Include="Models\DeploymentStatusTests.cs" />
|
||||||
<Compile Include="Models\DeploymentTests.cs" />
|
<Compile Include="Models\DeploymentTests.cs" />
|
||||||
<Compile Include="Models\GistTests.cs" />
|
<Compile Include="Models\GistTests.cs" />
|
||||||
|
<Compile Include="Models\IssueEventTests.cs" />
|
||||||
<Compile Include="Models\IssueRequestTests.cs" />
|
<Compile Include="Models\IssueRequestTests.cs" />
|
||||||
<Compile Include="Models\IssueTest.cs" />
|
<Compile Include="Models\IssueTest.cs" />
|
||||||
<Compile Include="Models\MilestoneRequestTests.cs" />
|
<Compile Include="Models\MilestoneRequestTests.cs" />
|
||||||
@@ -178,8 +181,8 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('..\packages\xunit.core.2.0.0-beta5-build2785\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.0.0-beta5-build2785\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid\xunit.core.props'))" />
|
<Error Condition="!Exists('..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props'))" />
|
||||||
<Error Condition="!Exists('..\packages\xunit.runner.visualstudio.0.99.9-build1021\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.0.99.9-build1021\build\net20\xunit.runner.visualstudio.props'))" />
|
<Error Condition="!Exists('..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props'))" />
|
||||||
</Target>
|
</Target>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="..\packages\xunit.runner.visualstudio.0.99.9-build1021\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.0.99.9-build1021\build\net20\xunit.runner.visualstudio.props')" />
|
<Import Project="..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props')" />
|
||||||
<Import Project="..\packages\xunit.core.2.0.0-beta5-build2785\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid\xunit.core.props" Condition="Exists('..\packages\xunit.core.2.0.0-beta5-build2785\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid\xunit.core.props')" />
|
<Import Project="..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props" Condition="Exists('..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" />
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
<AssemblyName>Octokit.Tests-Portable</AssemblyName>
|
<AssemblyName>Octokit.Tests-Portable</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<NuGetPackageImportStamp>6b300e8a</NuGetPackageImportStamp>
|
<NuGetPackageImportStamp>2ac0e5a7</NuGetPackageImportStamp>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
@@ -45,14 +45,16 @@
|
|||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
<Reference Include="System.XML" />
|
<Reference Include="System.XML" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="xunit.abstractions">
|
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\xunit.abstractions.2.0.0-beta5-build2785\lib\net35\xunit.abstractions.dll</HintPath>
|
<HintPath>..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="xunit.assert">
|
<Reference Include="xunit.assert, Version=2.0.0.2929, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\xunit.assert.2.0.0-beta5-build2785\lib\portable-net45+aspnetcore50+win+wpa81+wp80+monoandroid+monotouch10\xunit.assert.dll</HintPath>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\packages\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="xunit.core">
|
<Reference Include="xunit.core, Version=2.0.0.2929, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\xunit.core.2.0.0-beta5-build2785\lib\portable-net45+aspnetcore50+win+wpa81+wp80+monotouch+monoandroid\xunit.core.dll</HintPath>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -126,6 +128,7 @@
|
|||||||
<Compile Include="Models\DeploymentStatusTests.cs" />
|
<Compile Include="Models\DeploymentStatusTests.cs" />
|
||||||
<Compile Include="Models\DeploymentTests.cs" />
|
<Compile Include="Models\DeploymentTests.cs" />
|
||||||
<Compile Include="Models\GistTests.cs" />
|
<Compile Include="Models\GistTests.cs" />
|
||||||
|
<Compile Include="Models\IssueEventTests.cs" />
|
||||||
<Compile Include="Models\IssueRequestTests.cs" />
|
<Compile Include="Models\IssueRequestTests.cs" />
|
||||||
<Compile Include="Models\IssueTest.cs" />
|
<Compile Include="Models\IssueTest.cs" />
|
||||||
<Compile Include="Models\MilestoneRequestTests.cs" />
|
<Compile Include="Models\MilestoneRequestTests.cs" />
|
||||||
@@ -176,8 +179,8 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('..\packages\xunit.core.2.0.0-beta5-build2785\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.0.0-beta5-build2785\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid\xunit.core.props'))" />
|
<Error Condition="!Exists('..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props'))" />
|
||||||
<Error Condition="!Exists('..\packages\xunit.runner.visualstudio.0.99.9-build1021\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.0.99.9-build1021\build\net20\xunit.runner.visualstudio.props'))" />
|
<Error Condition="!Exists('..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props'))" />
|
||||||
</Target>
|
</Target>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="..\packages\xunit.runner.visualstudio.0.99.9-build1021\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.0.99.9-build1021\build\net20\xunit.runner.visualstudio.props')" />
|
<Import Project="..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props')" />
|
||||||
<Import Project="..\packages\xunit.core.2.0.0-beta5-build2785\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid\xunit.core.props" Condition="Exists('..\packages\xunit.core.2.0.0-beta5-build2785\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid\xunit.core.props')" />
|
<Import Project="..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props" Condition="Exists('..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" />
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
<AssemblyName>Octokit.Tests</AssemblyName>
|
<AssemblyName>Octokit.Tests</AssemblyName>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<NuGetPackageImportStamp>f1b9719f</NuGetPackageImportStamp>
|
<NuGetPackageImportStamp>525bf01a</NuGetPackageImportStamp>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
@@ -57,14 +57,16 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.XML" />
|
<Reference Include="System.XML" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
<Reference Include="xunit.abstractions">
|
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\xunit.abstractions.2.0.0-beta5-build2785\lib\net35\xunit.abstractions.dll</HintPath>
|
<HintPath>..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="xunit.assert">
|
<Reference Include="xunit.assert, Version=2.0.0.2929, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\xunit.assert.2.0.0-beta5-build2785\lib\portable-net45+aspnetcore50+win+wpa81+wp80+monoandroid+monotouch10\xunit.assert.dll</HintPath>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\packages\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="xunit.core">
|
<Reference Include="xunit.core, Version=2.0.0.2929, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\xunit.core.2.0.0-beta5-build2785\lib\portable-net45+aspnetcore50+win+wpa81+wp80+monotouch+monoandroid\xunit.core.dll</HintPath>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -144,6 +146,7 @@
|
|||||||
<Compile Include="Models\DeploymentStatusTests.cs" />
|
<Compile Include="Models\DeploymentStatusTests.cs" />
|
||||||
<Compile Include="Models\DeploymentTests.cs" />
|
<Compile Include="Models\DeploymentTests.cs" />
|
||||||
<Compile Include="Models\GistTests.cs" />
|
<Compile Include="Models\GistTests.cs" />
|
||||||
|
<Compile Include="Models\IssueEventTests.cs" />
|
||||||
<Compile Include="Models\IssueTest.cs" />
|
<Compile Include="Models\IssueTest.cs" />
|
||||||
<Compile Include="Models\NewReferenceTests.cs" />
|
<Compile Include="Models\NewReferenceTests.cs" />
|
||||||
<Compile Include="Models\MilestoneRequestTests.cs" />
|
<Compile Include="Models\MilestoneRequestTests.cs" />
|
||||||
@@ -218,8 +221,8 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('..\packages\xunit.core.2.0.0-beta5-build2785\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.0.0-beta5-build2785\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid\xunit.core.props'))" />
|
<Error Condition="!Exists('..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.0.0\build\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.props'))" />
|
||||||
<Error Condition="!Exists('..\packages\xunit.runner.visualstudio.0.99.9-build1021\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.0.99.9-build1021\build\net20\xunit.runner.visualstudio.props'))" />
|
<Error Condition="!Exists('..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.2.0.0\build\net20\xunit.runner.visualstudio.props'))" />
|
||||||
</Target>
|
</Target>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace Octokit.Tests.Reactive
|
|||||||
var githubClient = Substitute.For<IGitHubClient>();
|
var githubClient = Substitute.For<IGitHubClient>();
|
||||||
var client = new ObservableFollowersClient(githubClient);
|
var client = new ObservableFollowersClient(githubClient);
|
||||||
|
|
||||||
client.GetFollowingForCurrent();
|
client.GetAllFollowingForCurrent();
|
||||||
|
|
||||||
githubClient.Connection.Received(1).Get<List<User>>(
|
githubClient.Connection.Received(1).Get<List<User>>(
|
||||||
new Uri("user/following", UriKind.Relative), null, null);
|
new Uri("user/following", UriKind.Relative), null, null);
|
||||||
@@ -75,7 +75,7 @@ namespace Octokit.Tests.Reactive
|
|||||||
var githubClient = Substitute.For<IGitHubClient>();
|
var githubClient = Substitute.For<IGitHubClient>();
|
||||||
var client = new ObservableFollowersClient(githubClient);
|
var client = new ObservableFollowersClient(githubClient);
|
||||||
|
|
||||||
client.GetFollowing("alfhenrik");
|
client.GetAllFollowing("alfhenrik");
|
||||||
|
|
||||||
githubClient.Connection.Received(1).Get<List<User>>(
|
githubClient.Connection.Received(1).Get<List<User>>(
|
||||||
new Uri("users/alfhenrik/following", UriKind.Relative), null, null);
|
new Uri("users/alfhenrik/following", UriKind.Relative), null, null);
|
||||||
@@ -86,8 +86,8 @@ namespace Octokit.Tests.Reactive
|
|||||||
{
|
{
|
||||||
var client = new ObservableFollowersClient(Substitute.For<IGitHubClient>());
|
var client = new ObservableFollowersClient(Substitute.For<IGitHubClient>());
|
||||||
|
|
||||||
await AssertEx.Throws<ArgumentNullException>(async () => await client.GetFollowing(null));
|
await AssertEx.Throws<ArgumentNullException>(async () => await client.GetAllFollowing(null));
|
||||||
await AssertEx.Throws<ArgumentException>(async () => await client.GetFollowing(""));
|
await AssertEx.Throws<ArgumentException>(async () => await client.GetAllFollowing(""));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Reactive.Linq;
|
using System.Reactive.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using NSubstitute;
|
using NSubstitute;
|
||||||
@@ -130,10 +131,12 @@ namespace Octokit.Tests.Reactive
|
|||||||
);
|
);
|
||||||
var gitHubClient = Substitute.For<IGitHubClient>();
|
var gitHubClient = Substitute.For<IGitHubClient>();
|
||||||
gitHubClient.Connection.Get<List<PullRequest>>(Arg.Is(firstPageUrl),
|
gitHubClient.Connection.Get<List<PullRequest>>(Arg.Is(firstPageUrl),
|
||||||
Arg.Is<Dictionary<string, string>>(d => d.Count == 3
|
Arg.Is<Dictionary<string, string>>(d => d.Count == 5
|
||||||
&& d["head"] == "user:ref-name"
|
&& d["head"] == "user:ref-name"
|
||||||
&& d["state"] == "open"
|
&& d["state"] == "open"
|
||||||
&& d["base"] == "fake_base_branch"), Arg.Any<string>())
|
&& d["base"] == "fake_base_branch"
|
||||||
|
&& d["sort"] == "created"
|
||||||
|
&& d["direction"] == "desc"), Arg.Any<string>())
|
||||||
.Returns(Task.Factory.StartNew<IApiResponse<List<PullRequest>>>(() => firstPageResponse));
|
.Returns(Task.Factory.StartNew<IApiResponse<List<PullRequest>>>(() => firstPageResponse));
|
||||||
gitHubClient.Connection.Get<List<PullRequest>>(secondPageUrl, null, null)
|
gitHubClient.Connection.Get<List<PullRequest>>(secondPageUrl, null, null)
|
||||||
.Returns(Task.Factory.StartNew<IApiResponse<List<PullRequest>>>(() => secondPageResponse));
|
.Returns(Task.Factory.StartNew<IApiResponse<List<PullRequest>>>(() => secondPageResponse));
|
||||||
@@ -276,7 +279,7 @@ namespace Octokit.Tests.Reactive
|
|||||||
[Fact]
|
[Fact]
|
||||||
public async Task FetchesAllCommitsForPullRequest()
|
public async Task FetchesAllCommitsForPullRequest()
|
||||||
{
|
{
|
||||||
var commit = new PullRequestCommit(null, null, null, null, null, null, null, null);
|
var commit = new PullRequestCommit(null, null, null, null, null, Enumerable.Empty<GitReference>(), null, null);
|
||||||
var expectedUrl = string.Format("repos/fake/repo/pulls/42/commits");
|
var expectedUrl = string.Format("repos/fake/repo/pulls/42/commits");
|
||||||
var gitHubClient = Substitute.For<IGitHubClient>();
|
var gitHubClient = Substitute.For<IGitHubClient>();
|
||||||
var connection = Substitute.For<IConnection>();
|
var connection = Substitute.For<IConnection>();
|
||||||
@@ -310,6 +313,44 @@ namespace Octokit.Tests.Reactive
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class TheFilesMethod
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public async Task FetchesAllFilesForPullRequest()
|
||||||
|
{
|
||||||
|
var file = new PullRequestFile(null, null, null, 0, 0, 0, null, null, null, null);
|
||||||
|
var expectedUrl = string.Format("repos/fake/repo/pulls/42/files");
|
||||||
|
var gitHubClient = Substitute.For<IGitHubClient>();
|
||||||
|
var connection = Substitute.For<IConnection>();
|
||||||
|
IApiResponse<List<PullRequestFile>> response = new ApiResponse<List<PullRequestFile>>
|
||||||
|
(
|
||||||
|
new Response(),
|
||||||
|
new List<PullRequestFile> { file }
|
||||||
|
);
|
||||||
|
connection.Get<List<PullRequestFile>>(Args.Uri, null, null)
|
||||||
|
.Returns(Task.FromResult(response));
|
||||||
|
gitHubClient.Connection.Returns(connection);
|
||||||
|
var client = new ObservablePullRequestsClient(gitHubClient);
|
||||||
|
|
||||||
|
var files = await client.Files("fake", "repo", 42).ToList();
|
||||||
|
|
||||||
|
Assert.Equal(1, files.Count);
|
||||||
|
Assert.Same(file, files[0]);
|
||||||
|
connection.Received().Get<List<PullRequestFile>>(new Uri(expectedUrl, UriKind.Relative), null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task EnsuresArgumentsNotNull()
|
||||||
|
{
|
||||||
|
var connection = Substitute.For<IApiConnection>();
|
||||||
|
var client = new PullRequestsClient(connection);
|
||||||
|
|
||||||
|
await AssertEx.Throws<ArgumentNullException>(async () => await client.Files(null, "name", 1));
|
||||||
|
await AssertEx.Throws<ArgumentNullException>(async () => await client.Files("owner", null, 1));
|
||||||
|
await AssertEx.Throws<ArgumentException>(async () => await client.Files("", "name", 1));
|
||||||
|
await AssertEx.Throws<ArgumentException>(async () => await client.Files("owner", "", 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
public class TheCtor
|
public class TheCtor
|
||||||
{
|
{
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|||||||
@@ -4,9 +4,10 @@
|
|||||||
<package id="Rx-Core" version="2.2.5" targetFramework="net45" />
|
<package id="Rx-Core" version="2.2.5" targetFramework="net45" />
|
||||||
<package id="Rx-Interfaces" version="2.2.5" targetFramework="net45" />
|
<package id="Rx-Interfaces" version="2.2.5" targetFramework="net45" />
|
||||||
<package id="Rx-Linq" version="2.2.5" targetFramework="net45" />
|
<package id="Rx-Linq" version="2.2.5" targetFramework="net45" />
|
||||||
<package id="xunit" version="2.0.0-beta5-build2785" targetFramework="net45" />
|
<package id="xunit" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="xunit.abstractions" version="2.0.0-beta5-build2785" targetFramework="net45" />
|
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="xunit.assert" version="2.0.0-beta5-build2785" targetFramework="net45" />
|
<package id="xunit.assert" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="xunit.core" version="2.0.0-beta5-build2785" targetFramework="net45" />
|
<package id="xunit.core" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="xunit.runner.visualstudio" version="0.99.9-build1021" targetFramework="net45" />
|
<package id="xunit.extensibility.core" version="2.0.0" targetFramework="net45" />
|
||||||
|
<package id="xunit.runner.visualstudio" version="2.0.0" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -4,9 +4,10 @@
|
|||||||
<package id="Rx-Core" version="2.2.5" targetFramework="net45" />
|
<package id="Rx-Core" version="2.2.5" targetFramework="net45" />
|
||||||
<package id="Rx-Interfaces" version="2.2.5" targetFramework="net45" />
|
<package id="Rx-Interfaces" version="2.2.5" targetFramework="net45" />
|
||||||
<package id="Rx-Linq" version="2.2.5" targetFramework="net45" />
|
<package id="Rx-Linq" version="2.2.5" targetFramework="net45" />
|
||||||
<package id="xunit" version="2.0.0-beta5-build2785" targetFramework="net45" />
|
<package id="xunit" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="xunit.abstractions" version="2.0.0-beta5-build2785" targetFramework="net45" />
|
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="xunit.assert" version="2.0.0-beta5-build2785" targetFramework="net45" />
|
<package id="xunit.assert" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="xunit.core" version="2.0.0-beta5-build2785" targetFramework="net45" />
|
<package id="xunit.core" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="xunit.runner.visualstudio" version="0.99.9-build1021" targetFramework="net45" />
|
<package id="xunit.extensibility.core" version="2.0.0" targetFramework="net45" />
|
||||||
|
<package id="xunit.runner.visualstudio" version="2.0.0" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -4,9 +4,10 @@
|
|||||||
<package id="Rx-Core" version="2.2.5" targetFramework="net45" />
|
<package id="Rx-Core" version="2.2.5" targetFramework="net45" />
|
||||||
<package id="Rx-Interfaces" version="2.2.5" targetFramework="net45" />
|
<package id="Rx-Interfaces" version="2.2.5" targetFramework="net45" />
|
||||||
<package id="Rx-Linq" version="2.2.5" targetFramework="net45" />
|
<package id="Rx-Linq" version="2.2.5" targetFramework="net45" />
|
||||||
<package id="xunit" version="2.0.0-beta5-build2785" targetFramework="net45" />
|
<package id="xunit" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="xunit.abstractions" version="2.0.0-beta5-build2785" targetFramework="net45" />
|
<package id="xunit.abstractions" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="xunit.assert" version="2.0.0-beta5-build2785" targetFramework="net45" />
|
<package id="xunit.assert" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="xunit.core" version="2.0.0-beta5-build2785" targetFramework="net45" />
|
<package id="xunit.core" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="xunit.runner.visualstudio" version="0.99.9-build1021" targetFramework="net45" />
|
<package id="xunit.extensibility.core" version="2.0.0" targetFramework="net45" />
|
||||||
|
<package id="xunit.runner.visualstudio" version="2.0.0" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Octokit.Tests.Integration",
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{CEC9D451-6291-4EDF-971A-D398144FBF96}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{CEC9D451-6291-4EDF-971A-D398144FBF96}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
|
.gitattributes = .gitattributes
|
||||||
|
.gitignore = .gitignore
|
||||||
appveyor.yml = appveyor.yml
|
appveyor.yml = appveyor.yml
|
||||||
build.cmd = build.cmd
|
build.cmd = build.cmd
|
||||||
build.fsx = build.fsx
|
build.fsx = build.fsx
|
||||||
@@ -46,6 +48,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Octokit-Portable", "Octokit
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Octokit.Tests-Portable", "Octokit.Tests\Octokit.Tests-Portable.csproj", "{CBE29DDD-F15C-46CC-A250-E6ECF55BEED4}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Octokit.Tests-Portable", "Octokit.Tests\Octokit.Tests-Portable.csproj", "{CBE29DDD-F15C-46CC-A250-E6ECF55BEED4}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{DB068FD2-F54C-48EB-A6FD-1AC9EA3F8F57}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
|||||||
@@ -176,6 +176,85 @@ namespace Octokit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks the validity of an OAuth token without running afoul of normal rate limits for failed login attempts.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method requires authentication.
|
||||||
|
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#check-an-authorization">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="clientId">Client ID of the OAuth application for the token</param>
|
||||||
|
/// <param name="accessToken">The OAuth token to check</param>
|
||||||
|
/// <returns>The valid <see cref="ApplicationAuthorization"/>.</returns>
|
||||||
|
public async Task<ApplicationAuthorization> CheckApplicationAuthentication(string clientId, string accessToken)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(clientId, "clientId");
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(accessToken, "accessToken");
|
||||||
|
|
||||||
|
var endpoint = ApiUrls.ApplicationAuthorization(clientId, accessToken);
|
||||||
|
return await ApiConnection.Get<ApplicationAuthorization>(
|
||||||
|
endpoint,
|
||||||
|
null,
|
||||||
|
previewAcceptsHeader);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets a valid OAuth token for an OAuth application without end user involvment.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method requires authentication.
|
||||||
|
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#reset-an-authorization">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="clientId">ClientID of the OAuth application for the token</param>
|
||||||
|
/// <param name="accessToken">The OAuth token to reset</param>
|
||||||
|
/// <returns>The valid <see cref="ApplicationAuthorization"/> with a new OAuth token</returns>
|
||||||
|
public async Task<ApplicationAuthorization> ResetApplicationAuthentication(string clientId, string accessToken)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(clientId, "clientId");
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(accessToken, "accessToken");
|
||||||
|
|
||||||
|
var requestData = new { };
|
||||||
|
|
||||||
|
return await ApiConnection.Post<ApplicationAuthorization>(
|
||||||
|
ApiUrls.ApplicationAuthorization(clientId, accessToken), requestData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Revokes a single OAuth token for an OAuth application.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method requires authentication.
|
||||||
|
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#revoke-an-authorization-for-an-application">API documentation for more information.</a>
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="clientId">ClientID of the OAuth application for the token</param>
|
||||||
|
/// <param name="accessToken">The OAuth token to revoke</param>
|
||||||
|
/// <returns>A <see cref="Task"/> for the request's execution.</returns>
|
||||||
|
public Task RevokeApplicationAuthentication(string clientId, string accessToken)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(clientId, "clientId");
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(accessToken, "accessToken");
|
||||||
|
|
||||||
|
return ApiConnection.Delete(
|
||||||
|
ApiUrls.ApplicationAuthorization(clientId, accessToken));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Revokes every OAuth token for an OAuth application.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method requires authentication.
|
||||||
|
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#revoke-all-authorizations-for-an-application">API documentation for more information.</a>
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="clientId">ClientID of the OAuth application for the token</param>
|
||||||
|
/// <returns>A <see cref="Task"/> for the request's execution.</returns>
|
||||||
|
public Task RevokeAllApplicationAuthentications(string clientId)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(clientId, "clientId");
|
||||||
|
|
||||||
|
return ApiConnection.Delete(
|
||||||
|
ApiUrls.ApplicationAuthorization(clientId));
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the specified <see cref="Authorization"/>.
|
/// Updates the specified <see cref="Authorization"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace Octokit
|
|||||||
/// See the <a href="http://developer.github.com/v3/users/followers/#list-users-followed-by-another-user">API documentation</a> for more information.
|
/// See the <a href="http://developer.github.com/v3/users/followers/#list-users-followed-by-another-user">API documentation</a> for more information.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <returns>A <see cref="IReadOnlyList{User}"/> of <see cref="User"/>s that the authenticated user follows.</returns>
|
/// <returns>A <see cref="IReadOnlyList{User}"/> of <see cref="User"/>s that the authenticated user follows.</returns>
|
||||||
public Task<IReadOnlyList<User>> GetFollowingForCurrent()
|
public Task<IReadOnlyList<User>> GetAllFollowingForCurrent()
|
||||||
{
|
{
|
||||||
return ApiConnection.GetAll<User>(ApiUrls.Following());
|
return ApiConnection.GetAll<User>(ApiUrls.Following());
|
||||||
}
|
}
|
||||||
@@ -67,7 +67,7 @@ namespace Octokit
|
|||||||
/// See the <a href="http://developer.github.com/v3/users/followers/#list-users-followed-by-another-user">API documentation</a> for more information.
|
/// See the <a href="http://developer.github.com/v3/users/followers/#list-users-followed-by-another-user">API documentation</a> for more information.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <returns>A <see cref="IReadOnlyList{User}"/> of <see cref="User"/>s that the passed user follows.</returns>
|
/// <returns>A <see cref="IReadOnlyList{User}"/> of <see cref="User"/>s that the passed user follows.</returns>
|
||||||
public Task<IReadOnlyList<User>> GetFollowing(string login)
|
public Task<IReadOnlyList<User>> GetAllFollowing(string login)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNullOrEmptyString(login, "login");
|
Ensure.ArgumentNotNullOrEmptyString(login, "login");
|
||||||
|
|
||||||
|
|||||||
@@ -99,6 +99,53 @@ namespace Octokit
|
|||||||
NewAuthorization newAuthorization,
|
NewAuthorization newAuthorization,
|
||||||
string twoFactorAuthenticationCode);
|
string twoFactorAuthenticationCode);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks the validity of an OAuth token without running afoul of normal rate limits for failed login attempts.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method requires authentication.
|
||||||
|
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#check-an-authorization">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="clientId">Client ID of the OAuth application for the token</param>
|
||||||
|
/// <param name="accessToken">The OAuth token to check</param>
|
||||||
|
/// <returns>The valid <see cref="ApplicationAuthorization"/>.</returns>
|
||||||
|
Task<ApplicationAuthorization> CheckApplicationAuthentication(string clientId, string accessToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets a valid OAuth token for an OAuth application without end user involvment.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method requires authentication.
|
||||||
|
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#reset-an-authorization">API documentation</a> for more information.
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="clientId">ClientID of the OAuth application for the token</param>
|
||||||
|
/// <param name="accessToken">The OAuth token to reset</param>
|
||||||
|
/// <returns>The valid <see cref="ApplicationAuthorization"/> with a new OAuth token</returns>
|
||||||
|
Task<ApplicationAuthorization> ResetApplicationAuthentication(string clientId, string accessToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Revokes a single OAuth token for an OAuth application.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method requires authentication.
|
||||||
|
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#revoke-an-authorization-for-an-application">API documentation for more information.</a>
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="clientId">ClientID of the OAuth application for the token</param>
|
||||||
|
/// <param name="accessToken">The OAuth token to revoke</param>
|
||||||
|
/// <returns>A <see cref="Task"/> for the request's execution.</returns>
|
||||||
|
Task RevokeApplicationAuthentication(string clientId, string accessToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Revokes every OAuth token for an OAuth application.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// This method requires authentication.
|
||||||
|
/// See the <a href="https://developer.github.com/v3/oauth_authorizations/#revoke-all-authorizations-for-an-application">API documentation for more information.</a>
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="clientId">ClientID of the OAuth application for the token</param>
|
||||||
|
/// <returns>A <see cref="Task"/> for the request's execution.</returns>
|
||||||
|
Task RevokeAllApplicationAuthentications(string clientId);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the specified <see cref="Authorization"/>.
|
/// Updates the specified <see cref="Authorization"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace Octokit
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <returns>A <see cref="IReadOnlyList{User}"/> of <see cref="User"/>s that the authenticated user follows.</returns>
|
/// <returns>A <see cref="IReadOnlyList{User}"/> of <see cref="User"/>s that the authenticated user follows.</returns>
|
||||||
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
|
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
|
||||||
Task<IReadOnlyList<User>> GetFollowingForCurrent();
|
Task<IReadOnlyList<User>> GetAllFollowingForCurrent();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List who a user is following
|
/// List who a user is following
|
||||||
@@ -50,7 +50,7 @@ namespace Octokit
|
|||||||
/// See the <a href="http://developer.github.com/v3/users/followers/#list-users-followed-by-another-user">API documentation</a> for more information.
|
/// See the <a href="http://developer.github.com/v3/users/followers/#list-users-followed-by-another-user">API documentation</a> for more information.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// <returns>A <see cref="IReadOnlyList{User}"/> of <see cref="User"/>s that the passed user follows.</returns>
|
/// <returns>A <see cref="IReadOnlyList{User}"/> of <see cref="User"/>s that the passed user follows.</returns>
|
||||||
Task<IReadOnlyList<User>> GetFollowing(string login);
|
Task<IReadOnlyList<User>> GetAllFollowing(string login);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check if the authenticated user follows another user
|
/// Check if the authenticated user follows another user
|
||||||
|
|||||||
@@ -29,5 +29,35 @@ namespace Octokit
|
|||||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
||||||
/// <returns>The rendered Markdown.</returns>
|
/// <returns>The rendered Markdown.</returns>
|
||||||
Task<string> RenderRawMarkdown(string markdown);
|
Task<string> RenderRawMarkdown(string markdown);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List all templates available to pass as an option when creating a repository.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A list of template names</returns>
|
||||||
|
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
|
||||||
|
Task<IReadOnlyList<string>> GetGitIgnoreTemplates();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the source for a single GitIgnore template
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="templateName"></param>
|
||||||
|
/// <returns>A template and its source</returns>
|
||||||
|
Task<GitIgnoreTemplate> GetGitIgnoreTemplate(string templateName);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a list of the licenses shown in the license picker on GitHub.com. This is not a comprehensive
|
||||||
|
/// list of all possible OSS licenses.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This is a PREVIEW API! Use it at your own risk.</remarks>
|
||||||
|
/// <returns>A list of licenses available on the site</returns>
|
||||||
|
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
|
||||||
|
Task<IReadOnlyList<LicenseMetadata>> GetLicenses();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a license based on the licence key such as "mit"
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <returns>A <see cref="License" /> that includes the license key, text, and attributes of the license.</returns>
|
||||||
|
Task<License> GetLicense(string key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,5 +97,15 @@ namespace Octokit
|
|||||||
/// <param name="number">The pull request number</param>
|
/// <param name="number">The pull request number</param>
|
||||||
/// <returns>A <see cref="IReadOnlyList{PullRequestCommit}"/> of <see cref="Commit"/>s which are part of this pull request</returns>
|
/// <returns>A <see cref="IReadOnlyList{PullRequestCommit}"/> of <see cref="Commit"/>s which are part of this pull request</returns>
|
||||||
Task<IReadOnlyList<PullRequestCommit>> Commits(string owner, string name, int number);
|
Task<IReadOnlyList<PullRequestCommit>> Commits(string owner, string name, int number);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the list of files on a pull request.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>https://developer.github.com/v3/pulls/#list-pull-requests-files</remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="name">The name of the repository</param>
|
||||||
|
/// <param name="number">The pull request number</param>
|
||||||
|
/// <returns>A <see cref="IReadOnlyList{PullRequestFile}"/> which are part of this pull request</returns>
|
||||||
|
Task<IReadOnlyList<PullRequestFile>> Files(string owner, string name, int number);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,32 +164,6 @@ namespace Octokit
|
|||||||
Justification = "Makes a network request")]
|
Justification = "Makes a network request")]
|
||||||
Task<IReadOnlyList<Repository>> GetAllForOrg(string organization);
|
Task<IReadOnlyList<Repository>> GetAllForOrg(string organization);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the preferred README for the specified repository.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// See the <a href="http://developer.github.com/v3/repos/contents/#get-the-readme">API documentation</a> for more information.
|
|
||||||
/// </remarks>
|
|
||||||
/// <param name="owner">The owner of the repository</param>
|
|
||||||
/// <param name="name">The name of the repository</param>
|
|
||||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
|
||||||
/// <returns></returns>
|
|
||||||
[Obsolete("This method has been obsoleted by Content.GetReadme. Please use that instead.")]
|
|
||||||
Task<Readme> GetReadme(string owner, string name);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the perferred README's HTML for the specified repository.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// See the <a href="http://developer.github.com/v3/repos/contents/#get-the-readme">API documentation</a> for more information.
|
|
||||||
/// </remarks>
|
|
||||||
/// <param name="owner">The owner of the repository</param>
|
|
||||||
/// <param name="name">The name of the repository</param>
|
|
||||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
|
||||||
/// <returns></returns>
|
|
||||||
[Obsolete("This method has been obsoleted by Content.GetReadmeHtml. Please use that instead.")]
|
|
||||||
Task<string> GetReadmeHtml(string owner, string name);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A client for GitHub's Commit Status API.
|
/// A client for GitHub's Commit Status API.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
#if NET_45
|
#if NET_45
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
#endif
|
#endif
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Octokit
|
namespace Octokit
|
||||||
{
|
{
|
||||||
@@ -19,7 +19,7 @@ namespace Octokit
|
|||||||
readonly IConnection _connection;
|
readonly IConnection _connection;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new GitHub miscellaneous API client.
|
/// Initializes a new GitHub miscellaneous API client.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="connection">An API connection</param>
|
/// <param name="connection">An API connection</param>
|
||||||
public MiscellaneousClient(IConnection connection)
|
public MiscellaneousClient(IConnection connection)
|
||||||
@@ -38,7 +38,7 @@ namespace Octokit
|
|||||||
{
|
{
|
||||||
var endpoint = new Uri("emojis", UriKind.Relative);
|
var endpoint = new Uri("emojis", UriKind.Relative);
|
||||||
var response = await _connection.Get<Dictionary<string, string>>(endpoint, null, null)
|
var response = await _connection.Get<Dictionary<string, string>>(endpoint, null, null)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
return new ReadOnlyCollection<Emoji>(
|
return new ReadOnlyCollection<Emoji>(
|
||||||
response.Body.Select(kvp => new Emoji(kvp.Key, new Uri(kvp.Value))).ToArray());
|
response.Body.Select(kvp => new Emoji(kvp.Key, new Uri(kvp.Value))).ToArray());
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,67 @@ namespace Octokit
|
|||||||
{
|
{
|
||||||
var endpoint = new Uri("markdown/raw", UriKind.Relative);
|
var endpoint = new Uri("markdown/raw", UriKind.Relative);
|
||||||
var response = await _connection.Post<string>(endpoint, markdown, "text/html", "text/plain")
|
var response = await _connection.Post<string>(endpoint, markdown, "text/html", "text/plain")
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
return response.Body;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List all templates available to pass as an option when creating a repository.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A list of template names</returns>
|
||||||
|
public async Task<IReadOnlyList<string>> GetGitIgnoreTemplates()
|
||||||
|
{
|
||||||
|
var endpoint = new Uri("gitignore/templates", UriKind.Relative);
|
||||||
|
|
||||||
|
var response = await _connection.Get<string[]>(endpoint, null, null)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
return new ReadOnlyCollection<string>(response.Body);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the source for a single GitIgnore template
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="templateName"></param>
|
||||||
|
/// <returns>A template and its source</returns>
|
||||||
|
public async Task<GitIgnoreTemplate> GetGitIgnoreTemplate(string templateName)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(templateName, "templateName");
|
||||||
|
|
||||||
|
var endpoint = new Uri("gitignore/templates/" + Uri.EscapeUriString(templateName), UriKind.Relative);
|
||||||
|
|
||||||
|
var response = await _connection.Get<GitIgnoreTemplate>(endpoint, null, null)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
return response.Body;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a list of the licenses shown in the license picker on GitHub.com. This is not a comprehensive
|
||||||
|
/// list of all possible OSS licenses.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>This is a PREVIEW API! Use it at your own risk.</remarks>
|
||||||
|
/// <returns>A list of licenses available on the site</returns>
|
||||||
|
public async Task<IReadOnlyList<LicenseMetadata>> GetLicenses()
|
||||||
|
{
|
||||||
|
const string previewAcceptsHeader = "application/vnd.github.drax-preview+json";
|
||||||
|
var endpoint = new Uri("licenses", UriKind.Relative);
|
||||||
|
|
||||||
|
var response = await _connection.Get<LicenseMetadata[]>(endpoint, null, previewAcceptsHeader)
|
||||||
|
.ConfigureAwait(false);
|
||||||
|
return new ReadOnlyCollection<LicenseMetadata>(response.Body);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a license based on the licence key such as "mit"
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <returns>A <see cref="License" /> that includes the license key, text, and attributes of the license.</returns>
|
||||||
|
public async Task<License> GetLicense(string key)
|
||||||
|
{
|
||||||
|
const string previewAcceptsHeader = "application/vnd.github.drax-preview+json";
|
||||||
|
var endpoint = new Uri("licenses/" + Uri.EscapeUriString(key), UriKind.Relative);
|
||||||
|
|
||||||
|
var response = await _connection.Get<License>(endpoint, null, previewAcceptsHeader)
|
||||||
|
.ConfigureAwait(false);
|
||||||
return response.Body;
|
return response.Body;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,5 +159,21 @@ namespace Octokit
|
|||||||
|
|
||||||
return ApiConnection.GetAll<PullRequestCommit>(ApiUrls.PullRequestCommits(owner, name, number));
|
return ApiConnection.GetAll<PullRequestCommit>(ApiUrls.PullRequestCommits(owner, name, number));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the list of files on a pull request.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>https://developer.github.com/v3/pulls/#list-pull-requests-files</remarks>
|
||||||
|
/// <param name="owner">The owner of the repository</param>
|
||||||
|
/// <param name="name">The name of the repository</param>
|
||||||
|
/// <param name="number">The pull request number</param>
|
||||||
|
/// <returns>A <see cref="IReadOnlyList{PullRequestFile}"/> which are part of this pull request</returns>
|
||||||
|
public Task<IReadOnlyList<PullRequestFile>> Files(string owner, string name, int number)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||||
|
|
||||||
|
return ApiConnection.GetAll<PullRequestFile>(ApiUrls.PullRequestFiles(owner, name, number));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,8 +48,6 @@ namespace Octokit
|
|||||||
public Task<Repository> Create(NewRepository newRepository)
|
public Task<Repository> Create(NewRepository newRepository)
|
||||||
{
|
{
|
||||||
Ensure.ArgumentNotNull(newRepository, "newRepository");
|
Ensure.ArgumentNotNull(newRepository, "newRepository");
|
||||||
if (string.IsNullOrEmpty(newRepository.Name))
|
|
||||||
throw new ArgumentException("The new repository's name must not be null.");
|
|
||||||
|
|
||||||
return Create(ApiUrls.Repositories(), null, newRepository);
|
return Create(ApiUrls.Repositories(), null, newRepository);
|
||||||
}
|
}
|
||||||
@@ -256,38 +254,6 @@ namespace Octokit
|
|||||||
return ApiConnection.GetAll<Repository>(ApiUrls.OrganizationRepositories(organization));
|
return ApiConnection.GetAll<Repository>(ApiUrls.OrganizationRepositories(organization));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the preferred README for the specified repository.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// See the <a href="http://developer.github.com/v3/repos/contents/#get-the-readme">API documentation</a> for more information.
|
|
||||||
/// </remarks>
|
|
||||||
/// <param name="owner">The owner of the repository</param>
|
|
||||||
/// <param name="name">The name of the repository</param>
|
|
||||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
|
||||||
/// <returns></returns>
|
|
||||||
[Obsolete("This method has been obsoleted by Content.GetReadme. Please use that instead.")]
|
|
||||||
public Task<Readme> GetReadme(string owner, string name)
|
|
||||||
{
|
|
||||||
return Content.GetReadme(owner, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the perferred README's HTML for the specified repository.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// See the <a href="http://developer.github.com/v3/repos/contents/#get-the-readme">API documentation</a> for more information.
|
|
||||||
/// </remarks>
|
|
||||||
/// <param name="owner">The owner of the repository</param>
|
|
||||||
/// <param name="name">The name of the repository</param>
|
|
||||||
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
|
|
||||||
/// <returns></returns>
|
|
||||||
[Obsolete("This method has been obsoleted by Content.GetReadmeHtml. Please use that instead.")]
|
|
||||||
public Task<string> GetReadmeHtml(string owner, string name)
|
|
||||||
{
|
|
||||||
return Content.GetReadmeHtml(owner, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A client for GitHub's Commit Status API.
|
/// A client for GitHub's Commit Status API.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ namespace Octokit
|
|||||||
Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName");
|
Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName");
|
||||||
|
|
||||||
var endpoint = "/repos/{0}/{1}/stats/commit_activity".FormatUri(owner, repositoryName);
|
var endpoint = "/repos/{0}/{1}/stats/commit_activity".FormatUri(owner, repositoryName);
|
||||||
var activity = await ApiConnection.GetQueuedOperation<IEnumerable<WeeklyCommitActivity>>(endpoint,cancellationToken);
|
var activity = await ApiConnection.GetQueuedOperation<IReadOnlyList<WeeklyCommitActivity>>(endpoint,cancellationToken);
|
||||||
return new CommitActivity(activity);
|
return new CommitActivity(activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,5 +48,15 @@ namespace Octokit
|
|||||||
{
|
{
|
||||||
return "authorizations/clients/{0}/{1}".FormatUri(clientId, fingerprint);
|
return "authorizations/clients/{0}/{1}".FormatUri(clientId, fingerprint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Uri ApplicationAuthorization(string clientId)
|
||||||
|
{
|
||||||
|
return "applications/{0}/tokens".FormatUri(clientId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Uri ApplicationAuthorization(string clientId, string accessToken)
|
||||||
|
{
|
||||||
|
return "applications/{0}/tokens/{1}".FormatUri(clientId, accessToken);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -857,6 +857,11 @@ namespace Octokit
|
|||||||
return "repos/{0}/{1}/pulls/{2}/commits".FormatUri(owner, name, number);
|
return "repos/{0}/{1}/pulls/{2}/commits".FormatUri(owner, name, number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Uri PullRequestFiles(string owner, string name, int number)
|
||||||
|
{
|
||||||
|
return "repos/{0}/{1}/pulls/{2}/files".FormatUri(owner, name, number);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the <see cref="Uri"/> for a spesific comment for the specified commit.
|
/// Returns the <see cref="Uri"/> for a spesific comment for the specified commit.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -11,6 +11,17 @@ namespace Octokit
|
|||||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||||
public class NewRepository
|
public class NewRepository
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Creates an object that describes the repository to create on GitHub.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="name">The name of the repository. This is the only required parameter.</param>
|
||||||
|
public NewRepository(string name)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||||
|
|
||||||
|
Name = name;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Optional. Gets or sets whether to create an initial commit with empty README. The default is false.
|
/// Optional. Gets or sets whether to create an initial commit with empty README. The default is false.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -47,10 +58,20 @@ namespace Octokit
|
|||||||
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gitignore", Justification = "It needs to be this way for proper serialization.")]
|
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gitignore", Justification = "It needs to be this way for proper serialization.")]
|
||||||
public string GitignoreTemplate { get; set; }
|
public string GitignoreTemplate { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Optional. Gets or sets the desired Desired LICENSE template to apply. Use the name of the template without
|
||||||
|
/// the extension. For example, “mit” or “mozilla”.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// The list of license templates are here: https://github.com/github/choosealicense.com/tree/gh-pages/_licenses
|
||||||
|
/// Just omit the ".txt" file extension for the template name.
|
||||||
|
/// </remarks>
|
||||||
|
public string LicenseTemplate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required. Gets or sets the new repository's name.
|
/// Required. Gets or sets the new repository's name.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Name { get; set; }
|
public string Name { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Optional. Gets or sets whether the new repository is private; the default is false.
|
/// Optional. Gets or sets whether the new repository is private; the default is false.
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using Octokit.Internal;
|
||||||
|
|
||||||
namespace Octokit
|
namespace Octokit
|
||||||
{
|
{
|
||||||
@@ -10,6 +11,8 @@ namespace Octokit
|
|||||||
public PullRequestRequest()
|
public PullRequestRequest()
|
||||||
{
|
{
|
||||||
State = ItemState.Open;
|
State = ItemState.Open;
|
||||||
|
SortProperty = PullRequestSort.Created;
|
||||||
|
SortDirection = SortDirection.Descending;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -27,6 +30,18 @@ namespace Octokit
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string Base { get; set; }
|
public string Base { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// What property to sort pull requests by.
|
||||||
|
/// </summary>
|
||||||
|
[Parameter(Key="sort")]
|
||||||
|
public PullRequestSort SortProperty { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// What direction to sort the pull requests.
|
||||||
|
/// </summary>
|
||||||
|
[Parameter(Key="direction")]
|
||||||
|
public SortDirection SortDirection { get; set; }
|
||||||
|
|
||||||
internal string DebuggerDisplay
|
internal string DebuggerDisplay
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -35,4 +50,25 @@ namespace Octokit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum PullRequestSort
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Sort by created date (default)
|
||||||
|
/// </summary>
|
||||||
|
Created,
|
||||||
|
/// <summary>
|
||||||
|
/// Sort by last updated date
|
||||||
|
/// </summary>
|
||||||
|
Updated,
|
||||||
|
/// <summary>
|
||||||
|
/// Sort by popularity (comment count)
|
||||||
|
/// </summary>
|
||||||
|
Popularity,
|
||||||
|
/// <summary>
|
||||||
|
/// Sort by age (filtering by pulls updated in the last month)
|
||||||
|
/// </summary>
|
||||||
|
[Parameter(Value= "long-running")]
|
||||||
|
LongRunning
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -16,7 +17,9 @@ namespace Octokit
|
|||||||
|
|
||||||
public CodeFrequency(IEnumerable<AdditionsAndDeletions> additionsAndDeletionsByWeek)
|
public CodeFrequency(IEnumerable<AdditionsAndDeletions> additionsAndDeletionsByWeek)
|
||||||
{
|
{
|
||||||
AdditionsAndDeletionsByWeek = additionsAndDeletionsByWeek;
|
Ensure.ArgumentNotNull(additionsAndDeletionsByWeek, "additionsAndDeletionsByWeek");
|
||||||
|
|
||||||
|
AdditionsAndDeletionsByWeek = new ReadOnlyCollection<AdditionsAndDeletions>(additionsAndDeletionsByWeek.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -32,7 +35,7 @@ namespace Octokit
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A weekly aggregate of the number of additions and deletions pushed to a repository.
|
/// A weekly aggregate of the number of additions and deletions pushed to a repository.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEnumerable<AdditionsAndDeletions> AdditionsAndDeletionsByWeek { get; private set; }
|
public IReadOnlyList<AdditionsAndDeletions> AdditionsAndDeletionsByWeek { get; private set; }
|
||||||
|
|
||||||
internal string DebuggerDisplay
|
internal string DebuggerDisplay
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Octokit
|
namespace Octokit
|
||||||
{
|
{
|
||||||
@@ -11,11 +13,13 @@ namespace Octokit
|
|||||||
public Commit(string url, string label, string @ref, string sha, User user, Repository repository, string message, SignatureResponse author, SignatureResponse committer, GitReference tree, IEnumerable<GitReference> parents, int commentCount)
|
public Commit(string url, string label, string @ref, string sha, User user, Repository repository, string message, SignatureResponse author, SignatureResponse committer, GitReference tree, IEnumerable<GitReference> parents, int commentCount)
|
||||||
: base(url, label, @ref, sha, user, repository)
|
: base(url, label, @ref, sha, user, repository)
|
||||||
{
|
{
|
||||||
|
Ensure.ArgumentNotNull(parents, "parents");
|
||||||
|
|
||||||
Message = message;
|
Message = message;
|
||||||
Author = author;
|
Author = author;
|
||||||
Committer = committer;
|
Committer = committer;
|
||||||
Tree = tree;
|
Tree = tree;
|
||||||
Parents = parents;
|
Parents = new ReadOnlyCollection<GitReference>(parents.ToList());
|
||||||
CommentCount = commentCount;
|
CommentCount = commentCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,7 +31,7 @@ namespace Octokit
|
|||||||
|
|
||||||
public GitReference Tree { get; protected set; }
|
public GitReference Tree { get; protected set; }
|
||||||
|
|
||||||
public IEnumerable<GitReference> Parents { get; protected set; }
|
public IReadOnlyList<GitReference> Parents { get; protected set; }
|
||||||
|
|
||||||
public int CommentCount { get; protected set; }
|
public int CommentCount { get; protected set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -13,13 +14,15 @@ namespace Octokit
|
|||||||
|
|
||||||
public CommitActivity(IEnumerable<WeeklyCommitActivity> activity)
|
public CommitActivity(IEnumerable<WeeklyCommitActivity> activity)
|
||||||
{
|
{
|
||||||
Activity = activity;
|
Ensure.ArgumentNotNull(activity, "activity");
|
||||||
|
|
||||||
|
Activity = new ReadOnlyCollection<WeeklyCommitActivity>(activity.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the last year of commit activity grouped by week.
|
/// Returns the last year of commit activity grouped by week.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEnumerable<WeeklyCommitActivity> Activity { get; private set; }
|
public IReadOnlyList<WeeklyCommitActivity> Activity { get; private set; }
|
||||||
|
|
||||||
internal string DebuggerDisplay
|
internal string DebuggerDisplay
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -162,5 +162,10 @@ namespace Octokit
|
|||||||
/// The pull request’s branch was restored.
|
/// The pull request’s branch was restored.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
HeadRefRestored,
|
HeadRefRestored,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The actor unsubscribed from notifications for an issue.
|
||||||
|
/// </summary>
|
||||||
|
Unsubscribed,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
35
Octokit/Models/Response/GitIgnoreTemplate.cs
Normal file
35
Octokit/Models/Response/GitIgnoreTemplate.cs
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace Octokit
|
||||||
|
{
|
||||||
|
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||||
|
public class GitIgnoreTemplate
|
||||||
|
{
|
||||||
|
public GitIgnoreTemplate(string name, string source)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(source, "source");
|
||||||
|
|
||||||
|
Name = name;
|
||||||
|
Source = source;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GitIgnoreTemplate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name { get; protected set; }
|
||||||
|
public string Source { get; protected set; }
|
||||||
|
|
||||||
|
internal string DebuggerDisplay
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return String.Format(CultureInfo.InvariantCulture, "GitIgnore: {0}", Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
104
Octokit/Models/Response/License.cs
Normal file
104
Octokit/Models/Response/License.cs
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Octokit
|
||||||
|
{
|
||||||
|
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||||
|
public class License : LicenseMetadata
|
||||||
|
{
|
||||||
|
public License(
|
||||||
|
string key,
|
||||||
|
string name,
|
||||||
|
Uri url,
|
||||||
|
Uri htmlUrl,
|
||||||
|
bool featured,
|
||||||
|
string description,
|
||||||
|
string category,
|
||||||
|
string implementation,
|
||||||
|
string body,
|
||||||
|
IEnumerable<string> required,
|
||||||
|
IEnumerable<string> permitted,
|
||||||
|
IEnumerable<string> forbidden) : base(key, name, url)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNull(htmlUrl, "htmlUrl");
|
||||||
|
Ensure.ArgumentNotNull(description, "description");
|
||||||
|
Ensure.ArgumentNotNull(category, "category");
|
||||||
|
Ensure.ArgumentNotNull(implementation, "implementation");
|
||||||
|
Ensure.ArgumentNotNull(body, "body");
|
||||||
|
Ensure.ArgumentNotNull(required, "required");
|
||||||
|
Ensure.ArgumentNotNull(permitted, "permitted");
|
||||||
|
Ensure.ArgumentNotNull(forbidden, "forbidden");
|
||||||
|
|
||||||
|
HtmlUrl = htmlUrl;
|
||||||
|
Featured = featured;
|
||||||
|
Description = description;
|
||||||
|
Category = category;
|
||||||
|
Implementation = implementation;
|
||||||
|
Body = body;
|
||||||
|
Required = new ReadOnlyCollection<string>(required.ToList());
|
||||||
|
Permitted = new ReadOnlyCollection<string>(permitted.ToList());
|
||||||
|
Forbidden = new ReadOnlyCollection<string>(forbidden.ToList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public License()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Url to the license on https://choosealicense.com
|
||||||
|
/// </summary>
|
||||||
|
public Uri HtmlUrl { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the license is one of the licenses featured on https://choosealicense.com
|
||||||
|
/// </summary>
|
||||||
|
public bool Featured { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A description of the license.
|
||||||
|
/// </summary>
|
||||||
|
public string Description { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A group or family that the license belongs to such as the GPL family of licenses.
|
||||||
|
/// </summary>
|
||||||
|
public string Category { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Notes on how to properly apply the license.
|
||||||
|
/// </summary>
|
||||||
|
public string Implementation { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set of codes for what is required under the terms of the license. For example, "include-copyright"
|
||||||
|
/// </summary>
|
||||||
|
public IReadOnlyList<string> Required { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set of codes for what is permitted under the terms of the license. For example, "commerical-use"
|
||||||
|
/// </summary>
|
||||||
|
public IReadOnlyList<string> Permitted { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set of codes for what is forbidden under the terms of the license. For example, "no-liability"
|
||||||
|
/// </summary>
|
||||||
|
public IReadOnlyList<string> Forbidden { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The text of the license
|
||||||
|
/// </summary>
|
||||||
|
public string Body { get; protected set; }
|
||||||
|
|
||||||
|
internal override string DebuggerDisplay
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return String.Format(CultureInfo.InvariantCulture, "{0} Category: {1}", base.DebuggerDisplay, Category);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
48
Octokit/Models/Response/LicenseMetadata.cs
Normal file
48
Octokit/Models/Response/LicenseMetadata.cs
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace Octokit
|
||||||
|
{
|
||||||
|
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||||
|
public class LicenseMetadata
|
||||||
|
{
|
||||||
|
public LicenseMetadata(string key, string name, Uri url)
|
||||||
|
{
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(key, "key");
|
||||||
|
Ensure.ArgumentNotNullOrEmptyString(name, "name");
|
||||||
|
Ensure.ArgumentNotNull(url, "url");
|
||||||
|
|
||||||
|
Key = key;
|
||||||
|
Name = name;
|
||||||
|
Url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LicenseMetadata()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The
|
||||||
|
/// </summary>
|
||||||
|
public string Key { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Friendly name of the license.
|
||||||
|
/// </summary>
|
||||||
|
public string Name { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// URL to retrieve details about a license.
|
||||||
|
/// </summary>
|
||||||
|
public Uri Url { get; protected set; }
|
||||||
|
|
||||||
|
internal virtual string DebuggerDisplay
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return String.Format(CultureInfo.InvariantCulture, "Key: {0} Name: {1}", Key, Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Octokit
|
namespace Octokit
|
||||||
{
|
{
|
||||||
@@ -10,10 +12,12 @@ namespace Octokit
|
|||||||
|
|
||||||
public Merge(Author author, Author committer, Commit commit, IEnumerable<GitReference> parents, string commentsUrl, int commentCount, string htmlUrl)
|
public Merge(Author author, Author committer, Commit commit, IEnumerable<GitReference> parents, string commentsUrl, int commentCount, string htmlUrl)
|
||||||
{
|
{
|
||||||
|
Ensure.ArgumentNotNull(parents, "parents");
|
||||||
|
|
||||||
Author = author;
|
Author = author;
|
||||||
Committer = committer;
|
Committer = committer;
|
||||||
Commit = commit;
|
Commit = commit;
|
||||||
Parents = parents;
|
Parents = new ReadOnlyCollection<GitReference>(parents.ToList());
|
||||||
CommentsUrl = commentsUrl;
|
CommentsUrl = commentsUrl;
|
||||||
CommentCount = commentCount;
|
CommentCount = commentCount;
|
||||||
HtmlUrl = htmlUrl;
|
HtmlUrl = htmlUrl;
|
||||||
@@ -22,7 +26,7 @@ namespace Octokit
|
|||||||
public Author Author { get; protected set; }
|
public Author Author { get; protected set; }
|
||||||
public Author Committer { get; protected set; }
|
public Author Committer { get; protected set; }
|
||||||
public Commit Commit { get; protected set; }
|
public Commit Commit { get; protected set; }
|
||||||
public IEnumerable<GitReference> Parents { get; protected set; }
|
public IReadOnlyList<GitReference> Parents { get; protected set; }
|
||||||
public string CommentsUrl { get; protected set; }
|
public string CommentsUrl { get; protected set; }
|
||||||
public int CommentCount { get; protected set; }
|
public int CommentCount { get; protected set; }
|
||||||
public string HtmlUrl { get; protected set; }
|
public string HtmlUrl { get; protected set; }
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -16,19 +17,22 @@ namespace Octokit
|
|||||||
|
|
||||||
public Participation(IEnumerable<int> all, IEnumerable<int> owner)
|
public Participation(IEnumerable<int> all, IEnumerable<int> owner)
|
||||||
{
|
{
|
||||||
All = all;
|
Ensure.ArgumentNotNull(all, "all");
|
||||||
Owner = owner;
|
Ensure.ArgumentNotNull(owner, "owner");
|
||||||
|
|
||||||
|
All = new ReadOnlyCollection<int>(all.ToList());
|
||||||
|
Owner = new ReadOnlyCollection<int>(owner.ToList());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the commit counts made each week, for the last 52 weeks
|
/// Returns the commit counts made each week, for the last 52 weeks
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEnumerable<int> All { get; protected set; }
|
public IReadOnlyList<int> All { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the commit counts made by the owner each week, for the last 52 weeks
|
/// Returns the commit counts made by the owner each week, for the last 52 weeks
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEnumerable<int> Owner { get; protected set; }
|
public IReadOnlyList<int> Owner { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The total number of commits made by the owner in the last 52 weeks.
|
/// The total number of commits made by the owner in the last 52 weeks.
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Octokit
|
namespace Octokit
|
||||||
{
|
{
|
||||||
@@ -12,12 +14,14 @@ namespace Octokit
|
|||||||
|
|
||||||
public PullRequestCommit(SignatureResponse author, Uri commentsUrl, Commit commit, SignatureResponse committer, Uri htmlUrl, IEnumerable<GitReference> parents, string sha, Uri url)
|
public PullRequestCommit(SignatureResponse author, Uri commentsUrl, Commit commit, SignatureResponse committer, Uri htmlUrl, IEnumerable<GitReference> parents, string sha, Uri url)
|
||||||
{
|
{
|
||||||
|
Ensure.ArgumentNotNull(parents, "parents");
|
||||||
|
|
||||||
Author = author;
|
Author = author;
|
||||||
CommentsUrl = commentsUrl;
|
CommentsUrl = commentsUrl;
|
||||||
Commit = commit;
|
Commit = commit;
|
||||||
Committer = committer;
|
Committer = committer;
|
||||||
HtmlUrl = htmlUrl;
|
HtmlUrl = htmlUrl;
|
||||||
Parents = parents;
|
Parents = new ReadOnlyCollection<GitReference>(parents.ToList());
|
||||||
Sha = sha;
|
Sha = sha;
|
||||||
Url = url;
|
Url = url;
|
||||||
}
|
}
|
||||||
@@ -32,7 +36,7 @@ namespace Octokit
|
|||||||
|
|
||||||
public Uri HtmlUrl { get; protected set; }
|
public Uri HtmlUrl { get; protected set; }
|
||||||
|
|
||||||
public IEnumerable<GitReference> Parents { get; protected set; }
|
public IReadOnlyList<GitReference> Parents { get; protected set; }
|
||||||
|
|
||||||
public string Sha { get; protected set; }
|
public string Sha { get; protected set; }
|
||||||
|
|
||||||
|
|||||||
48
Octokit/Models/Response/PullRequestFile.cs
Normal file
48
Octokit/Models/Response/PullRequestFile.cs
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Octokit.Internal;
|
||||||
|
|
||||||
|
namespace Octokit
|
||||||
|
{
|
||||||
|
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||||
|
public class PullRequestFile
|
||||||
|
{
|
||||||
|
public PullRequestFile() { }
|
||||||
|
|
||||||
|
public PullRequestFile(string sha, string fileName, string status, int additions, int deletions, int changes, Uri blobUri, Uri rawUri, Uri contentsUri, string patch)
|
||||||
|
{
|
||||||
|
Sha = sha;
|
||||||
|
FileName = fileName;
|
||||||
|
Status = status;
|
||||||
|
Additions = additions;
|
||||||
|
Deletions = deletions;
|
||||||
|
Changes = changes;
|
||||||
|
BlobUri = blobUri;
|
||||||
|
RawUri = rawUri;
|
||||||
|
ContentsUri = contentsUri;
|
||||||
|
Patch = patch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Sha { get; protected set; }
|
||||||
|
[Parameter(Key = "filename")]
|
||||||
|
public string FileName { get; protected set; }
|
||||||
|
public string Status { get; protected set; }
|
||||||
|
public int Additions { get; protected set; }
|
||||||
|
public int Deletions { get; protected set; }
|
||||||
|
public int Changes { get; protected set; }
|
||||||
|
public Uri BlobUri { get; protected set; }
|
||||||
|
public Uri RawUri { get; protected set; }
|
||||||
|
public Uri ContentsUri { get; protected set; }
|
||||||
|
public string Patch { get; protected set; }
|
||||||
|
|
||||||
|
internal string DebuggerDisplay
|
||||||
|
{
|
||||||
|
get { return String.Format(CultureInfo.InvariantCulture, "Sha: {0} FileName: {1} Additions: {2} Deletions: {3} Changes: {4}", Sha, FileName, Additions, Deletions, Changes); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -14,7 +15,9 @@ namespace Octokit
|
|||||||
|
|
||||||
public WeeklyCommitActivity(IEnumerable<int> days, int total, long week)
|
public WeeklyCommitActivity(IEnumerable<int> days, int total, long week)
|
||||||
{
|
{
|
||||||
Days = days;
|
Ensure.ArgumentNotNull(days, "days");
|
||||||
|
|
||||||
|
Days = new ReadOnlyCollection<int>(days.ToList());
|
||||||
Total = total;
|
Total = total;
|
||||||
Week = week;
|
Week = week;
|
||||||
}
|
}
|
||||||
@@ -22,7 +25,7 @@ namespace Octokit
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The days array is a group of commits per day, starting on Sunday.
|
/// The days array is a group of commits per day, starting on Sunday.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEnumerable<int> Days { get; protected set; }
|
public IReadOnlyList<int> Days { get; protected set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Totally number of commits made this week.
|
/// Totally number of commits made this week.
|
||||||
|
|||||||
@@ -389,6 +389,10 @@
|
|||||||
<Compile Include="Models\Request\RepositoryRequest.cs" />
|
<Compile Include="Models\Request\RepositoryRequest.cs" />
|
||||||
<Compile Include="Models\Response\RepositoryHookConfiguration.cs" />
|
<Compile Include="Models\Response\RepositoryHookConfiguration.cs" />
|
||||||
<Compile Include="Models\Request\RepositoryForksListRequest.cs" />
|
<Compile Include="Models\Request\RepositoryForksListRequest.cs" />
|
||||||
|
<Compile Include="Models\Response\GitIgnoreTemplate.cs" />
|
||||||
|
<Compile Include="Models\Response\License.cs" />
|
||||||
|
<Compile Include="Models\Response\LicenseMetadata.cs" />
|
||||||
|
<Compile Include="Models\Response\PullRequestFile.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
@@ -401,6 +401,10 @@
|
|||||||
<Compile Include="Models\Request\RepositoryRequest.cs" />
|
<Compile Include="Models\Request\RepositoryRequest.cs" />
|
||||||
<Compile Include="Models\Response\RepositoryHookConfiguration.cs" />
|
<Compile Include="Models\Response\RepositoryHookConfiguration.cs" />
|
||||||
<Compile Include="Models\Request\RepositoryForksListRequest.cs" />
|
<Compile Include="Models\Request\RepositoryForksListRequest.cs" />
|
||||||
|
<Compile Include="Models\Response\GitIgnoreTemplate.cs" />
|
||||||
|
<Compile Include="Models\Response\License.cs" />
|
||||||
|
<Compile Include="Models\Response\LicenseMetadata.cs" />
|
||||||
|
<Compile Include="Models\Response\PullRequestFile.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
|
||||||
</Project>
|
</Project>
|
||||||
@@ -394,6 +394,10 @@
|
|||||||
<Compile Include="Models\Request\RepositoryRequest.cs" />
|
<Compile Include="Models\Request\RepositoryRequest.cs" />
|
||||||
<Compile Include="Models\Response\RepositoryHookConfiguration.cs" />
|
<Compile Include="Models\Response\RepositoryHookConfiguration.cs" />
|
||||||
<Compile Include="Models\Request\RepositoryForksListRequest.cs" />
|
<Compile Include="Models\Request\RepositoryForksListRequest.cs" />
|
||||||
|
<Compile Include="Models\Response\GitIgnoreTemplate.cs" />
|
||||||
|
<Compile Include="Models\Response\License.cs" />
|
||||||
|
<Compile Include="Models\Response\LicenseMetadata.cs" />
|
||||||
|
<Compile Include="Models\Response\PullRequestFile.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
|
|||||||
@@ -387,6 +387,10 @@
|
|||||||
<Compile Include="Models\Request\RepositoryRequest.cs" />
|
<Compile Include="Models\Request\RepositoryRequest.cs" />
|
||||||
<Compile Include="Models\Response\RepositoryHookConfiguration.cs" />
|
<Compile Include="Models\Response\RepositoryHookConfiguration.cs" />
|
||||||
<Compile Include="Models\Request\RepositoryForksListRequest.cs" />
|
<Compile Include="Models\Request\RepositoryForksListRequest.cs" />
|
||||||
|
<Compile Include="Models\Response\GitIgnoreTemplate.cs" />
|
||||||
|
<Compile Include="Models\Response\License.cs" />
|
||||||
|
<Compile Include="Models\Response\LicenseMetadata.cs" />
|
||||||
|
<Compile Include="Models\Response\PullRequestFile.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CodeAnalysisDictionary Include="..\CustomDictionary.xml">
|
<CodeAnalysisDictionary Include="..\CustomDictionary.xml">
|
||||||
|
|||||||
@@ -391,6 +391,10 @@
|
|||||||
<Compile Include="Models\Request\ReleaseAssetUpload.cs" />
|
<Compile Include="Models\Request\ReleaseAssetUpload.cs" />
|
||||||
<Compile Include="Models\Request\RepositoryRequest.cs" />
|
<Compile Include="Models\Request\RepositoryRequest.cs" />
|
||||||
<Compile Include="Models\Request\RepositoryForksListRequest.cs" />
|
<Compile Include="Models\Request\RepositoryForksListRequest.cs" />
|
||||||
|
<Compile Include="Models\Response\GitIgnoreTemplate.cs" />
|
||||||
|
<Compile Include="Models\Response\License.cs" />
|
||||||
|
<Compile Include="Models\Response\LicenseMetadata.cs" />
|
||||||
|
<Compile Include="Models\Response\PullRequestFile.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<CodeAnalysisDictionary Include="..\CustomDictionary.xml">
|
<CodeAnalysisDictionary Include="..\CustomDictionary.xml">
|
||||||
|
|||||||
@@ -105,11 +105,15 @@
|
|||||||
<Compile Include="Models\Response\ActivityPayloads\StarredEventPayload.cs" />
|
<Compile Include="Models\Response\ActivityPayloads\StarredEventPayload.cs" />
|
||||||
<Compile Include="Models\Response\CombinedCommitStatus.cs" />
|
<Compile Include="Models\Response\CombinedCommitStatus.cs" />
|
||||||
<Compile Include="Models\Response\CommitContent.cs" />
|
<Compile Include="Models\Response\CommitContent.cs" />
|
||||||
|
<Compile Include="Models\Response\GitIgnoreTemplate.cs" />
|
||||||
|
<Compile Include="Models\Response\License.cs" />
|
||||||
|
<Compile Include="Models\Response\LicenseMetadata.cs" />
|
||||||
<Compile Include="Models\Response\Merge.cs" />
|
<Compile Include="Models\Response\Merge.cs" />
|
||||||
<Compile Include="Models\Response\ContentType.cs" />
|
<Compile Include="Models\Response\ContentType.cs" />
|
||||||
<Compile Include="Models\Response\ApplicationAuthorization.cs" />
|
<Compile Include="Models\Response\ApplicationAuthorization.cs" />
|
||||||
<Compile Include="Models\Response\GitHubCommitFile.cs" />
|
<Compile Include="Models\Response\GitHubCommitFile.cs" />
|
||||||
<Compile Include="Models\Response\PublicKey.cs" />
|
<Compile Include="Models\Response\PublicKey.cs" />
|
||||||
|
<Compile Include="Models\Response\PullRequestFile.cs" />
|
||||||
<Compile Include="Models\Response\RepositoryContent.cs" />
|
<Compile Include="Models\Response\RepositoryContent.cs" />
|
||||||
<Compile Include="Models\Response\RepositoryContentChangeSet.cs" />
|
<Compile Include="Models\Response\RepositoryContentChangeSet.cs" />
|
||||||
<Compile Include="Models\Response\RepositoryContributor.cs" />
|
<Compile Include="Models\Response\RepositoryContributor.cs" />
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Octokit - GitHub API Client Library for .NET 
|
# Octokit - GitHub API Client Library for .NET [](https://ci.appveyor.com/project/Haacked15676/octokit-net)
|
||||||
|
|
||||||
Octokit is a client library targeting .NET 4.5 and above that provides an easy
|
Octokit is a client library targeting .NET 4.5 and above that provides an easy
|
||||||
way to interact with the [GitHub API](http://developer.github.com/v3/).
|
way to interact with the [GitHub API](http://developer.github.com/v3/).
|
||||||
@@ -54,7 +54,7 @@ for more details.
|
|||||||
|
|
||||||
## Build Server
|
## Build Server
|
||||||
|
|
||||||
The builds and tests for Octokit.net are run on [qed](https://github.com/half-ogre/qed/). This enables us to build and test incoming pull requests: http://half-ogre-qed.cloudapp.net/octokit/octokit.net
|
The builds and tests for Octokit.net are run on [AppVeyor](http://www.appveyor.com). This enables us to build and test incoming pull requests: https://ci.appveyor.com/project/Haacked15676/octokit-net
|
||||||
|
|
||||||
## Problems?
|
## Problems?
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,10 @@
|
|||||||
|
### New in 0.8.0 (released 2015/03/20)
|
||||||
|
* New: added `MiscellaneousClient.GetGitIgnoreTemplates` and `MiscellaneousClient.GetGitIgnoreTemplates` APIs - #753 via @haacked
|
||||||
|
* New: added `MiscellaneousClient.GetLicenses` and `MiscellaneousClient.GetLicense` preview APIs - #754 via @haacked
|
||||||
|
* New: enhancements to `AuthorizationClient`- #731 via @alfhenrik
|
||||||
|
* Fixed: handled `unsubscribe` type for Issue events - #751 via @darrencamp
|
||||||
|
* Fixes: ensure response models define readonly interfaces - #755 via @khellang
|
||||||
|
|
||||||
### New in 0.7.3 (released 2015/03/06)
|
### New in 0.7.3 (released 2015/03/06)
|
||||||
* New: added `Repository.GetAllPublic` for searching public repositories - #691 via @rms81
|
* New: added `Repository.GetAllPublic` for searching public repositories - #691 via @rms81
|
||||||
* New: added filters to `Repository.GetAllForCurrent()` - #742 via @shiftkey
|
* New: added filters to `Repository.GetAllForCurrent()` - #742 via @shiftkey
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user