diff --git a/Octokit.Reactive/Clients/IObservableCommitCommentReactionsClient.cs b/Octokit.Reactive/Clients/IObservableCommitCommentReactionsClient.cs index 4771f2ef..a4df576f 100644 --- a/Octokit.Reactive/Clients/IObservableCommitCommentReactionsClient.cs +++ b/Octokit.Reactive/Clients/IObservableCommitCommentReactionsClient.cs @@ -40,7 +40,7 @@ namespace Octokit.Reactive /// 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 356ac10f..ed0eb373 100644 --- a/Octokit.Reactive/Clients/IObservableCommitStatusClient.cs +++ b/Octokit.Reactive/Clients/IObservableCommitStatusClient.cs @@ -19,7 +19,7 @@ namespace Octokit.Reactive /// 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 213b1d7f..832f8e4d 100644 --- a/Octokit.Reactive/Clients/IObservableCommitsClient.cs +++ b/Octokit.Reactive/Clients/IObservableCommitsClient.cs @@ -46,7 +46,7 @@ namespace Octokit.Reactive /// 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 361a1346..250e0e09 100644 --- a/Octokit.Reactive/Clients/IObservableDeploymentsClient.cs +++ b/Octokit.Reactive/Clients/IObservableDeploymentsClient.cs @@ -21,7 +21,7 @@ namespace Octokit.Reactive /// 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 @@ namespace Octokit.Reactive /// 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/IObservableIssueTimelineClient.cs b/Octokit.Reactive/Clients/IObservableIssueTimelineClient.cs index 053c1221..f60a8247 100644 --- a/Octokit.Reactive/Clients/IObservableIssueTimelineClient.cs +++ b/Octokit.Reactive/Clients/IObservableIssueTimelineClient.cs @@ -32,7 +32,7 @@ namespace Octokit.Reactive /// 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 0307f846..44c714e3 100644 --- a/Octokit.Reactive/Clients/IObservableIssuesEventsClient.cs +++ b/Octokit.Reactive/Clients/IObservableIssuesEventsClient.cs @@ -21,7 +21,7 @@ namespace Octokit.Reactive /// 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 95cd5f82..eab33ef0 100644 --- a/Octokit.Reactive/Clients/IObservableMilestonesClient.cs +++ b/Octokit.Reactive/Clients/IObservableMilestonesClient.cs @@ -22,7 +22,7 @@ namespace Octokit.Reactive [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 @@ namespace Octokit.Reactive /// 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 24366e59..85b9955e 100644 --- a/Octokit.Reactive/Clients/IObservableOrganizationsClient.cs +++ b/Octokit.Reactive/Clients/IObservableOrganizationsClient.cs @@ -55,7 +55,7 @@ namespace Octokit.Reactive /// 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")] + [Obsolete("Please use IObservableOrganizationsClient.GetAllForUser() instead. This method will be removed in a future version")] IObservable GetAll(string user, ApiOptions options); /// diff --git a/Octokit.Reactive/Clients/IObservableReferencesClient.cs b/Octokit.Reactive/Clients/IObservableReferencesClient.cs index 51d5582d..a1ff6dc1 100644 --- a/Octokit.Reactive/Clients/IObservableReferencesClient.cs +++ b/Octokit.Reactive/Clients/IObservableReferencesClient.cs @@ -25,7 +25,7 @@ namespace Octokit.Reactive [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 be24c954..ec56e379 100644 --- a/Octokit.Reactive/Clients/IObservableReleasesClient.cs +++ b/Octokit.Reactive/Clients/IObservableReleasesClient.cs @@ -231,7 +231,7 @@ namespace Octokit.Reactive /// 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 bca5a1a2..e08c7128 100644 --- a/Octokit.Reactive/Clients/IObservableRepositoryContentsClient.cs +++ b/Octokit.Reactive/Clients/IObservableRepositoryContentsClient.cs @@ -36,7 +36,7 @@ namespace Octokit.Reactive /// /// The Id of the repository IObservable GetReadmeHtml(long repositoryId); - + /// /// Get an archive of a given repository's contents /// @@ -167,7 +167,7 @@ namespace Octokit.Reactive /// 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 844b9705..e6daa3d9 100644 --- a/Octokit.Reactive/Clients/IObservableRepositoryHooksClient.cs +++ b/Octokit.Reactive/Clients/IObservableRepositoryHooksClient.cs @@ -35,7 +35,7 @@ namespace Octokit.Reactive /// 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 1b815085..d5832876 100644 --- a/Octokit.Reactive/Clients/IObservableStarredClient.cs +++ b/Octokit.Reactive/Clients/IObservableStarredClient.cs @@ -33,7 +33,7 @@ namespace Octokit.Reactive /// 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 @@ namespace Octokit.Reactive /// 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 @@ namespace Octokit.Reactive /// /// Thrown if the client is not authenticated IObservable GetAllForCurrent(); - + /// /// Retrieves all of the starred (ies) for the current user /// @@ -91,7 +91,7 @@ namespace Octokit.Reactive /// /// 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/ObservableCommitStatusClient.cs b/Octokit.Reactive/Clients/ObservableCommitStatusClient.cs index 4edc9e1d..8cf0fc04 100644 --- a/Octokit.Reactive/Clients/ObservableCommitStatusClient.cs +++ b/Octokit.Reactive/Clients/ObservableCommitStatusClient.cs @@ -37,7 +37,7 @@ namespace Octokit.Reactive 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 @@ namespace Octokit.Reactive 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 ea3a09bc..666fc8c1 100644 --- a/Octokit.Reactive/Clients/ObservableEventsClient.cs +++ b/Octokit.Reactive/Clients/ObservableEventsClient.cs @@ -382,7 +382,7 @@ namespace Octokit.Reactive 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 57165687..240dd6f3 100644 --- a/Octokit.Reactive/Clients/ObservableGistCommentsClient.cs +++ b/Octokit.Reactive/Clients/ObservableGistCommentsClient.cs @@ -38,7 +38,7 @@ namespace Octokit.Reactive /// 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 1dbd817a..a76dd58d 100644 --- a/Octokit.Reactive/Clients/ObservableGistsClient.cs +++ b/Octokit.Reactive/Clients/ObservableGistsClient.cs @@ -111,7 +111,7 @@ namespace Octokit.Reactive /// /// Only gists updated at or after this time are returned public IObservable GetAll(DateTimeOffset since) - { + { return GetAll(since, ApiOptions.None); } @@ -179,7 +179,7 @@ namespace Octokit.Reactive /// 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/ObservableOrganizationsClient.cs b/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs index e30c4e23..966cd184 100644 --- a/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs +++ b/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs @@ -102,9 +102,9 @@ namespace Octokit.Reactive /// public IObservable GetAllForUser(string user) { - Ensure.ArgumentNotNullOrEmptyString(user, "user"); + Ensure.ArgumentNotNullOrEmptyString(user, "user"); - return _connection.GetAndFlattenAllPages(ApiUrls.UserOrganizations(user)); + return _connection.GetAndFlattenAllPages(ApiUrls.UserOrganizations(user)); } /// @@ -115,10 +115,10 @@ namespace Octokit.Reactive /// public IObservable GetAllForUser(string user, ApiOptions options) { - Ensure.ArgumentNotNullOrEmptyString(user, "user"); - Ensure.ArgumentNotNull(options, "options"); + Ensure.ArgumentNotNullOrEmptyString(user, "user"); + Ensure.ArgumentNotNull(options, "options"); - return _connection.GetAndFlattenAllPages(ApiUrls.UserOrganizations(user), options); + return _connection.GetAndFlattenAllPages(ApiUrls.UserOrganizations(user), options); } /// diff --git a/Octokit.Reactive/Clients/ObservableRepositoryCommentsClient.cs b/Octokit.Reactive/Clients/ObservableRepositoryCommentsClient.cs index e0f2e36e..7749df06 100644 --- a/Octokit.Reactive/Clients/ObservableRepositoryCommentsClient.cs +++ b/Octokit.Reactive/Clients/ObservableRepositoryCommentsClient.cs @@ -15,7 +15,7 @@ namespace Octokit.Reactive { 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 ea35f3b4..5b0268c0 100644 --- a/Octokit.Reactive/Clients/ObservableRepositoryHooksClient.cs +++ b/Octokit.Reactive/Clients/ObservableRepositoryHooksClient.cs @@ -15,7 +15,7 @@ namespace Octokit.Reactive { 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 b5d0e7a5..eadd60d5 100644 --- a/Octokit.Tests.Conventions/ClientConstructorTests.cs +++ b/Octokit.Tests.Conventions/ClientConstructorTests.cs @@ -15,7 +15,7 @@ namespace Octokit.Tests.Conventions 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 61d1111f..51002dae 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/AuthorizationClientTests.cs b/Octokit.Tests.Integration/Clients/AuthorizationClientTests.cs index 72ed1ad5..3ef38065 100644 --- a/Octokit.Tests.Integration/Clients/AuthorizationClientTests.cs +++ b/Octokit.Tests.Integration/Clients/AuthorizationClientTests.cs @@ -30,7 +30,7 @@ namespace Octokit.Tests.Integration.Clients 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 4c6ae338..bb6ce3aa 100644 --- a/Octokit.Tests.Integration/Clients/DeploymentStatusClientTests.cs +++ b/Octokit.Tests.Integration/Clients/DeploymentStatusClientTests.cs @@ -162,7 +162,7 @@ public class DeploymentStatusClientTests : IDisposable 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 d8cc1f0c..e0e85456 100644 --- a/Octokit.Tests.Integration/Clients/EventsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/EventsClientTests.cs @@ -109,7 +109,7 @@ namespace Octokit.Tests.Integration.Clients public async Task ReturnsDistinctEventsBasedOnStartPage() { var github = Helper.GetAuthenticatedClient(); - + var startOptions = new ApiOptions { PageSize = 1, @@ -134,7 +134,7 @@ namespace Octokit.Tests.Integration.Clients public async Task ReturnsDistinctEventsBasedOnStartPageWithRepositoryId() { var github = Helper.GetAuthenticatedClient(); - + var startOptions = new ApiOptions { PageSize = 1, @@ -158,7 +158,7 @@ namespace Octokit.Tests.Integration.Clients 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 @@ namespace Octokit.Tests.Integration.Clients 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 @@ namespace Octokit.Tests.Integration.Clients 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 @@ namespace Octokit.Tests.Integration.Clients 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 @@ namespace Octokit.Tests.Integration.Clients 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 @@ namespace Octokit.Tests.Integration.Clients 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 @@ namespace Octokit.Tests.Integration.Clients 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 @@ namespace Octokit.Tests.Integration.Clients 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 9bb74b12..168b9c08 100644 --- a/Octokit.Tests.Integration/Clients/IssueCommentsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/IssueCommentsClientTests.cs @@ -13,7 +13,7 @@ public class IssueCommentsClientTests { readonly IGitHubClient _github; readonly IIssueCommentsClient _issueCommentsClient; - + const string owner = "octokit"; const string name = "octokit.net"; const int id = 12067722; @@ -220,7 +220,7 @@ public class IssueCommentsClientTests 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 cb684dbb..f4ffbcb3 100644 --- a/Octokit.Tests.Integration/Clients/IssueReactionsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/IssueReactionsClientTests.cs @@ -71,7 +71,7 @@ public class IssueReactionsClientTests { 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 af18d72f..c19148f0 100644 --- a/Octokit.Tests.Integration/Clients/IssueTimelineClientTests.cs +++ b/Octokit.Tests.Integration/Clients/IssueTimelineClientTests.cs @@ -5,7 +5,7 @@ using Xunit; 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 @@ namespace Octokit.Tests.Integration.Clients 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 @@ namespace Octokit.Tests.Integration.Clients 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 eece58b7..eeafb095 100644 --- a/Octokit.Tests.Integration/Clients/IssuesClientTests.cs +++ b/Octokit.Tests.Integration/Clients/IssuesClientTests.cs @@ -666,9 +666,11 @@ public class IssuesClientTests : IDisposable [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, @@ -692,9 +694,11 @@ public class IssuesClientTests : IDisposable [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, @@ -1108,7 +1112,6 @@ public class IssuesClientTests : IDisposable var updatedIssue = await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue.Number, issueUpdate); Assert.Empty(updatedIssue.Assignees); - } [IntegrationTest] diff --git a/Octokit.Tests.Integration/Clients/IssuesLabelsClientTests.cs b/Octokit.Tests.Integration/Clients/IssuesLabelsClientTests.cs index b025fc55..dd43dc96 100644 --- a/Octokit.Tests.Integration/Clients/IssuesLabelsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/IssuesLabelsClientTests.cs @@ -139,14 +139,14 @@ public class IssuesLabelsClientTests : IDisposable 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 class IssuesLabelsClientTests : IDisposable 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 class IssuesLabelsClientTests : IDisposable { 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 class IssuesLabelsClientTests : IDisposable { 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 class IssuesLabelsClientTests : IDisposable 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 class IssuesLabelsClientTests : IDisposable 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 class IssuesLabelsClientTests : IDisposable 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 class IssuesLabelsClientTests : IDisposable 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 class IssuesLabelsClientTests : IDisposable 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 class IssuesLabelsClientTests : IDisposable 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 8c43c03d..3ed7d8bd 100644 --- a/Octokit.Tests.Integration/Clients/MigrationsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/MigrationsClientTests.cs @@ -81,11 +81,11 @@ public class MigrationsClientTests : IDisposable { 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 @@ public class MigrationsClientTests : IDisposable 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 7952c0e4..9624336d 100644 --- a/Octokit.Tests.Integration/Clients/MilestonesClientTests.cs +++ b/Octokit.Tests.Integration/Clients/MilestonesClientTests.cs @@ -94,7 +94,7 @@ public class MilestonesClientTests : IDisposable 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 class MilestonesClientTests : IDisposable 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 class MilestonesClientTests : IDisposable 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 class MilestonesClientTests : IDisposable 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 class MilestonesClientTests : IDisposable 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/OrganizationMembersClientTests.cs b/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs index 5e3d4c56..63ea01b0 100644 --- a/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs +++ b/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs @@ -20,7 +20,7 @@ namespace Octokit.Tests.Integration.Clients [IntegrationTest] public async Task ReturnsMembers() { - var members = await + var members = await _gitHub.Organization.Member.GetAll(_organizationFixture); Assert.NotEmpty(members); } @@ -35,7 +35,7 @@ namespace Octokit.Tests.Integration.Clients }; var members = await _gitHub.Organization.Member.GetAll(_organizationFixture, options); - + Assert.Equal(1, members.Count); } diff --git a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs index ac9ab891..19255e9b 100644 --- a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs @@ -406,7 +406,6 @@ public class PullRequestReviewCommentsClientTests : IDisposable var pullRequestComments = await _client.GetAllForRepository(_context.Repository.Id); AssertComments(pullRequestComments, commentsToCreate, position); - } [IntegrationTest] @@ -855,7 +854,7 @@ public class PullRequestReviewCommentsClientTests : IDisposable 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/ReleasesClientTests.cs b/Octokit.Tests.Integration/Clients/ReleasesClientTests.cs index 28f1fd38..7104612f 100644 --- a/Octokit.Tests.Integration/Clients/ReleasesClientTests.cs +++ b/Octokit.Tests.Integration/Clients/ReleasesClientTests.cs @@ -836,7 +836,7 @@ public class ReleasesClientTests 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 927326b9..6979d22a 100644 --- a/Octokit.Tests.Integration/Clients/RepositoriesClientTests.cs +++ b/Octokit.Tests.Integration/Clients/RepositoriesClientTests.cs @@ -231,7 +231,7 @@ public class RepositoriesClientTests } } - [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 RepositoriesClientTests public async Task ReturnsRepositoriesForOrganization() { var github = Helper.GetAuthenticatedClient(); - + var options = new ApiOptions { PageSize = 20, @@ -1134,7 +1134,7 @@ public class RepositoriesClientTests 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 class RepositoriesClientTests 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 class RepositoriesClientTests 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 b59b6e41..5e300efe 100644 --- a/Octokit.Tests.Integration/Clients/RepositoryBranchesClientTests.cs +++ b/Octokit.Tests.Integration/Clients/RepositoryBranchesClientTests.cs @@ -683,7 +683,7 @@ public class RepositoryBranchesClientTests public class TheGetRequiredStatusChecksContextsMethod : IDisposable { IRepositoryBranchesClient _client; - RepositoryContext _userRepoContext; + RepositoryContext _userRepoContext; public TheGetRequiredStatusChecksContextsMethod() { @@ -741,7 +741,7 @@ public class RepositoryBranchesClientTests 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 class RepositoryBranchesClientTests 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 class RepositoryBranchesClientTests { 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 47266a48..aaccd9df 100644 --- a/Octokit.Tests.Integration/Clients/RepositoryCommentsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/RepositoryCommentsClientTests.cs @@ -499,7 +499,7 @@ public class RepositoryCommentsClientTests { 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/RepositoryHooksClientTests.cs b/Octokit.Tests.Integration/Clients/RepositoryHooksClientTests.cs index a4c84047..719bf7c9 100644 --- a/Octokit.Tests.Integration/Clients/RepositoryHooksClientTests.cs +++ b/Octokit.Tests.Integration/Clients/RepositoryHooksClientTests.cs @@ -48,7 +48,7 @@ namespace Octokit.Tests.Integration.Clients public async Task ReturnsCorrectCountOfHooksWithoutStart() { var github = Helper.GetAuthenticatedClient(); - + var options = new ApiOptions { PageSize = 5, @@ -64,7 +64,7 @@ namespace Octokit.Tests.Integration.Clients 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 561fea25..a26d989e 100644 --- a/Octokit.Tests.Integration/Clients/RepositoryPagesClientTests.cs +++ b/Octokit.Tests.Integration/Clients/RepositoryPagesClientTests.cs @@ -18,14 +18,14 @@ public class RepositoryPagesClientTests _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 0196a5e7..9e6802e4 100644 --- a/Octokit.Tests.Integration/Clients/StarredClientTests.cs +++ b/Octokit.Tests.Integration/Clients/StarredClientTests.cs @@ -32,7 +32,7 @@ namespace Octokit.Tests.Integration.Clients { 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 f4a5fd59..a74320cd 100644 --- a/Octokit.Tests.Integration/Clients/TagsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/TagsClientTests.cs @@ -125,7 +125,6 @@ namespace Octokit.Tests.Integration.Clients 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 12ac23e4..492132ce 100644 --- a/Octokit.Tests.Integration/Clients/UserEmailsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/UserEmailsClientTests.cs @@ -41,7 +41,7 @@ namespace Octokit.Tests.Integration.Clients 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 4df8f13f..4bf48d3a 100644 --- a/Octokit.Tests.Integration/Clients/UserKeysClientTests.cs +++ b/Octokit.Tests.Integration/Clients/UserKeysClientTests.cs @@ -57,19 +57,21 @@ namespace Octokit.Tests.Integration.Clients [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 ac7ef4b7..ff869c62 100644 --- a/Octokit.Tests.Integration/Helpers/GithubClientExtensions.cs +++ b/Octokit.Tests.Integration/Helpers/GithubClientExtensions.cs @@ -44,7 +44,7 @@ namespace Octokit.Tests.Integration.Helpers { // 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 a3073409..90d8e435 100644 --- a/Octokit.Tests.Integration/Helpers/ObservableGithubClientExtensions.cs +++ b/Octokit.Tests.Integration/Helpers/ObservableGithubClientExtensions.cs @@ -46,7 +46,7 @@ namespace Octokit.Tests.Integration.Helpers { // 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 f903f896..569c1e7c 100644 --- a/Octokit.Tests.Integration/Reactive/ObservableCommitStatusClientTests.cs +++ b/Octokit.Tests.Integration/Reactive/ObservableCommitStatusClientTests.cs @@ -12,7 +12,7 @@ namespace Octokit.Tests.Integration.Reactive 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 @@ namespace Octokit.Tests.Integration.Reactive 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 @@ namespace Octokit.Tests.Integration.Reactive 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 3cef1ffd..40aa6aed 100644 --- a/Octokit.Tests.Integration/Reactive/ObservableEventsClientTests.cs +++ b/Octokit.Tests.Integration/Reactive/ObservableEventsClientTests.cs @@ -79,12 +79,10 @@ namespace Octokit.Tests.Integration.Reactive 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 @@ namespace Octokit.Tests.Integration.Reactive Assert.NotEqual(firstRepositoryEventsPage[3].Id, secondRepositoryEventsPage[3].Id); Assert.NotEqual(firstRepositoryEventsPage[4].Id, secondRepositoryEventsPage[4].Id); } - } public class TheGetAllIssuesForRepositoryMethod @@ -240,7 +237,6 @@ namespace Octokit.Tests.Integration.Reactive Assert.NotEqual(firstRepositoryEventsPage[3].Id, secondRepositoryEventsPage[3].Id); Assert.NotEqual(firstRepositoryEventsPage[4].Id, secondRepositoryEventsPage[4].Id); } - } public class TheGetAllForRepositoryNetworkMethod @@ -316,14 +312,12 @@ namespace Octokit.Tests.Integration.Reactive 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 @@ namespace Octokit.Tests.Integration.Reactive PageSize = 5, PageCount = 1, StartPage = 2 - }; + }; var organizationEvents = await _eventsClient.GetAllForOrganization(organization, options).ToList(); @@ -393,7 +387,6 @@ namespace Octokit.Tests.Integration.Reactive Assert.NotEqual(firstOrganizationEventsPage[3].Id, secondOrganizationEventsPage[3].Id); Assert.NotEqual(firstOrganizationEventsPage[4].Id, secondOrganizationEventsPage[4].Id); } - } public class TheGetAllUserReceivedMethod @@ -473,7 +466,6 @@ namespace Octokit.Tests.Integration.Reactive public class TheGetAllUserReceivedPublicMethod { - readonly ObservableEventsClient _eventsClient; const string user = "shiftkey"; @@ -545,7 +537,6 @@ namespace Octokit.Tests.Integration.Reactive Assert.NotEqual(firstUserReceivedPublicEventsPage[3].Id, secondUserReceivedPublicEventsPage[3].Id); Assert.NotEqual(firstUserReceivedPublicEventsPage[4].Id, secondUserReceivedPublicEventsPage[4].Id); } - } public class TheGetAllUserPerformedMethod @@ -585,7 +576,7 @@ namespace Octokit.Tests.Integration.Reactive { var options = new ApiOptions { - PageSize = 5, + PageSize = 5, PageCount = 1, StartPage = 2 }; @@ -621,7 +612,6 @@ namespace Octokit.Tests.Integration.Reactive Assert.NotEqual(firstUserPerformedEventsPage[3].Id, secondUserPerformedEventsPage[3].Id); Assert.NotEqual(firstUserPerformedEventsPage[4].Id, secondUserPerformedEventsPage[4].Id); } - } public class TheGetAllUserPerformedPublicMethod @@ -697,7 +687,6 @@ namespace Octokit.Tests.Integration.Reactive Assert.NotEqual(firstUserPerformedPublicEventsPage[3].Id, secondUserPerformedPublicEventsPage[3].Id); Assert.NotEqual(firstUserPerformedPublicEventsPage[4].Id, secondUserPerformedPublicEventsPage[4].Id); } - } public class TheGetAllForAnOrganizationMethod @@ -717,7 +706,7 @@ namespace Octokit.Tests.Integration.Reactive [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 @@ namespace Octokit.Tests.Integration.Reactive 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 6b3e61dc..1eb20be4 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 @@ namespace Octokit.Tests.Integration.Reactive { public class TheGetAllForCurrentMethod { - readonly ObservableFollowersClient _followersClient; + readonly ObservableFollowersClient _followersClient; public TheGetAllForCurrentMethod() { @@ -18,7 +19,7 @@ namespace Octokit.Tests.Integration.Reactive _followersClient = new ObservableFollowersClient(github); } - [IntegrationTest] + [IntegrationTest] public async Task ReturnsFollowers() { var followers = await _followersClient.GetAllForCurrent().ToList(); @@ -30,7 +31,7 @@ namespace Octokit.Tests.Integration.Reactive public async Task ReturnsCorrectCountOfFollowersWithoutStart() { var options = new ApiOptions - { + { PageSize = 1, PageCount = 1 }; @@ -75,7 +76,7 @@ namespace Octokit.Tests.Integration.Reactive 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 @@ namespace Octokit.Tests.Integration.Reactive } } - 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 @@ namespace Octokit.Tests.Integration.Reactive 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 1f350dbe..edaaafcb 100644 --- a/Octokit.Tests.Integration/Reactive/ObservableGistCommentsClientTests.cs +++ b/Octokit.Tests.Integration/Reactive/ObservableGistCommentsClientTests.cs @@ -6,7 +6,7 @@ using Xunit; namespace Octokit.Tests.Integration.Reactive { public class ObservableGistCommentsClientTests - { + { public class TheGetAllForGistMethod { readonly ObservableGistCommentsClient _gistCommentsClient; @@ -79,8 +79,8 @@ namespace Octokit.Tests.Integration.Reactive 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 7cfb66a8..2608591b 100644 --- a/Octokit.Tests.Integration/Reactive/ObservableIssueTimelineClientTests.cs +++ b/Octokit.Tests.Integration/Reactive/ObservableIssueTimelineClientTests.cs @@ -5,7 +5,7 @@ using Octokit.Reactive; using Xunit; namespace Octokit.Tests.Integration.Reactive -{ +{ public class ObservableIssueTimelineClientTests { private readonly RepositoryContext _context; @@ -95,7 +95,7 @@ namespace Octokit.Tests.Integration.Reactive 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 @@ namespace Octokit.Tests.Integration.Reactive 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 dc195ee1..bedb3d37 100644 --- a/Octokit.Tests.Integration/Reactive/ObservableIssuesClientTests.cs +++ b/Octokit.Tests.Integration/Reactive/ObservableIssuesClientTests.cs @@ -79,7 +79,8 @@ public class ObservableIssuesClientTests : IDisposable [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 class ObservableIssuesClientTests : IDisposable [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 class ObservableIssuesClientTests : IDisposable 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 48b6a75f..be340347 100644 --- a/Octokit.Tests.Integration/Reactive/ObservableRepositoryCommitsClientTests.cs +++ b/Octokit.Tests.Integration/Reactive/ObservableRepositoryCommitsClientTests.cs @@ -17,7 +17,7 @@ namespace Octokit.Tests.Integration.Reactive 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 0bb66f59..403ee6b8 100644 --- a/Octokit.Tests.Integration/Reactive/ObservableRepositoryPagesClientTests.cs +++ b/Octokit.Tests.Integration/Reactive/ObservableRepositoryPagesClientTests.cs @@ -33,7 +33,7 @@ namespace Octokit.Tests.Integration.Reactive { 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 864d94ea..61cbf862 100644 --- a/Octokit.Tests.Integration/Reactive/ObservableUserKeysClientTests.cs +++ b/Octokit.Tests.Integration/Reactive/ObservableUserKeysClientTests.cs @@ -65,19 +65,19 @@ namespace Octokit.Tests.Integration.Clients [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=="; + // 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; - var observable = _github.User.GitSshKey.Create(new NewPublicKey(keyTitle, keyData)); - var key = await observable; + keyTitle = key.Title; + keyData = key.Key; - Assert.NotNull(key); - Assert.Equal(key.Title, "title"); - Assert.Equal(key.Key, keyData); - - // 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/CommitStatusClientTests.cs b/Octokit.Tests/Clients/CommitStatusClientTests.cs index adf5a0eb..b574c630 100644 --- a/Octokit.Tests/Clients/CommitStatusClientTests.cs +++ b/Octokit.Tests/Clients/CommitStatusClientTests.cs @@ -70,12 +70,12 @@ namespace Octokit.Tests.Clients connection.Received() .GetAll(Arg.Is(u => u.ToString() == "repositories/1/commits/sha/statuses"), options); } - + [Fact] public async Task EnsuresNonNullArguments() { var client = new CommitStatusClient(Substitute.For()); - + await Assert.ThrowsAsync(() => client.GetAll(null, "name", "sha")); await Assert.ThrowsAsync(() => client.GetAll("owner", null, "sha")); await Assert.ThrowsAsync(() => client.GetAll("owner", "name", null)); @@ -128,7 +128,7 @@ namespace Octokit.Tests.Clients public async Task EnsuresNonNullArguments() { var client = new CommitStatusClient(Substitute.For()); - + await Assert.ThrowsAsync(() => client.GetCombined(null, "name", "sha")); await Assert.ThrowsAsync(() => client.GetCombined("owner", null, "sha")); await Assert.ThrowsAsync(() => client.GetCombined("owner", "name", null)); diff --git a/Octokit.Tests/Clients/CommitsClientTests.cs b/Octokit.Tests/Clients/CommitsClientTests.cs index adb9deb1..b24478ea 100644 --- a/Octokit.Tests/Clients/CommitsClientTests.cs +++ b/Octokit.Tests/Clients/CommitsClientTests.cs @@ -18,7 +18,7 @@ public class CommitsClientTests await client.Get("owner", "repo", "reference"); - connection.Received().Get(Arg.Is(u => u.ToString() == "repos/owner/repo/git/commits/reference"), null, + connection.Received().Get(Arg.Is(u => u.ToString() == "repos/owner/repo/git/commits/reference"), null, "application/vnd.github.cryptographer-preview+sha"); } diff --git a/Octokit.Tests/Clients/DeploymentsClientTests.cs b/Octokit.Tests/Clients/DeploymentsClientTests.cs index 703ec7d3..92f37bba 100644 --- a/Octokit.Tests/Clients/DeploymentsClientTests.cs +++ b/Octokit.Tests/Clients/DeploymentsClientTests.cs @@ -60,7 +60,7 @@ public class DeploymentsClientTests connection.Received(1) .GetAll(Arg.Is(u => u.ToString() == expectedUrl), null, - "application/vnd.github.ant-man-preview+json", + "application/vnd.github.ant-man-preview+json", Args.ApiOptions); } @@ -74,7 +74,7 @@ public class DeploymentsClientTests await client.GetAll(repositoryId); connection.Received(1) - .GetAll(Arg.Is(u => u.ToString() == expectedUrl), + .GetAll(Arg.Is(u => u.ToString() == expectedUrl), Args.ApiOptions); } @@ -95,7 +95,7 @@ public class DeploymentsClientTests await client.GetAll(owner, name, options); connection.Received(1) - .GetAll(Arg.Is(u => u.ToString() == expectedUrl), + .GetAll(Arg.Is(u => u.ToString() == expectedUrl), null, "application/vnd.github.ant-man-preview+json", options); diff --git a/Octokit.Tests/Clients/EventsClientTests.cs b/Octokit.Tests/Clients/EventsClientTests.cs index 82c1084d..8be648f6 100644 --- a/Octokit.Tests/Clients/EventsClientTests.cs +++ b/Octokit.Tests/Clients/EventsClientTests.cs @@ -47,7 +47,7 @@ namespace Octokit.Tests.Clients PageCount = 1, StartPage = 1 }; - + await client.GetAll(options); connection.Received().GetAll(Arg.Is(u => u.ToString() == "events"), options); @@ -59,7 +59,7 @@ namespace Octokit.Tests.Clients var connection = Substitute.For(); var client = new EventsClient(connection); - await Assert.ThrowsAsync(() => client.GetAll(null)); + await Assert.ThrowsAsync(() => client.GetAll(null)); } } diff --git a/Octokit.Tests/Clients/FollowersClientTests.cs b/Octokit.Tests/Clients/FollowersClientTests.cs index 29314bbd..e279e1e2 100644 --- a/Octokit.Tests/Clients/FollowersClientTests.cs +++ b/Octokit.Tests/Clients/FollowersClientTests.cs @@ -34,7 +34,7 @@ namespace Octokit.Tests.Clients client.GetAllForCurrent(); connection.Received().GetAll( - Arg.Is(u => u.ToString() == "user/followers"),Args.ApiOptions); + Arg.Is(u => u.ToString() == "user/followers"), Args.ApiOptions); } [Fact] @@ -53,7 +53,7 @@ namespace Octokit.Tests.Clients client.GetAllForCurrent(options); connection.Received().GetAll( - Arg.Is(u => u.ToString() == "user/followers"),options); + Arg.Is(u => u.ToString() == "user/followers"), options); } [Fact] @@ -61,8 +61,8 @@ namespace Octokit.Tests.Clients { var connection = Substitute.For(); var client = new FollowersClient(connection); - - await Assert.ThrowsAsync(() => client.GetAllForCurrent(null)); + + await Assert.ThrowsAsync(() => client.GetAllForCurrent(null)); } } @@ -93,7 +93,7 @@ namespace Octokit.Tests.Clients StartPage = 1 }; - client.GetAll("alfhenrik",options); + client.GetAll("alfhenrik", options); connection.Received().GetAll( Arg.Is(u => u.ToString() == "users/alfhenrik/followers"), options); @@ -107,8 +107,8 @@ namespace Octokit.Tests.Clients await Assert.ThrowsAsync(() => client.GetAll(null)); await Assert.ThrowsAsync(() => client.GetAll("")); - await Assert.ThrowsAsync(() => client.GetAll("fake",null)); - await Assert.ThrowsAsync(() => client.GetAll("",ApiOptions.None)); + await Assert.ThrowsAsync(() => client.GetAll("fake", null)); + await Assert.ThrowsAsync(() => client.GetAll("", ApiOptions.None)); } } diff --git a/Octokit.Tests/Clients/GistCommentsClientTests.cs b/Octokit.Tests/Clients/GistCommentsClientTests.cs index 6b9cf86e..a3bc2972 100644 --- a/Octokit.Tests/Clients/GistCommentsClientTests.cs +++ b/Octokit.Tests/Clients/GistCommentsClientTests.cs @@ -71,7 +71,6 @@ namespace Octokit.Tests.Clients await Assert.ThrowsAsync(() => client.GetAllForGist("")); await Assert.ThrowsAsync(() => client.GetAllForGist("24", null)); await Assert.ThrowsAsync(() => client.GetAllForGist("", ApiOptions.None)); - } } diff --git a/Octokit.Tests/Clients/GistsClientTests.cs b/Octokit.Tests/Clients/GistsClientTests.cs index 536d7619..3dceab8c 100644 --- a/Octokit.Tests/Clients/GistsClientTests.cs +++ b/Octokit.Tests/Clients/GistsClientTests.cs @@ -74,7 +74,6 @@ public class GistsClientTests client.GetAll(options); connection.Received().GetAll(Arg.Is(u => u.ToString() == "gists"), options); - } [Fact] @@ -107,7 +106,6 @@ public class GistsClientTests connection.Received().GetAll(Arg.Is(u => u.ToString() == "gists"), DictionaryWithSince, options); - } [Fact] @@ -149,7 +147,6 @@ public class GistsClientTests client.GetAllPublic(options); connection.Received().GetAll(Arg.Is(u => u.ToString() == "gists/public"), options); - } [Fact] @@ -192,9 +189,7 @@ public class GistsClientTests await Assert.ThrowsAsync(() => client.GetAllPublic(null)); await Assert.ThrowsAsync(() => client.GetAllPublic(DateTimeOffset.Now, null)); - } - } public class TheGetAllStarredMethod @@ -225,7 +220,6 @@ public class GistsClientTests client.GetAllStarred(options); connection.Received().GetAll(Arg.Is(u => u.ToString() == "gists/starred"), options); - } [Fact] @@ -267,7 +261,6 @@ public class GistsClientTests await Assert.ThrowsAsync(() => client.GetAllStarred(null)); await Assert.ThrowsAsync(() => client.GetAllStarred(DateTimeOffset.Now, null)); - } } @@ -299,7 +292,6 @@ public class GistsClientTests client.GetAllForUser("octokit", options); connection.Received().GetAll(Arg.Is(u => u.ToString() == "users/octokit/gists"), options); - } [Fact] @@ -313,7 +305,6 @@ public class GistsClientTests connection.Received().GetAll(Arg.Is(u => u.ToString() == "users/octokit/gists"), DictionaryWithSince, Args.ApiOptions); - } [Fact] @@ -348,7 +339,6 @@ public class GistsClientTests await Assert.ThrowsAsync(() => client.GetAllForUser("", DateTimeOffset.Now, ApiOptions.None)); await Assert.ThrowsAsync(() => client.GetAllForUser("user", DateTimeOffset.Now, null)); } - } public class TheGetAllCommitsMethod @@ -392,7 +382,6 @@ public class GistsClientTests await Assert.ThrowsAsync(() => client.GetAllCommits("id", null)); await Assert.ThrowsAsync(() => client.GetAllCommits("", ApiOptions.None)); } - } public class TheGetAllForksMethod @@ -553,7 +542,6 @@ public class GistsClientTests connection.Received().Post(Arg.Is(u => u.ToString() == "gists/1/forks"), Arg.Any()); - } } diff --git a/Octokit.Tests/Clients/IssueCommentsClientTests.cs b/Octokit.Tests/Clients/IssueCommentsClientTests.cs index 688feb02..ff5a5ef9 100644 --- a/Octokit.Tests/Clients/IssueCommentsClientTests.cs +++ b/Octokit.Tests/Clients/IssueCommentsClientTests.cs @@ -21,7 +21,7 @@ namespace Octokit.Tests.Clients await client.Get("fake", "repo", 42); connection.Received().Get( - Arg.Is(u => u.ToString() == "repos/fake/repo/issues/comments/42"), + Arg.Is(u => u.ToString() == "repos/fake/repo/issues/comments/42"), Arg.Any>(), "application/vnd.github.squirrel-girl-preview"); } @@ -196,7 +196,7 @@ namespace Octokit.Tests.Clients await client.GetAllForIssue("fake", "repo", 3, options); connection.Received().GetAll( - Arg.Is(u => u.ToString() == "repos/fake/repo/issues/3/comments"), + Arg.Is(u => u.ToString() == "repos/fake/repo/issues/3/comments"), Arg.Any>(), "application/vnd.github.squirrel-girl-preview", options); diff --git a/Octokit.Tests/Clients/IssueTimelineClientTests.cs b/Octokit.Tests/Clients/IssueTimelineClientTests.cs index 694cedd7..89b8b63f 100644 --- a/Octokit.Tests/Clients/IssueTimelineClientTests.cs +++ b/Octokit.Tests/Clients/IssueTimelineClientTests.cs @@ -29,7 +29,7 @@ namespace Octokit.Tests.Clients await client.GetAllForIssue("fake", "repo", 42); connection.Received().GetAll( - Arg.Is(u => u.ToString() == "repos/fake/repo/issues/42/timeline"), + Arg.Is(u => u.ToString() == "repos/fake/repo/issues/42/timeline"), Arg.Any>(), "application/vnd.github.mockingbird-preview", Arg.Any()); @@ -41,7 +41,7 @@ namespace Octokit.Tests.Clients var connection = Substitute.For(); var client = new IssueTimelineClient(connection); - await client.GetAllForIssue("fake", "repo", 42, new ApiOptions {PageSize = 30}); + await client.GetAllForIssue("fake", "repo", 42, new ApiOptions { PageSize = 30 }); connection.Received().GetAll( Arg.Is(u => u.ToString() == "repos/fake/repo/issues/42/timeline"), @@ -71,7 +71,7 @@ namespace Octokit.Tests.Clients var connection = Substitute.For(); var client = new IssueTimelineClient(connection); - await client.GetAllForIssue(1, 42, new ApiOptions {PageSize = 30}); + await client.GetAllForIssue(1, 42, new ApiOptions { PageSize = 30 }); connection.Received().GetAll( Arg.Is(u => u.ToString() == "repositories/1/issues/42/timeline"), @@ -92,7 +92,6 @@ namespace Octokit.Tests.Clients await Assert.ThrowsAsync(() => client.GetAllForIssue("", "repo", 42)); await Assert.ThrowsAsync(() => client.GetAllForIssue("owner", "", 42)); - } } } diff --git a/Octokit.Tests/Clients/IssuesLabelsClientTests.cs b/Octokit.Tests/Clients/IssuesLabelsClientTests.cs index b84a453a..786cf120 100644 --- a/Octokit.Tests/Clients/IssuesLabelsClientTests.cs +++ b/Octokit.Tests/Clients/IssuesLabelsClientTests.cs @@ -560,7 +560,7 @@ namespace Octokit.Tests.Clients { var connection = Substitute.For(); var client = new IssuesLabelsClient(connection); - + var labelUpdate = new LabelUpdate("name", "FF0000"); client.Update("fake", "repo", "labelName", labelUpdate); diff --git a/Octokit.Tests/Clients/OrganizationMembersClientTests.cs b/Octokit.Tests/Clients/OrganizationMembersClientTests.cs index bcd2ec4f..efe95273 100644 --- a/Octokit.Tests/Clients/OrganizationMembersClientTests.cs +++ b/Octokit.Tests/Clients/OrganizationMembersClientTests.cs @@ -295,7 +295,7 @@ namespace Octokit.Tests.Clients await Assert.ThrowsAsync(() => client.GetAllPublic(null)); await Assert.ThrowsAsync(() => client.GetAllPublic(null, ApiOptions.None)); await Assert.ThrowsAsync(() => client.GetAllPublic("org", null)); - + await Assert.ThrowsAsync(() => client.GetAllPublic("")); await Assert.ThrowsAsync(() => client.GetAllPublic("", ApiOptions.None)); } diff --git a/Octokit.Tests/Clients/OrganizationsClientTests.cs b/Octokit.Tests/Clients/OrganizationsClientTests.cs index 9bfb8e46..c246cd52 100644 --- a/Octokit.Tests/Clients/OrganizationsClientTests.cs +++ b/Octokit.Tests/Clients/OrganizationsClientTests.cs @@ -92,48 +92,48 @@ namespace Octokit.Tests.Clients public class TheGetAllForUserMethod { - [Fact] - public async Task RequestsTheCorrectUrl() - { - var connection = Substitute.For(); - var client = new OrganizationsClient(connection); - - await client.GetAllForUser("username"); - - connection.Received().GetAll(Arg.Is(u => u.ToString() == "users/username/orgs"), Args.ApiOptions); - } - - [Fact] - public async Task RequestsTheCorrectUrlWithApiOptions() - { - var connection = Substitute.For(); - var client = new OrganizationsClient(connection); - - var options = new ApiOptions + [Fact] + public async Task RequestsTheCorrectUrl() { - StartPage = 1, - PageCount = 1, - PageSize = 1 - }; + var connection = Substitute.For(); + var client = new OrganizationsClient(connection); - await client.GetAllForUser("username", options); + await client.GetAllForUser("username"); - connection.Received().GetAll(Arg.Is(u => u.ToString() == "users/username/orgs"), options); - } + connection.Received().GetAll(Arg.Is(u => u.ToString() == "users/username/orgs"), Args.ApiOptions); + } - [Fact] - public async Task EnsuresNonNullArguments() - { - var connection = Substitute.For(); - var client = new OrganizationsClient(connection); + [Fact] + public async Task RequestsTheCorrectUrlWithApiOptions() + { + var connection = Substitute.For(); + var client = new OrganizationsClient(connection); - await Assert.ThrowsAsync(() => client.GetAllForUser(null)); - await Assert.ThrowsAsync(() => client.GetAllForUser(null, ApiOptions.None)); - await Assert.ThrowsAsync(() => client.GetAllForUser("username", null)); + var options = new ApiOptions + { + StartPage = 1, + PageCount = 1, + PageSize = 1 + }; - await Assert.ThrowsAsync(() => client.GetAllForUser("")); - await Assert.ThrowsAsync(() => client.GetAllForUser("", ApiOptions.None)); - } + await client.GetAllForUser("username", options); + + connection.Received().GetAll(Arg.Is(u => u.ToString() == "users/username/orgs"), options); + } + + [Fact] + public async Task EnsuresNonNullArguments() + { + var connection = Substitute.For(); + var client = new OrganizationsClient(connection); + + await Assert.ThrowsAsync(() => client.GetAllForUser(null)); + await Assert.ThrowsAsync(() => client.GetAllForUser(null, ApiOptions.None)); + await Assert.ThrowsAsync(() => client.GetAllForUser("username", null)); + + await Assert.ThrowsAsync(() => client.GetAllForUser("")); + await Assert.ThrowsAsync(() => client.GetAllForUser("", ApiOptions.None)); + } } public class TheGetAllForCurrentMethod @@ -176,7 +176,7 @@ namespace Octokit.Tests.Clients await Assert.ThrowsAsync(() => client.GetAllForCurrent(null)); } } - + public class TheGetAllOrganizationsMethod { [Fact] @@ -196,7 +196,7 @@ namespace Octokit.Tests.Clients var connection = Substitute.For(); var client = new OrganizationsClient(connection); - var request = new OrganizationRequest(1); + var request = new OrganizationRequest(1); await client.GetAll(request); @@ -212,7 +212,7 @@ namespace Octokit.Tests.Clients await Assert.ThrowsAsync(() => client.GetAll((OrganizationRequest)null)); } } - + public class TheUpdateMethod { [Fact] diff --git a/Octokit.Tests/Clients/PullRequestReviewCommentsClientTests.cs b/Octokit.Tests/Clients/PullRequestReviewCommentsClientTests.cs index 2217f9b5..a63a1bed 100644 --- a/Octokit.Tests/Clients/PullRequestReviewCommentsClientTests.cs +++ b/Octokit.Tests/Clients/PullRequestReviewCommentsClientTests.cs @@ -200,7 +200,7 @@ public class PullRequestReviewCommentsClientTests && d["direction"] == "desc" && d["since"] == "2013-11-15T11:43:01Z" && d["sort"] == "updated"), - "application/vnd.github.squirrel-girl-preview", + "application/vnd.github.squirrel-girl-preview", Args.ApiOptions); } @@ -254,7 +254,7 @@ public class PullRequestReviewCommentsClientTests && d["direction"] == "desc" && d["since"] == "2013-11-15T11:43:01Z" && d["sort"] == "updated"), - "application/vnd.github.squirrel-girl-preview", + "application/vnd.github.squirrel-girl-preview", options); } diff --git a/Octokit.Tests/Clients/ReleasesClientTests.cs b/Octokit.Tests/Clients/ReleasesClientTests.cs index 29e81a30..09a2c49a 100644 --- a/Octokit.Tests/Clients/ReleasesClientTests.cs +++ b/Octokit.Tests/Clients/ReleasesClientTests.cs @@ -273,7 +273,6 @@ namespace Octokit.Tests.Clients await Assert.ThrowsAsync(() => releasesClient.Edit("", "name", 1, releaseUpdate)); await Assert.ThrowsAsync(() => releasesClient.Edit("owner", "", 1, releaseUpdate)); - } } @@ -390,7 +389,7 @@ namespace Octokit.Tests.Clients public async Task EnsuresNonNullArguments() { var client = new ReleasesClient(Substitute.For()); - + await Assert.ThrowsAsync(() => client.GetAllAssets(null, "name", 1)); await Assert.ThrowsAsync(() => client.GetAllAssets("owner", null, 1)); diff --git a/Octokit.Tests/Clients/RepositoryHooksClientTest.cs b/Octokit.Tests/Clients/RepositoryHooksClientTest.cs index 4a3027f9..9a060129 100644 --- a/Octokit.Tests/Clients/RepositoryHooksClientTest.cs +++ b/Octokit.Tests/Clients/RepositoryHooksClientTest.cs @@ -28,7 +28,7 @@ namespace Octokit.Tests.Clients await client.GetAll("fake", "repo"); - connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/hooks"), + connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/hooks"), Args.ApiOptions); } @@ -40,7 +40,7 @@ namespace Octokit.Tests.Clients await client.GetAll(1); - connection.Received().GetAll(Arg.Is(u => u.ToString() == "repositories/1/hooks"), + connection.Received().GetAll(Arg.Is(u => u.ToString() == "repositories/1/hooks"), Args.ApiOptions); } diff --git a/Octokit.Tests/Clients/RepositoryInvitationsClientTests.cs b/Octokit.Tests/Clients/RepositoryInvitationsClientTests.cs index 374ce748..d103e512 100644 --- a/Octokit.Tests/Clients/RepositoryInvitationsClientTests.cs +++ b/Octokit.Tests/Clients/RepositoryInvitationsClientTests.cs @@ -107,6 +107,5 @@ public class RepositoryInvitationsClientTests await Assert.ThrowsAsync(() => client.Edit(1, 2, null)); } } - } diff --git a/Octokit.Tests/Clients/RespositoryCommitsClientTests.cs b/Octokit.Tests/Clients/RespositoryCommitsClientTests.cs index c989ced2..24585943 100644 --- a/Octokit.Tests/Clients/RespositoryCommitsClientTests.cs +++ b/Octokit.Tests/Clients/RespositoryCommitsClientTests.cs @@ -317,7 +317,7 @@ namespace Octokit.Tests.Clients await client.GetSha1("fake", "repo", "ref"); - connection.Received().Get(Arg.Is(u => u.ToString() == "repos/fake/repo/commits/ref"), + connection.Received().Get(Arg.Is(u => u.ToString() == "repos/fake/repo/commits/ref"), null, "application/vnd.github.chitauri-preview+sha"); } diff --git a/Octokit.Tests/Clients/StatisticsClientTests.cs b/Octokit.Tests/Clients/StatisticsClientTests.cs index c117bd03..53e7f34c 100644 --- a/Octokit.Tests/Clients/StatisticsClientTests.cs +++ b/Octokit.Tests/Clients/StatisticsClientTests.cs @@ -64,7 +64,7 @@ namespace Octokit.Tests.Clients var cancellationToken = new CancellationToken(true); var connection = Substitute.For(); - + connection.GetQueuedOperation(expectedEndPoint, cancellationToken) .Returns(Task.FromResult(contributors)); @@ -83,7 +83,7 @@ namespace Octokit.Tests.Clients var cancellationToken = new CancellationToken(true); var connection = Substitute.For(); - + connection.GetQueuedOperation(expectedEndPoint, cancellationToken) .Returns(Task.FromResult(contributors)); @@ -164,7 +164,7 @@ namespace Octokit.Tests.Clients .Returns(Task.FromResult(response)); var client = new StatisticsClient(connection); - + var result = await client.GetCommitActivity("owner", "name", cancellationToken); Assert.Equal(2, result.Activity[0].Days.Count); @@ -187,7 +187,7 @@ namespace Octokit.Tests.Clients .Returns(Task.FromResult(response)); var client = new StatisticsClient(connection); - + var result = await client.GetCommitActivity(1, cancellationToken); Assert.Equal(2, result.Activity[0].Days.Count); @@ -379,7 +379,7 @@ namespace Octokit.Tests.Clients var statisticsClient = new StatisticsClient(client); statisticsClient.GetParticipation("owner", "name", cancellationToken); - + client.Received().GetQueuedOperation(expectedEndPoint, cancellationToken); } @@ -393,7 +393,7 @@ namespace Octokit.Tests.Clients var statisticsClient = new StatisticsClient(client); statisticsClient.GetParticipation(1, cancellationToken); - + client.Received().GetQueuedOperation(expectedEndPoint, cancellationToken); } diff --git a/Octokit.Tests/Clients/UserGpgKeysClientTests.cs b/Octokit.Tests/Clients/UserGpgKeysClientTests.cs index be5e6318..bc9a9891 100644 --- a/Octokit.Tests/Clients/UserGpgKeysClientTests.cs +++ b/Octokit.Tests/Clients/UserGpgKeysClientTests.cs @@ -10,7 +10,6 @@ namespace Octokit.Tests.Clients { public class UserGpgKeysClientTests { - public class TheCtor { [Fact] diff --git a/Octokit.Tests/GitHubClientTests.cs b/Octokit.Tests/GitHubClientTests.cs index 82ea3423..9f466e7d 100644 --- a/Octokit.Tests/GitHubClientTests.cs +++ b/Octokit.Tests/GitHubClientTests.cs @@ -23,7 +23,7 @@ namespace Octokit.Tests Assert.Throws(() => new GitHubClient(productInformation, (ICredentialStore)null)); Assert.Throws(() => new GitHubClient(null, credentialStore)); - + Assert.Throws(() => new GitHubClient(productInformation, (Uri)null)); Assert.Throws(() => new GitHubClient(null, baseAddress)); @@ -33,7 +33,7 @@ namespace Octokit.Tests Assert.Throws(() => new GitHubClient(productInformation, null, null)); Assert.Throws(() => new GitHubClient(null, credentialStore, null)); Assert.Throws(() => new GitHubClient(null, null, baseAddress)); - + Assert.Throws(() => new GitHubClient(null, credentialStore, baseAddress)); Assert.Throws(() => new GitHubClient(productInformation, null, baseAddress)); Assert.Throws(() => new GitHubClient(productInformation, credentialStore, null)); diff --git a/Octokit.Tests/Helpers/Arg.cs b/Octokit.Tests/Helpers/Arg.cs index bee4238b..5408f72d 100644 --- a/Octokit.Tests/Helpers/Arg.cs +++ b/Octokit.Tests/Helpers/Arg.cs @@ -51,7 +51,7 @@ namespace Octokit.Tests public static Dictionary EmptyDictionary { get { return Arg.Is>(d => d.Count == 0); } - } + } public static OrganizationUpdate OrganizationUpdate { diff --git a/Octokit.Tests/Http/RedirectHandlerTests.cs b/Octokit.Tests/Http/RedirectHandlerTests.cs index 860f1cb0..051e62cd 100644 --- a/Octokit.Tests/Http/RedirectHandlerTests.cs +++ b/Octokit.Tests/Http/RedirectHandlerTests.cs @@ -119,7 +119,7 @@ namespace Octokit.Tests.Http httpRequestMessage.Content = new StringContent("Hello World"); var response = await adapter.SendAsync(httpRequestMessage, new CancellationToken()); - + Assert.Equal(response.RequestMessage.Method, httpRequestMessage.Method); Assert.NotSame(response.RequestMessage, httpRequestMessage); } @@ -136,7 +136,7 @@ namespace Octokit.Tests.Http var httpRequestMessage = CreateRequest(HttpMethod.Post); httpRequestMessage.Content = new StringContent("Hello World"); - + var response = await adapter.SendAsync(httpRequestMessage, new CancellationToken()); Assert.Equal(HttpMethod.Get, response.RequestMessage.Method); @@ -152,7 +152,7 @@ namespace Octokit.Tests.Http var redirectResponse2 = new HttpResponseMessage(HttpStatusCode.Found); redirectResponse2.Headers.Location = new Uri("http://example.org/foo"); - + var handler = CreateMockHttpHandler(redirectResponse, redirectResponse2); var adapter = new HttpClientAdapter(handler); diff --git a/Octokit.Tests/Models/MigrationTests.cs b/Octokit.Tests/Models/MigrationTests.cs index fbe81bac..31b89da7 100644 --- a/Octokit.Tests/Models/MigrationTests.cs +++ b/Octokit.Tests/Models/MigrationTests.cs @@ -113,7 +113,7 @@ namespace Octokit.Tests.Models private static readonly Migration migration = new Migration( id: 79, guid: "0b989ba4-242f-11e5-81e1-c7b6966d2516", - state: Migration.MigrationState.Exported, + state: Migration.MigrationState.Exported, lockRepositories: true, excludeAttachments: false, url: "https://api.github.com/orgs/octo-org/migrations/79", @@ -168,6 +168,5 @@ namespace Octokit.Tests.Models Assert.Equal(1, _migrationReuqest.Repositories.Count); Assert.Equal(true, _migrationReuqest.LockRepositories); } - } } diff --git a/Octokit.Tests/Reactive/ObservableAuthorizationsClientTests.cs b/Octokit.Tests/Reactive/ObservableAuthorizationsClientTests.cs index 7fe3bea0..99d1b55d 100644 --- a/Octokit.Tests/Reactive/ObservableAuthorizationsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableAuthorizationsClientTests.cs @@ -29,7 +29,7 @@ namespace Octokit.Tests.Reactive { var client = Substitute.For(); var authEndpoint = new ObservableAuthorizationsClient(client); - + authEndpoint.GetAll(ApiOptions.None); client.Connection.Received(1).Get>(Arg.Is(u => u.ToString() == "authorizations"), diff --git a/Octokit.Tests/Reactive/ObservableCommitStatusClientTests.cs b/Octokit.Tests/Reactive/ObservableCommitStatusClientTests.cs index b11cba62..9d7e5d1f 100644 --- a/Octokit.Tests/Reactive/ObservableCommitStatusClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableCommitStatusClientTests.cs @@ -149,7 +149,7 @@ namespace Octokit.Tests.Clients client.Create("owner", "repo", "sha", newCommitStatus); - gitHubClient.Received(). Repository.Status.Create("owner", "repo", "sha", newCommitStatus); + gitHubClient.Received().Repository.Status.Create("owner", "repo", "sha", newCommitStatus); } [Fact] diff --git a/Octokit.Tests/Reactive/ObservableDeploymentsClientTests.cs b/Octokit.Tests/Reactive/ObservableDeploymentsClientTests.cs index 9e105b55..58bdc62d 100644 --- a/Octokit.Tests/Reactive/ObservableDeploymentsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableDeploymentsClientTests.cs @@ -60,7 +60,7 @@ namespace Octokit.Tests.Reactive _githubClient.Connection.Received(1) .Get>(Arg.Is(u => u.ToString() == expectedUrl), - Arg.Is>(dictionary => dictionary.Count == 0), + Arg.Is>(dictionary => dictionary.Count == 0), Arg.Any()); } @@ -73,7 +73,7 @@ namespace Octokit.Tests.Reactive _githubClient.Connection.Received(1) .Get>(Arg.Is(u => u.ToString() == expectedUrl), - Arg.Is>(dictionary => dictionary.Count == 0), + Arg.Is>(dictionary => dictionary.Count == 0), Arg.Any()); } diff --git a/Octokit.Tests/Reactive/ObservableEventsClientTests.cs b/Octokit.Tests/Reactive/ObservableEventsClientTests.cs index 9e01765e..30e96296 100644 --- a/Octokit.Tests/Reactive/ObservableEventsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableEventsClientTests.cs @@ -83,7 +83,7 @@ namespace Octokit.Tests.Reactive client.GetAllForRepository(1); - gitHubClient.Connection.Received(1).Get>(new Uri("repositories/1/events", UriKind.Relative), + gitHubClient.Connection.Received(1).Get>(new Uri("repositories/1/events", UriKind.Relative), Args.EmptyDictionary, null); } @@ -102,7 +102,7 @@ namespace Octokit.Tests.Reactive client.GetAllForRepository("fake", "repo", options); - gitHubClient.Connection.Received(1).Get>(new Uri("repos/fake/repo/events", UriKind.Relative), + gitHubClient.Connection.Received(1).Get>(new Uri("repos/fake/repo/events", UriKind.Relative), Arg.Is>(d => d.Count == 2), null); } @@ -121,7 +121,7 @@ namespace Octokit.Tests.Reactive client.GetAllForRepository(1, apiOptions); - gitHubClient.Connection.Received(1).Get>(new Uri("repositories/1/events", UriKind.Relative), + gitHubClient.Connection.Received(1).Get>(new Uri("repositories/1/events", UriKind.Relative), Arg.Is>(d => d.Count == 2), null); } @@ -156,7 +156,7 @@ namespace Octokit.Tests.Reactive client.GetAllIssuesForRepository("fake", "repo"); - gitHubClient.Connection.Received(1).Get>(new Uri("repos/fake/repo/issues/events", UriKind.Relative), + gitHubClient.Connection.Received(1).Get>(new Uri("repos/fake/repo/issues/events", UriKind.Relative), Args.EmptyDictionary, null); } @@ -168,7 +168,7 @@ namespace Octokit.Tests.Reactive client.GetAllIssuesForRepository(1); - gitHubClient.Connection.Received(1).Get>(new Uri("repositories/1/issues/events", UriKind.Relative), + gitHubClient.Connection.Received(1).Get>(new Uri("repositories/1/issues/events", UriKind.Relative), Args.EmptyDictionary, null); } @@ -187,7 +187,7 @@ namespace Octokit.Tests.Reactive client.GetAllIssuesForRepository("fake", "repo", options); - gitHubClient.Connection.Received(1).Get>(new Uri("repos/fake/repo/issues/events", UriKind.Relative), + gitHubClient.Connection.Received(1).Get>(new Uri("repos/fake/repo/issues/events", UriKind.Relative), Arg.Is>(d => d.Count == 2), null); } @@ -206,7 +206,7 @@ namespace Octokit.Tests.Reactive client.GetAllIssuesForRepository(1, options); - gitHubClient.Connection.Received(1).Get>(new Uri("repositories/1/issues/events", UriKind.Relative), + gitHubClient.Connection.Received(1).Get>(new Uri("repositories/1/issues/events", UriKind.Relative), Arg.Is>(d => d.Count == 2), null); } diff --git a/Octokit.Tests/Reactive/ObservableGistsTests.cs b/Octokit.Tests/Reactive/ObservableGistsTests.cs index 6f7e7348..d824c91c 100644 --- a/Octokit.Tests/Reactive/ObservableGistsTests.cs +++ b/Octokit.Tests/Reactive/ObservableGistsTests.cs @@ -59,7 +59,7 @@ namespace Octokit.Tests.Reactive }; client.GetAll(options); - gitHubClient.Connection.Received(1).Get>(Arg.Is(u => u.ToString() == "gists"), + gitHubClient.Connection.Received(1).Get>(Arg.Is(u => u.ToString() == "gists"), DictionaryWithApiOptions, null); } @@ -99,8 +99,8 @@ namespace Octokit.Tests.Reactive { var gitsClient = new ObservableGistsClient(Substitute.For()); - Assert.Throws(() => gitsClient.GetAll(null)); - Assert.Throws(() => gitsClient.GetAll(DateTimeOffset.Now, null)); + Assert.Throws(() => gitsClient.GetAll(null)); + Assert.Throws(() => gitsClient.GetAll(DateTimeOffset.Now, null)); } } @@ -321,8 +321,8 @@ namespace Octokit.Tests.Reactive Assert.Throws(() => gitsClient.GetAllForUser("")); Assert.Throws(() => gitsClient.GetAllForUser(null, DateTimeOffset.Now)); Assert.Throws(() => gitsClient.GetAllForUser("", DateTimeOffset.Now)); - Assert.Throws(() => gitsClient.GetAllForUser("samthedev",DateTimeOffset.Now, null)); - Assert.Throws(() => gitsClient.GetAllForUser("",DateTimeOffset.Now, ApiOptions.None)); + Assert.Throws(() => gitsClient.GetAllForUser("samthedev", DateTimeOffset.Now, null)); + Assert.Throws(() => gitsClient.GetAllForUser("", DateTimeOffset.Now, ApiOptions.None)); } } @@ -355,7 +355,7 @@ namespace Octokit.Tests.Reactive gitHubClient.Connection.Received(1).Get>(Arg.Is(u => u.ToString() == "gists/id/commits"), DictionaryWithApiOptions, null); - } + } [Fact] @@ -365,9 +365,8 @@ namespace Octokit.Tests.Reactive Assert.Throws(() => gitsClient.GetAllCommits(null)); Assert.Throws(() => gitsClient.GetAllCommits("")); - Assert.Throws(() => gitsClient.GetAllCommits("id", null)); - Assert.Throws(() => gitsClient.GetAllCommits("", ApiOptions.None)); - + Assert.Throws(() => gitsClient.GetAllCommits("id", null)); + Assert.Throws(() => gitsClient.GetAllCommits("", ApiOptions.None)); } } @@ -412,7 +411,6 @@ namespace Octokit.Tests.Reactive Assert.Throws(() => gitsClient.GetAllForks("")); Assert.Throws(() => gitsClient.GetAllForks("id", null)); Assert.Throws(() => gitsClient.GetAllForks("", ApiOptions.None)); - } } } diff --git a/Octokit.Tests/Reactive/ObservableIssueCommentsClientTests.cs b/Octokit.Tests/Reactive/ObservableIssueCommentsClientTests.cs index 49742430..821968b9 100644 --- a/Octokit.Tests/Reactive/ObservableIssueCommentsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableIssueCommentsClientTests.cs @@ -58,7 +58,7 @@ namespace Octokit.Tests.Reactive gitHubClient.Connection.Received(1).Get>( new Uri("repos/fake/repo/issues/comments", UriKind.Relative), - Arg.Any>(), + Arg.Any>(), "application/vnd.github.squirrel-girl-preview"); } @@ -170,7 +170,7 @@ namespace Octokit.Tests.Reactive client.GetAllForIssue("fake", "repo", 3); gitHubClient.Connection.Received(1).Get>( - new Uri("repos/fake/repo/issues/3/comments", UriKind.Relative), + new Uri("repos/fake/repo/issues/3/comments", UriKind.Relative), Args.EmptyDictionary, "application/vnd.github.squirrel-girl-preview"); } diff --git a/Octokit.Tests/Reactive/ObservableIssueTimelineClientTests.cs b/Octokit.Tests/Reactive/ObservableIssueTimelineClientTests.cs index 776f8435..dcc02ca2 100644 --- a/Octokit.Tests/Reactive/ObservableIssueTimelineClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableIssueTimelineClientTests.cs @@ -43,8 +43,8 @@ namespace Octokit.Tests.Reactive var timelineEvents = await client.GetAllForIssue("fake", "repo", 42).ToList(); connection.Received().Get>( - Arg.Is(u => u.ToString() == "repos/fake/repo/issues/42/timeline"), - Arg.Any>(), + Arg.Is(u => u.ToString() == "repos/fake/repo/issues/42/timeline"), + Arg.Any>(), "application/vnd.github.mockingbird-preview"); Assert.Equal(1, timelineEvents.Count); } @@ -66,7 +66,7 @@ namespace Octokit.Tests.Reactive gitHubClient.Connection.Get>(Args.Uri, Arg.Is>(d => d.Count == 1), "application/vnd.github.mockingbird-preview") .Returns(Task.FromResult(response)); - var timelineEvents = await client.GetAllForIssue("fake", "repo", 42, new ApiOptions {PageSize = 30}).ToList(); + var timelineEvents = await client.GetAllForIssue("fake", "repo", 42, new ApiOptions { PageSize = 30 }).ToList(); connection.Received().Get>( Arg.Is(u => u.ToString() == "repos/fake/repo/issues/42/timeline"), @@ -116,7 +116,7 @@ namespace Octokit.Tests.Reactive githubClient.Connection.Get>(Args.Uri, Arg.Is>(d => d.Count == 1), "application/vnd.github.mockingbird-preview") .Returns(Task.FromResult(response)); - var timelineEvents = await client.GetAllForIssue(1, 42, new ApiOptions {PageSize = 30}).ToList(); + var timelineEvents = await client.GetAllForIssue(1, 42, new ApiOptions { PageSize = 30 }).ToList(); connection.Received().Get>( Arg.Is(u => u.ToString() == "repositories/1/issues/42/timeline"), @@ -137,7 +137,6 @@ namespace Octokit.Tests.Reactive Assert.Throws(() => client.GetAllForIssue("", "repo", 42)); Assert.Throws(() => client.GetAllForIssue("owner", "", 42)); - } } } diff --git a/Octokit.Tests/Reactive/ObservableIssuesClientTests.cs b/Octokit.Tests/Reactive/ObservableIssuesClientTests.cs index 7df08bb0..5577d5a8 100644 --- a/Octokit.Tests/Reactive/ObservableIssuesClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableIssuesClientTests.cs @@ -125,9 +125,9 @@ public class ObservableIssuesClientTests client.GetAllForRepository("fake", "repo", options); - gitHubClient.Connection.Received().Get>(Arg.Is(u => u.ToString() == "repos/fake/repo/issues"), - Arg.Is>(d => d.Count == 6 - && d["filter"] == "assigned" + gitHubClient.Connection.Received().Get>(Arg.Is(u => u.ToString() == "repos/fake/repo/issues"), + Arg.Is>(d => d.Count == 6 + && d["filter"] == "assigned" && d["state"] == "open" && d["sort"] == "created" && d["direction"] == "desc" @@ -636,7 +636,6 @@ public class ObservableIssuesClientTests Assert.Throws(() => client.Update("", "name", 42, new IssueUpdate())); Assert.Throws(() => client.Update("owner", "", 42, new IssueUpdate())); - } } diff --git a/Octokit.Tests/Reactive/ObservableIssuesEventsClientTests.cs b/Octokit.Tests/Reactive/ObservableIssuesEventsClientTests.cs index 0ff4de9e..85d32e70 100644 --- a/Octokit.Tests/Reactive/ObservableIssuesEventsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableIssuesEventsClientTests.cs @@ -77,7 +77,7 @@ namespace Octokit.Tests.Reactive var connection = Substitute.For(); var gitHubClient = new GitHubClient(connection); var client = new ObservableIssuesEventsClient(gitHubClient); - + var options = new ApiOptions { StartPage = 1, @@ -107,7 +107,7 @@ namespace Octokit.Tests.Reactive var connection = Substitute.For(); var gitHubClient = new GitHubClient(connection); var client = new ObservableIssuesEventsClient(gitHubClient); - + var options = new ApiOptions { StartPage = 1, diff --git a/Octokit.Tests/Reactive/ObservableIssuesLabelsClientTests.cs b/Octokit.Tests/Reactive/ObservableIssuesLabelsClientTests.cs index 7a880e9c..fe63561c 100644 --- a/Octokit.Tests/Reactive/ObservableIssuesLabelsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableIssuesLabelsClientTests.cs @@ -562,9 +562,9 @@ namespace Octokit.Tests.Reactive Assert.Throws(() => client.Create(null, "name", newLabel)); Assert.Throws(() => client.Create("owner", null, newLabel)); Assert.Throws(() => client.Create("owner", "name", null)); - + Assert.Throws(() => client.Create(1, null)); - + Assert.Throws(() => client.Create("", "name", newLabel)); Assert.Throws(() => client.Create("owner", "", newLabel)); } diff --git a/Octokit.Tests/Reactive/ObservableMilestonesClientTests.cs b/Octokit.Tests/Reactive/ObservableMilestonesClientTests.cs index 4281418d..628575bc 100644 --- a/Octokit.Tests/Reactive/ObservableMilestonesClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableMilestonesClientTests.cs @@ -186,12 +186,12 @@ namespace Octokit.Tests.Reactive Assert.Throws(() => client.GetAllForRepository(null, "name", new MilestoneRequest())); Assert.Throws(() => client.GetAllForRepository("owner", null, new MilestoneRequest())); Assert.Throws(() => client.GetAllForRepository("owner", "name", (MilestoneRequest)null)); - + Assert.Throws(() => client.GetAllForRepository(null, "name", new MilestoneRequest(), ApiOptions.None)); Assert.Throws(() => client.GetAllForRepository("owner", null, new MilestoneRequest(), ApiOptions.None)); Assert.Throws(() => client.GetAllForRepository("owner", "name", null, ApiOptions.None)); Assert.Throws(() => client.GetAllForRepository("owner", "name", new MilestoneRequest(), null)); - + Assert.Throws(() => client.GetAllForRepository(1, (ApiOptions)null)); Assert.Throws(() => client.GetAllForRepository(1, (MilestoneRequest)null)); Assert.Throws(() => client.GetAllForRepository(1, null, ApiOptions.None)); diff --git a/Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs b/Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs index 28b5ddc3..25ff187a 100644 --- a/Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs @@ -656,7 +656,7 @@ namespace Octokit.Tests.Reactive Assert.Throws(() => client.GetAllLanguages(null, "repo")); Assert.Throws(() => client.GetAllLanguages("owner", null)); - + Assert.Throws(() => client.GetAllLanguages("", "repo")); Assert.Throws(() => client.GetAllLanguages("owner", "")); } diff --git a/Octokit.Tests/Reactive/ObservableRepositoryCommentsClientTests.cs b/Octokit.Tests/Reactive/ObservableRepositoryCommentsClientTests.cs index 4af7888f..429ebdd5 100644 --- a/Octokit.Tests/Reactive/ObservableRepositoryCommentsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableRepositoryCommentsClientTests.cs @@ -176,7 +176,7 @@ namespace Octokit.Tests.Reactive githubClient.Connection.Received().Get>(Arg.Is(new Uri("repos/fake/repo/commits/sha/comments", UriKind.Relative)), Arg.Is>(d => d.Count == 2), "application/vnd.github.squirrel-girl-preview"); } - + [Fact] public void RequestsCorrectUrlWithRepositoryIdWithApiOptions() { @@ -191,7 +191,7 @@ namespace Octokit.Tests.Reactive }; client.GetAllForCommit(1, "sha", options); - githubClient.Connection.Received().Get>(Arg.Is(new Uri("repositories/1/commits/sha/comments", UriKind.Relative)), + githubClient.Connection.Received().Get>(Arg.Is(new Uri("repositories/1/commits/sha/comments", UriKind.Relative)), Arg.Is>(d => d.Count == 2), "application/vnd.github.squirrel-girl-preview"); } diff --git a/Octokit.Tests/Reactive/ObservableRepositoryCommitsClientTests.cs b/Octokit.Tests/Reactive/ObservableRepositoryCommitsClientTests.cs index 9891b046..4738a34d 100644 --- a/Octokit.Tests/Reactive/ObservableRepositoryCommitsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableRepositoryCommitsClientTests.cs @@ -44,7 +44,6 @@ namespace Octokit.Tests.Reactive Assert.ThrowsAsync(() => client.GetAll("owner", null, request, options).ToTask()); Assert.ThrowsAsync(() => client.GetAll("owner", "name", null, options).ToTask()); Assert.ThrowsAsync(() => client.GetAll("owner", "name", request, null).ToTask()); - } [Fact] diff --git a/Octokit.Tests/Reactive/ObservableRepositoryContentsClientTests.cs b/Octokit.Tests/Reactive/ObservableRepositoryContentsClientTests.cs index 7bdc3154..2d52c22d 100644 --- a/Octokit.Tests/Reactive/ObservableRepositoryContentsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableRepositoryContentsClientTests.cs @@ -59,7 +59,7 @@ namespace Octokit.Tests.Reactive Assert.Equal("README", htmlReadme); apiConnection.Received().GetHtml(Arg.Is(u => u.ToString() == "https://github.example.com/readme.md"), null); } - + [Fact] public async Task ReturnsReadmeWithRepositoryId() { @@ -781,7 +781,7 @@ namespace Octokit.Tests.Reactive var client = new ObservableRepositoryContentsClient(gitHubClient); client.GetArchive("org", "repo"); - + gitHubClient.Received().Repository.Content.GetArchive("org", "repo"); } @@ -836,7 +836,7 @@ namespace Octokit.Tests.Reactive var client = new ObservableRepositoryContentsClient(gitHubClient); client.GetArchive(1, ArchiveFormat.Zipball, "ref"); - + gitHubClient.Received().Repository.Content.GetArchive(1, ArchiveFormat.Zipball, "ref"); } diff --git a/Octokit.Tests/Reactive/ObservableStarredClientTests.cs b/Octokit.Tests/Reactive/ObservableStarredClientTests.cs index e3f0bc56..c650878f 100644 --- a/Octokit.Tests/Reactive/ObservableStarredClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableStarredClientTests.cs @@ -265,7 +265,7 @@ namespace Octokit.Tests.Reactive client.GetAllForCurrent(request, options); - connection.Received().Get>(endpoint, + connection.Received().Get>(endpoint, Arg.Is>(d => d.Count == 4 && d["direction"] == "asc" && d["per_page"] == "1" && d["page"] == "1"), null); } @@ -301,8 +301,8 @@ namespace Octokit.Tests.Reactive client.GetAllForCurrentWithTimestamps(options); - connection.Received().Get>(endpoint, - Arg.Is>(d => d.Count == 2 && d["per_page"] == "1" && d["page"] == "1"), + connection.Received().Get>(endpoint, + Arg.Is>(d => d.Count == 2 && d["per_page"] == "1" && d["page"] == "1"), "application/vnd.github.v3.star+json"); } @@ -343,7 +343,7 @@ namespace Octokit.Tests.Reactive client.GetAllForCurrentWithTimestamps(request, options); - connection.Received().Get>(endpoint, + connection.Received().Get>(endpoint, Arg.Is>(d => d.Count == 4 && d["direction"] == "asc" && d["per_page"] == "1" && d["page"] == "1"), "application/vnd.github.v3.star+json"); } @@ -399,7 +399,7 @@ namespace Octokit.Tests.Reactive client.GetAllForUser("banana", options); - connection.Received().Get>(endpoint, + connection.Received().Get>(endpoint, Arg.Is>(d => d.Count == 2 && d["per_page"] == "1" && d["page"] == "1"), null); } @@ -439,7 +439,7 @@ namespace Octokit.Tests.Reactive client.GetAllForUser("banana", starredRequest, options); - connection.Received().Get>(endpoint, + connection.Received().Get>(endpoint, Arg.Is>(d => d.Count == 4 && d["direction"] == "asc" && d["direction"] == "asc" && d["per_page"] == "1" && d["page"] == "1"), null); } @@ -477,7 +477,7 @@ namespace Octokit.Tests.Reactive client.GetAllForUserWithTimestamps("banana", options); - connection.Received().Get>(endpoint, + connection.Received().Get>(endpoint, Arg.Is>(d => d.Count == 2 && d["per_page"] == "1" && d["page"] == "1"), "application/vnd.github.v3.star+json"); } diff --git a/Octokit.Tests/Reactive/ObservableTeamsClientTests.cs b/Octokit.Tests/Reactive/ObservableTeamsClientTests.cs index 5fc8bd39..fdec6e11 100644 --- a/Octokit.Tests/Reactive/ObservableTeamsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableTeamsClientTests.cs @@ -41,6 +41,6 @@ namespace Octokit.Tests.Reactive { Assert.Throws(() => new ObservableTeamsClient(null)); } - } + } } } \ No newline at end of file diff --git a/Octokit.Tests/Reactive/ObservableTreesClientTests.cs b/Octokit.Tests/Reactive/ObservableTreesClientTests.cs index b94e211d..a1a13f8a 100644 --- a/Octokit.Tests/Reactive/ObservableTreesClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableTreesClientTests.cs @@ -52,7 +52,7 @@ namespace Octokit.Tests Assert.Throws(() => client.Get("owner", "name", null)); Assert.Throws(() => client.Get(1, null)); - + Assert.Throws(() => client.Get("", "name", "123456ABCD")); Assert.Throws(() => client.Get("owner", "", "123456ABCD")); Assert.Throws(() => client.Get("owner", "name", "")); diff --git a/Octokit.Tests/SimpleJsonSerializerTests.cs b/Octokit.Tests/SimpleJsonSerializerTests.cs index 0b3ff29d..9b1b3127 100644 --- a/Octokit.Tests/SimpleJsonSerializerTests.cs +++ b/Octokit.Tests/SimpleJsonSerializerTests.cs @@ -306,7 +306,7 @@ namespace Octokit.Tests Assert.Equal(SomeEnum.Unicode, sample.SomeEnum); } - + [Fact] public void RemovesDashFromEnums() { @@ -366,5 +366,4 @@ namespace Octokit.Tests SomethingElse, Unicode } - } diff --git a/Octokit/Clients/DeploymentStatusClient.cs b/Octokit/Clients/DeploymentStatusClient.cs index 7445fc9c..92c50620 100644 --- a/Octokit/Clients/DeploymentStatusClient.cs +++ b/Octokit/Clients/DeploymentStatusClient.cs @@ -66,7 +66,7 @@ namespace Octokit Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(options, "options"); - return ApiConnection.GetAll(ApiUrls.DeploymentStatuses(owner, name, deploymentId), + return ApiConnection.GetAll(ApiUrls.DeploymentStatuses(owner, name, deploymentId), null, AcceptHeaders.DeploymentApiPreview, options); diff --git a/Octokit/Clients/Enterprise/EnterpriseProbe.cs b/Octokit/Clients/Enterprise/EnterpriseProbe.cs index 3ea5bd48..bd4e0002 100644 --- a/Octokit/Clients/Enterprise/EnterpriseProbe.cs +++ b/Octokit/Clients/Enterprise/EnterpriseProbe.cs @@ -44,7 +44,7 @@ namespace Octokit Ensure.ArgumentNotNull(productInformation, "productHeader"); Ensure.ArgumentNotNull(httpClient, "httpClient"); - this.productHeader = productInformation; + productHeader = productInformation; this.httpClient = httpClient; } @@ -93,7 +93,6 @@ namespace Octokit : (IsEnterpriseResponse(response) ? EnterpriseProbeResult.Ok : EnterpriseProbeResult.NotFound); - } static bool IsEnterpriseResponse(IResponse response) diff --git a/Octokit/Clients/EventsClient.cs b/Octokit/Clients/EventsClient.cs index 431dc34c..d9b0c5c7 100644 --- a/Octokit/Clients/EventsClient.cs +++ b/Octokit/Clients/EventsClient.cs @@ -43,7 +43,7 @@ namespace Octokit { Ensure.ArgumentNotNull(options, "options"); - return ApiConnection.GetAll(ApiUrls.Events(),options); + return ApiConnection.GetAll(ApiUrls.Events(), options); } /// @@ -289,7 +289,7 @@ namespace Octokit Ensure.ArgumentNotNullOrEmptyString(user, "user"); Ensure.ArgumentNotNull(options, "options"); - return ApiConnection.GetAll(ApiUrls.ReceivedEvents(user, true),options); + return ApiConnection.GetAll(ApiUrls.ReceivedEvents(user, true), options); } /// @@ -319,7 +319,7 @@ namespace Octokit Ensure.ArgumentNotNullOrEmptyString(user, "user"); Ensure.ArgumentNotNull(options, "options"); - return ApiConnection.GetAll(ApiUrls.PerformedEvents(user),options); + return ApiConnection.GetAll(ApiUrls.PerformedEvents(user), options); } /// @@ -383,7 +383,7 @@ namespace Octokit Ensure.ArgumentNotNullOrEmptyString(organization, "organization"); Ensure.ArgumentNotNull(options, "options"); - return ApiConnection.GetAll(ApiUrls.OrganizationEvents(user, organization),options); + return ApiConnection.GetAll(ApiUrls.OrganizationEvents(user, organization), options); } } } diff --git a/Octokit/Clients/FollowersClient.cs b/Octokit/Clients/FollowersClient.cs index d1295c2b..8a808681 100644 --- a/Octokit/Clients/FollowersClient.cs +++ b/Octokit/Clients/FollowersClient.cs @@ -44,7 +44,7 @@ namespace Octokit { Ensure.ArgumentNotNull(options, "options"); - return ApiConnection.GetAll(ApiUrls.Followers(),options); + return ApiConnection.GetAll(ApiUrls.Followers(), options); } /// diff --git a/Octokit/Clients/GistCommentsClient.cs b/Octokit/Clients/GistCommentsClient.cs index 23eccda0..c9954b9c 100644 --- a/Octokit/Clients/GistCommentsClient.cs +++ b/Octokit/Clients/GistCommentsClient.cs @@ -53,7 +53,7 @@ namespace Octokit /// Task{IReadOnlyList{GistComment}}. public Task> GetAllForGist(string gistId, ApiOptions options) { - Ensure.ArgumentNotNullOrEmptyString(gistId, "gistId"); + Ensure.ArgumentNotNullOrEmptyString(gistId, "gistId"); Ensure.ArgumentNotNull(options, "options"); return ApiConnection.GetAll(ApiUrls.GistComments(gistId), options); diff --git a/Octokit/Clients/GistsClient.cs b/Octokit/Clients/GistsClient.cs index e3d567ba..aedc99cd 100644 --- a/Octokit/Clients/GistsClient.cs +++ b/Octokit/Clients/GistsClient.cs @@ -129,7 +129,6 @@ namespace Octokit /// Only gists updated at or after this time are returned public Task> GetAll(DateTimeOffset since) { - return GetAll(since, ApiOptions.None); } @@ -183,8 +182,7 @@ namespace Octokit /// /// Only gists updated at or after this time are returned public Task> GetAllPublic(DateTimeOffset since) - { - + { return GetAllPublic(since, ApiOptions.None); } @@ -212,7 +210,6 @@ namespace Octokit /// public Task> GetAllStarred() { - return GetAllStarred(ApiOptions.None); } @@ -238,8 +235,7 @@ namespace Octokit /// /// Only gists updated at or after this time are returned public Task> GetAllStarred(DateTimeOffset since) - { - + { return GetAllStarred(since, ApiOptions.None); } @@ -300,7 +296,7 @@ namespace Octokit public Task> GetAllForUser(string user, DateTimeOffset since) { Ensure.ArgumentNotNullOrEmptyString(user, "user"); - + return GetAllForUser(user, since, ApiOptions.None); } diff --git a/Octokit/Clients/IEventsClient.cs b/Octokit/Clients/IEventsClient.cs index 2ed95b37..431295f6 100644 --- a/Octokit/Clients/IEventsClient.cs +++ b/Octokit/Clients/IEventsClient.cs @@ -130,7 +130,7 @@ namespace Octokit /// The name of the repository /// Options for changing the API response Task> GetAllForRepositoryNetwork(string owner, string name, ApiOptions options); - + /// /// Gets all the events for a given organization /// diff --git a/Octokit/Clients/IGistsClient.cs b/Octokit/Clients/IGistsClient.cs index 877a3ce1..1dffebca 100644 --- a/Octokit/Clients/IGistsClient.cs +++ b/Octokit/Clients/IGistsClient.cs @@ -101,7 +101,7 @@ namespace Octokit /// Only gists updated at or after this time are returned /// Options for changing the API response Task> GetAllPublic(DateTimeOffset since, ApiOptions options); - + /// diff --git a/Octokit/Clients/IIssueCommentReactionsClient.cs b/Octokit/Clients/IIssueCommentReactionsClient.cs index d0e1544b..ef34d6e7 100644 --- a/Octokit/Clients/IIssueCommentReactionsClient.cs +++ b/Octokit/Clients/IIssueCommentReactionsClient.cs @@ -38,7 +38,7 @@ namespace Octokit /// The name of the repository /// The comment id Task> GetAll(string owner, string name, int number); - + /// /// Get all reactions for a specified Issue Comment /// diff --git a/Octokit/Clients/IIssuesLabelsClient.cs b/Octokit/Clients/IIssuesLabelsClient.cs index 4a3e0019..e34d8304 100644 --- a/Octokit/Clients/IIssuesLabelsClient.cs +++ b/Octokit/Clients/IIssuesLabelsClient.cs @@ -22,7 +22,7 @@ namespace Octokit /// The name of the repository /// The number of the issue Task> GetAllForIssue(string owner, string name, int number); - + /// /// Gets all labels for the issue. /// diff --git a/Octokit/Clients/IOrganizationsClient.cs b/Octokit/Clients/IOrganizationsClient.cs index a0fb42a1..5416aea4 100644 --- a/Octokit/Clients/IOrganizationsClient.cs +++ b/Octokit/Clients/IOrganizationsClient.cs @@ -102,7 +102,7 @@ namespace Octokit /// Thrown when a general API error occurs. /// A list of s. Task> GetAll(OrganizationRequest request); - + /// /// Update the specified organization with data from . /// diff --git a/Octokit/Clients/IPullRequestReviewCommentReactionsClient.cs b/Octokit/Clients/IPullRequestReviewCommentReactionsClient.cs index b0d9ff65..773ff315 100644 --- a/Octokit/Clients/IPullRequestReviewCommentReactionsClient.cs +++ b/Octokit/Clients/IPullRequestReviewCommentReactionsClient.cs @@ -19,7 +19,7 @@ namespace Octokit /// The name of the repository /// The comment id Task> GetAll(string owner, string name, int number); - + /// /// Get all reactions for a specified Pull Request Review Comment. /// diff --git a/Octokit/Clients/IRepositoryHooksClient.cs b/Octokit/Clients/IRepositoryHooksClient.cs index 99a4e83d..c7899ff5 100644 --- a/Octokit/Clients/IRepositoryHooksClient.cs +++ b/Octokit/Clients/IRepositoryHooksClient.cs @@ -19,7 +19,7 @@ namespace Octokit /// The repository's name /// See API documentation for more information. Task> GetAll(string owner, string name); - + /// /// Gets the list of hooks defined for a repository /// diff --git a/Octokit/Clients/IStarredClient.cs b/Octokit/Clients/IStarredClient.cs index 61c1034d..d0c226db 100644 --- a/Octokit/Clients/IStarredClient.cs +++ b/Octokit/Clients/IStarredClient.cs @@ -202,14 +202,14 @@ namespace Octokit /// The name of the repository /// Thrown if the client is not authenticated. Task CheckStarred(string owner, string name); - + /// /// Stars a repository for the authenticated user. /// /// The owner of the repository to star /// The name of the repository to star Task StarRepo(string owner, string name); - + /// /// Unstars a repository for the authenticated user. /// diff --git a/Octokit/Clients/IssueCommentsClient.cs b/Octokit/Clients/IssueCommentsClient.cs index ca91a1cb..776de315 100644 --- a/Octokit/Clients/IssueCommentsClient.cs +++ b/Octokit/Clients/IssueCommentsClient.cs @@ -55,7 +55,7 @@ namespace Octokit { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); - + return GetAllForRepository(owner, name, new IssueCommentRequest(), ApiOptions.None); } diff --git a/Octokit/Clients/IssueTimelineClient.cs b/Octokit/Clients/IssueTimelineClient.cs index 2b96c30e..d09dc763 100644 --- a/Octokit/Clients/IssueTimelineClient.cs +++ b/Octokit/Clients/IssueTimelineClient.cs @@ -11,7 +11,7 @@ namespace Octokit /// /// See the Issue Timeline API documentation for more information. /// - public class IssueTimelineClient: ApiClient, IIssueTimelineClient + public class IssueTimelineClient : ApiClient, IIssueTimelineClient { public IssueTimelineClient(IApiConnection apiConnection) : base(apiConnection) { diff --git a/Octokit/Clients/MilestonesClient.cs b/Octokit/Clients/MilestonesClient.cs index 5e658013..c0842d0f 100644 --- a/Octokit/Clients/MilestonesClient.cs +++ b/Octokit/Clients/MilestonesClient.cs @@ -59,7 +59,7 @@ namespace Octokit { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); - + return GetAllForRepository(owner, name, new MilestoneRequest()); } diff --git a/Octokit/Clients/OrganizationsClient.cs b/Octokit/Clients/OrganizationsClient.cs index e9796569..e4936cc7 100644 --- a/Octokit/Clients/OrganizationsClient.cs +++ b/Octokit/Clients/OrganizationsClient.cs @@ -108,9 +108,9 @@ namespace Octokit /// A list of the specified user's s. public Task> GetAllForUser(string user) { - Ensure.ArgumentNotNullOrEmptyString(user, "user"); + Ensure.ArgumentNotNullOrEmptyString(user, "user"); - return GetAllForUser(user, ApiOptions.None); + return GetAllForUser(user, ApiOptions.None); } /// @@ -122,10 +122,10 @@ namespace Octokit /// A list of the specified user's s. public Task> GetAllForUser(string user, ApiOptions options) { - Ensure.ArgumentNotNullOrEmptyString(user, "user"); - Ensure.ArgumentNotNull(options, "options"); + Ensure.ArgumentNotNullOrEmptyString(user, "user"); + Ensure.ArgumentNotNull(options, "options"); - return ApiConnection.GetAll(ApiUrls.UserOrganizations(user), options); + return ApiConnection.GetAll(ApiUrls.UserOrganizations(user), options); } @@ -136,7 +136,7 @@ namespace Octokit /// A list of s. public Task> GetAll() { - return ApiConnection.GetAll(ApiUrls.AllOrganizations()); + return ApiConnection.GetAll(ApiUrls.AllOrganizations()); } /// diff --git a/Octokit/Clients/RepositoryCommitsClient.cs b/Octokit/Clients/RepositoryCommitsClient.cs index 88d85b4f..6656f435 100644 --- a/Octokit/Clients/RepositoryCommitsClient.cs +++ b/Octokit/Clients/RepositoryCommitsClient.cs @@ -11,7 +11,7 @@ namespace Octokit /// public class RepositoryCommitsClient : ApiClient, IRepositoryCommitsClient { - public RepositoryCommitsClient(IApiConnection apiConnection) + public RepositoryCommitsClient(IApiConnection apiConnection) : base(apiConnection) { } diff --git a/Octokit/Clients/RepositoryInvitationsClient.cs b/Octokit/Clients/RepositoryInvitationsClient.cs index 6215660a..92a50cba 100644 --- a/Octokit/Clients/RepositoryInvitationsClient.cs +++ b/Octokit/Clients/RepositoryInvitationsClient.cs @@ -29,7 +29,7 @@ namespace Octokit var httpStatusCode = await Connection.Patch(endpoint, AcceptHeaders.InvitationsApiPreview).ConfigureAwait(false); return httpStatusCode == HttpStatusCode.NoContent; } - catch(NotFoundException) + catch (NotFoundException) { return false; } @@ -52,7 +52,7 @@ namespace Octokit var httpStatusCode = await Connection.Delete(endpoint, new object(), AcceptHeaders.InvitationsApiPreview).ConfigureAwait(false); return httpStatusCode == HttpStatusCode.NoContent; } - catch(NotFoundException) + catch (NotFoundException) { return false; } @@ -76,7 +76,7 @@ namespace Octokit var httpStatusCode = await Connection.Delete(endpoint, new object(), AcceptHeaders.InvitationsApiPreview).ConfigureAwait(false); return httpStatusCode == HttpStatusCode.NoContent; } - catch(NotFoundException) + catch (NotFoundException) { return false; } diff --git a/Octokit/Clients/UserEmailsClient.cs b/Octokit/Clients/UserEmailsClient.cs index fc638cd0..9dd9736b 100644 --- a/Octokit/Clients/UserEmailsClient.cs +++ b/Octokit/Clients/UserEmailsClient.cs @@ -32,7 +32,7 @@ namespace Octokit { return GetAll(ApiOptions.None); } - + /// /// Gets all email addresses for the authenticated user. /// diff --git a/Octokit/Exceptions/ApiException.cs b/Octokit/Exceptions/ApiException.cs index 67b16735..853b2e67 100644 --- a/Octokit/Exceptions/ApiException.cs +++ b/Octokit/Exceptions/ApiException.cs @@ -155,8 +155,8 @@ namespace Octokit : base(info, context) { if (info == null) return; - StatusCode = (HttpStatusCode) info.GetInt32("HttpStatusCode"); - ApiError = (ApiError) info.GetValue("ApiError", typeof(ApiError)); + StatusCode = (HttpStatusCode)info.GetInt32("HttpStatusCode"); + ApiError = (ApiError)info.GetValue("ApiError", typeof(ApiError)); } [SecurityCritical] diff --git a/Octokit/Exceptions/RepositoryExistsException.cs b/Octokit/Exceptions/RepositoryExistsException.cs index 51f0247a..82ab94e5 100644 --- a/Octokit/Exceptions/RepositoryExistsException.cs +++ b/Octokit/Exceptions/RepositoryExistsException.cs @@ -115,7 +115,7 @@ namespace Octokit RepositoryName = info.GetString("RepositoryName"); Organization = info.GetString("Organization"); OwnerIsOrganization = info.GetBoolean("OwnerIsOrganization"); - ExistingRepositoryWebUrl = (Uri) info.GetValue("ExistingRepositoryWebUrl", typeof(Uri)); + ExistingRepositoryWebUrl = (Uri)info.GetValue("ExistingRepositoryWebUrl", typeof(Uri)); } [SecurityCritical] diff --git a/Octokit/Exceptions/TwoFactorAuthorizationException.cs b/Octokit/Exceptions/TwoFactorAuthorizationException.cs index 6e71102c..5f47cafa 100644 --- a/Octokit/Exceptions/TwoFactorAuthorizationException.cs +++ b/Octokit/Exceptions/TwoFactorAuthorizationException.cs @@ -78,7 +78,7 @@ namespace Octokit : base(info, context) { if (info == null) return; - TwoFactorType = (TwoFactorType) info.GetInt32("TwoFactorType"); + TwoFactorType = (TwoFactorType)info.GetInt32("TwoFactorType"); } [SecurityCritical] diff --git a/Octokit/Helpers/ApiUrls.cs b/Octokit/Helpers/ApiUrls.cs index 05cd1ce4..e9e46568 100644 --- a/Octokit/Helpers/ApiUrls.cs +++ b/Octokit/Helpers/ApiUrls.cs @@ -117,7 +117,7 @@ namespace Octokit /// public static Uri AllOrganizations() { - return "organizations".FormatUri(); + return "organizations".FormatUri(); } /// @@ -127,7 +127,7 @@ namespace Octokit /// public static Uri AllOrganizations(long since) { - return "organizations?since={0}".FormatUri(since); + return "organizations?since={0}".FormatUri(since); } /// @@ -2844,8 +2844,6 @@ namespace Octokit /// The for comparing two commits. public static Uri RepoCompare(long repositoryId, string @base, string head) { - - Ensure.ArgumentNotNullOrEmptyString(@base, "base"); Ensure.ArgumentNotNullOrEmptyString(head, "head"); var encodedBase = @base.UriEncode(); diff --git a/Octokit/Http/Connection.cs b/Octokit/Http/Connection.cs index d6cc3243..58f6eec5 100644 --- a/Octokit/Http/Connection.cs +++ b/Octokit/Http/Connection.cs @@ -638,7 +638,7 @@ namespace Octokit if (body.Contains("abuse-rate-limits") || body.Contains("abuse detection mechanism")) { - return new AbuseException(response); + return new AbuseException(response); } return new ForbiddenException(response); diff --git a/Octokit/Http/SimpleJsonSerializer.cs b/Octokit/Http/SimpleJsonSerializer.cs index 8253bdad..7921230d 100644 --- a/Octokit/Http/SimpleJsonSerializer.cs +++ b/Octokit/Http/SimpleJsonSerializer.cs @@ -109,7 +109,6 @@ namespace Octokit.Internal { if (attribute.Value.Equals(value)) _cachedEnums[type].Add(attribute.Value, field.GetValue(null)); - } } } diff --git a/Octokit/Models/Request/NewIssue.cs b/Octokit/Models/Request/NewIssue.cs index c7d12478..417aa0cd 100644 --- a/Octokit/Models/Request/NewIssue.cs +++ b/Octokit/Models/Request/NewIssue.cs @@ -1,4 +1,5 @@ -using System.Collections.ObjectModel; +using System; +using System.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; @@ -37,6 +38,7 @@ namespace Octokit /// /// Only users with push access can set the assignee for new issues. The assignee is silently dropped otherwise. /// + [Obsolete("Please use Assignees property. This property will no longer be supported by the GitHub API and will be removed in a future version")] public string Assignee { get; set; } /// diff --git a/Octokit/Models/Request/OrganizationRequest.cs b/Octokit/Models/Request/OrganizationRequest.cs index 79e34031..3743fe11 100644 --- a/Octokit/Models/Request/OrganizationRequest.cs +++ b/Octokit/Models/Request/OrganizationRequest.cs @@ -9,7 +9,6 @@ namespace Octokit [DebuggerDisplay("{DebuggerDisplay,nq}")] public class OrganizationRequest : RequestParameters { - /// /// Intializes a new instance of the class. /// @@ -17,10 +16,10 @@ namespace Octokit public OrganizationRequest(int since) { Ensure.ArgumentNotNull(since, "since"); - + Since = since; } - + /// /// Gets or sets the integer Id of the last Organization that you've seen. /// @@ -28,10 +27,10 @@ namespace Octokit internal string DebuggerDisplay { - get - { - return string.Format(CultureInfo.InvariantCulture, "Since: {0} ", Since); - } + get + { + return string.Format(CultureInfo.InvariantCulture, "Since: {0} ", Since); + } } } } \ No newline at end of file diff --git a/Octokit/Models/Request/RepositoryUpdate.cs b/Octokit/Models/Request/RepositoryUpdate.cs index dbce3686..b6c856b8 100644 --- a/Octokit/Models/Request/RepositoryUpdate.cs +++ b/Octokit/Models/Request/RepositoryUpdate.cs @@ -15,7 +15,6 @@ namespace Octokit [Obsolete("Please use the ctor RepositoryUpdate(string name) as Name is a required field")] public RepositoryUpdate() { - } /// @@ -33,42 +32,42 @@ namespace Octokit /// Required. Gets or sets the repository name. /// public string Name { get; set; } - + /// /// Optional. Gets or sets the repository description. The default is null (do not update) /// public string Description { get; set; } - + /// /// Optional. Gets or sets the repository homepage url. The default is null (do not update). /// public string Homepage { get; set; } - + /// /// Gets or sets whether to make the repository private. The default is null (do not update). /// public bool? Private { get; set; } - + /// /// Gets or sets whether to enable issues for the repository. The default is null (do not update). /// public bool? HasIssues { get; set; } - + /// /// Optional. Gets or sets whether to enable the wiki for the repository. The default is null (do not update). /// public bool? HasWiki { get; set; } - + /// /// Optional. Gets or sets whether to enable downloads for the repository. The default is null (do not update). /// public bool? HasDownloads { get; set; } - + /// /// Optional. Gets or sets the default branch. The default is null (do not update). /// public string DefaultBranch { get; set; } - + /// /// Optional. Allows the "Rebase and Merge" method to be used. /// diff --git a/Octokit/Models/Response/BranchProtection.cs b/Octokit/Models/Response/BranchProtection.cs index 94ecf065..a7d04d0c 100644 --- a/Octokit/Models/Response/BranchProtection.cs +++ b/Octokit/Models/Response/BranchProtection.cs @@ -128,7 +128,7 @@ namespace Octokit { get { - return string.Format(CultureInfo.InvariantCulture, + return string.Format(CultureInfo.InvariantCulture, "StatusChecks: {0} Restrictions: {1}", RequiredStatusChecks == null ? "disabled" : RequiredStatusChecks.DebuggerDisplay, Restrictions == null ? "disabled" : Restrictions.DebuggerDisplay); @@ -172,8 +172,8 @@ namespace Octokit { return string.Format(CultureInfo.InvariantCulture, "IncludeAdmins: {0} Strict: {1} Contexts: {2}", - IncludeAdmins, - Strict, + IncludeAdmins, + Strict, Contexts == null ? "" : String.Join(",", Contexts)); } } @@ -207,7 +207,7 @@ namespace Octokit { get { - return string.Format(CultureInfo.InvariantCulture, + return string.Format(CultureInfo.InvariantCulture, "Teams: {0} Users: {1}", Teams == null ? "" : String.Join(",", Teams), Users == null ? "" : String.Join(",", Users)); diff --git a/Octokit/Models/Response/ReactionSummary.cs b/Octokit/Models/Response/ReactionSummary.cs index feb634a1..360f5946 100644 --- a/Octokit/Models/Response/ReactionSummary.cs +++ b/Octokit/Models/Response/ReactionSummary.cs @@ -24,14 +24,14 @@ namespace Octokit get { return string.Format( - CultureInfo.InvariantCulture, - "TotalCount: {0} +1: {1} -1: {2} Laugh: {3} Confused: {4} Heart: {5} Hooray: {6}", - TotalCount, - Plus1, - Minus1, - Laugh, - Confused, - Heart, + CultureInfo.InvariantCulture, + "TotalCount: {0} +1: {1} -1: {2} Laugh: {3} Confused: {4} Heart: {5} Hooray: {6}", + TotalCount, + Plus1, + Minus1, + Laugh, + Confused, + Heart, Hooray); } } diff --git a/Octokit/Models/Response/Repository.cs b/Octokit/Models/Response/Repository.cs index d17ed63c..575d8404 100644 --- a/Octokit/Models/Response/Repository.cs +++ b/Octokit/Models/Response/Repository.cs @@ -110,7 +110,7 @@ namespace Octokit public bool HasWiki { get; protected set; } public bool HasDownloads { get; protected set; } - + public bool? AllowRebaseMerge { get; protected set; } public bool? AllowSquashMerge { get; protected set; } diff --git a/Octokit/Models/Response/SourceInfo.cs b/Octokit/Models/Response/SourceInfo.cs index ff91bdfe..7e52de16 100644 --- a/Octokit/Models/Response/SourceInfo.cs +++ b/Octokit/Models/Response/SourceInfo.cs @@ -8,11 +8,12 @@ namespace Octokit { public User Actor { get; protected set; } public int Id { get; protected set; } + public Issue Issue { get; protected set; } public string Url { get; protected set; } internal string DebuggerDisplay { - get { return string.Format(CultureInfo.InvariantCulture, "Id: {0} Url: {1}", Id, Url); } + get { return string.Format(CultureInfo.InvariantCulture, "Id: {0} Url: {1}", Id, Url ?? ""); } } } } diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 388d254f..26f3ad55 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -1,3 +1,45 @@ +### New in 0.24.0 (released 17/1/2017) + +**Features/Enhancements** + + - Add `GetAll` method to `OrganizationsClient` - [#1469](https://github.com/octokit/octokit.net/pull/1469) via [malamour-work](https://github.com/malamour-work) + - Add missing fields to `Repository` class - `HasPages`, `SubscribersCount`, `Size` - [#1473](https://github.com/octokit/octokit.net/pull/1473) via [ryangribble](https://github.com/ryangribble) + - Allow base64 content for create/update file - [#1488](https://github.com/octokit/octokit.net/pull/1488) via [laedit](https://github.com/laedit) + - Add `HtmlUrl` field to `Milestone` class - [#1489](https://github.com/octokit/octokit.net/pull/1489) via [StanleyGoldman](https://github.com/StanleyGoldman) + - Add support for passing sort options to `IssueCommentsClient.GetAllForRepository()` - [#1501](https://github.com/octokit/octokit.net/pull/1501) via [pjc0247](https://github.com/pjc0247) + - Rename `PullRequest.Comment` to `PullRequest.ReviewComment` for better accuracy - [#1520](https://github.com/octokit/octokit.net/pull/1520) via [bmeverett](https://github.com/bmeverett) + - Introduce `AbuseException` - [#1528](https://github.com/octokit/octokit.net/pull/1528) via [SeanKilleen](https://github.com/SeanKilleen) + - Add `Id` field to `PullRequest` class - [#1537](https://github.com/octokit/octokit.net/pull/1537) via [YunLi1988](https://github.com/YunLi1988) + - Unparseable `ApiErrors` should now fall back to better default error messages - [#1540](https://github.com/octokit/octokit.net/pull/1540) via [SeanKilleen](https://github.com/SeanKilleen) + +**Fixes** + + - Fix errors in `ObservableEventsClient` caused by incorrect return types - [#1490](https://github.com/octokit/octokit.net/pull/1490) via [StanleyGoldman](https://github.com/StanleyGoldman) + - Add missing `SecurityCritical` attribute on `GetObjectData()` overrides - [#1493](https://github.com/octokit/octokit.net/pull/1493) via [M-Zuber](https://github.com/M-Zuber) + - Fix exceptions in Events API by adding missing event types to `EventInfo` enumeration - [#1536](https://github.com/octokit/octokit.net/pull/1536) via [lynnfaraday](https://github.com/lynnfaraday) + - Add new AccountType "Bot" to prevent deserialization errors - [#1541](https://github.com/octokit/octokit.net/pull/1541) via [ryangribble](https://github.com/ryangribble) + +**Documentation Updates** + + - Clarify `ApiInfo` rate limiting usage in docs - [#1524](https://github.com/octokit/octokit.net/pull/1524) via [SeanKilleen](https://github.com/SeanKilleen) + - Clarify label coloring usage in docs - [#1530](https://github.com/octokit/octokit.net/pull/1530) via [SeanKilleen](https://github.com/SeanKilleen) + +**Breaking Changes** + + - Creating and Editing Issues (and PullRequests) using `NewIssue` and `IssueUpdate` requests +should now use the `Assignees` collection rather than the now deprecated 'Assignee` field. +Both fields can't be specified on the same request, so any code still using `Assignee` will +need to explicitly set `Assignees` to `null` to avoid Api validation errors. + + - `OrganizationsClient.GetAll(string user)` has been marked obsolete in favour of +`OrganizationsClient.GetAllForUser(string user)` + + - `PullRequest.Comment` has been marked obsolete in favour of `PullRequest.ReviewComment` + +- Several `EventsClient` methods previously returned the incorrect `Activity` response class. +This has been corrected to `IssueEvent` which although is now correct could break calling +code that was written assuming this previous incorrect return type. + ### New in 0.23.0 (released 07/10/2016) **Features** diff --git a/SolutionInfo.cs b/SolutionInfo.cs index cd5d37f2..294c3558 100644 --- a/SolutionInfo.cs +++ b/SolutionInfo.cs @@ -3,12 +3,14 @@ using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyProductAttribute("Octokit")] -[assembly: AssemblyVersionAttribute("0.23.0")] -[assembly: AssemblyFileVersionAttribute("0.23.0")] +[assembly: AssemblyVersionAttribute("0.24.0")] +[assembly: AssemblyFileVersionAttribute("0.24.0")] [assembly: ComVisibleAttribute(false)] -namespace System { - internal static class AssemblyVersionInformation { - internal const string Version = "0.23.0"; - internal const string InformationalVersion = "0.23.0"; +namespace System +{ + internal static class AssemblyVersionInformation + { + internal const string Version = "0.24.0"; + internal const string InformationalVersion = "0.24.0"; } }