diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000000..722bb8dfc7
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,74 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, gender identity and expression, level of experience,
+nationality, personal appearance, race, religion, or sexual identity and
+orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at [support@github.com](mailto:support@github.com). All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at [http://contributor-covenant.org/version/1/4][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/
diff --git a/Octokit.Reactive/Clients/IObservableAssigneesClient.cs b/Octokit.Reactive/Clients/IObservableAssigneesClient.cs
index 2f2ae79c14..4fd7e71e8f 100644
--- a/Octokit.Reactive/Clients/IObservableAssigneesClient.cs
+++ b/Octokit.Reactive/Clients/IObservableAssigneesClient.cs
@@ -46,6 +46,26 @@ public interface IObservableAssigneesClient
/// Username of the prospective assignee
IObservable CheckAssignee(string owner, string name, string assignee);
+ ///
+ /// Add assignees to a specified Issue.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// The issue number
+ /// List of names of assignees to add
+ ///
+ IObservable AddAssignees(string owner, string name, int number, AssigneesUpdate assignees);
+
+ ///
+ /// Remove assignees from a specified Issue.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// The issue number
+ /// List of assignees to remove
+ ///
+ IObservable RemoveAssignees(string owner, string name, int number, AssigneesUpdate assignees);
+
///
/// Checks to see if a user is an assignee for a repository.
///
diff --git a/Octokit.Reactive/Clients/IObservableCommitCommentReactionsClient.cs b/Octokit.Reactive/Clients/IObservableCommitCommentReactionsClient.cs
index 4771f2ef67..a4df576fff 100644
--- a/Octokit.Reactive/Clients/IObservableCommitCommentReactionsClient.cs
+++ b/Octokit.Reactive/Clients/IObservableCommitCommentReactionsClient.cs
@@ -40,7 +40,7 @@ public interface IObservableCommitCommentReactionsClient
/// The comment id
///
IObservable GetAll(string owner, string name, int number);
-
+
///
/// List reactions for a specified Commit Comment
///
diff --git a/Octokit.Reactive/Clients/IObservableCommitStatusClient.cs b/Octokit.Reactive/Clients/IObservableCommitStatusClient.cs
index 356ac10f1c..ed0eb37307 100644
--- a/Octokit.Reactive/Clients/IObservableCommitStatusClient.cs
+++ b/Octokit.Reactive/Clients/IObservableCommitStatusClient.cs
@@ -19,7 +19,7 @@ public interface IObservableCommitStatusClient
/// The name of the repository
/// The reference (SHA, branch name, or tag name) to list commits for
IObservable GetAll(string owner, string name, string reference);
-
+
///
/// Retrieves commit statuses for the specified reference. A reference can be a commit SHA, a branch name, or
/// a tag name.
diff --git a/Octokit.Reactive/Clients/IObservableCommitsClient.cs b/Octokit.Reactive/Clients/IObservableCommitsClient.cs
index 213b1d7f94..832f8e4dc8 100644
--- a/Octokit.Reactive/Clients/IObservableCommitsClient.cs
+++ b/Octokit.Reactive/Clients/IObservableCommitsClient.cs
@@ -46,7 +46,7 @@ public interface IObservableCommitsClient
/// The name of the repository
/// The commit to create
IObservable Create(string owner, string name, NewCommit commit);
-
+
///
/// Create a commit for a given repository
///
diff --git a/Octokit.Reactive/Clients/IObservableDeploymentsClient.cs b/Octokit.Reactive/Clients/IObservableDeploymentsClient.cs
index 361a1346a9..250e0e0948 100644
--- a/Octokit.Reactive/Clients/IObservableDeploymentsClient.cs
+++ b/Octokit.Reactive/Clients/IObservableDeploymentsClient.cs
@@ -21,7 +21,7 @@ public interface IObservableDeploymentsClient
/// The owner of the repository
/// The name of the repository
IObservable GetAll(string owner, string name);
-
+
///
/// Gets all the deployments for the specified repository. Any user with pull access
/// to a repository can view deployments.
@@ -43,7 +43,7 @@ public interface IObservableDeploymentsClient
/// The name of the repository
/// Options for changing the API response
IObservable GetAll(string owner, string name, ApiOptions options);
-
+
///
/// Gets all the deployments for the specified repository. Any user with pull access
/// to a repository can view deployments.
diff --git a/Octokit.Reactive/Clients/IObservableEventsClient.cs b/Octokit.Reactive/Clients/IObservableEventsClient.cs
index 558b7f7055..7bf37345a7 100644
--- a/Octokit.Reactive/Clients/IObservableEventsClient.cs
+++ b/Octokit.Reactive/Clients/IObservableEventsClient.cs
@@ -76,7 +76,7 @@ public interface IObservableEventsClient
///
/// The owner of the repository
/// The name of the repository
- IObservable GetAllIssuesForRepository(string owner, string name);
+ IObservable GetAllIssuesForRepository(string owner, string name);
///
/// Gets all the issue events for a given repository
@@ -85,7 +85,7 @@ public interface IObservableEventsClient
/// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
///
/// The Id of the repository
- IObservable GetAllIssuesForRepository(long repositoryId);
+ IObservable GetAllIssuesForRepository(long repositoryId);
///
/// Gets all the issue events for a given repository
@@ -96,7 +96,7 @@ public interface IObservableEventsClient
/// The owner of the repository
/// The name of the repository
/// Options for changing the API response
- IObservable GetAllIssuesForRepository(string owner, string name, ApiOptions options);
+ IObservable GetAllIssuesForRepository(string owner, string name, ApiOptions options);
///
/// Gets all the issue events for a given repository
@@ -106,7 +106,7 @@ public interface IObservableEventsClient
///
/// The Id of the repository
/// Options for changing the API response
- IObservable GetAllIssuesForRepository(long repositoryId, ApiOptions options);
+ IObservable GetAllIssuesForRepository(long repositoryId, ApiOptions options);
///
/// Gets all the events for a given repository network
diff --git a/Octokit.Reactive/Clients/IObservableIssueCommentsClient.cs b/Octokit.Reactive/Clients/IObservableIssueCommentsClient.cs
index 24c29d48f1..9f0c2783e8 100644
--- a/Octokit.Reactive/Clients/IObservableIssueCommentsClient.cs
+++ b/Octokit.Reactive/Clients/IObservableIssueCommentsClient.cs
@@ -65,6 +65,42 @@ public interface IObservableIssueCommentsClient
/// Options for changing the API response
IObservable GetAllForRepository(long repositoryId, ApiOptions options);
+ ///
+ /// Gets Issue Comments for a repository.
+ ///
+ /// http://developer.github.com/v3/issues/comments/#list-comments-in-a-repository
+ /// The owner of the repository
+ /// The name of the repository
+ /// The sorting parameters
+ IObservable GetAllForRepository(string owner, string name, IssueCommentRequest request);
+
+ ///
+ /// Gets Issue Comments for a repository.
+ ///
+ /// http://developer.github.com/v3/issues/comments/#list-comments-in-a-repository
+ /// The Id of the repository
+ /// The sorting parameters
+ IObservable GetAllForRepository(long repositoryId, IssueCommentRequest request);
+
+ ///
+ /// Gets Issue Comments for a repository.
+ ///
+ /// http://developer.github.com/v3/issues/comments/#list-comments-in-a-repository
+ /// The owner of the repository
+ /// The name of the repository
+ /// The sorting parameters
+ /// Options for changing the API response
+ IObservable GetAllForRepository(string owner, string name, IssueCommentRequest request, ApiOptions options);
+
+ ///
+ /// Gets Issue Comments for a repository.
+ ///
+ /// http://developer.github.com/v3/issues/comments/#list-comments-in-a-repository
+ /// The Id of the repository
+ /// The sorting parameters
+ /// Options for changing the API response
+ IObservable GetAllForRepository(long repositoryId, IssueCommentRequest request, ApiOptions options);
+
///
/// Gets Issue Comments for a specified Issue.
///
diff --git a/Octokit.Reactive/Clients/IObservableIssueTimelineClient.cs b/Octokit.Reactive/Clients/IObservableIssueTimelineClient.cs
index 053c1221f1..f60a824731 100644
--- a/Octokit.Reactive/Clients/IObservableIssueTimelineClient.cs
+++ b/Octokit.Reactive/Clients/IObservableIssueTimelineClient.cs
@@ -32,7 +32,7 @@ public interface IObservableIssueTimelineClient
/// The issue number
/// Options for changing the API response
IObservable GetAllForIssue(string owner, string repo, int number, ApiOptions options);
-
+
///
/// Gets all the various events that have occurred around an issue or pull request.
///
diff --git a/Octokit.Reactive/Clients/IObservableIssuesEventsClient.cs b/Octokit.Reactive/Clients/IObservableIssuesEventsClient.cs
index 0307f84629..44c714e3bf 100644
--- a/Octokit.Reactive/Clients/IObservableIssuesEventsClient.cs
+++ b/Octokit.Reactive/Clients/IObservableIssuesEventsClient.cs
@@ -21,7 +21,7 @@ public interface IObservableIssuesEventsClient
/// The name of the repository
/// The issue number
IObservable GetAllForIssue(string owner, string name, int number);
-
+
///
/// Gets all events for the issue.
///
diff --git a/Octokit.Reactive/Clients/IObservableMilestonesClient.cs b/Octokit.Reactive/Clients/IObservableMilestonesClient.cs
index 95cd5f82e0..eab33ef0e3 100644
--- a/Octokit.Reactive/Clients/IObservableMilestonesClient.cs
+++ b/Octokit.Reactive/Clients/IObservableMilestonesClient.cs
@@ -22,7 +22,7 @@ public interface IObservableMilestonesClient
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "Method makes a network request")]
IObservable Get(string owner, string name, int number);
-
+
///
/// Gets a single Milestone by number.
///
@@ -44,7 +44,7 @@ public interface IObservableMilestonesClient
/// The name of the repository
///
IObservable GetAllForRepository(string owner, string name);
-
+
///
/// Gets all open milestones for the repository.
///
diff --git a/Octokit.Reactive/Clients/IObservableOrganizationsClient.cs b/Octokit.Reactive/Clients/IObservableOrganizationsClient.cs
index fb9efd7f07..85b9955e33 100644
--- a/Octokit.Reactive/Clients/IObservableOrganizationsClient.cs
+++ b/Octokit.Reactive/Clients/IObservableOrganizationsClient.cs
@@ -46,6 +46,7 @@ public interface IObservableOrganizationsClient
///
/// The login for the user
///
+ [Obsolete("Please use IObservableOrganizationsClient.GetAllForUser() instead. This method will be removed in a future version")]
IObservable GetAll(string user);
///
@@ -54,8 +55,37 @@ public interface IObservableOrganizationsClient
/// The login for the user
/// Options for changing the API response
///
+ [Obsolete("Please use IObservableOrganizationsClient.GetAllForUser() instead. This method will be removed in a future version")]
IObservable GetAll(string user, ApiOptions options);
+ ///
+ /// Returns all the organizations for the specified user
+ ///
+ /// The login for the user
+ ///
+ IObservable GetAllForUser(string user);
+
+ ///
+ /// Returns all the organizations for the specified user
+ ///
+ /// The login for the user
+ /// Options for changing the API response
+ ///
+ IObservable GetAllForUser(string user, ApiOptions options);
+
+ ///
+ /// Returns all the organizations
+ ///
+ ///
+ IObservable GetAll();
+
+ ///
+ /// Returns all the organizations
+ ///
+ /// Search parameters of the last organization seen
+ ///
+ IObservable GetAll(OrganizationRequest request);
+
///
/// Update the specified organization with data from .
///
diff --git a/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs b/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs
index 752024be3f..ad5dd7c97a 100644
--- a/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs
+++ b/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs
@@ -12,10 +12,16 @@ namespace Octokit.Reactive
public interface IObservablePullRequestsClient
{
///
- /// Client for managing comments.
+ /// Client for managing review comments.
///
+ [Obsolete("Please use IObservablePullRequestsClient.ReviewComment. This will be removed in a future version")]
IObservablePullRequestReviewCommentsClient Comment { get; }
+ ///
+ /// Client for managing review comments.
+ ///
+ IObservablePullRequestReviewCommentsClient ReviewComment { get; }
+
///
/// Gets a single Pull Request by number.
///
diff --git a/Octokit.Reactive/Clients/IObservableReferencesClient.cs b/Octokit.Reactive/Clients/IObservableReferencesClient.cs
index 51d5582d7a..a1ff6dc101 100644
--- a/Octokit.Reactive/Clients/IObservableReferencesClient.cs
+++ b/Octokit.Reactive/Clients/IObservableReferencesClient.cs
@@ -25,7 +25,7 @@ public interface IObservableReferencesClient
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "Method makes a network request")]
IObservable Get(string owner, string name, string reference);
-
+
///
/// Gets a reference for a given repository by reference name
///
diff --git a/Octokit.Reactive/Clients/IObservableReleasesClient.cs b/Octokit.Reactive/Clients/IObservableReleasesClient.cs
index be24c954f8..ec56e379e4 100644
--- a/Octokit.Reactive/Clients/IObservableReleasesClient.cs
+++ b/Octokit.Reactive/Clients/IObservableReleasesClient.cs
@@ -231,7 +231,7 @@ public interface IObservableReleasesClient
/// Description of the asset with its data
/// Thrown when a general API error occurs.
IObservable UploadAsset(Release release, ReleaseAssetUpload data);
-
+
///
/// Gets the specified for the specified release of the specified repository.
///
diff --git a/Octokit.Reactive/Clients/IObservableRepositoryContentsClient.cs b/Octokit.Reactive/Clients/IObservableRepositoryContentsClient.cs
index bca5a1a237..e08c7128c6 100644
--- a/Octokit.Reactive/Clients/IObservableRepositoryContentsClient.cs
+++ b/Octokit.Reactive/Clients/IObservableRepositoryContentsClient.cs
@@ -36,7 +36,7 @@ public interface IObservableRepositoryContentsClient
///
/// The Id of the repository
IObservable GetReadmeHtml(long repositoryId);
-
+
///
/// Get an archive of a given repository's contents
///
@@ -167,7 +167,7 @@ public interface IObservableRepositoryContentsClient
/// The name of the commit/branch/tag. Default: the repository’s default branch (usually master)
/// The content path
IObservable GetAllContentsByRef(long repositoryId, string reference, string path);
-
+
///
/// Returns the contents of the home directory in a repository.
///
diff --git a/Octokit.Reactive/Clients/IObservableRepositoryHooksClient.cs b/Octokit.Reactive/Clients/IObservableRepositoryHooksClient.cs
index 844b970552..e6daa3d909 100644
--- a/Octokit.Reactive/Clients/IObservableRepositoryHooksClient.cs
+++ b/Octokit.Reactive/Clients/IObservableRepositoryHooksClient.cs
@@ -35,7 +35,7 @@ public interface IObservableRepositoryHooksClient
/// Options for changing the API response
/// See API documentation for more information.
IObservable GetAll(string owner, string name, ApiOptions options);
-
+
///
/// Gets the list of hooks defined for a repository
///
diff --git a/Octokit.Reactive/Clients/IObservableStarredClient.cs b/Octokit.Reactive/Clients/IObservableStarredClient.cs
index 1b81508569..d583287636 100644
--- a/Octokit.Reactive/Clients/IObservableStarredClient.cs
+++ b/Octokit.Reactive/Clients/IObservableStarredClient.cs
@@ -33,7 +33,7 @@ public interface IObservableStarredClient
/// Options for changing the API response
/// Thrown if the client is not authenticated
IObservable GetAllStargazers(string owner, string name, ApiOptions options);
-
+
///
/// Retrieves all of the stargazers for the passed repository
///
@@ -49,7 +49,7 @@ public interface IObservableStarredClient
/// The name of the repository
/// Thrown if the client is not authenticated.
IObservable GetAllStargazersWithTimestamps(string owner, string name);
-
+
///
/// Retrieves all of the stargazers for the passed repository with star creation timestamps.
///
@@ -79,7 +79,7 @@ public interface IObservableStarredClient
///
/// Thrown if the client is not authenticated
IObservable GetAllForCurrent();
-
+
///
/// Retrieves all of the starred (ies) for the current user
///
@@ -91,7 +91,7 @@ public interface IObservableStarredClient
///
/// Thrown if the client is not authenticated.
IObservable GetAllForCurrentWithTimestamps();
-
+
///
/// Retrieves all of the starred (ies) for the current user with star creation timestamps.
///
diff --git a/Octokit.Reactive/Clients/ObservableAssigneesClient.cs b/Octokit.Reactive/Clients/ObservableAssigneesClient.cs
index 0eb3cff526..eb242d635b 100644
--- a/Octokit.Reactive/Clients/ObservableAssigneesClient.cs
+++ b/Octokit.Reactive/Clients/ObservableAssigneesClient.cs
@@ -87,6 +87,39 @@ public IObservable CheckAssignee(string owner, string name, string assigne
return _client.CheckAssignee(owner, name, assignee).ToObservable();
}
+ ///
+ /// Add assignees to a specified Issue.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// The issue number
+ /// List of names of assignees to add
+ public IObservable AddAssignees(string owner, string name, int number, AssigneesUpdate assignees)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(assignees, "assignees");
+
+ return _client.AddAssignees(owner, name, number, assignees).ToObservable();
+ }
+
+ ///
+ /// Remove assignees from a specified Issue.
+ ///
+ /// The owner of the repository
+ /// The name of the repository
+ /// The issue number
+ /// List of assignees to remove
+ ///
+ public IObservable RemoveAssignees(string owner, string name, int number, AssigneesUpdate assignees)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(assignees, "assignees");
+
+ return _client.RemoveAssignees(owner, name, number, assignees).ToObservable();
+ }
+
///
/// Checks to see if a user is an assignee for a repository.
///
diff --git a/Octokit.Reactive/Clients/ObservableCommitStatusClient.cs b/Octokit.Reactive/Clients/ObservableCommitStatusClient.cs
index 4edc9e1d3b..8cf0fc04d4 100644
--- a/Octokit.Reactive/Clients/ObservableCommitStatusClient.cs
+++ b/Octokit.Reactive/Clients/ObservableCommitStatusClient.cs
@@ -37,7 +37,7 @@ public IObservable GetAll(string owner, string name, string refere
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
- return GetAll(owner, name ,reference, ApiOptions.None);
+ return GetAll(owner, name, reference, ApiOptions.None);
}
///
@@ -68,7 +68,7 @@ public IObservable GetAll(string owner, string name, string refere
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
- Ensure.ArgumentNotNull(options, "options");
+ Ensure.ArgumentNotNull(options, "options");
return _connection.GetAndFlattenAllPages(ApiUrls.CommitStatuses(owner, name, reference), options);
}
diff --git a/Octokit.Reactive/Clients/ObservableEventsClient.cs b/Octokit.Reactive/Clients/ObservableEventsClient.cs
index b365ea0ac6..666fc8c1d1 100644
--- a/Octokit.Reactive/Clients/ObservableEventsClient.cs
+++ b/Octokit.Reactive/Clients/ObservableEventsClient.cs
@@ -107,14 +107,14 @@ public IObservable GetAllForRepository(long repositoryId, ApiOptions o
}
///
- /// Gets all the events for a given repository
+ /// Gets all the issue events for a given repository
///
///
/// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
///
/// The owner of the repository
/// The name of the repository
- public IObservable GetAllIssuesForRepository(string owner, string name)
+ public IObservable GetAllIssuesForRepository(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
@@ -129,13 +129,13 @@ public IObservable GetAllIssuesForRepository(string owner, string name
/// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
///
/// The Id of the repository
- public IObservable GetAllIssuesForRepository(long repositoryId)
+ public IObservable GetAllIssuesForRepository(long repositoryId)
{
return GetAllIssuesForRepository(repositoryId, ApiOptions.None);
}
///
- /// Gets all the events for a given repository
+ /// Gets all the issue events for a given repository
///
///
/// http://developer.github.com/v3/activity/events/#list-issue-events-for-a-repository
@@ -143,13 +143,13 @@ public IObservable GetAllIssuesForRepository(long repositoryId)
/// The owner of the repository
/// The name of the repository
/// Options for changing the API response
- public IObservable GetAllIssuesForRepository(string owner, string name, ApiOptions options)
+ public IObservable GetAllIssuesForRepository(string owner, string name, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(options, "options");
- return _connection.GetAndFlattenAllPages(ApiUrls.IssuesEvents(owner, name), options);
+ return _connection.GetAndFlattenAllPages(ApiUrls.IssuesEvents(owner, name), options);
}
///
@@ -160,11 +160,11 @@ public IObservable GetAllIssuesForRepository(string owner, string name
///
/// The Id of the repository
/// Options for changing the API response
- public IObservable GetAllIssuesForRepository(long repositoryId, ApiOptions options)
+ public IObservable GetAllIssuesForRepository(long repositoryId, ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");
- return _connection.GetAndFlattenAllPages(ApiUrls.IssuesEvents(repositoryId), options);
+ return _connection.GetAndFlattenAllPages(ApiUrls.IssuesEvents(repositoryId), options);
}
///
@@ -382,7 +382,7 @@ public IObservable GetAllForAnOrganization(string user, string organiz
Ensure.ArgumentNotNullOrEmptyString(organization, "organization");
Ensure.ArgumentNotNull(options, "options");
- return _connection.GetAndFlattenAllPages(ApiUrls.OrganizationEvents(user, organization),options);
+ return _connection.GetAndFlattenAllPages(ApiUrls.OrganizationEvents(user, organization), options);
}
}
}
diff --git a/Octokit.Reactive/Clients/ObservableGistCommentsClient.cs b/Octokit.Reactive/Clients/ObservableGistCommentsClient.cs
index 57165687ab..240dd6f3a8 100644
--- a/Octokit.Reactive/Clients/ObservableGistCommentsClient.cs
+++ b/Octokit.Reactive/Clients/ObservableGistCommentsClient.cs
@@ -38,7 +38,7 @@ public IObservable Get(string gistId, int commentId)
/// IObservable{GistComment}.
public IObservable GetAllForGist(string gistId)
{
- Ensure.ArgumentNotNullOrEmptyString(gistId, "gistId");
+ Ensure.ArgumentNotNullOrEmptyString(gistId, "gistId");
return GetAllForGist(gistId, ApiOptions.None);
}
diff --git a/Octokit.Reactive/Clients/ObservableGistsClient.cs b/Octokit.Reactive/Clients/ObservableGistsClient.cs
index 1dbd817a8e..a76dd58d64 100644
--- a/Octokit.Reactive/Clients/ObservableGistsClient.cs
+++ b/Octokit.Reactive/Clients/ObservableGistsClient.cs
@@ -111,7 +111,7 @@ public IObservable GetAll(ApiOptions options)
///
/// Only gists updated at or after this time are returned
public IObservable GetAll(DateTimeOffset since)
- {
+ {
return GetAll(since, ApiOptions.None);
}
@@ -179,7 +179,7 @@ public IObservable GetAllPublic(DateTimeOffset since)
/// Options for changing the API response
public IObservable GetAllPublic(DateTimeOffset since, ApiOptions options)
{
- Ensure.ArgumentNotNull(options, "options");
+ Ensure.ArgumentNotNull(options, "options");
var request = new GistRequest(since);
return _connection.GetAndFlattenAllPages(ApiUrls.PublicGists(), request.ToParametersDictionary(), options);
diff --git a/Octokit.Reactive/Clients/ObservableIssueCommentsClient.cs b/Octokit.Reactive/Clients/ObservableIssueCommentsClient.cs
index 54527b7a48..7069091cd1 100644
--- a/Octokit.Reactive/Clients/ObservableIssueCommentsClient.cs
+++ b/Octokit.Reactive/Clients/ObservableIssueCommentsClient.cs
@@ -87,7 +87,7 @@ public IObservable GetAllForRepository(string owner, string name,
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(options, "options");
- return _connection.GetAndFlattenAllPages(ApiUrls.IssueComments(owner, name), null, AcceptHeaders.ReactionsPreview, options);
+ return GetAllForRepository(owner, name, new IssueCommentRequest(), options);
}
///
@@ -100,7 +100,69 @@ public IObservable GetAllForRepository(long repositoryId, ApiOptio
{
Ensure.ArgumentNotNull(options, "options");
- return _connection.GetAndFlattenAllPages(ApiUrls.IssueComments(repositoryId), options);
+ return GetAllForRepository(repositoryId, new IssueCommentRequest(), options);
+ }
+
+ ///
+ /// Gets Issue Comments for a repository.
+ ///
+ /// http://developer.github.com/v3/issues/comments/#list-comments-in-a-repository
+ /// The owner of the repository
+ /// The name of the repository
+ /// The sorting parameters
+ public IObservable GetAllForRepository(string owner, string name, IssueCommentRequest request)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(request, "request");
+
+ return GetAllForRepository(owner, name, request, ApiOptions.None);
+ }
+
+ ///
+ /// Gets Issue Comments for a repository.
+ ///
+ /// http://developer.github.com/v3/issues/comments/#list-comments-in-a-repository
+ /// The Id of the repository
+ /// The sorting parameters
+ public IObservable GetAllForRepository(long repositoryId, IssueCommentRequest request)
+ {
+ Ensure.ArgumentNotNull(request, "request");
+
+ return GetAllForRepository(repositoryId, request, ApiOptions.None);
+ }
+
+ ///
+ /// Gets Issue Comments for a repository.
+ ///
+ /// http://developer.github.com/v3/issues/comments/#list-comments-in-a-repository
+ /// The owner of the repository
+ /// The name of the repository
+ /// The sorting parameters
+ /// Options for changing the API response
+ public IObservable GetAllForRepository(string owner, string name, IssueCommentRequest request, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
+ Ensure.ArgumentNotNullOrEmptyString(name, "name");
+ Ensure.ArgumentNotNull(request, "request");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.IssueComments(owner, name), request.ToParametersDictionary(), AcceptHeaders.ReactionsPreview, options);
+ }
+
+ ///
+ /// Gets Issue Comments for a repository.
+ ///
+ /// http://developer.github.com/v3/issues/comments/#list-comments-in-a-repository
+ /// The Id of the repository
+ /// The sorting parameters
+ /// Options for changing the API response
+ public IObservable GetAllForRepository(long repositoryId, IssueCommentRequest request, ApiOptions options)
+ {
+ Ensure.ArgumentNotNull(request, "request");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.IssueComments(repositoryId), request.ToParametersDictionary(), AcceptHeaders.ReactionsPreview, options);
}
///
diff --git a/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs b/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs
index ff5b310132..966cd18415 100644
--- a/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs
+++ b/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs
@@ -64,7 +64,7 @@ public IObservable GetAllForCurrent(ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");
- return _connection.GetAndFlattenAllPages(ApiUrls.Organizations());
+ return _connection.GetAndFlattenAllPages(ApiUrls.UserOrganizations());
}
///
@@ -72,11 +72,12 @@ public IObservable GetAllForCurrent(ApiOptions options)
///
/// The login for the user
///
+ [Obsolete("Please use ObservableOrganizationsClient.GetAllForUser() instead. This method will be removed in a future version")]
public IObservable GetAll(string user)
{
Ensure.ArgumentNotNullOrEmptyString(user, "user");
- return _connection.GetAndFlattenAllPages(ApiUrls.Organizations(user));
+ return _connection.GetAndFlattenAllPages(ApiUrls.UserOrganizations(user));
}
///
@@ -85,12 +86,62 @@ public IObservable GetAll(string user)
/// The login for the user
/// Options for changing the API response
///
+ [Obsolete("Please use ObservableOrganizationsClient.GetAllForUser() instead. This method will be removed in a future version")]
public IObservable GetAll(string user, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(user, "user");
Ensure.ArgumentNotNull(options, "options");
- return _connection.GetAndFlattenAllPages(ApiUrls.Organizations(user), options);
+ return _connection.GetAndFlattenAllPages(ApiUrls.UserOrganizations(user), options);
+ }
+
+ ///
+ /// Returns all the organizations for the specified user
+ ///
+ /// The login for the user
+ ///
+ public IObservable GetAllForUser(string user)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(user, "user");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.UserOrganizations(user));
+ }
+
+ ///
+ /// Returns all the organizations for the specified user
+ ///
+ /// The login for the user
+ /// Options for changing the API response
+ ///
+ public IObservable GetAllForUser(string user, ApiOptions options)
+ {
+ Ensure.ArgumentNotNullOrEmptyString(user, "user");
+ Ensure.ArgumentNotNull(options, "options");
+
+ return _connection.GetAndFlattenAllPages(ApiUrls.UserOrganizations(user), options);
+ }
+
+ ///
+ /// Returns all the organizations
+ ///
+ ///
+ public IObservable GetAll()
+ {
+ return _connection.GetAndFlattenAllPages(ApiUrls.AllOrganizations());
+ }
+
+ ///
+ /// Returns all the organizations
+ ///
+ /// Search parameters of the last organization seen
+ ///
+ public IObservable GetAll(OrganizationRequest request)
+ {
+ Ensure.ArgumentNotNull(request, "request");
+
+ var url = ApiUrls.AllOrganizations(request.Since);
+
+ return _connection.GetAndFlattenAllPages(url);
}
///
diff --git a/Octokit.Reactive/Clients/ObservablePullRequestReviewCommentsClient.cs b/Octokit.Reactive/Clients/ObservablePullRequestReviewCommentsClient.cs
index 89bb8ea0c8..4caefcd4f4 100644
--- a/Octokit.Reactive/Clients/ObservablePullRequestReviewCommentsClient.cs
+++ b/Octokit.Reactive/Clients/ObservablePullRequestReviewCommentsClient.cs
@@ -20,7 +20,7 @@ public ObservablePullRequestReviewCommentsClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
- _client = client.PullRequest.Comment;
+ _client = client.PullRequest.ReviewComment;
_connection = client.Connection;
}
diff --git a/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs b/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs
index be36824697..912d0fe293 100644
--- a/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs
+++ b/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs
@@ -16,9 +16,15 @@ public class ObservablePullRequestsClient : IObservablePullRequestsClient
readonly IConnection _connection;
///
- /// Client for managing comments.
+ /// Client for managing review comments.
///
- public IObservablePullRequestReviewCommentsClient Comment { get; private set; }
+ [Obsolete("Please use ObservablePullRequestsClient.ReviewComment. This will be removed in a future version")]
+ public IObservablePullRequestReviewCommentsClient Comment { get { return this.ReviewComment; } }
+
+ ///
+ /// Client for managing review comments.
+ ///
+ public IObservablePullRequestReviewCommentsClient ReviewComment { get; private set; }
public ObservablePullRequestsClient(IGitHubClient client)
{
@@ -26,7 +32,7 @@ public ObservablePullRequestsClient(IGitHubClient client)
_client = client.Repository.PullRequest;
_connection = client.Connection;
- Comment = new ObservablePullRequestReviewCommentsClient(client);
+ ReviewComment = new ObservablePullRequestReviewCommentsClient(client);
}
///
diff --git a/Octokit.Reactive/Clients/ObservableRepositoryCommentsClient.cs b/Octokit.Reactive/Clients/ObservableRepositoryCommentsClient.cs
index e0f2e36e16..7749df06e2 100644
--- a/Octokit.Reactive/Clients/ObservableRepositoryCommentsClient.cs
+++ b/Octokit.Reactive/Clients/ObservableRepositoryCommentsClient.cs
@@ -15,7 +15,7 @@ public class ObservableRepositoryCommentsClient : IObservableRepositoryCommentsC
{
readonly IRepositoryCommentsClient _client;
readonly IConnection _connection;
-
+
public ObservableRepositoryCommentsClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
diff --git a/Octokit.Reactive/Clients/ObservableRepositoryHooksClient.cs b/Octokit.Reactive/Clients/ObservableRepositoryHooksClient.cs
index ea35f3b4f5..5b0268c0db 100644
--- a/Octokit.Reactive/Clients/ObservableRepositoryHooksClient.cs
+++ b/Octokit.Reactive/Clients/ObservableRepositoryHooksClient.cs
@@ -15,7 +15,7 @@ public class ObservableRepositoryHooksClient : IObservableRepositoryHooksClient
{
readonly IRepositoryHooksClient _client;
readonly IConnection _connection;
-
+
public ObservableRepositoryHooksClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
diff --git a/Octokit.Tests.Conventions/ClientConstructorTests.cs b/Octokit.Tests.Conventions/ClientConstructorTests.cs
index b5d0e7a5fb..eadd60d541 100644
--- a/Octokit.Tests.Conventions/ClientConstructorTests.cs
+++ b/Octokit.Tests.Conventions/ClientConstructorTests.cs
@@ -15,7 +15,7 @@ public void CheckTestConstructorNames(Type type)
const string constructorTestMethodName = "EnsuresNonNullArguments";
var classes = new HashSet(type.GetNestedTypes().Select(t => t.Name));
-
+
if (!classes.Contains(constructorTestClassName))
{
throw new MissingClientConstructorTestClassException(type);
diff --git a/Octokit.Tests.Conventions/Exception/ApiOptionsMissingException.cs b/Octokit.Tests.Conventions/Exception/ApiOptionsMissingException.cs
index 61d1111f12..51002dae8e 100644
--- a/Octokit.Tests.Conventions/Exception/ApiOptionsMissingException.cs
+++ b/Octokit.Tests.Conventions/Exception/ApiOptionsMissingException.cs
@@ -8,7 +8,8 @@ namespace Octokit.Tests.Conventions
public class ApiOptionsMissingException : Exception
{
public ApiOptionsMissingException(Type type, IEnumerable methods)
- : base(CreateMessage(type, methods)) { }
+ : base(CreateMessage(type, methods))
+ { }
static string CreateMessage(Type type, IEnumerable methods)
{
diff --git a/Octokit.Tests.Integration/Clients/AssigneesClientTests.cs b/Octokit.Tests.Integration/Clients/AssigneesClientTests.cs
index 8df64aa123..2ebc10d0e3 100644
--- a/Octokit.Tests.Integration/Clients/AssigneesClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/AssigneesClientTests.cs
@@ -1,4 +1,5 @@
-using System.Linq;
+using System.Collections.Generic;
+using System.Linq;
using System.Threading.Tasks;
using Octokit;
using Octokit.Tests.Integration;
@@ -9,6 +10,7 @@ public class AssigneesClientTests
{
readonly IGitHubClient _github;
readonly RepositoryContext _context;
+ readonly IIssuesClient _issuesClient;
public AssigneesClientTests()
{
@@ -53,6 +55,30 @@ public async Task CanListAssignees()
}
[IntegrationTest]
+ public async Task CanAddAndRemoveAssignees()
+ {
+ var newAssignees = new AssigneesUpdate(new List() { _context.RepositoryOwner });
+ var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
+ var issuesClient = _github.Issue;
+
+ var issue = await issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
+
+ Assert.NotNull(issue);
+
+ var addAssignees = await _github.Issue.Assignee.AddAssignees(_context.RepositoryOwner, _context.RepositoryName, issue.Number, newAssignees);
+
+ Assert.IsType(addAssignees);
+
+ //Check if assignee was added to issue
+ Assert.True(addAssignees.Assignees.Any(x => x.Login == _context.RepositoryOwner));
+
+ //Test to remove assignees
+ var removeAssignees = await _github.Issue.Assignee.RemoveAssignees(_context.RepositoryOwner, _context.RepositoryName, issue.Number, newAssignees);
+
+ //Check if assignee was removed
+ Assert.False(removeAssignees.Assignees.Any(x => x.Login == _context.RepositoryOwner));
+ }
+
public async Task CanListAssigneesWithRepositoryId()
{
// Repository owner is always an assignee
diff --git a/Octokit.Tests.Integration/Clients/AuthorizationClientTests.cs b/Octokit.Tests.Integration/Clients/AuthorizationClientTests.cs
index 72ed1ad5cd..3ef380659a 100644
--- a/Octokit.Tests.Integration/Clients/AuthorizationClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/AuthorizationClientTests.cs
@@ -30,7 +30,7 @@ public async Task CanCreatePersonalToken()
public async Task CanGetAuthorization()
{
var github = Helper.GetBasicAuthClient();
-
+
var authorizations = await github.Authorization.GetAll();
Assert.NotEmpty(authorizations);
}
diff --git a/Octokit.Tests.Integration/Clients/DeploymentStatusClientTests.cs b/Octokit.Tests.Integration/Clients/DeploymentStatusClientTests.cs
index 4c6ae33861..bb6ce3aaee 100644
--- a/Octokit.Tests.Integration/Clients/DeploymentStatusClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/DeploymentStatusClientTests.cs
@@ -162,7 +162,7 @@ public async Task ReturnsCorrectCountOfDeploymentStatusesWithStartWithRepository
var newStatus1 = new NewDeploymentStatus(DeploymentState.Success);
var newStatus2 = new NewDeploymentStatus(DeploymentState.Success);
var newStatus3 = new NewDeploymentStatus(DeploymentState.Success);
- await _deploymentsClient.Status.Create(_context.Repository.Id,_deployment.Id, newStatus1);
+ await _deploymentsClient.Status.Create(_context.Repository.Id, _deployment.Id, newStatus1);
await _deploymentsClient.Status.Create(_context.Repository.Id, _deployment.Id, newStatus2);
await _deploymentsClient.Status.Create(_context.Repository.Id, _deployment.Id, newStatus3);
diff --git a/Octokit.Tests.Integration/Clients/EventsClientTests.cs b/Octokit.Tests.Integration/Clients/EventsClientTests.cs
index d8cc1f0c25..e0e8545665 100644
--- a/Octokit.Tests.Integration/Clients/EventsClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/EventsClientTests.cs
@@ -109,7 +109,7 @@ public async Task ReturnsCorrectCountOfEventsWithStartWithRepositoryId()
public async Task ReturnsDistinctEventsBasedOnStartPage()
{
var github = Helper.GetAuthenticatedClient();
-
+
var startOptions = new ApiOptions
{
PageSize = 1,
@@ -134,7 +134,7 @@ public async Task ReturnsDistinctEventsBasedOnStartPage()
public async Task ReturnsDistinctEventsBasedOnStartPageWithRepositoryId()
{
var github = Helper.GetAuthenticatedClient();
-
+
var startOptions = new ApiOptions
{
PageSize = 1,
@@ -158,7 +158,7 @@ public async Task ReturnsDistinctEventsBasedOnStartPageWithRepositoryId()
public class TheGetAllIssuesForRepositoryMethod
{
- [IntegrationTest(Skip = "Fails because of SimpleJsonSerializer, see https://github.com/octokit/octokit.net/issues/1374 for details.")]
+ [IntegrationTest]
public async Task CanListIssues()
{
var github = Helper.GetAuthenticatedClient();
@@ -167,7 +167,7 @@ public async Task CanListIssues()
Assert.NotEmpty(issues);
}
- [IntegrationTest(Skip = "Fails because of SimpleJsonSerializer, see https://github.com/octokit/octokit.net/issues/1374 for details.")]
+ [IntegrationTest]
public async Task CanListIssuesWithRepositoryId()
{
var github = Helper.GetAuthenticatedClient();
@@ -176,7 +176,7 @@ public async Task CanListIssuesWithRepositoryId()
Assert.NotEmpty(issues);
}
- [IntegrationTest(Skip = "Fails because of SimpleJsonSerializer, see https://github.com/octokit/octokit.net/issues/1374 for details.")]
+ [IntegrationTest]
public async Task ReturnsCorrectCountOfEventsWithoutStart()
{
var github = Helper.GetAuthenticatedClient();
@@ -192,7 +192,7 @@ public async Task ReturnsCorrectCountOfEventsWithoutStart()
Assert.Equal(3, eventInfos.Count);
}
- [IntegrationTest(Skip = "Fails because of SimpleJsonSerializer, see https://github.com/octokit/octokit.net/issues/1374 for details.")]
+ [IntegrationTest]
public async Task ReturnsCorrectCountOfEventsWithoutStartWitRepositoryId()
{
var github = Helper.GetAuthenticatedClient();
@@ -208,7 +208,7 @@ public async Task ReturnsCorrectCountOfEventsWithoutStartWitRepositoryId()
Assert.Equal(3, eventInfos.Count);
}
- [IntegrationTest(Skip = "Fails because of SimpleJsonSerializer, see https://github.com/octokit/octokit.net/issues/1374 for details.")]
+ [IntegrationTest]
public async Task ReturnsCorrectCountOfEventsWithStart()
{
var github = Helper.GetAuthenticatedClient();
@@ -225,7 +225,7 @@ public async Task ReturnsCorrectCountOfEventsWithStart()
Assert.Equal(2, eventInfos.Count);
}
- [IntegrationTest(Skip = "Fails because of SimpleJsonSerializer, see https://github.com/octokit/octokit.net/issues/1374 for details.")]
+ [IntegrationTest]
public async Task ReturnsCorrectCountOfEventsWithStartWithRepositoryId()
{
var github = Helper.GetAuthenticatedClient();
@@ -242,7 +242,7 @@ public async Task ReturnsCorrectCountOfEventsWithStartWithRepositoryId()
Assert.Equal(2, eventInfos.Count);
}
- [IntegrationTest(Skip = "Fails because of SimpleJsonSerializer, see https://github.com/octokit/octokit.net/issues/1374 for details.")]
+ [IntegrationTest]
public async Task ReturnsDistinctEventsBasedOnStartPage()
{
var github = Helper.GetAuthenticatedClient();
@@ -267,7 +267,7 @@ public async Task ReturnsDistinctEventsBasedOnStartPage()
Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
}
- [IntegrationTest(Skip = "Fails because of SimpleJsonSerializer, see https://github.com/octokit/octokit.net/issues/1374 for details.")]
+ [IntegrationTest]
public async Task ReturnsDistinctEventsBasedOnStartPageWithRepositoryId()
{
var github = Helper.GetAuthenticatedClient();
diff --git a/Octokit.Tests.Integration/Clients/IssueCommentsClientTests.cs b/Octokit.Tests.Integration/Clients/IssueCommentsClientTests.cs
index 9bb74b1232..168b9c087f 100644
--- a/Octokit.Tests.Integration/Clients/IssueCommentsClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/IssueCommentsClientTests.cs
@@ -13,7 +13,7 @@ public class TheGetMethod
{
readonly IGitHubClient _github;
readonly IIssueCommentsClient _issueCommentsClient;
-
+
const string owner = "octokit";
const string name = "octokit.net";
const int id = 12067722;
@@ -220,7 +220,7 @@ public async Task CanGetReactionPayload()
using (var context = await _github.CreateRepositoryContext(Helper.MakeNameWithTimestamp("IssueCommentsReactionTests")))
{
var commentIds = new List();
-
+
// Create multiple test issues
for (int count = 1; count <= numberToCreate; count++)
{
diff --git a/Octokit.Tests.Integration/Clients/IssueReactionsClientTests.cs b/Octokit.Tests.Integration/Clients/IssueReactionsClientTests.cs
index cb684dbbd2..f4ffbcb31e 100644
--- a/Octokit.Tests.Integration/Clients/IssueReactionsClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/IssueReactionsClientTests.cs
@@ -71,7 +71,7 @@ public async Task CanCreateReaction()
{
var newReaction = new NewReaction(reactionType);
- var reaction = await _github.Reaction.CommitComment.Create(_context.RepositoryOwner, _context.RepositoryName, issue.Id, newReaction);
+ var reaction = await _github.Reaction.Issue.Create(_context.RepositoryOwner, _context.RepositoryName, issue.Number, newReaction);
Assert.IsType(reaction);
Assert.Equal(reactionType, reaction.Content);
diff --git a/Octokit.Tests.Integration/Clients/IssueTimelineClientTests.cs b/Octokit.Tests.Integration/Clients/IssueTimelineClientTests.cs
index af18d72f67..c19148f03a 100644
--- a/Octokit.Tests.Integration/Clients/IssueTimelineClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/IssueTimelineClientTests.cs
@@ -5,7 +5,7 @@
namespace Octokit.Tests.Integration.Clients
{
- public class IssueTimelineClientTests :IDisposable
+ public class IssueTimelineClientTests : IDisposable
{
private readonly IIssueTimelineClient _issueTimelineClient;
private readonly IIssuesClient _issuesClient;
@@ -86,7 +86,7 @@ public async Task CanDeserializeCrossReferenceEvent()
var timelineEventInfos = await _issueTimelineClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
Assert.Equal(1, timelineEventInfos.Count);
- Assert.Equal(anotherNewIssue.Id, timelineEventInfos[0].Source.Id);
+ Assert.Equal(anotherNewIssue.Id, timelineEventInfos[0].Source.Issue.Id);
}
[IntegrationTest]
@@ -133,7 +133,7 @@ public async Task CanDeserializeCrossReferenceEventByRepositoryId()
var timelineEventInfos = await _issueTimelineClient.GetAllForIssue(_context.Repository.Id, issue.Number);
Assert.Equal(1, timelineEventInfos.Count);
- Assert.Equal(anotherNewIssue.Id, timelineEventInfos[0].Source.Id);
+ Assert.Equal(anotherNewIssue.Id, timelineEventInfos[0].Source.Issue.Id);
}
public void Dispose()
diff --git a/Octokit.Tests.Integration/Clients/IssuesClientTests.cs b/Octokit.Tests.Integration/Clients/IssuesClientTests.cs
index 205d99d969..eeafb095cd 100644
--- a/Octokit.Tests.Integration/Clients/IssuesClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/IssuesClientTests.cs
@@ -98,7 +98,7 @@ public async Task ReturnsPageOfIssuesForARepositoryWithStartPage()
var options = new ApiOptions
{
PageSize = 5,
- PageCount = 1,
+ PageCount = 1,
StartPage = 2
};
@@ -186,20 +186,30 @@ public async Task ReturnsPageOfIssuesFromStartForARepositoryWithRepositoryId()
public async Task CanCreateRetrieveAndCloseIssue()
{
var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" };
+ newIssue.Labels.Add("test");
+ newIssue.Assignees.Add(_context.RepositoryOwner);
+
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
try
{
Assert.NotNull(issue);
+ Assert.True(issue.Assignees.All(x => x.Login == _context.RepositoryOwner));
var retrieved = await _issuesClient.Get(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
- var all = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName);
Assert.NotNull(retrieved);
+ Assert.True(retrieved.Assignees.Count == 1);
+ Assert.True(retrieved.Assignees[0].Login == _context.RepositoryOwner);
+ var all = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName);
Assert.True(all.Any(i => i.Number == retrieved.Number));
+ Assert.True(all.Any(i => i.Assignees.Count == 1));
+ Assert.True(all.Any(i => i.Assignees[0].Login == _context.RepositoryOwner));
}
finally
{
var closed = _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new IssueUpdate { State = ItemState.Closed }).Result;
Assert.NotNull(closed);
+ Assert.Equal(1, closed.Assignees.Count);
+ Assert.Equal(_context.RepositoryOwner, closed.Assignees[0].Login);
}
}
@@ -568,6 +578,28 @@ public async Task CanRetrieveAllIssues()
Assert.True(retrieved.Any(i => i.Number == issue4.Number));
}
+ [IntegrationTest]
+ public async Task CanRetrieveIssueWithMultipleAssignees()
+ {
+ var issue = await _issuesClient.Get("octokit", "octokit.net", 1171);
+
+ Assert.Equal(2, issue.Assignees.Count);
+ }
+
+ [IntegrationTest]
+ public async Task CanRetrieveIssuesWithMultipleAssignees()
+ {
+ var newIssue1 = new NewIssue("A test issue1") { Body = "A new unassigned issue" };
+ var issue1 = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue1);
+
+ await _issuesClient.Assignee.AddAssignees(_context.RepositoryOwner, _context.RepositoryName, issue1.Number, new AssigneesUpdate(new List() { _context.RepositoryOwner }));
+
+ var request = new RepositoryIssueRequest { State = ItemStateFilter.All };
+ var issues = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, request);
+
+ Assert.True(issues.Any(x => x.Assignees.Count > 0));
+ }
+
[IntegrationTest]
public async Task CanRetrieveAllIssuesReturnsDistinctReulstsBasedOnApiOptions()
{
@@ -634,9 +666,11 @@ public async Task CanRetrieveAllIssuesWithRepositoryId()
[IntegrationTest]
public async Task CanFilterByAssigned()
{
- var newIssue1 = new NewIssue("An assigned issue") { Body = "Assigning this to myself", Assignee = _context.RepositoryOwner };
- var newIssue2 = new NewIssue("An unassigned issue") { Body = "A new unassigned issue" };
+ var newIssue1 = new NewIssue("An assigned issue") { Body = "Assigning this to myself" };
+ newIssue1.Assignees.Add(_context.RepositoryOwner);
await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue1);
+
+ var newIssue2 = new NewIssue("An unassigned issue") { Body = "A new unassigned issue" };
await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue2);
var allIssues = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName,
@@ -660,9 +694,11 @@ public async Task CanFilterByAssigned()
[IntegrationTest]
public async Task CanFilterByAssignedWithRepositoryId()
{
- var newIssue1 = new NewIssue("An assigned issue") { Body = "Assigning this to myself", Assignee = _context.RepositoryOwner };
- var newIssue2 = new NewIssue("An unassigned issue") { Body = "A new unassigned issue" };
+ var newIssue1 = new NewIssue("An assigned issue") { Body = "Assigning this to myself" };
+ newIssue1.Assignees.Add(_context.RepositoryOwner);
await _issuesClient.Create(_context.Repository.Id, newIssue1);
+
+ var newIssue2 = new NewIssue("An unassigned issue") { Body = "A new unassigned issue" };
await _issuesClient.Create(_context.Repository.Id, newIssue2);
var allIssues = await _issuesClient.GetAllForRepository(_context.Repository.Id,
@@ -881,6 +917,44 @@ public async Task DoesNotChangeLabelsByDefaultWithRepositoryId()
Assert.Equal(1, updatedIssue.Labels.Count);
}
+ [IntegrationTest]
+ public async Task DoesNotChangeEmptyLabelsByDefault()
+ {
+ await _issuesClient.Labels.Create(_context.RepositoryOwner, _context.RepositoryName, new NewLabel("something", "FF0000"));
+
+ var newIssue = new NewIssue("A test issue1")
+ {
+ Body = "A new unassigned issue"
+ };
+
+ var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
+
+ var issueUpdate = issue.ToUpdate();
+
+ var updatedIssue = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, issueUpdate);
+
+ Assert.Empty(updatedIssue.Labels);
+ }
+
+ [IntegrationTest]
+ public async Task DoesNotChangeEmptyLabelsByDefaultWithRepositoryId()
+ {
+ await _issuesClient.Labels.Create(_context.RepositoryOwner, _context.RepositoryName, new NewLabel("something", "FF0000"));
+
+ var newIssue = new NewIssue("A test issue1")
+ {
+ Body = "A new unassigned issue"
+ };
+
+ var issue = await _issuesClient.Create(_context.Repository.Id, newIssue);
+
+ var issueUpdate = issue.ToUpdate();
+
+ var updatedIssue = await _issuesClient.Update(_context.Repository.Id, issue.Number, issueUpdate);
+
+ Assert.Empty(updatedIssue.Labels);
+ }
+
[IntegrationTest]
public async Task CanUpdateLabelForAnIssue()
{
@@ -985,6 +1059,162 @@ public async Task CanClearLabelsForAnIssueWithRepositoryId()
Assert.Empty(updatedIssue.Labels);
}
+ [IntegrationTest]
+ public async Task DoesNotChangeAssigneesByDefault()
+ {
+ var newIssue = new NewIssue("A test issue1")
+ {
+ Body = "A new unassigned issue"
+ };
+ newIssue.Assignees.Add(_context.RepositoryOwner);
+
+ var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
+
+ var issueUpdate = issue.ToUpdate();
+
+ var updatedIssue = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, issueUpdate);
+
+ Assert.Equal(1, updatedIssue.Assignees.Count);
+ Assert.Equal(_context.RepositoryOwner, updatedIssue.Assignees[0].Login);
+ }
+
+ [IntegrationTest]
+ public async Task DoesNotChangeAssigneesByDefaultWithRepositoryId()
+ {
+ var newIssue = new NewIssue("A test issue1")
+ {
+ Body = "A new unassigned issue"
+ };
+ newIssue.Assignees.Add(_context.RepositoryOwner);
+
+ var issue = await _issuesClient.Create(_context.Repository.Id, newIssue);
+
+ var issueUpdate = issue.ToUpdate();
+
+ var updatedIssue = await _issuesClient.Update(_context.Repository.Id, issue.Number, issueUpdate);
+
+ Assert.Equal(1, updatedIssue.Assignees.Count);
+ Assert.Equal(_context.RepositoryOwner, updatedIssue.Assignees[0].Login);
+ }
+
+ [IntegrationTest]
+ public async Task DoesNotChangeEmptyAssigneesByDefault()
+ {
+ var newIssue = new NewIssue("A test issue1")
+ {
+ Body = "A new unassigned issue"
+ };
+
+ var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
+
+ var issueUpdate = issue.ToUpdate();
+
+ var updatedIssue = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, issueUpdate);
+
+ Assert.Empty(updatedIssue.Assignees);
+ }
+
+ [IntegrationTest]
+ public async Task DoesNotChangeEmptyAssigneesByDefaultWithRepositoryId()
+ {
+ var newIssue = new NewIssue("A test issue1")
+ {
+ Body = "A new unassigned issue"
+ };
+
+ var issue = await _issuesClient.Create(_context.Repository.Id, newIssue);
+
+ var issueUpdate = issue.ToUpdate();
+
+ var updatedIssue = await _issuesClient.Update(_context.Repository.Id, issue.Number, issueUpdate);
+
+ Assert.Empty(updatedIssue.Assignees);
+ }
+
+ [IntegrationTest]
+ public async Task CanUpdateAssigneeForAnIssue()
+ {
+ // setup us the issue
+ var newIssue = new NewIssue("A test issue1")
+ {
+ Body = "A new unassigned issue"
+ };
+
+ var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
+
+ // update the issue
+ var issueUpdate = issue.ToUpdate();
+ issueUpdate.AddAssignee(_context.RepositoryOwner);
+
+ var updatedIssue = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, issueUpdate);
+
+ Assert.Equal(_context.RepositoryOwner, updatedIssue.Assignees[0].Login);
+ }
+
+ [IntegrationTest]
+ public async Task CanUpdateAssigneeForAnIssueWithRepositoryId()
+ {
+ // setup us the issue
+ var newIssue = new NewIssue("A test issue1")
+ {
+ Body = "A new unassigned issue"
+ };
+
+ var issue = await _issuesClient.Create(_context.Repository.Id, newIssue);
+
+ // update the issue
+ var issueUpdate = issue.ToUpdate();
+ issueUpdate.AddAssignee(_context.RepositoryOwner);
+
+ var updatedIssue = await _issuesClient.Update(_context.Repository.Id, issue.Number, issueUpdate);
+
+ Assert.Equal(_context.RepositoryOwner, updatedIssue.Assignees[0].Login);
+ }
+
+ [IntegrationTest]
+ public async Task CanClearAssigneesForAnIssue()
+ {
+ // setup us the issue
+ var newIssue = new NewIssue("A test issue1")
+ {
+ Body = "A new unassigned issue"
+ };
+ newIssue.Assignees.Add(_context.RepositoryOwner);
+
+ var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
+ Assert.Equal(1, issue.Assignees.Count);
+
+ // update the issue
+ var issueUpdate = issue.ToUpdate();
+ issueUpdate.ClearAssignees();
+
+ var updatedIssue = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, issueUpdate);
+
+ Assert.Empty(updatedIssue.Assignees);
+ }
+
+ [IntegrationTest]
+ public async Task CanClearAssigneesForAnIssueWithRepositoryId()
+ {
+ // setup us the issue
+ var newIssue = new NewIssue("A test issue1")
+ {
+ Body = "A new unassigned issue"
+ };
+ newIssue.Assignees.Add(_context.RepositoryOwner);
+
+ var issue = await _issuesClient.Create(_context.Repository.Id, newIssue);
+ Assert.Equal(1, issue.Assignees.Count);
+
+ // update the issue
+ var issueUpdate = issue.ToUpdate();
+ issueUpdate.ClearAssignees();
+
+ var updatedIssue = await _issuesClient.Update(_context.Repository.Id, issue.Number, issueUpdate);
+
+ Assert.Empty(updatedIssue.Assignees);
+ }
+
[IntegrationTest]
public async Task CanAccessUrls()
{
diff --git a/Octokit.Tests.Integration/Clients/IssuesLabelsClientTests.cs b/Octokit.Tests.Integration/Clients/IssuesLabelsClientTests.cs
index b025fc5544..dd43dc9658 100644
--- a/Octokit.Tests.Integration/Clients/IssuesLabelsClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/IssuesLabelsClientTests.cs
@@ -139,14 +139,14 @@ public async Task ReturnsCorrectCountOfIssueLabelsWithStartForAnIssue()
for (int i = 0; i < 2; i++)
{
- var label = await _issuesLabelsClient.Create(_context.RepositoryOwner, _context.RepositoryName, new NewLabel("test label " + (i + 1), "FFFFF" + (i+1)));
+ var label = await _issuesLabelsClient.Create(_context.RepositoryOwner, _context.RepositoryName, new NewLabel("test label " + (i + 1), "FFFFF" + (i + 1)));
labels.Add(label);
issueUpdate.AddLabel(label.Name);
}
var issueLabelsInfo = await _issuesLabelsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
Assert.Empty(issueLabelsInfo);
-
+
var updated = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, issueUpdate);
Assert.NotNull(updated);
@@ -173,14 +173,14 @@ public async Task ReturnsCorrectCountOfIssueLabelsWithStartForAnIssueWithReposit
for (int i = 0; i < 2; i++)
{
- var label = await _issuesLabelsClient.Create(_context.Repository.Id, new NewLabel("test label " + (i + 1), "FFFFF" + (i+1)));
+ var label = await _issuesLabelsClient.Create(_context.Repository.Id, new NewLabel("test label " + (i + 1), "FFFFF" + (i + 1)));
labels.Add(label);
issueUpdate.AddLabel(label.Name);
}
var issueLabelsInfo = await _issuesLabelsClient.GetAllForIssue(_context.Repository.Id, issue.Number);
Assert.Empty(issueLabelsInfo);
-
+
var updated = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, issueUpdate);
Assert.NotNull(updated);
@@ -202,7 +202,7 @@ public async Task ReturnsDistinctIssueLabelsBasedOnStartPageForAnIssue()
{
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, new NewIssue("A test issue") { Body = "A new unassigned issue" });
var issueUpdate = new IssueUpdate();
-
+
for (int i = 0; i < 2; i++)
{
var label = await _issuesLabelsClient.Create(_context.RepositoryOwner, _context.RepositoryName, new NewLabel("test label " + (i + 1), "FFFFF" + (i + 1)));
@@ -243,7 +243,7 @@ public async Task ReturnsDistinctIssueLabelsBasedOnStartPageForAnIssueWithReposi
{
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, new NewIssue("A test issue") { Body = "A new unassigned issue" });
var issueUpdate = new IssueUpdate();
-
+
for (int i = 0; i < 2; i++)
{
var label = await _issuesLabelsClient.Create(_context.Repository.Id, new NewLabel("test label " + (i + 1), "FFFFF" + (i + 1)));
@@ -521,7 +521,7 @@ public async Task CanListLabelsForAnMilestone()
var label = await _issuesLabelsClient.Create(_context.RepositoryOwner, _context.RepositoryName, newLabel);
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
var milestone = await _issuesClient.Milestone.Create(_context.RepositoryOwner, _context.RepositoryName, newMilestone);
-
+
var issueLabelsInfo = await _issuesLabelsClient.GetAllForMilestone(_context.RepositoryOwner, _context.RepositoryName, milestone.Number);
Assert.Empty(issueLabelsInfo);
@@ -547,7 +547,7 @@ public async Task CanListLabelsForAnMilestoneWithRepositoryId()
var label = await _issuesLabelsClient.Create(_context.Repository.Id, newLabel);
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
var milestone = await _issuesClient.Milestone.Create(_context.RepositoryOwner, _context.RepositoryName, newMilestone);
-
+
var issueLabelsInfo = await _issuesLabelsClient.GetAllForMilestone(_context.Repository.Id, milestone.Number);
Assert.Empty(issueLabelsInfo);
@@ -853,7 +853,7 @@ public async Task CanAddToIssue()
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
Assert.NotNull(issue);
- await _issuesLabelsClient.AddToIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new []{ label.Name });
+ await _issuesLabelsClient.AddToIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new[] { label.Name });
var labels = await _issuesLabelsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
@@ -895,7 +895,7 @@ public async Task CanRemoveAllFromIssue()
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
Assert.NotNull(issue);
- await _issuesLabelsClient.AddToIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new []{ label.Name });
+ await _issuesLabelsClient.AddToIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new[] { label.Name });
await _issuesLabelsClient.RemoveAllFromIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
var labels = await _issuesLabelsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
@@ -935,7 +935,7 @@ public async Task CanRemoveFromIssue()
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
Assert.NotNull(issue);
- await _issuesLabelsClient.AddToIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new []{ label.Name });
+ await _issuesLabelsClient.AddToIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new[] { label.Name });
await _issuesLabelsClient.RemoveFromIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, label.Name);
var labels = await _issuesLabelsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
@@ -978,7 +978,7 @@ public async Task CanReplaceAllForIssue()
var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue1);
Assert.NotNull(issue);
- await _issuesLabelsClient.AddToIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new []{ label1.Name });
+ await _issuesLabelsClient.AddToIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new[] { label1.Name });
await _issuesLabelsClient.ReplaceAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number, new[] { label2.Name });
var labels = await _issuesLabelsClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
diff --git a/Octokit.Tests.Integration/Clients/MigrationsClientTests.cs b/Octokit.Tests.Integration/Clients/MigrationsClientTests.cs
index 8c43c03dd9..3ed7d8bd09 100644
--- a/Octokit.Tests.Integration/Clients/MigrationsClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/MigrationsClientTests.cs
@@ -81,11 +81,11 @@ public async Task CanGetArchive()
{
while (!isExported)
{
- Thread.Sleep(2000);
+ Thread.Sleep(2000);
}
var contents = await _gitHub.Migration.Migrations.GetArchive(_orgName, _migrationContext.Id);
-
+
Assert.NotEmpty(contents);
}
@@ -127,6 +127,6 @@ async Task ChecksMigrationCompletion()
public void Dispose()
{
- _repos.ForEach( (repo) => repo.Dispose() );
+ _repos.ForEach((repo) => repo.Dispose());
}
}
diff --git a/Octokit.Tests.Integration/Clients/MilestonesClientTests.cs b/Octokit.Tests.Integration/Clients/MilestonesClientTests.cs
index 7952c0e49d..9624336dae 100644
--- a/Octokit.Tests.Integration/Clients/MilestonesClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/MilestonesClientTests.cs
@@ -94,7 +94,7 @@ public async Task CanUpdateOneMilestoneWithRepositoryId()
var result1 = await _milestonesClient.Get(_context.Repository.Id, created.Number);
Assert.Equal("a milestone", result1.Title);
- await _milestonesClient.Update(_context.Repository.Id, created.Number, new MilestoneUpdate {Title = "New title"});
+ await _milestonesClient.Update(_context.Repository.Id, created.Number, new MilestoneUpdate { Title = "New title" });
var result2 = await _milestonesClient.Get(_context.Repository.Id, created.Number);
Assert.Equal("New title", result2.Title);
@@ -315,7 +315,7 @@ public async Task ReturnsDistinctResultsBasedOnStartPage()
await _milestonesClient.Create(_context.RepositoryOwner, _context.RepositoryName, milestone1);
await _milestonesClient.Create(_context.RepositoryOwner, _context.RepositoryName, milestone2);
await _milestonesClient.Create(_context.RepositoryOwner, _context.RepositoryName, milestone3);
-
+
var startOptions = new ApiOptions
{
PageSize = 1,
@@ -345,7 +345,7 @@ public async Task ReturnsDistinctResultsBasedOnStartPageWithRepositoryId()
await _milestonesClient.Create(_context.RepositoryOwner, _context.RepositoryName, milestone1);
await _milestonesClient.Create(_context.RepositoryOwner, _context.RepositoryName, milestone2);
await _milestonesClient.Create(_context.RepositoryOwner, _context.RepositoryName, milestone3);
-
+
var startOptions = new ApiOptions
{
PageSize = 1,
@@ -486,7 +486,7 @@ public async Task ReturnsDistinctResultsBasedOnStartPageParametrized()
PageCount = 1,
StartPage = 2
};
-
+
var secondPage = await _milestonesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, milestoneRequest, skipStartOptions);
Assert.NotEqual(firstPage[0].Number, secondPage[0].Number);
@@ -518,7 +518,7 @@ public async Task ReturnsDistinctResultsBasedOnStartPageParametrizedWithReposito
PageCount = 1,
StartPage = 2
};
-
+
var secondPage = await _milestonesClient.GetAllForRepository(_context.Repository.Id, milestoneRequest, skipStartOptions);
Assert.NotEqual(firstPage[0].Number, secondPage[0].Number);
diff --git a/Octokit.Tests.Integration/Clients/OrganizationClientTests.cs b/Octokit.Tests.Integration/Clients/OrganizationClientTests.cs
index 5577f15449..1ca0e804c9 100644
--- a/Octokit.Tests.Integration/Clients/OrganizationClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/OrganizationClientTests.cs
@@ -1,4 +1,5 @@
-using System.Threading.Tasks;
+using System.Collections;
+using System.Threading.Tasks;
using Xunit;
namespace Octokit.Tests.Integration.Clients
@@ -18,30 +19,88 @@ public TheGetAllMethod()
}
[GitHubEnterpriseTest]
- public async Task CanListOrganizations()
+ public async Task CanListAllOrganizations()
+ {
+ string orgLogin1 = Helper.MakeNameWithTimestamp("MyOrganization1");
+ string orgName1 = string.Concat(orgLogin1, " Display Name 1");
+ string orgLogin2 = Helper.MakeNameWithTimestamp("MyOrganization2");
+ string orgName2 = string.Concat(orgLogin2, " Display Name 2");
+
+ var newOrganization1 = new NewOrganization(orgLogin1, EnterpriseHelper.UserName, orgName1);
+ var newOrganization2 = new NewOrganization(orgLogin2, EnterpriseHelper.UserName, orgName2);
+ await _github.Enterprise.Organization.Create(newOrganization1);
+ await _github.Enterprise.Organization.Create(newOrganization2);
+
+ var organizations = await _organizationsClient.GetAll();
+
+ Assert.Contains(organizations, (org => org.Login == orgLogin1));
+ Assert.Contains(organizations, (org => org.Login == orgLogin2));
+ }
+
+ [GitHubEnterpriseTest]
+ public async Task ReturnsCorrectOrganizationsWithSince()
+ {
+ string orgLogin1 = Helper.MakeNameWithTimestamp("MyOrganization1");
+ string orgName1 = string.Concat(orgLogin1, " Display Name 1");
+ string orgLogin2 = Helper.MakeNameWithTimestamp("MyOrganization2");
+ string orgName2 = string.Concat(orgLogin2, " Display Name 2");
+ string orgLogin3 = Helper.MakeNameWithTimestamp("MyOrganization3");
+ string orgName3 = string.Concat(orgLogin3, " Display Name 3");
+
+ var newOrganization1 = new NewOrganization(orgLogin1, EnterpriseHelper.UserName, orgName1);
+ var newOrganization2 = new NewOrganization(orgLogin2, EnterpriseHelper.UserName, orgName2);
+ var newOrganization3 = new NewOrganization(orgLogin3, EnterpriseHelper.UserName, orgName3);
+
+ var createdOrganization1 = await _github.Enterprise.Organization.Create(newOrganization1);
+ var createdOrganization2 = await _github.Enterprise.Organization.Create(newOrganization2);
+ var createdOrganization3 = await _github.Enterprise.Organization.Create(newOrganization3);
+
+ var requestParameter = new OrganizationRequest(createdOrganization1.Id);
+
+ var organizations = await _organizationsClient.GetAll(requestParameter);
+
+ Assert.DoesNotContain(organizations, (org => org.Login == orgLogin1));
+ Assert.Contains(organizations, (org => org.Login == orgLogin2));
+ Assert.Contains(organizations, (org => org.Login == orgLogin3));
+ }
+ }
+
+ public class TheGetAllForCurrentMethod
+ {
+ readonly IGitHubClient _github;
+ readonly IOrganizationsClient _organizationsClient;
+
+ public TheGetAllForCurrentMethod()
+ {
+ _github = EnterpriseHelper.GetAuthenticatedClient();
+
+ _organizationsClient = _github.Organization;
+ }
+
+ [GitHubEnterpriseTest]
+ public async Task CanListUserOrganizations()
{
string orgLogin = Helper.MakeNameWithTimestamp("MyOrganization");
string orgName = string.Concat(orgLogin, " Display Name");
var newOrganization = new NewOrganization(orgLogin, EnterpriseHelper.UserName, orgName);
- var organization = await
- _github.Enterprise.Organization.Create(newOrganization);
+ var organization = await _github.Enterprise.Organization.Create(newOrganization);
Assert.NotNull(organization);
- var milestones = await _organizationsClient.GetAllForCurrent();
+ var organizations = await _organizationsClient.GetAllForCurrent();
- Assert.NotEmpty(milestones);
+ Assert.NotEmpty(organizations);
}
[GitHubEnterpriseTest]
- public async Task ReturnsCorrectCountOfOrganizationsWithoutStart()
+ public async Task ReturnsCorrectCountOfUserOrganizationsWithoutStart()
{
string orgLogin1 = Helper.MakeNameWithTimestamp("MyOrganization1");
string orgName1 = string.Concat(orgLogin1, " Display Name 1");
string orgLogin2 = Helper.MakeNameWithTimestamp("MyOrganization2");
string orgName2 = string.Concat(orgLogin2, " Display Name 2");
-
+
var newOrganization1 = new NewOrganization(orgLogin1, EnterpriseHelper.UserName, orgName1);
var newOrganization2 = new NewOrganization(orgLogin2, EnterpriseHelper.UserName, orgName2);
await _github.Enterprise.Organization.Create(newOrganization1);
@@ -59,7 +118,7 @@ public async Task ReturnsCorrectCountOfOrganizationsWithoutStart()
}
[GitHubEnterpriseTest]
- public async Task ReturnsCorrectCountOfOrganizationsWithStart()
+ public async Task ReturnsCorrectCountOfUserOrganizationsWithStart()
{
string orgLogin1 = Helper.MakeNameWithTimestamp("MyOrganization1");
string orgName1 = string.Concat(orgLogin1, " Display Name 1");
diff --git a/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs b/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs
index 5e3d4c561f..63ea01b0c2 100644
--- a/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs
@@ -20,7 +20,7 @@ public TheGetAllMethod()
[IntegrationTest]
public async Task ReturnsMembers()
{
- var members = await
+ var members = await
_gitHub.Organization.Member.GetAll(_organizationFixture);
Assert.NotEmpty(members);
}
@@ -35,7 +35,7 @@ public async Task ReturnsCorrectCountOfMembersWithoutStart()
};
var members = await _gitHub.Organization.Member.GetAll(_organizationFixture, options);
-
+
Assert.Equal(1, members.Count);
}
diff --git a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs
index 92f21dc963..4044adde88 100644
--- a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentReactionsClientTests.cs
@@ -20,7 +20,7 @@ public PullRequestReviewCommentReactionsClientTests()
{
_github = Helper.GetAuthenticatedClient();
- _client = _github.PullRequest.Comment;
+ _client = _github.PullRequest.ReviewComment;
// We'll create a pull request that can be used by most tests
_context = _github.CreateRepositoryContext("test-repo").Result;
diff --git a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs
index 86c9c14ad7..19255e9bb6 100644
--- a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs
@@ -20,7 +20,7 @@ public PullRequestReviewCommentsClientTests()
{
_github = Helper.GetAuthenticatedClient();
- _client = _github.PullRequest.Comment;
+ _client = _github.PullRequest.ReviewComment;
// We'll create a pull request that can be used by most tests
_context = _github.CreateRepositoryContext("test-repo").Result;
@@ -406,7 +406,6 @@ public async Task CanGetForRepositoryWithRepositoryId()
var pullRequestComments = await _client.GetAllForRepository(_context.Repository.Id);
AssertComments(pullRequestComments, commentsToCreate, position);
-
}
[IntegrationTest]
@@ -855,7 +854,7 @@ async Task CreatePullRequest(RepositoryContext context, string
var repoName = context.RepositoryName;
-
+
// Creating a commit in master
var createdCommitInMaster = await CreateCommit(repoName, "Hello World!", "README.md", "heads/master", "A master commit message");
diff --git a/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs
index 426c9152b2..80afe81b67 100644
--- a/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs
@@ -59,6 +59,7 @@ public async Task CanGetForRepository()
Assert.Equal(1, pullRequests.Count);
Assert.Equal(result.Title, pullRequests[0].Title);
+ Assert.True(pullRequests[0].Id > 0);
}
[IntegrationTest]
@@ -75,6 +76,52 @@ public async Task CanGetForRepositoryWithRepositoryId()
Assert.Equal(result.Title, pullRequests[0].Title);
}
+ [IntegrationTest]
+ public async Task CanGetWithAssigneesForRepository()
+ {
+ await CreateTheWorld();
+
+ var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
+ var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest);
+
+ // Add an assignee
+ var issueUpdate = new IssueUpdate();
+ issueUpdate.AddAssignee(Helper.UserName);
+ await _github.Issue.Update(Helper.UserName, _context.RepositoryName, result.Number, issueUpdate);
+
+ // Retrieve the Pull Requests
+ var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName);
+
+ Assert.Equal(1, pullRequests.Count);
+ Assert.Equal(result.Title, pullRequests[0].Title);
+ Assert.Equal(Helper.UserName, pullRequests[0].Assignee.Login);
+ Assert.Equal(1, pullRequests[0].Assignees.Count);
+ Assert.True(pullRequests[0].Assignees.Any(x => x.Login == Helper.UserName));
+ }
+
+ [IntegrationTest]
+ public async Task CanGetWithAssigneesForRepositoryWithRepositoryId()
+ {
+ await CreateTheWorld();
+
+ var newPullRequest = new NewPullRequest("a pull request", branchName, "master");
+ var result = await _fixture.Create(_context.Repository.Id, newPullRequest);
+
+ // Add an assignee
+ var issueUpdate = new IssueUpdate();
+ issueUpdate.AddAssignee(Helper.UserName);
+ await _github.Issue.Update(_context.Repository.Id, result.Number, issueUpdate);
+
+ // Retrieve the Pull Requests
+ var pullRequests = await _fixture.GetAllForRepository(_context.Repository.Id);
+
+ Assert.Equal(1, pullRequests.Count);
+ Assert.Equal(result.Title, pullRequests[0].Title);
+ Assert.Equal(Helper.UserName, pullRequests[0].Assignee.Login);
+ Assert.Equal(1, pullRequests[0].Assignees.Count);
+ Assert.True(pullRequests[0].Assignees.Any(x => x.Login == Helper.UserName));
+ }
+
[IntegrationTest]
public async Task ReturnsCorrectCountOfPullRequestsWithoutStart()
{
diff --git a/Octokit.Tests.Integration/Clients/ReleasesClientTests.cs b/Octokit.Tests.Integration/Clients/ReleasesClientTests.cs
index 28f1fd3889..7104612f37 100644
--- a/Octokit.Tests.Integration/Clients/ReleasesClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/ReleasesClientTests.cs
@@ -836,7 +836,7 @@ public async Task CanDelete()
await _releaseClient.Delete(_context.RepositoryOwner, _context.RepositoryName, createdRelease.Id);
- Assert.ThrowsAsync(async ()=> await _releaseClient.Get(_context.RepositoryOwner, _context.RepositoryName, createdRelease.Id));
+ Assert.ThrowsAsync(async () => await _releaseClient.Get(_context.RepositoryOwner, _context.RepositoryName, createdRelease.Id));
}
[IntegrationTest]
diff --git a/Octokit.Tests.Integration/Clients/RepositoriesClientTests.cs b/Octokit.Tests.Integration/Clients/RepositoriesClientTests.cs
index 927326b90e..6979d22ad1 100644
--- a/Octokit.Tests.Integration/Clients/RepositoriesClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/RepositoriesClientTests.cs
@@ -231,7 +231,7 @@ public async Task ThrowsRepositoryExistsExceptionForExistingRepository()
}
}
- [PaidAccountTest(Skip="Paid plans now have unlimited repositories. We shouldn't test this now.")]
+ [PaidAccountTest(Skip = "Paid plans now have unlimited repositories. We shouldn't test this now.")]
public async Task ThrowsPrivateRepositoryQuotaExceededExceptionWhenOverQuota()
{
var github = Helper.GetAuthenticatedClient();
@@ -782,7 +782,7 @@ public class TheGetAllForOrgMethod
public async Task ReturnsRepositoriesForOrganization()
{
var github = Helper.GetAuthenticatedClient();
-
+
var options = new ApiOptions
{
PageSize = 20,
@@ -1134,7 +1134,7 @@ public async Task GetsPagesOfContributorsIncludeAnonymous()
PageCount = 1
};
- var firstPage = await github.Repository.GetAllContributors("ruby", "ruby", true, firstPageOptions);
+ var firstPage = await github.Repository.GetAllContributors("ruby", "ruby", true, firstPageOptions);
var secondPageOptions = new ApiOptions
{
@@ -1646,7 +1646,7 @@ public async Task GetsABranchWithRepositoryId()
public class TheGetAllTeamsMethod
{
- [IntegrationTest(Skip="Test requires administration rights to access this endpoint")]
+ [IntegrationTest(Skip = "Test requires administration rights to access this endpoint")]
public async Task GetsAllTeams()
{
var github = Helper.GetAuthenticatedClient();
@@ -1656,7 +1656,7 @@ public async Task GetsAllTeams()
Assert.NotEmpty(branches);
}
- [IntegrationTest(Skip="Test requires administration rights to access this endpoint")]
+ [IntegrationTest(Skip = "Test requires administration rights to access this endpoint")]
public async Task GetsAllTeamsWithRepositoryId()
{
var github = Helper.GetAuthenticatedClient();
diff --git a/Octokit.Tests.Integration/Clients/RepositoryBranchesClientTests.cs b/Octokit.Tests.Integration/Clients/RepositoryBranchesClientTests.cs
index b59b6e4120..5e300efeba 100644
--- a/Octokit.Tests.Integration/Clients/RepositoryBranchesClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/RepositoryBranchesClientTests.cs
@@ -683,7 +683,7 @@ public async Task DeletesRequiredStatusChecksWithRepositoryId()
public class TheGetRequiredStatusChecksContextsMethod : IDisposable
{
IRepositoryBranchesClient _client;
- RepositoryContext _userRepoContext;
+ RepositoryContext _userRepoContext;
public TheGetRequiredStatusChecksContextsMethod()
{
@@ -741,7 +741,7 @@ public async Task UpdateRequiredStatusChecksContexts()
var repoName = _userRepoContext.RepositoryName;
var update = new List() { "build2" };
var requiredStatusChecksContexts = await _client.UpdateRequiredStatusChecksContexts(repoOwner, repoName, "master", update);
-
+
Assert.Equal(1, requiredStatusChecksContexts.Count);
}
@@ -867,7 +867,7 @@ public async Task GetsRequirProtectedBranchRestrictionsForOrgRepo()
var repoOwner = _orgRepoContext.RepositoryContext.RepositoryOwner;
var repoName = _orgRepoContext.RepositoryContext.RepositoryName;
var restrictions = await _client.GetProtectedBranchRestrictions(repoOwner, repoName, "master");
-
+
Assert.Equal(1, restrictions.Teams.Count);
Assert.Equal(0, restrictions.Users.Count);
}
@@ -877,7 +877,7 @@ public async Task GetsProtectedBranchRestrictionsForOrgRepoWithRepositoryId()
{
var repoId = _orgRepoContext.RepositoryContext.RepositoryId;
var restrictions = await _client.GetProtectedBranchRestrictions(repoId, "master");
-
+
Assert.Equal(1, restrictions.Teams.Count);
Assert.Equal(0, restrictions.Users.Count);
}
diff --git a/Octokit.Tests.Integration/Clients/RepositoryCommentsClientTests.cs b/Octokit.Tests.Integration/Clients/RepositoryCommentsClientTests.cs
index 47266a4893..aaccd9dfe1 100644
--- a/Octokit.Tests.Integration/Clients/RepositoryCommentsClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/RepositoryCommentsClientTests.cs
@@ -499,7 +499,7 @@ public async Task CanGetReactionPayload()
{
var newReaction = new NewReaction(reactionType);
- var reaction = await _github.Reaction.Issue.Create(_context.RepositoryOwner, _context.RepositoryName, result.Id, newReaction);
+ var reaction = await _github.Reaction.CommitComment.Create(_context.RepositoryOwner, _context.RepositoryName, result.Id, newReaction);
Assert.IsType(reaction);
Assert.Equal(reactionType, reaction.Content);
diff --git a/Octokit.Tests.Integration/Clients/RepositoryContentsClientTests.cs b/Octokit.Tests.Integration/Clients/RepositoryContentsClientTests.cs
index 2cc8cf7013..e1d70edfa0 100644
--- a/Octokit.Tests.Integration/Clients/RepositoryContentsClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/RepositoryContentsClientTests.cs
@@ -469,6 +469,182 @@ await Assert.ThrowsAsync(
}
}
+ [IntegrationTest]
+ public async Task CrudTestWithExplicitBase64()
+ {
+ var client = Helper.GetAuthenticatedClient();
+ var fixture = client.Repository.Content;
+ var repoName = Helper.MakeNameWithTimestamp("source-repo");
+
+ using (var context = await client.CreateRepositoryContext(new NewRepository(repoName) { AutoInit = true }))
+ {
+ var repository = context.Repository;
+
+ var file = await fixture.CreateFile(
+ repository.Owner.Login,
+ repository.Name,
+ "somefile.txt",
+ new CreateFileRequest("Test commit", "U29tZSBDb250ZW50", false));
+ Assert.Equal("somefile.txt", file.Content.Name);
+
+ var contents = await fixture.GetAllContents(repository.Owner.Login, repository.Name, "somefile.txt");
+ string fileSha = contents.First().Sha;
+ Assert.Equal("Some Content", contents.First().Content);
+
+ var update = await fixture.UpdateFile(
+ repository.Owner.Login,
+ repository.Name,
+ "somefile.txt",
+ new UpdateFileRequest("Updating file", "TmV3IENvbnRlbnQ=", fileSha, false));
+ Assert.Equal("somefile.txt", update.Content.Name);
+
+ contents = await fixture.GetAllContents(repository.Owner.Login, repository.Name, "somefile.txt");
+ Assert.Equal("New Content", contents.First().Content);
+ fileSha = contents.First().Sha;
+
+ await fixture.DeleteFile(
+ repository.Owner.Login,
+ repository.Name,
+ "somefile.txt",
+ new DeleteFileRequest("Deleted file", fileSha));
+
+ await Assert.ThrowsAsync(
+ () => fixture.GetAllContents(repository.Owner.Login, repository.Name, "somefile.txt"));
+ }
+ }
+
+ [IntegrationTest]
+ public async Task CrudTestWithRepositoryIdWithExplicitBase64()
+ {
+ var client = Helper.GetAuthenticatedClient();
+ var fixture = client.Repository.Content;
+ var repoName = Helper.MakeNameWithTimestamp("source-repo");
+
+ using (var context = await client.CreateRepositoryContext(new NewRepository(repoName) { AutoInit = true }))
+ {
+ var repository = context.Repository;
+
+ var file = await fixture.CreateFile(
+ repository.Id,
+ "somefile.txt",
+ new CreateFileRequest("Test commit", "U29tZSBDb250ZW50", false));
+ Assert.Equal("somefile.txt", file.Content.Name);
+
+ var contents = await fixture.GetAllContents(repository.Owner.Login, repository.Name, "somefile.txt");
+ string fileSha = contents.First().Sha;
+ Assert.Equal("Some Content", contents.First().Content);
+
+ var update = await fixture.UpdateFile(
+ repository.Id,
+ "somefile.txt",
+ new UpdateFileRequest("Updating file", "TmV3IENvbnRlbnQ=", fileSha, false));
+ Assert.Equal("somefile.txt", update.Content.Name);
+
+ contents = await fixture.GetAllContents(repository.Owner.Login, repository.Name, "somefile.txt");
+ Assert.Equal("New Content", contents.First().Content);
+ fileSha = contents.First().Sha;
+
+ await fixture.DeleteFile(
+ repository.Id,
+ "somefile.txt",
+ new DeleteFileRequest("Deleted file", fileSha));
+
+ await Assert.ThrowsAsync(
+ () => fixture.GetAllContents(repository.Owner.Login, repository.Name, "somefile.txt"));
+ }
+ }
+
+ [IntegrationTest]
+ public async Task CrudTestWithNamedBranchWithExplicitBase64()
+ {
+ var client = Helper.GetAuthenticatedClient();
+ var fixture = client.Repository.Content;
+ var repoName = Helper.MakeNameWithTimestamp("source-repo");
+ var branchName = "other-branch";
+
+ using (var context = await client.CreateRepositoryContext(new NewRepository(repoName) { AutoInit = true }))
+ {
+ var repository = context.Repository;
+
+ var master = await client.Git.Reference.Get(Helper.UserName, repository.Name, "heads/master");
+ await client.Git.Reference.Create(Helper.UserName, repository.Name, new NewReference("refs/heads/" + branchName, master.Object.Sha));
+ var file = await fixture.CreateFile(
+ repository.Owner.Login,
+ repository.Name,
+ "somefile.txt",
+ new CreateFileRequest("Test commit", "U29tZSBDb250ZW50", branchName, false));
+ Assert.Equal("somefile.txt", file.Content.Name);
+
+ var contents = await fixture.GetAllContentsByRef(repository.Owner.Login, repository.Name, "somefile.txt", branchName);
+ string fileSha = contents.First().Sha;
+ Assert.Equal("Some Content", contents.First().Content);
+
+ var update = await fixture.UpdateFile(
+ repository.Owner.Login,
+ repository.Name,
+ "somefile.txt",
+ new UpdateFileRequest("Updating file", "TmV3IENvbnRlbnQ=", fileSha, branchName, false));
+ Assert.Equal("somefile.txt", update.Content.Name);
+
+ contents = await fixture.GetAllContentsByRef(repository.Owner.Login, repository.Name, "somefile.txt", branchName);
+ Assert.Equal("New Content", contents.First().Content);
+ fileSha = contents.First().Sha;
+
+ await fixture.DeleteFile(
+ repository.Owner.Login,
+ repository.Name,
+ "somefile.txt",
+ new DeleteFileRequest("Deleted file", fileSha, branchName));
+
+ await Assert.ThrowsAsync(
+ () => fixture.GetAllContents(repository.Owner.Login, repository.Name, "somefile.txt"));
+ }
+ }
+
+ [IntegrationTest]
+ public async Task CrudTestWithNamedBranchWithRepositoryIdWithExplicitBase64()
+ {
+ var client = Helper.GetAuthenticatedClient();
+ var fixture = client.Repository.Content;
+ var repoName = Helper.MakeNameWithTimestamp("source-repo");
+ var branchName = "other-branch";
+
+ using (var context = await client.CreateRepositoryContext(new NewRepository(repoName) { AutoInit = true }))
+ {
+ var repository = context.Repository;
+
+ var master = await client.Git.Reference.Get(Helper.UserName, repository.Name, "heads/master");
+ await client.Git.Reference.Create(Helper.UserName, repository.Name, new NewReference("refs/heads/" + branchName, master.Object.Sha));
+ var file = await fixture.CreateFile(
+ repository.Id,
+ "somefile.txt",
+ new CreateFileRequest("Test commit", "U29tZSBDb250ZW50", branchName, false));
+ Assert.Equal("somefile.txt", file.Content.Name);
+
+ var contents = await fixture.GetAllContentsByRef(repository.Owner.Login, repository.Name, "somefile.txt", branchName);
+ string fileSha = contents.First().Sha;
+ Assert.Equal("Some Content", contents.First().Content);
+
+ var update = await fixture.UpdateFile(
+ repository.Id,
+ "somefile.txt",
+ new UpdateFileRequest("Updating file", "TmV3IENvbnRlbnQ=", fileSha, branchName, false));
+ Assert.Equal("somefile.txt", update.Content.Name);
+
+ contents = await fixture.GetAllContentsByRef(repository.Owner.Login, repository.Name, "somefile.txt", branchName);
+ Assert.Equal("New Content", contents.First().Content);
+ fileSha = contents.First().Sha;
+
+ await fixture.DeleteFile(
+ repository.Id,
+ "somefile.txt",
+ new DeleteFileRequest("Deleted file", fileSha, branchName));
+
+ await Assert.ThrowsAsync(
+ () => fixture.GetAllContents(repository.Owner.Login, repository.Name, "somefile.txt"));
+ }
+ }
+
public class TheGetArchiveMethod
{
[IntegrationTest(Skip = "this will probably take too long")]
diff --git a/Octokit.Tests.Integration/Clients/RepositoryHooksClientTests.cs b/Octokit.Tests.Integration/Clients/RepositoryHooksClientTests.cs
index a4c8404756..719bf7c9ae 100644
--- a/Octokit.Tests.Integration/Clients/RepositoryHooksClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/RepositoryHooksClientTests.cs
@@ -48,7 +48,7 @@ public async Task ReturnsAllHooksFromRepositoryWithRepositoryId()
public async Task ReturnsCorrectCountOfHooksWithoutStart()
{
var github = Helper.GetAuthenticatedClient();
-
+
var options = new ApiOptions
{
PageSize = 5,
@@ -64,7 +64,7 @@ public async Task ReturnsCorrectCountOfHooksWithoutStart()
public async Task ReturnsCorrectCountOfHooksWithoutStartWithRepositoryId()
{
var github = Helper.GetAuthenticatedClient();
-
+
var options = new ApiOptions
{
PageSize = 5,
diff --git a/Octokit.Tests.Integration/Clients/RepositoryPagesClientTests.cs b/Octokit.Tests.Integration/Clients/RepositoryPagesClientTests.cs
index 561fea2506..a26d989eeb 100644
--- a/Octokit.Tests.Integration/Clients/RepositoryPagesClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/RepositoryPagesClientTests.cs
@@ -18,14 +18,14 @@ public TheGetMethod()
_repositoryPagesClient = github.Repository.Page;
}
- [IntegrationTest(Skip= "These tests require repository admin rights - see https://github.com/octokit/octokit.net/issues/1263 for discussion")]
+ [IntegrationTest(Skip = "These tests require repository admin rights - see https://github.com/octokit/octokit.net/issues/1263 for discussion")]
public async Task ReturnsMetadata()
{
var data = await _repositoryPagesClient.Get(owner, name);
Assert.Equal("https://api.github.com/repos/octokit/octokit.net/pages", data.Url);
}
- [IntegrationTest(Skip= "These tests require repository admin rights - see https://github.com/octokit/octokit.net/issues/1263 for discussion")]
+ [IntegrationTest(Skip = "These tests require repository admin rights - see https://github.com/octokit/octokit.net/issues/1263 for discussion")]
public async Task ReturnsMetadataWithRepositoryId()
{
var data = await _repositoryPagesClient.Get(repositoryId);
diff --git a/Octokit.Tests.Integration/Clients/StarredClientTests.cs b/Octokit.Tests.Integration/Clients/StarredClientTests.cs
index 0196a5e73e..9e6802e4d2 100644
--- a/Octokit.Tests.Integration/Clients/StarredClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/StarredClientTests.cs
@@ -32,7 +32,7 @@ public async Task CanGetAllForCurrent()
{
var repositories = await _fixture.GetAllForCurrent();
Assert.NotEmpty(repositories);
-
+
var repo = repositories.FirstOrDefault(repository => repository.Owner.Login == _repositoryContext.RepositoryOwner && repository.Name == _repositoryContext.RepositoryName);
Assert.NotNull(repo);
}
diff --git a/Octokit.Tests.Integration/Clients/TagsClientTests.cs b/Octokit.Tests.Integration/Clients/TagsClientTests.cs
index f4a5fd5900..a74320cd84 100644
--- a/Octokit.Tests.Integration/Clients/TagsClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/TagsClientTests.cs
@@ -125,7 +125,6 @@ public async Task DeserializeTagSignatureVerification()
Assert.Equal(gitTag.Verification.Reason, VerificationReason.Unsigned);
Assert.Null(gitTag.Verification.Signature);
Assert.Null(gitTag.Verification.Payload);
-
}
}
}
diff --git a/Octokit.Tests.Integration/Clients/UserEmailsClientTests.cs b/Octokit.Tests.Integration/Clients/UserEmailsClientTests.cs
index 12ac23e496..492132ceda 100644
--- a/Octokit.Tests.Integration/Clients/UserEmailsClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/UserEmailsClientTests.cs
@@ -41,7 +41,7 @@ public async Task ReturnsCorrectCountOfEmailsWithoutStart()
Assert.NotEmpty(emails);
}
-
+
const string testEmailAddress = "hahaha-not-a-real-email@foo.com";
[IntegrationTest(Skip = "this isn't passing in CI - i hate past me right now")]
diff --git a/Octokit.Tests.Integration/Clients/UserKeysClientTests.cs b/Octokit.Tests.Integration/Clients/UserKeysClientTests.cs
index 4df8f13f0e..4bf48d3a18 100644
--- a/Octokit.Tests.Integration/Clients/UserKeysClientTests.cs
+++ b/Octokit.Tests.Integration/Clients/UserKeysClientTests.cs
@@ -57,19 +57,21 @@ public async Task CanGetKeyById()
[IntegrationTest]
public async Task CanCreateAndDeleteKey()
{
- // Create a key
- string keyTitle = "title";
- string keyData = "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAjo4DqFKg8dOxiz/yjypmN1A4itU5QOStyYrfOFuTinesU/2zm9hqxJ5BctIhgtSHJ5foxkhsiBji0qrUg73Q25BThgNg8YFE8njr4EwjmqSqW13akx/zLV0GFFU0SdJ2F6rBldhi93lMnl0ex9swBqa3eLTY8C+HQGBI6MQUMw+BKp0oFkz87Kv+Pfp6lt/Uo32ejSxML1PT5hTH5n+fyl0ied+sRmPGZWmWoHB5Bc9mox7lB6I6A/ZgjtBqbEEn4HQ2/6vp4ojKfSgA4Mm7XMu0bZzX0itKjH1QWD9Lr5apV1cmZsj49Xf8SHucTtH+bq98hb8OOXEGFzplwsX2MQ==";
var github = Helper.GetAuthenticatedClient();
- var key = await github.User.GitSshKey.Create(new NewPublicKey(keyTitle, keyData));
+ // Use context helper to create/destroy a key safely (to avoid test failures when a key exists due to not having been deleted)
+ string keyTitle = null;
+ string keyData = null;
+ using (var context = await github.CreatePublicKeyContext())
+ {
+ var observable = github.User.GitSshKey.Get(context.KeyId);
+ var key = await observable;
- Assert.NotNull(key);
- Assert.Equal(key.Title, "title");
- Assert.Equal(key.Key, keyData);
+ Assert.NotNull(key);
- // Delete key
- await github.User.GitSshKey.Delete(key.Id);
+ keyTitle = key.Title;
+ keyData = key.Key;
+ }
// Verify key no longer exists
var keys = await github.User.GitSshKey.GetAllForCurrent();
diff --git a/Octokit.Tests.Integration/Helpers/GithubClientExtensions.cs b/Octokit.Tests.Integration/Helpers/GithubClientExtensions.cs
index ac7ef4b7b8..ff869c6241 100644
--- a/Octokit.Tests.Integration/Helpers/GithubClientExtensions.cs
+++ b/Octokit.Tests.Integration/Helpers/GithubClientExtensions.cs
@@ -44,7 +44,7 @@ internal static async Task CreatePublicKeyContext(this IGitHub
{
// Create a key
string keyTitle = "title";
- string keyData = "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAjo4DqFKg8dOxiz/yjypmN1A4itU5QOStyYrfOFuTinesU/2zm9hqxJ5BctIhgtSHJ5foxkhsiBji0qrUg73Q25BThgNg8YFE8njr4EwjmqSqW13akx/zLV0GFFU0SdJ2F6rBldhi93lMnl0ex9swBqa3eLTY8C+HQGBI6MQUMw+BKp0oFkz87Kv+Pfp6lt/Uo32ejSxML1PT5hTH5n+fyl0ied+sRmPGZWmWoHB5Bc9mox7lB6I6A/ZgjtBqbEEn4HQ2/6vp4ojKfSgA4Mm7XMu0bZzX0itKjH1QWD9Lr5apV1cmZsj49Xf8SHucTtH+bq98hb8OOXEGFzplwsX2MQ==";
+ string keyData = "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAq42HufbSy1BUbZTdKyEy8nX44gdchbh1A/cYuVFkRXETrFr6XYLETi4tauXGS3Wp3E4s3oG272O4JW+fIBX0kuOJXnRgYz52H3BDk6aY9B0ny+PYFJrYrpG43px5EVfojj9o7oxugNq4zLCGqWTqZU1maTf5T4Mopjt0ggA7cyNnM5B645cBxXjD2KNfrTIyLI+meYxptzjRiB6fHLGFRA9fxpVqUnbq7EcGbwsTlILRuEPt58hZ9He88M45m0F8rkVZOewt4JSzsLsC+sQs+h/LXI8dbrg6xWpxJVi0trzYuMuY/MwygloWKtaFQYuPkJ7yqMZ3Aew+J3DupF6uxQ==";
var key = await client.User.GitSshKey.Create(new NewPublicKey(keyTitle, keyData));
diff --git a/Octokit.Tests.Integration/Helpers/ObservableGithubClientExtensions.cs b/Octokit.Tests.Integration/Helpers/ObservableGithubClientExtensions.cs
index a3073409bf..90d8e435bc 100644
--- a/Octokit.Tests.Integration/Helpers/ObservableGithubClientExtensions.cs
+++ b/Octokit.Tests.Integration/Helpers/ObservableGithubClientExtensions.cs
@@ -46,7 +46,7 @@ internal static async Task CreatePublicKeyContext(this IObserv
{
// Create a key
string keyTitle = "title";
- string keyData = "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAjo4DqFKg8dOxiz/yjypmN1A4itU5QOStyYrfOFuTinesU/2zm9hqxJ5BctIhgtSHJ5foxkhsiBji0qrUg73Q25BThgNg8YFE8njr4EwjmqSqW13akx/zLV0GFFU0SdJ2F6rBldhi93lMnl0ex9swBqa3eLTY8C+HQGBI6MQUMw+BKp0oFkz87Kv+Pfp6lt/Uo32ejSxML1PT5hTH5n+fyl0ied+sRmPGZWmWoHB5Bc9mox7lB6I6A/ZgjtBqbEEn4HQ2/6vp4ojKfSgA4Mm7XMu0bZzX0itKjH1QWD9Lr5apV1cmZsj49Xf8SHucTtH+bq98hb8OOXEGFzplwsX2MQ==";
+ string keyData = "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAq42HufbSy1BUbZTdKyEy8nX44gdchbh1A/cYuVFkRXETrFr6XYLETi4tauXGS3Wp3E4s3oG272O4JW+fIBX0kuOJXnRgYz52H3BDk6aY9B0ny+PYFJrYrpG43px5EVfojj9o7oxugNq4zLCGqWTqZU1maTf5T4Mopjt0ggA7cyNnM5B645cBxXjD2KNfrTIyLI+meYxptzjRiB6fHLGFRA9fxpVqUnbq7EcGbwsTlILRuEPt58hZ9He88M45m0F8rkVZOewt4JSzsLsC+sQs+h/LXI8dbrg6xWpxJVi0trzYuMuY/MwygloWKtaFQYuPkJ7yqMZ3Aew+J3DupF6uxQ==";
var key = await client.User.GitSshKey.Create(new NewPublicKey(keyTitle, keyData));
diff --git a/Octokit.Tests.Integration/Reactive/ObservableCommitStatusClientTests.cs b/Octokit.Tests.Integration/Reactive/ObservableCommitStatusClientTests.cs
index f903f896ae..569c1e7cb9 100644
--- a/Octokit.Tests.Integration/Reactive/ObservableCommitStatusClientTests.cs
+++ b/Octokit.Tests.Integration/Reactive/ObservableCommitStatusClientTests.cs
@@ -12,7 +12,7 @@ public class TheGetAllMethod
readonly ObservableCommitStatusClient _commitStatusClient;
const string owner = "octokit";
const string name = "octokit.net";
- const string reference = "1335f37";
+ const string reference = "1335f37";
public TheGetAllMethod()
{
@@ -37,7 +37,7 @@ public async Task ReturnsCorrectCountOfCommitStatusWithoutStart()
PageCount = 1
};
- var commitStatus = await _commitStatusClient.GetAll(owner, name ,reference , options).ToList();
+ var commitStatus = await _commitStatusClient.GetAll(owner, name, reference, options).ToList();
Assert.Equal(2, commitStatus.Count);
}
@@ -75,10 +75,10 @@ public async Task ReturnsDistinctResultsBasedOnStartPage()
StartPage = 2
};
- var secondPage = await _commitStatusClient.GetAll(owner, name, reference,skipStartOptions).ToList();
+ var secondPage = await _commitStatusClient.GetAll(owner, name, reference, skipStartOptions).ToList();
Assert.NotEqual(firstPage[0].Id, secondPage[0].Id);
- Assert.NotEqual(firstPage[1].Id, secondPage[1].Id);
+ Assert.NotEqual(firstPage[1].Id, secondPage[1].Id);
}
}
}
diff --git a/Octokit.Tests.Integration/Reactive/ObservableEventsClientTests.cs b/Octokit.Tests.Integration/Reactive/ObservableEventsClientTests.cs
index 60ae9041b0..40aa6aed1c 100644
--- a/Octokit.Tests.Integration/Reactive/ObservableEventsClientTests.cs
+++ b/Octokit.Tests.Integration/Reactive/ObservableEventsClientTests.cs
@@ -79,12 +79,10 @@ public async Task ReturnsDistinctEventsBasedOnStartPage()
Assert.NotEqual(firstEventsPage[3].Id, secondEventsPage[3].Id);
Assert.NotEqual(firstEventsPage[4].Id, secondEventsPage[4].Id);
}
-
}
public class TheGetAllForRepositoryMethod
{
-
readonly ObservableEventsClient _eventsClient;
const string owner = "octokit";
const string name = "octokit.net";
@@ -156,7 +154,6 @@ public async Task ReturnsDistinctRepositoryEventsBasedOnStartPage()
Assert.NotEqual(firstRepositoryEventsPage[3].Id, secondRepositoryEventsPage[3].Id);
Assert.NotEqual(firstRepositoryEventsPage[4].Id, secondRepositoryEventsPage[4].Id);
}
-
}
public class TheGetAllIssuesForRepositoryMethod
@@ -170,7 +167,7 @@ public TheGetAllIssuesForRepositoryMethod()
_eventsClient = new ObservableEventsClient(Helper.GetAuthenticatedClient());
}
- [IntegrationTest(Skip = "These tests just don't work any more")]
+ [IntegrationTest]
public async Task ReturnsRepositoryEvents()
{
var options = new ApiOptions
@@ -185,7 +182,7 @@ public async Task ReturnsRepositoryEvents()
Assert.NotEmpty(repositoryEvents);
}
- [IntegrationTest(Skip = "These tests just don't work any more")]
+ [IntegrationTest]
public async Task ReturnsCorrectCountOfRepositoryEventsWithoutStart()
{
var options = new ApiOptions
@@ -199,7 +196,7 @@ public async Task ReturnsCorrectCountOfRepositoryEventsWithoutStart()
Assert.Equal(5, repositoryEvents.Count);
}
- [IntegrationTest(Skip = "These tests just don't work any more")]
+ [IntegrationTest]
public async Task ReturnsCorrectCountOfRepositoryEventsWithStart()
{
var options = new ApiOptions
@@ -214,7 +211,7 @@ public async Task ReturnsCorrectCountOfRepositoryEventsWithStart()
Assert.Equal(5, repositoryEvents.Count);
}
- [IntegrationTest(Skip = "These tests just don't work any more")]
+ [IntegrationTest]
public async Task ReturnsDistinctRepositoryEventsBasedOnStartPage()
{
var startOptions = new ApiOptions
@@ -240,7 +237,6 @@ public async Task ReturnsDistinctRepositoryEventsBasedOnStartPage()
Assert.NotEqual(firstRepositoryEventsPage[3].Id, secondRepositoryEventsPage[3].Id);
Assert.NotEqual(firstRepositoryEventsPage[4].Id, secondRepositoryEventsPage[4].Id);
}
-
}
public class TheGetAllForRepositoryNetworkMethod
@@ -316,14 +312,12 @@ public async Task ReturnsDistinctRepositoryNetworkEventsBasedOnStartPage()
Assert.NotEqual(firstRepositoryNetworkEventsPage[3].Id, secondRepositoryNetworkEventsPage[3].Id);
Assert.NotEqual(firstRepositoryNetworkEventsPage[4].Id, secondRepositoryNetworkEventsPage[4].Id);
}
-
}
public class TheGetAllForOrganizationMethod
{
-
readonly ObservableEventsClient _eventsClient;
- const string organization = "octokit";
+ const string organization = "octokit";
public TheGetAllForOrganizationMethod()
{
@@ -360,7 +354,7 @@ public async Task ReturnsCorrectCountOfOrganizationEventsWithStart()
PageSize = 5,
PageCount = 1,
StartPage = 2
- };
+ };
var organizationEvents = await _eventsClient.GetAllForOrganization(organization, options).ToList();
@@ -393,7 +387,6 @@ public async Task ReturnsDistinctOrganizationEventsBasedOnStartPage()
Assert.NotEqual(firstOrganizationEventsPage[3].Id, secondOrganizationEventsPage[3].Id);
Assert.NotEqual(firstOrganizationEventsPage[4].Id, secondOrganizationEventsPage[4].Id);
}
-
}
public class TheGetAllUserReceivedMethod
@@ -473,7 +466,6 @@ public async Task ReturnsDistinctUserReceivedEventsBasedOnStartPage()
public class TheGetAllUserReceivedPublicMethod
{
-
readonly ObservableEventsClient _eventsClient;
const string user = "shiftkey";
@@ -545,7 +537,6 @@ public async Task ReturnsDistinctUserReceivedPublicEventsBasedOnStartPage()
Assert.NotEqual(firstUserReceivedPublicEventsPage[3].Id, secondUserReceivedPublicEventsPage[3].Id);
Assert.NotEqual(firstUserReceivedPublicEventsPage[4].Id, secondUserReceivedPublicEventsPage[4].Id);
}
-
}
public class TheGetAllUserPerformedMethod
@@ -585,7 +576,7 @@ public async Task ReturnsCorrectCountOfUserPerformedEventsWithStart()
{
var options = new ApiOptions
{
- PageSize = 5,
+ PageSize = 5,
PageCount = 1,
StartPage = 2
};
@@ -621,7 +612,6 @@ public async Task ReturnsDistinctUserPerformedEventsBasedOnStartPage()
Assert.NotEqual(firstUserPerformedEventsPage[3].Id, secondUserPerformedEventsPage[3].Id);
Assert.NotEqual(firstUserPerformedEventsPage[4].Id, secondUserPerformedEventsPage[4].Id);
}
-
}
public class TheGetAllUserPerformedPublicMethod
@@ -697,7 +687,6 @@ public async Task ReturnsDistinctUserPerformedPublicEventsBasedOnStartPage()
Assert.NotEqual(firstUserPerformedPublicEventsPage[3].Id, secondUserPerformedPublicEventsPage[3].Id);
Assert.NotEqual(firstUserPerformedPublicEventsPage[4].Id, secondUserPerformedPublicEventsPage[4].Id);
}
-
}
public class TheGetAllForAnOrganizationMethod
@@ -717,7 +706,7 @@ public TheGetAllForAnOrganizationMethod()
[IntegrationTest]
public async Task ReturnsUserOrganizationEvents()
{
- var userOrganizationEvents = await _eventsClient.GetAllForAnOrganization(_user,_organization).ToList();
+ var userOrganizationEvents = await _eventsClient.GetAllForAnOrganization(_user, _organization).ToList();
Assert.NotEmpty(userOrganizationEvents);
}
@@ -777,7 +766,6 @@ public async Task ReturnsDistinctUserOrganizationEventsBasedOnStartPage()
Assert.NotEqual(firstUserOrganizationEventsPage[3].Id, secondUserOrganizationEventsPage[3].Id);
Assert.NotEqual(firstUserOrganizationEventsPage[4].Id, secondUserOrganizationEventsPage[4].Id);
}
-
}
}
}
diff --git a/Octokit.Tests.Integration/Reactive/ObservableFollowersClientTests.cs b/Octokit.Tests.Integration/Reactive/ObservableFollowersClientTests.cs
index 6b3e61dc8d..1eb20be4fe 100644
--- a/Octokit.Tests.Integration/Reactive/ObservableFollowersClientTests.cs
+++ b/Octokit.Tests.Integration/Reactive/ObservableFollowersClientTests.cs
@@ -1,4 +1,5 @@
-using System.Reactive.Linq;
+using System;
+using System.Reactive.Linq;
using System.Threading.Tasks;
using Octokit.Reactive;
using Xunit;
@@ -9,7 +10,7 @@ public class ObservableFollowersClientTests
{
public class TheGetAllForCurrentMethod
{
- readonly ObservableFollowersClient _followersClient;
+ readonly ObservableFollowersClient _followersClient;
public TheGetAllForCurrentMethod()
{
@@ -18,7 +19,7 @@ public TheGetAllForCurrentMethod()
_followersClient = new ObservableFollowersClient(github);
}
- [IntegrationTest]
+ [IntegrationTest]
public async Task ReturnsFollowers()
{
var followers = await _followersClient.GetAllForCurrent().ToList();
@@ -30,7 +31,7 @@ public async Task ReturnsFollowers()
public async Task ReturnsCorrectCountOfFollowersWithoutStart()
{
var options = new ApiOptions
- {
+ {
PageSize = 1,
PageCount = 1
};
@@ -75,7 +76,7 @@ public async Task ReturnsDistinctResultsBasedOnStartPage()
var secondFollowersPage = await _followersClient.GetAllForCurrent(skipStartOptions).ToList();
- Assert.NotEqual(firstFollowersPage[0].Id, secondFollowersPage[0].Id);
+ Assert.NotEqual(firstFollowersPage[0].Id, secondFollowersPage[0].Id);
}
}
@@ -153,15 +154,19 @@ public async Task ReturnsDistinctResultsBasedOnStartPage()
}
}
- public class TheGetAllFollowingForCurrentMethod
+ public class TheGetAllFollowingForCurrentMethod : IDisposable
{
- readonly ObservableFollowersClient _followersClient;
+ readonly ObservableFollowersClient _followersClient;
public TheGetAllFollowingForCurrentMethod()
{
var github = Helper.GetAuthenticatedClient();
_followersClient = new ObservableFollowersClient(github);
+
+ // Follow someone to set initial state
+ _followersClient.Follow("alfhenrik").ToList();
+ _followersClient.Follow("ryangribble").ToList();
}
[IntegrationTest]
@@ -221,7 +226,13 @@ public async Task ReturnsDistinctResultsBasedOnStartPage()
var secondFollowingPage = await _followersClient.GetAllFollowingForCurrent(skipStartOptions).ToList();
- Assert.NotEqual(firstFollowingPage[0].Id, secondFollowingPage[0].Id);
+ Assert.NotEqual(firstFollowingPage[0].Id, secondFollowingPage[0].Id);
+ }
+
+ public void Dispose()
+ {
+ _followersClient.Unfollow("alfhenrik");
+ _followersClient.Unfollow("ryangribble");
}
}
diff --git a/Octokit.Tests.Integration/Reactive/ObservableGistCommentsClientTests.cs b/Octokit.Tests.Integration/Reactive/ObservableGistCommentsClientTests.cs
index 1f350dbe8f..edaaafcbf2 100644
--- a/Octokit.Tests.Integration/Reactive/ObservableGistCommentsClientTests.cs
+++ b/Octokit.Tests.Integration/Reactive/ObservableGistCommentsClientTests.cs
@@ -6,7 +6,7 @@
namespace Octokit.Tests.Integration.Reactive
{
public class ObservableGistCommentsClientTests
- {
+ {
public class TheGetAllForGistMethod
{
readonly ObservableGistCommentsClient _gistCommentsClient;
@@ -79,8 +79,8 @@ public async Task ReturnsDistinctResultsBasedOnStartPage()
Assert.NotEqual(firstCommentsPage[0].Id, secondCommentsPage[0].Id);
Assert.NotEqual(firstCommentsPage[1].Id, secondCommentsPage[1].Id);
Assert.NotEqual(firstCommentsPage[2].Id, secondCommentsPage[2].Id);
- Assert.NotEqual(firstCommentsPage[3].Id, secondCommentsPage[3].Id);
+ Assert.NotEqual(firstCommentsPage[3].Id, secondCommentsPage[3].Id);
}
}
- }
+ }
}
diff --git a/Octokit.Tests.Integration/Reactive/ObservableIssueTimelineClientTests.cs b/Octokit.Tests.Integration/Reactive/ObservableIssueTimelineClientTests.cs
index 7cfb66a887..2608591b4f 100644
--- a/Octokit.Tests.Integration/Reactive/ObservableIssueTimelineClientTests.cs
+++ b/Octokit.Tests.Integration/Reactive/ObservableIssueTimelineClientTests.cs
@@ -5,7 +5,7 @@
using Xunit;
namespace Octokit.Tests.Integration.Reactive
-{
+{
public class ObservableIssueTimelineClientTests
{
private readonly RepositoryContext _context;
@@ -95,7 +95,7 @@ public async Task CanDeserializeCrossReferenceEvent()
var observableTimeline = _client.Issue.Timeline.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number);
var timelineEventInfos = await observableTimeline.ToList();
Assert.Equal(1, timelineEventInfos.Count);
- Assert.Equal(anotherNewIssue.Id, timelineEventInfos[0].Source.Id);
+ Assert.Equal(anotherNewIssue.Id, timelineEventInfos[0].Source.Issue.Id);
}
[IntegrationTest]
@@ -152,7 +152,7 @@ public async Task CanDeserializeCrossReferenceEventByRepositoryId()
var observableTimeline = _client.Issue.Timeline.GetAllForIssue(_context.Repository.Id, issue.Number);
var timelineEventInfos = await observableTimeline.ToList();
Assert.Equal(1, timelineEventInfos.Count);
- Assert.Equal(anotherNewIssue.Id, timelineEventInfos[0].Source.Id);
+ Assert.Equal(anotherNewIssue.Id, timelineEventInfos[0].Source.Issue.Id);
}
}
}
diff --git a/Octokit.Tests.Integration/Reactive/ObservableIssuesClientTests.cs b/Octokit.Tests.Integration/Reactive/ObservableIssuesClientTests.cs
index dc195ee123..bedb3d3791 100644
--- a/Octokit.Tests.Integration/Reactive/ObservableIssuesClientTests.cs
+++ b/Octokit.Tests.Integration/Reactive/ObservableIssuesClientTests.cs
@@ -79,7 +79,8 @@ public async Task ReturnsPageOfIssuesFromStartForARepository()
[IntegrationTest]
public async Task ReturnsAllIssuesForCurrentUser()
{
- var newIssue = new NewIssue("Integration test issue") { Assignee = _context.RepositoryOwner };
+ var newIssue = new NewIssue("Integration test issue");
+ newIssue.Assignees.Add(_context.RepositoryOwner);
await _client.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
var issues = await _client.GetAllForCurrent().ToList();
@@ -90,7 +91,8 @@ public async Task ReturnsAllIssuesForCurrentUser()
[IntegrationTest]
public async Task ReturnsAllIssuesForOwnedAndMemberRepositories()
{
- var newIssue = new NewIssue("Integration test issue") { Assignee = _context.RepositoryOwner };
+ var newIssue = new NewIssue("Integration test issue");
+ newIssue.Assignees.Add(_context.RepositoryOwner);
await _client.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
var result = await _client.GetAllForOwnedAndMemberRepositories().ToList();
@@ -108,23 +110,23 @@ public async Task CanCreateAndUpdateIssues()
Assert.Equal("Modified integration test issue", updateResult.Title);
}
- [IntegrationTest]
- public async Task CanLockAndUnlockIssues()
- {
- var newIssue = new NewIssue("Integration Test Issue");
-
- var createResult = await _client.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
- Assert.False(createResult.Locked);
-
- await _client.Lock(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);
- var lockResult = await _client.Get(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);
- Assert.True(lockResult.Locked);
-
- await _client.Unlock(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);
- var unlockIssueResult = await _client.Get(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);
- Assert.False(unlockIssueResult.Locked);
+ [IntegrationTest]
+ public async Task CanLockAndUnlockIssues()
+ {
+ var newIssue = new NewIssue("Integration Test Issue");
+
+ var createResult = await _client.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue);
+ Assert.False(createResult.Locked);
+
+ await _client.Lock(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);
+ var lockResult = await _client.Get(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);
+ Assert.True(lockResult.Locked);
+
+ await _client.Unlock(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);
+ var unlockIssueResult = await _client.Get(_context.RepositoryOwner, _context.RepositoryName, createResult.Number);
+ Assert.False(unlockIssueResult.Locked);
}
-
+
public void Dispose()
{
_context.Dispose();
diff --git a/Octokit.Tests.Integration/Reactive/ObservableRepositoryCommitsClientTests.cs b/Octokit.Tests.Integration/Reactive/ObservableRepositoryCommitsClientTests.cs
index 48b6a75f17..be340347cb 100644
--- a/Octokit.Tests.Integration/Reactive/ObservableRepositoryCommitsClientTests.cs
+++ b/Octokit.Tests.Integration/Reactive/ObservableRepositoryCommitsClientTests.cs
@@ -17,7 +17,7 @@ public TheGetAllMethod()
var client = Helper.GetAuthenticatedClient();
_repositoryCommitsClient = new ObservableRepositoryCommitsClient(client);
}
-
+
[IntegrationTest]
public async Task CanGetCorrectCountOfCommitsWithoutStart()
{
diff --git a/Octokit.Tests.Integration/Reactive/ObservableRepositoryPagesClientTests.cs b/Octokit.Tests.Integration/Reactive/ObservableRepositoryPagesClientTests.cs
index 0bb66f59ed..403ee6b802 100644
--- a/Octokit.Tests.Integration/Reactive/ObservableRepositoryPagesClientTests.cs
+++ b/Octokit.Tests.Integration/Reactive/ObservableRepositoryPagesClientTests.cs
@@ -33,7 +33,7 @@ public async Task ReturnsPageOfRepositoryBuilds()
{
var options = new ApiOptions
{
- PageSize= 5,
+ PageSize = 5,
PageCount = 1
};
diff --git a/Octokit.Tests.Integration/Reactive/ObservableUserKeysClientTests.cs b/Octokit.Tests.Integration/Reactive/ObservableUserKeysClientTests.cs
index 864d94eaa6..61cbf8628e 100644
--- a/Octokit.Tests.Integration/Reactive/ObservableUserKeysClientTests.cs
+++ b/Octokit.Tests.Integration/Reactive/ObservableUserKeysClientTests.cs
@@ -65,19 +65,19 @@ public async Task CanGetKeyById()
[IntegrationTest]
public async Task CanCreateAndDeleteKey()
{
- // Create a key
- string keyTitle = "title";
- string keyData = "ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAjo4DqFKg8dOxiz/yjypmN1A4itU5QOStyYrfOFuTinesU/2zm9hqxJ5BctIhgtSHJ5foxkhsiBji0qrUg73Q25BThgNg8YFE8njr4EwjmqSqW13akx/zLV0GFFU0SdJ2F6rBldhi93lMnl0ex9swBqa3eLTY8C+HQGBI6MQUMw+BKp0oFkz87Kv+Pfp6lt/Uo32ejSxML1PT5hTH5n+fyl0ied+sRmPGZWmWoHB5Bc9mox7lB6I6A/ZgjtBqbEEn4HQ2/6vp4ojKfSgA4Mm7XMu0bZzX0itKjH1QWD9Lr5apV1cmZsj49Xf8SHucTtH+bq98hb8OOXEGFzplwsX2MQ==";
-
- var observable = _github.User.GitSshKey.Create(new NewPublicKey(keyTitle, keyData));
- var key = await observable;
+ // Use context helper to create/destroy a key safely (to avoid test failures when a key exists due to not having been deleted)
+ string keyTitle = null;
+ string keyData = null;
+ using (var context = await _github.CreatePublicKeyContext())
+ {
+ var observable = _github.User.GitSshKey.Get(context.KeyId);
+ var key = await observable;
- Assert.NotNull(key);
- Assert.Equal(key.Title, "title");
- Assert.Equal(key.Key, keyData);
+ keyTitle = key.Title;
+ keyData = key.Key;
- // Delete key
- await _github.User.GitSshKey.Delete(key.Id);
+ Assert.NotNull(key);
+ }
// Verify key no longer exists
var keys = await _github.User.GitSshKey.GetAllForCurrent().ToList();
diff --git a/Octokit.Tests/Clients/AssigneesClientTests.cs b/Octokit.Tests/Clients/AssigneesClientTests.cs
index 2044a817ed..84731319e1 100644
--- a/Octokit.Tests/Clients/AssigneesClientTests.cs
+++ b/Octokit.Tests/Clients/AssigneesClientTests.cs
@@ -196,6 +196,66 @@ public async Task EnsuresNonNullArguments()
}
}
+ public class TheAddAssigneesMethod
+ {
+ [Fact]
+ public async Task PostsToCorrectUrl()
+ {
+ var newAssignees = new AssigneesUpdate(new List() { "assignee1", "assignee2" });
+
+ var connection = Substitute.For();
+ var client = new AssigneesClient(connection);
+
+ await client.AddAssignees("fake", "repo", 2, newAssignees);
+
+ connection.Received().Post(Arg.Is(u => u.ToString() == "repos/fake/repo/issues/2/assignees"), Arg.Any