From a846891ef7d2f5c95eead5fb349f88605739b51b Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Tue, 19 May 2015 20:15:52 +0930 Subject: [PATCH 1/4] local install of code formatter --- build.cmd | 1 + 1 file changed, 1 insertion(+) diff --git a/build.cmd b/build.cmd index f2347ba6c2..abca1187ce 100644 --- a/build.cmd +++ b/build.cmd @@ -3,6 +3,7 @@ "tools\nuget\nuget.exe" "install" "xunit.runner.console" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "2.0.0" "tools\nuget\nuget.exe" "install" "FAKE.Core" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "4.4.2" "tools\nuget\nuget.exe" "install" "SourceLink.Fake" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "1.1.0" +"tools\nuget\nuget.exe" "install" "Octokit.CodeFormatter" "-OutputDirectory" "tools" "-ExcludeVersion" "-version" "1.0.0-preview" -Pre :Build cls From ab018e8910d917b69921956a674fa554f3951e1d Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Tue, 19 May 2015 20:49:39 +0930 Subject: [PATCH 2/4] format the code in the script --- .gitignore | 1 + build.fsx | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/.gitignore b/.gitignore index 64fac8693e..1128a7f633 100644 --- a/.gitignore +++ b/.gitignore @@ -74,6 +74,7 @@ packaging/ tools/FAKE.Core tools/SourceLink.Fake tools/xunit.runner.console +tools/Octokit.CodeFormatter *.ncrunch* *.GhostDoc.xml diff --git a/build.fsx b/build.fsx index ad9f9af4f2..3043ca76ca 100644 --- a/build.fsx +++ b/build.fsx @@ -59,6 +59,23 @@ Target "CheckProjects" (fun _ -> |> Fake.MSBuild.ProjectSystem.CompareProjectsTo "./Octokit.Reactive/Octokit.Reactive.csproj" ) +let codeFormatter = @"tools\Octokit.CodeFormatter\tools\CodeFormatter.exe" + +Target "FormatCode" (fun _ -> + [ "Octokit" + "Octokit.Reactive" + "Octokit.Tests" + "Octokit.Tests.Conventions" + "Octokit.Tests.Integration"] + |> Seq.iter (fun pf -> + let project = pf + "/" + pf + ".csproj" + ExecProcess (fun info -> + info.FileName <- codeFormatter + info.Arguments <- project + " /nocopyright") (TimeSpan.FromMinutes 1.0) + |> ignore + ) +) + Target "FixProjects" (fun _ -> !! "./Octokit/Octokit*.csproj" |> Fake.MSBuild.ProjectSystem.FixProjectFiles "./Octokit/Octokit.csproj" From 3305dfcf4fb1013e7b343b7f9a999e90ef428914 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Fri, 22 May 2015 15:08:03 +0930 Subject: [PATCH 3/4] skip unicode character editing --- build.fsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.fsx b/build.fsx index 3043ca76ca..521d5a5437 100644 --- a/build.fsx +++ b/build.fsx @@ -71,7 +71,7 @@ Target "FormatCode" (fun _ -> let project = pf + "/" + pf + ".csproj" ExecProcess (fun info -> info.FileName <- codeFormatter - info.Arguments <- project + " /nocopyright") (TimeSpan.FromMinutes 1.0) + info.Arguments <- project + " /nocopyright /nounicode") (TimeSpan.FromMinutes 1.0) |> ignore ) ) From 80719c003359bed7308e1c698564bc1aeeac4804 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Wed, 4 Nov 2015 13:38:51 -0800 Subject: [PATCH 4/4] aaaand format the code --- .../Clients/IObservableCommitsClient.cs | 2 +- .../Clients/IObservableOrganizationsClient.cs | 2 +- .../Clients/IObservablePullRequestsClient.cs | 1 - .../Clients/IObservableRepositoriesClient.cs | 4 +- .../Clients/IObservableWatchedClient.cs | 2 +- .../Clients/ObservableAuthorizationsClient.cs | 2 +- .../Clients/ObservableCommitsClient.cs | 2 +- .../Clients/ObservableGistsClient.cs | 2 +- .../Clients/ObservableMergingClient.cs | 2 +- .../Clients/ObservableNotificationsClient.cs | 1 - .../ObservableOrganizationMembersClient.cs | 2 +- .../Clients/ObservableOrganizationsClient.cs | 2 +- .../Clients/ObservablePullRequestsClient.cs | 4 +- .../Clients/ObservableRepositoriesClient.cs | 6 +-- .../Clients/ObservableSshKeysClient.cs | 2 +- .../Clients/ObservableTreesClient.cs | 1 - .../Helpers/ObservableExtensions.cs | 2 +- Octokit.Reactive/ObservableGitHubClient.cs | 2 +- .../InterfaceHasAdditionalMethodsException.cs | 9 ++-- .../InterfaceMethodsMismatchException.cs | 11 ++-- .../InterfaceMissingMethodsException.cs | 9 ++-- .../Exception/InterfaceNotFoundException.cs | 10 ++-- ...dDebuggerDisplayAttributeValueException.cs | 3 +- .../InvalidDebuggerDisplayReturnType.cs | 3 +- ...issingDebuggerDisplayAttributeException.cs | 3 +- ...MissingDebuggerDisplayPropertyException.cs | 3 +- .../MutableModelPropertiesException.cs | 3 +- ...nationGetAllMethodNameMismatchException.cs | 3 +- .../ParameterCountMismatchException.cs | 9 ++-- .../Exception/ParameterMismatchException.cs | 9 ++-- .../Exception/ReturnValueMismatchException.cs | 11 ++-- .../SyncObservableClients.cs | 8 +-- Octokit.Tests.Conventions/TypeExtensions.cs | 10 ++-- .../Clients/AuthorizationClientTests.cs | 4 +- .../Clients/CommitsClientTests.cs | 2 +- .../Clients/DeploymentStatusClientTests.cs | 4 +- .../Clients/DeploymentsClientTests.cs | 2 +- .../Clients/EventsClientTests.cs | 4 +- .../Clients/FollowersClientTests.cs | 2 +- .../Clients/GistsClientTests.cs | 2 +- .../Clients/GitHubClientTests.cs | 3 +- .../Clients/IssuesClientTests.cs | 6 +-- .../Clients/IssuesEventsClientTests.cs | 8 +-- .../Clients/IssuesLabelsClientTests.cs | 2 +- .../Clients/MergingClientTests.cs | 4 +- .../Clients/MilestonesClientTests.cs | 2 +- .../Clients/MiscellaneousClientTests.cs | 1 - .../PullRequestReviewCommentsClientTests.cs | 4 +- .../Clients/PullRequestsClientTests.cs | 6 +-- .../Clients/ReleasesClientTests.cs | 11 ++-- .../Clients/UserEmailsClientTests.cs | 2 +- Octokit.Tests.Integration/Helper.cs | 4 +- .../Helpers/OrganizationTestAttribute.cs | 2 +- .../PersonalAccessTokenTestAttribute.cs | 2 +- .../Helpers/RepositorySetupHelper.cs | 1 - .../fixtures/RepositoriesHooksCollection.cs | 2 +- .../Authentication/TokenAuthenticatorTests.cs | 2 +- .../Clients/AuthorizationsClientTests.cs | 12 ++--- .../Clients/CommitStatusClientTests.cs | 4 +- Octokit.Tests/Clients/CommitsClientTests.cs | 4 +- .../Clients/DeploymentStatusClientTests.cs | 4 +- Octokit.Tests/Clients/EventsClientTests.cs | 4 +- Octokit.Tests/Clients/FollowersClientTests.cs | 13 +++-- Octokit.Tests/Clients/GistsClientTests.cs | 20 +++---- .../Clients/GitDatabaseClientTests.cs | 2 +- .../Clients/IssueCommentsClientTests.cs | 3 +- Octokit.Tests/Clients/IssuesClientTests.cs | 1 - .../Clients/IssuesEventsClientTests.cs | 1 - Octokit.Tests/Clients/MergingClientTests.cs | 6 +-- .../Clients/MiscellaneousClientTests.cs | 2 +- .../Clients/OrganizationMembersClientTests.cs | 14 ++--- .../Clients/PullRequestsClientTests.cs | 10 ++-- .../Clients/RepoCollaboratorsClientTests.cs | 8 +-- .../Clients/RepositoriesClientTests.cs | 4 +- .../Clients/RepositoryCommentsClientTests.cs | 7 ++- .../Clients/RepositoryHooksClientTest.cs | 2 +- Octokit.Tests/Clients/SearchClientTests.cs | 8 +-- Octokit.Tests/Clients/StarredClientTests.cs | 4 +- .../Clients/StatisticsClientTests.cs | 8 +-- Octokit.Tests/Clients/TagsClientTests.cs | 6 +-- Octokit.Tests/Clients/TeamsClientTests.cs | 1 - Octokit.Tests/Clients/WatchedClientTests.cs | 2 +- Octokit.Tests/Exceptions/ApiExceptionTests.cs | 4 +- .../Exceptions/ApiValidationExceptionTests.cs | 6 +-- .../Exceptions/ForbiddenExceptionTests.cs | 2 +- .../RateLimitExceededExceptionTests.cs | 2 +- .../RepositoryExistsExceptionTests.cs | 2 +- Octokit.Tests/GitHubClientTests.cs | 3 +- Octokit.Tests/Helpers/Arg.cs | 2 +- .../Helpers/StringExtensionsTests.cs | 2 +- .../Helpers/UnixTimestampExtensionsTests.cs | 6 +-- Octokit.Tests/Helpers/UriExtensionsTests.cs | 2 +- Octokit.Tests/Http/ApiConnectionTests.cs | 12 ++--- Octokit.Tests/Http/ApiInfoTests.cs | 3 +- Octokit.Tests/Http/ConnectionTests.cs | 14 ++--- Octokit.Tests/Http/HttpClientAdapterTests.cs | 11 ++-- Octokit.Tests/Http/JsonHttpPipelineTests.cs | 4 +- Octokit.Tests/Http/RateLimitTests.cs | 9 ++-- Octokit.Tests/Http/RedirectHandlerTests.cs | 2 +- Octokit.Tests/Models/DeploymentTests.cs | 2 +- .../Models/ReadOnlyPagedCollectionTests.cs | 4 +- Octokit.Tests/Models/RepositoryUpdateTests.cs | 4 +- .../Models/SearchCodeRequestTests.cs | 2 +- .../Models/SearchRepositoryRequestTests.cs | 2 +- .../Reactive/AuthorizationExtensionsTests.cs | 4 +- .../Reactive/ObservableCommitsClientTests.cs | 6 +-- .../ObservableDeploymentsClientTests.cs | 2 +- .../ObservableIssueCommentsClientTests.cs | 3 +- .../ObservableMilestonesClientTests.cs | 8 +-- ...blePullRequestReviewCommentsClientTests.cs | 2 +- .../ObservableRepositoriesClientTests.cs | 10 ++-- .../ObservableStatisticsClientTests.cs | 2 +- .../Reactive/ObservableTreesClientTests.cs | 4 +- Octokit.Tests/SimpleJsonSerializerTests.cs | 4 +- Octokit/Authentication/TokenAuthenticator.cs | 4 +- Octokit/Clients/ApiClient.cs | 2 +- Octokit/Clients/AuthorizationsClient.cs | 2 +- Octokit/Clients/CommitsClient.cs | 2 +- Octokit/Clients/FollowersClient.cs | 4 +- Octokit/Clients/GistsClient.cs | 9 ++-- Octokit/Clients/GitDatabaseClient.cs | 2 +- Octokit/Clients/IAuthorizationsClient.cs | 8 +-- Octokit/Clients/IDeploymentsClient.cs | 2 +- Octokit/Clients/IGistCommentsClient.cs | 2 +- Octokit/Clients/IOrganizationMembersClient.cs | 6 +-- .../Clients/IRepositoryDeployKeysClient.cs | 2 +- Octokit/Clients/IWatchedClient.cs | 2 +- Octokit/Clients/MergingClient.cs | 2 +- Octokit/Clients/OrganizationMembersClient.cs | 2 +- Octokit/Clients/PullRequestsClient.cs | 4 +- Octokit/Clients/ReferencesClient.cs | 2 +- Octokit/Clients/RepositoriesClient.cs | 6 +-- Octokit/Clients/RepositoryContentsClient.cs | 2 +- Octokit/Clients/RepositoryDeployKeysClient.cs | 2 +- Octokit/Clients/SearchClient.cs | 1 - Octokit/Clients/StatisticsClient.cs | 8 +-- Octokit/Clients/TagsClient.cs | 2 +- Octokit/Clients/WatchedClient.cs | 2 +- Octokit/Exceptions/ForbiddenException.cs | 2 +- .../InvalidGitignoreTemplateException.cs | 11 ++-- .../Exceptions/RepositoryExistsException.cs | 6 +-- .../Exceptions/RepositoryFormatException.cs | 3 +- .../TwoFactorAuthorizationException.cs | 2 +- Octokit/Helpers/ApiExtensions.cs | 2 +- Octokit/Helpers/ApiUrls.cs | 10 ++-- Octokit/Helpers/CollectionExtensions.cs | 2 +- Octokit/Helpers/PropertyOrField.cs | 7 ++- Octokit/Helpers/StringExtensions.cs | 4 +- Octokit/Helpers/UnixTimeStampExtensions.cs | 2 +- Octokit/Helpers/UriExtensions.cs | 2 +- Octokit/Http/ApiConnection.cs | 2 +- Octokit/Http/ApiInfo.cs | 2 - Octokit/Http/Connection.cs | 3 +- Octokit/Http/Credentials.cs | 2 +- Octokit/Http/HttpClientAdapter.cs | 47 ++++++++-------- Octokit/Http/IApiConnection.cs | 4 +- Octokit/Http/ICredentialStore.cs | 2 +- Octokit/Http/IResponse.cs | 2 +- Octokit/Http/JsonHttpPipeline.cs | 2 +- Octokit/Http/RateLimit.cs | 7 ++- Octokit/Http/SimpleJsonSerializer.cs | 2 +- Octokit/Models/Request/BodyWrapper.cs | 2 +- Octokit/Models/Request/CreateFileRequest.cs | 2 +- Octokit/Models/Request/EditRepositoryHook.cs | 4 +- Octokit/Models/Request/IssueUpdate.cs | 2 +- .../Models/Request/NewArbitraryMarkDown.cs | 8 +-- Octokit/Models/Request/NewCommit.cs | 4 +- Octokit/Models/Request/NewGist.cs | 2 +- Octokit/Models/Request/NewIssue.cs | 4 +- Octokit/Models/Request/NewMerge.cs | 2 +- Octokit/Models/Request/NewMilestone.cs | 2 +- Octokit/Models/Request/NewPullRequest.cs | 2 +- Octokit/Models/Request/NewReference.cs | 2 +- .../Models/Request/PublicRepositoryRequest.cs | 2 +- Octokit/Models/Request/PullRequestRequest.cs | 6 +-- Octokit/Models/Request/ReleaseAssetUpdate.cs | 2 +- Octokit/Models/Request/RequestParameters.cs | 2 +- Octokit/Models/Request/SearchIssuesRequest.cs | 4 +- .../Request/SearchRepositoriesRequest.cs | 2 +- Octokit/Models/Response/Account.cs | 2 +- .../ActivityPayloads/IssueCommentPayload.cs | 1 - .../ActivityPayloads/PushEventPayload.cs | 2 +- .../Models/Response/AdditionsAndDeletions.cs | 2 +- Octokit/Models/Response/Author.cs | 2 +- Octokit/Models/Response/CommitActivity.cs | 2 +- Octokit/Models/Response/CommitComment.cs | 2 +- Octokit/Models/Response/DeployKey.cs | 2 +- Octokit/Models/Response/Deployment.cs | 2 +- Octokit/Models/Response/EmailAddress.cs | 2 +- Octokit/Models/Response/GitIgnoreTemplate.cs | 1 - Octokit/Models/Response/Issue.cs | 4 +- Octokit/Models/Response/LicenseMetadata.cs | 2 +- Octokit/Models/Response/Merge.cs | 2 +- .../Models/Response/MiscellaneousRateLimit.cs | 2 +- Octokit/Models/Response/PunchCardPoint.cs | 2 +- Octokit/Models/Response/ResourceRateLimit.cs | 3 +- Octokit/Models/Response/TagObject.cs | 2 +- Octokit/SimpleJson.cs | 53 +++++++++---------- SolutionInfo.cs | 6 ++- 199 files changed, 442 insertions(+), 438 deletions(-) diff --git a/Octokit.Reactive/Clients/IObservableCommitsClient.cs b/Octokit.Reactive/Clients/IObservableCommitsClient.cs index 22d9b00382..a33beb1cb7 100644 --- a/Octokit.Reactive/Clients/IObservableCommitsClient.cs +++ b/Octokit.Reactive/Clients/IObservableCommitsClient.cs @@ -29,6 +29,6 @@ public interface IObservableCommitsClient /// The name of the repository /// The commit to create /// - IObservable Create(string owner, string name, NewCommit commit); + IObservable Create(string owner, string name, NewCommit commit); } } \ No newline at end of file diff --git a/Octokit.Reactive/Clients/IObservableOrganizationsClient.cs b/Octokit.Reactive/Clients/IObservableOrganizationsClient.cs index 3f01d2cee0..f36bb44a67 100644 --- a/Octokit.Reactive/Clients/IObservableOrganizationsClient.cs +++ b/Octokit.Reactive/Clients/IObservableOrganizationsClient.cs @@ -9,7 +9,7 @@ public interface IObservableOrganizationsClient /// Returns a client to manage members of an organization. /// IObservableOrganizationMembersClient Member { get; } - + /// /// Returns a client to manage teams for an organization. /// diff --git a/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs b/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs index 2369ce0faa..c1d8537492 100644 --- a/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs +++ b/Octokit.Reactive/Clients/IObservablePullRequestsClient.cs @@ -106,6 +106,5 @@ public interface IObservablePullRequestsClient /// The pull request number /// A collection of results IObservable Files(string owner, string name, int number); - } } diff --git a/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs b/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs index 0a81231f4a..7ba8c055c2 100644 --- a/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs +++ b/Octokit.Reactive/Clients/IObservableRepositoriesClient.cs @@ -29,7 +29,7 @@ public interface IObservableRepositoriesClient /// Deleting a repository requires admin access. If OAuth is used, the `delete_repo` scope is required. /// An for the operation IObservable Delete(string owner, string name); - + /// /// Retrieves the for the specified owner and name. /// @@ -154,7 +154,7 @@ public interface IObservableRepositoriesClient /// /// See Forks API documentation for more information. IObservableRepositoryForksClient Forks { get; } - + /// /// Client for GitHub's Repository Contents API. /// diff --git a/Octokit.Reactive/Clients/IObservableWatchedClient.cs b/Octokit.Reactive/Clients/IObservableWatchedClient.cs index f64e8ea0f9..a3fa7a070d 100644 --- a/Octokit.Reactive/Clients/IObservableWatchedClient.cs +++ b/Octokit.Reactive/Clients/IObservableWatchedClient.cs @@ -54,7 +54,7 @@ public interface IObservableWatchedClient /// The owner of the repository to unstar /// The name of the repository to unstar /// A bool representing the success of the operation - [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId="Unwatch", + [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Unwatch", Justification = "Unwatch is consistent with the GitHub website")] IObservable UnwatchRepo(string owner, string name); } diff --git a/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs b/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs index 2a4d196173..bbe991c1c1 100644 --- a/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs +++ b/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs @@ -8,7 +8,7 @@ namespace Octokit.Reactive public class ObservableAuthorizationsClient : IObservableAuthorizationsClient { readonly IAuthorizationsClient _client; - readonly IConnection _connection; + readonly IConnection _connection; public ObservableAuthorizationsClient(IGitHubClient client) { diff --git a/Octokit.Reactive/Clients/ObservableCommitsClient.cs b/Octokit.Reactive/Clients/ObservableCommitsClient.cs index 0030f83c67..236f10e148 100644 --- a/Octokit.Reactive/Clients/ObservableCommitsClient.cs +++ b/Octokit.Reactive/Clients/ObservableCommitsClient.cs @@ -29,7 +29,7 @@ public IObservable Get(string owner, string name, string reference) Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNullOrEmptyString(reference, "reference"); - return _client.Get(owner, name, reference).ToObservable(); + return _client.Get(owner, name, reference).ToObservable(); } /// diff --git a/Octokit.Reactive/Clients/ObservableGistsClient.cs b/Octokit.Reactive/Clients/ObservableGistsClient.cs index c5e2dd5fbe..9d63c775ba 100644 --- a/Octokit.Reactive/Clients/ObservableGistsClient.cs +++ b/Octokit.Reactive/Clients/ObservableGistsClient.cs @@ -5,7 +5,7 @@ namespace Octokit.Reactive { - public class ObservableGistsClient : IObservableGistsClient + public class ObservableGistsClient : IObservableGistsClient { readonly IGistsClient _client; readonly IConnection _connection; diff --git a/Octokit.Reactive/Clients/ObservableMergingClient.cs b/Octokit.Reactive/Clients/ObservableMergingClient.cs index 4523d2f4cd..f4ef7461b8 100644 --- a/Octokit.Reactive/Clients/ObservableMergingClient.cs +++ b/Octokit.Reactive/Clients/ObservableMergingClient.cs @@ -6,7 +6,7 @@ namespace Octokit.Reactive public class ObservableMergingClient : IObservableMergingClient { readonly IMergingClient _client; - + public ObservableMergingClient(IGitHubClient client) { Ensure.ArgumentNotNull(client, "client"); diff --git a/Octokit.Reactive/Clients/ObservableNotificationsClient.cs b/Octokit.Reactive/Clients/ObservableNotificationsClient.cs index b2f39e0329..025b321664 100644 --- a/Octokit.Reactive/Clients/ObservableNotificationsClient.cs +++ b/Octokit.Reactive/Clients/ObservableNotificationsClient.cs @@ -84,7 +84,6 @@ public IObservable MarkAsRead() public IObservable MarkAsRead(MarkAsReadRequest markAsReadRequest) { return _notificationsClient.MarkAsRead(markAsReadRequest).ToObservable(); - } /// diff --git a/Octokit.Reactive/Clients/ObservableOrganizationMembersClient.cs b/Octokit.Reactive/Clients/ObservableOrganizationMembersClient.cs index d8c447ccd2..9eef60a024 100644 --- a/Octokit.Reactive/Clients/ObservableOrganizationMembersClient.cs +++ b/Octokit.Reactive/Clients/ObservableOrganizationMembersClient.cs @@ -73,7 +73,7 @@ public IObservable GetAll(string org) public IObservable GetAll(string org, OrganizationMembersFilter filter) { Ensure.ArgumentNotNullOrEmptyString(org, "org"); - + return _connection.GetAndFlattenAllPages(ApiUrls.Members(org, filter)); } diff --git a/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs b/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs index 04daf29430..64afff9d1e 100644 --- a/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs +++ b/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs @@ -19,7 +19,7 @@ public ObservableOrganizationsClient(IGitHubClient client) Member = new ObservableOrganizationMembersClient(client); Team = new ObservableTeamsClient(client); - + _client = client.Organization; _connection = client.Connection; } diff --git a/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs b/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs index a4f1a3449f..b62929d6b4 100644 --- a/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs +++ b/Octokit.Reactive/Clients/ObservablePullRequestsClient.cs @@ -117,7 +117,7 @@ public IObservable Update(string owner, string name, int number, Pu /// The pull request number /// A instance describing a pull request merge /// A result - public IObservable Merge(string owner, string name, int number, MergePullRequest mergePullRequest) + public IObservable Merge(string owner, string name, int number, MergePullRequest mergePullRequest) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); @@ -134,7 +134,7 @@ public IObservable Merge(string owner, string name, int number /// The name of the repository /// The pull request number /// A result - true if the pull request has been merged, false otherwise - public IObservable Merged(string owner, string name, int number) + public IObservable Merged(string owner, string name, int number) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); diff --git a/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs b/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs index 144f97edd7..9e7ac33c7d 100644 --- a/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs +++ b/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs @@ -16,7 +16,7 @@ public class ObservableRepositoriesClient : IObservableRepositoriesClient public ObservableRepositoriesClient(IGitHubClient client) { Ensure.ArgumentNotNull(client, "client"); - + _client = client.Repository; _connection = client.Connection; CommitStatus = new ObservableCommitStatusClient(client); @@ -288,7 +288,7 @@ public IObservable GetAllContributors(string owner, strin { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); - + var endpoint = ApiUrls.RepositoryContributors(owner, name); var parameters = new Dictionary(); if (includeAnonymous) @@ -330,7 +330,7 @@ public IObservable GetAllTeams(string owner, string name) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); - + var endpoint = ApiUrls.RepositoryTeams(owner, name); return _connection.GetAndFlattenAllPages(endpoint); } diff --git a/Octokit.Reactive/Clients/ObservableSshKeysClient.cs b/Octokit.Reactive/Clients/ObservableSshKeysClient.cs index 2d09d92c31..5b4b340e8a 100644 --- a/Octokit.Reactive/Clients/ObservableSshKeysClient.cs +++ b/Octokit.Reactive/Clients/ObservableSshKeysClient.cs @@ -17,7 +17,7 @@ public class ObservableSshKeysClient : IObservableSshKeysClient public ObservableSshKeysClient(IGitHubClient client) { Ensure.ArgumentNotNull(client, "client"); - + _client = client.SshKey; _connection = client.Connection; } diff --git a/Octokit.Reactive/Clients/ObservableTreesClient.cs b/Octokit.Reactive/Clients/ObservableTreesClient.cs index e3c45d855f..776e4fad1f 100644 --- a/Octokit.Reactive/Clients/ObservableTreesClient.cs +++ b/Octokit.Reactive/Clients/ObservableTreesClient.cs @@ -3,7 +3,6 @@ namespace Octokit.Reactive { - public class ObservableTreesClient : IObservableTreesClient { readonly ITreesClient _client; diff --git a/Octokit.Reactive/Helpers/ObservableExtensions.cs b/Octokit.Reactive/Helpers/ObservableExtensions.cs index ad3b1435d0..7a96759c95 100644 --- a/Octokit.Reactive/Helpers/ObservableExtensions.cs +++ b/Octokit.Reactive/Helpers/ObservableExtensions.cs @@ -40,7 +40,7 @@ internal static IObservable Expand( var outGate = new object(); var q = new Queue>(); var m = new SerialDisposable(); - var d = new CompositeDisposable {m}; + var d = new CompositeDisposable { m }; var activeCount = 0; var isAcquired = false; diff --git a/Octokit.Reactive/ObservableGitHubClient.cs b/Octokit.Reactive/ObservableGitHubClient.cs index 4970eebc9c..c2230d2fd0 100644 --- a/Octokit.Reactive/ObservableGitHubClient.cs +++ b/Octokit.Reactive/ObservableGitHubClient.cs @@ -74,7 +74,7 @@ public IConnection Connection /// /// representing the information returned as part of an Api call public ApiInfo GetLastApiInfo() - { + { return _gitHubClient.Connection.GetLastApiInfo(); } } diff --git a/Octokit.Tests.Conventions/Exception/InterfaceHasAdditionalMethodsException.cs b/Octokit.Tests.Conventions/Exception/InterfaceHasAdditionalMethodsException.cs index 78ea2daa7c..cf68516212 100644 --- a/Octokit.Tests.Conventions/Exception/InterfaceHasAdditionalMethodsException.cs +++ b/Octokit.Tests.Conventions/Exception/InterfaceHasAdditionalMethodsException.cs @@ -8,13 +8,16 @@ namespace Octokit.Tests.Conventions public class InterfaceHasAdditionalMethodsException : Exception { public InterfaceHasAdditionalMethodsException(Type type, IEnumerable methodsMissingOnReactiveClient) - : base(CreateMessage(type, methodsMissingOnReactiveClient)) { } + : base(CreateMessage(type, methodsMissingOnReactiveClient)) + { } public InterfaceHasAdditionalMethodsException(Type type, IEnumerable methodsMissingOnReactiveClient, Exception innerException) - : base(CreateMessage(type, methodsMissingOnReactiveClient), innerException) { } + : base(CreateMessage(type, methodsMissingOnReactiveClient), innerException) + { } protected InterfaceHasAdditionalMethodsException(SerializationInfo info, StreamingContext context) - : base(info, context) { } + : base(info, context) + { } static string CreateMessage(Type type, IEnumerable methods) { diff --git a/Octokit.Tests.Conventions/Exception/InterfaceMethodsMismatchException.cs b/Octokit.Tests.Conventions/Exception/InterfaceMethodsMismatchException.cs index 7a422d4926..2265f5ec88 100644 --- a/Octokit.Tests.Conventions/Exception/InterfaceMethodsMismatchException.cs +++ b/Octokit.Tests.Conventions/Exception/InterfaceMethodsMismatchException.cs @@ -8,13 +8,16 @@ namespace Octokit.Tests.Conventions public class InterfaceMethodsMismatchException : Exception { public InterfaceMethodsMismatchException(Type observableType, Type clientInterface) - : base(CreateMessage(observableType, clientInterface)) { } + : base(CreateMessage(observableType, clientInterface)) + { } - public InterfaceMethodsMismatchException(Type type,Type clientInterface, Exception innerException) - : base(CreateMessage(type, clientInterface), innerException) { } + public InterfaceMethodsMismatchException(Type type, Type clientInterface, Exception innerException) + : base(CreateMessage(type, clientInterface), innerException) + { } protected InterfaceMethodsMismatchException(SerializationInfo info, StreamingContext context) - : base(info, context) { } + : base(info, context) + { } static string Format(ParameterInfo parameterInfo) { diff --git a/Octokit.Tests.Conventions/Exception/InterfaceMissingMethodsException.cs b/Octokit.Tests.Conventions/Exception/InterfaceMissingMethodsException.cs index 4d16288a27..e9d701f276 100644 --- a/Octokit.Tests.Conventions/Exception/InterfaceMissingMethodsException.cs +++ b/Octokit.Tests.Conventions/Exception/InterfaceMissingMethodsException.cs @@ -8,13 +8,16 @@ namespace Octokit.Tests.Conventions public class InterfaceMissingMethodsException : Exception { public InterfaceMissingMethodsException(Type type, IEnumerable methodsMissingOnReactiveClient) - : base(CreateMessage(type, methodsMissingOnReactiveClient)) { } + : base(CreateMessage(type, methodsMissingOnReactiveClient)) + { } public InterfaceMissingMethodsException(Type type, IEnumerable methodsMissingOnReactiveClient, Exception innerException) - : base(CreateMessage(type, methodsMissingOnReactiveClient), innerException) { } + : base(CreateMessage(type, methodsMissingOnReactiveClient), innerException) + { } protected InterfaceMissingMethodsException(SerializationInfo info, StreamingContext context) - : base(info, context) { } + : base(info, context) + { } static string CreateMessage(Type type, IEnumerable methods) { diff --git a/Octokit.Tests.Conventions/Exception/InterfaceNotFoundException.cs b/Octokit.Tests.Conventions/Exception/InterfaceNotFoundException.cs index 3a4283310d..fe8586c23c 100644 --- a/Octokit.Tests.Conventions/Exception/InterfaceNotFoundException.cs +++ b/Octokit.Tests.Conventions/Exception/InterfaceNotFoundException.cs @@ -8,18 +8,20 @@ public class InterfaceNotFoundException : Exception public InterfaceNotFoundException() { } public InterfaceNotFoundException(string type) - : base(CreateMessage(type)) { } + : base(CreateMessage(type)) + { } public InterfaceNotFoundException(string type, Exception innerException) - : base(CreateMessage(type), innerException) { } + : base(CreateMessage(type), innerException) + { } protected InterfaceNotFoundException(SerializationInfo info, StreamingContext context) - : base(info, context) { } + : base(info, context) + { } static string CreateMessage(string type) { return String.Format("Could not find the interface {0}. Add this to the Octokit.Reactive project", type); } - } } diff --git a/Octokit.Tests.Conventions/Exception/InvalidDebuggerDisplayAttributeValueException.cs b/Octokit.Tests.Conventions/Exception/InvalidDebuggerDisplayAttributeValueException.cs index 9f25afdea4..58476e77fe 100644 --- a/Octokit.Tests.Conventions/Exception/InvalidDebuggerDisplayAttributeValueException.cs +++ b/Octokit.Tests.Conventions/Exception/InvalidDebuggerDisplayAttributeValueException.cs @@ -5,7 +5,8 @@ namespace Octokit.Tests.Conventions public class InvalidDebuggerDisplayAttributeValueException : Exception { public InvalidDebuggerDisplayAttributeValueException(Type modelType, string value) - : base (CreateMessage(modelType, value)) { } + : base(CreateMessage(modelType, value)) + { } static string CreateMessage(Type modelType, string value) { diff --git a/Octokit.Tests.Conventions/Exception/InvalidDebuggerDisplayReturnType.cs b/Octokit.Tests.Conventions/Exception/InvalidDebuggerDisplayReturnType.cs index 3f9fab9046..c8932a39d3 100644 --- a/Octokit.Tests.Conventions/Exception/InvalidDebuggerDisplayReturnType.cs +++ b/Octokit.Tests.Conventions/Exception/InvalidDebuggerDisplayReturnType.cs @@ -5,7 +5,8 @@ namespace Octokit.Tests.Conventions public class InvalidDebuggerDisplayReturnType : Exception { public InvalidDebuggerDisplayReturnType(Type modelType, Type propertyType) - : base (CreateMessage(modelType, propertyType)) { } + : base(CreateMessage(modelType, propertyType)) + { } static string CreateMessage(Type modelType, Type propertyType) { diff --git a/Octokit.Tests.Conventions/Exception/MissingDebuggerDisplayAttributeException.cs b/Octokit.Tests.Conventions/Exception/MissingDebuggerDisplayAttributeException.cs index 47e94e295b..9861ae7618 100644 --- a/Octokit.Tests.Conventions/Exception/MissingDebuggerDisplayAttributeException.cs +++ b/Octokit.Tests.Conventions/Exception/MissingDebuggerDisplayAttributeException.cs @@ -5,6 +5,7 @@ namespace Octokit.Tests.Conventions public class MissingDebuggerDisplayAttributeException : Exception { public MissingDebuggerDisplayAttributeException(Type modelType) - : base (string.Format("Model type '{0}' is missing the DebuggerDisplayAttribute.", modelType.FullName)) { } + : base(string.Format("Model type '{0}' is missing the DebuggerDisplayAttribute.", modelType.FullName)) + { } } } \ No newline at end of file diff --git a/Octokit.Tests.Conventions/Exception/MissingDebuggerDisplayPropertyException.cs b/Octokit.Tests.Conventions/Exception/MissingDebuggerDisplayPropertyException.cs index 0587364e5b..2a378d5d25 100644 --- a/Octokit.Tests.Conventions/Exception/MissingDebuggerDisplayPropertyException.cs +++ b/Octokit.Tests.Conventions/Exception/MissingDebuggerDisplayPropertyException.cs @@ -5,6 +5,7 @@ namespace Octokit.Tests.Conventions public class MissingDebuggerDisplayPropertyException : Exception { public MissingDebuggerDisplayPropertyException(Type modelType) - : base (string.Format("Model type '{0}' is missing the DebuggerDisplay property.", modelType.FullName)) { } + : base(string.Format("Model type '{0}' is missing the DebuggerDisplay property.", modelType.FullName)) + { } } } \ No newline at end of file diff --git a/Octokit.Tests.Conventions/Exception/MutableModelPropertiesException.cs b/Octokit.Tests.Conventions/Exception/MutableModelPropertiesException.cs index 66d23a42b0..89e64b0408 100644 --- a/Octokit.Tests.Conventions/Exception/MutableModelPropertiesException.cs +++ b/Octokit.Tests.Conventions/Exception/MutableModelPropertiesException.cs @@ -8,7 +8,8 @@ namespace Octokit.Tests.Conventions public class MutableModelPropertiesException : Exception { public MutableModelPropertiesException(Type modelType, IEnumerable mutableProperties) - : base (CreateMessage(modelType, mutableProperties)) { } + : base(CreateMessage(modelType, mutableProperties)) + { } static string CreateMessage(Type modelType, IEnumerable mutableProperties) { diff --git a/Octokit.Tests.Conventions/Exception/PaginationGetAllMethodNameMismatchException.cs b/Octokit.Tests.Conventions/Exception/PaginationGetAllMethodNameMismatchException.cs index 8c20067ee9..f78822c4d3 100644 --- a/Octokit.Tests.Conventions/Exception/PaginationGetAllMethodNameMismatchException.cs +++ b/Octokit.Tests.Conventions/Exception/PaginationGetAllMethodNameMismatchException.cs @@ -10,7 +10,8 @@ namespace Octokit.Tests.Conventions public class PaginationGetAllMethodNameMismatchException : Exception { public PaginationGetAllMethodNameMismatchException(Type type, IEnumerable methods) - : base(CreateMessage(type, methods)) { } + : base(CreateMessage(type, methods)) + { } static string CreateMessage(Type type, IEnumerable methods) { diff --git a/Octokit.Tests.Conventions/Exception/ParameterCountMismatchException.cs b/Octokit.Tests.Conventions/Exception/ParameterCountMismatchException.cs index 24b165f33f..f83e0fc6b4 100644 --- a/Octokit.Tests.Conventions/Exception/ParameterCountMismatchException.cs +++ b/Octokit.Tests.Conventions/Exception/ParameterCountMismatchException.cs @@ -9,13 +9,16 @@ namespace Octokit.Tests.Conventions public class ParameterCountMismatchException : Exception { public ParameterCountMismatchException(MethodInfo method, IEnumerable expected, IEnumerable actual) - : base(CreateMessage(method, expected, actual)) { } + : base(CreateMessage(method, expected, actual)) + { } public ParameterCountMismatchException(MethodInfo method, IEnumerable expected, IEnumerable actual, Exception innerException) - : base(CreateMessage(method, expected, actual), innerException) { } + : base(CreateMessage(method, expected, actual), innerException) + { } protected ParameterCountMismatchException(SerializationInfo info, StreamingContext context) - : base(info, context) { } + : base(info, context) + { } static string CreateMethodSignature(IEnumerable parameters) { diff --git a/Octokit.Tests.Conventions/Exception/ParameterMismatchException.cs b/Octokit.Tests.Conventions/Exception/ParameterMismatchException.cs index 88009960e3..0e9783d13b 100644 --- a/Octokit.Tests.Conventions/Exception/ParameterMismatchException.cs +++ b/Octokit.Tests.Conventions/Exception/ParameterMismatchException.cs @@ -7,13 +7,16 @@ namespace Octokit.Tests.Conventions public class ParameterMismatchException : Exception { public ParameterMismatchException(MethodInfo method, int position, ParameterInfo expected, ParameterInfo actual) - : base(CreateMessage(method, position, expected, actual)) { } + : base(CreateMessage(method, position, expected, actual)) + { } public ParameterMismatchException(MethodInfo method, int position, ParameterInfo expected, ParameterInfo actual, Exception innerException) - : base(CreateMessage(method, position, expected, actual), innerException) { } + : base(CreateMessage(method, position, expected, actual), innerException) + { } protected ParameterMismatchException(SerializationInfo info, StreamingContext context) - : base(info, context) { } + : base(info, context) + { } static string CreateParameterSignature(ParameterInfo parameter) { diff --git a/Octokit.Tests.Conventions/Exception/ReturnValueMismatchException.cs b/Octokit.Tests.Conventions/Exception/ReturnValueMismatchException.cs index 3bc97e4e0d..38fbdef532 100644 --- a/Octokit.Tests.Conventions/Exception/ReturnValueMismatchException.cs +++ b/Octokit.Tests.Conventions/Exception/ReturnValueMismatchException.cs @@ -7,17 +7,20 @@ namespace Octokit.Tests.Conventions public class ReturnValueMismatchException : Exception { public ReturnValueMismatchException(MethodInfo method, Type expected, Type actual) - : base(CreateMessage(method, expected, actual)) { } + : base(CreateMessage(method, expected, actual)) + { } public ReturnValueMismatchException(MethodInfo method, Type expected, Type actual, Exception innerException) - : base(CreateMessage(method, expected, actual), innerException) { } + : base(CreateMessage(method, expected, actual), innerException) + { } protected ReturnValueMismatchException(SerializationInfo info, StreamingContext context) - : base(info, context) { } + : base(info, context) + { } static string CreateMessage(MethodInfo method, Type expected, Type actual) { - return String.Format("Return value for {0}.{1} must be \"{2}\" but is \"{3}\"", method.DeclaringType.Name, method.Name, expected, actual); + return String.Format("Return value for {0}.{1} must be \"{2}\" but is \"{3}\"", method.DeclaringType.Name, method.Name, expected, actual); } } } \ No newline at end of file diff --git a/Octokit.Tests.Conventions/SyncObservableClients.cs b/Octokit.Tests.Conventions/SyncObservableClients.cs index b222a51764..3d00599286 100644 --- a/Octokit.Tests.Conventions/SyncObservableClients.cs +++ b/Octokit.Tests.Conventions/SyncObservableClients.cs @@ -38,7 +38,7 @@ public void CheckObservableClients(Type clientInterface) } int index = 0; - foreach(var mainMethod in mainMethods) + foreach (var mainMethod in mainMethods) { var observableMethod = observableMethods[index]; AssertEx.WithMessage(() => CheckMethod(mainMethod, observableMethod), "Invalid signature for " + observableMethod); @@ -69,7 +69,7 @@ private static void CheckReturnValue(MethodInfo mainMethod, MethodInfo observabl private static Type GetObservableExpectedType(Type mainType) { var typeInfo = mainType.GetTypeInfo(); - switch(typeInfo.TypeCategory) + switch (typeInfo.TypeCategory) { case TypeCategory.ClientInterface: // client interface - IClient => IObservableClient @@ -78,7 +78,7 @@ private static Type GetObservableExpectedType(Type mainType) // void - Task => IObservable return typeof(IObservable); case TypeCategory.GenericTask: - // single item - Task => IObservable + // single item - Task => IObservable case TypeCategory.ReadOnlyList: // list - Task> => IObservable return typeof(IObservable<>).MakeGenericType(typeInfo.Type); @@ -100,7 +100,7 @@ private static void CheckParameters(MethodInfo mainMethod, MethodInfo observable } int index = 0; - foreach(var mainParameter in mainParameters) + foreach (var mainParameter in mainParameters) { var observableParameter = observableParameters[index]; if (mainParameter.Name != observableParameter.Name) diff --git a/Octokit.Tests.Conventions/TypeExtensions.cs b/Octokit.Tests.Conventions/TypeExtensions.cs index be3e589b41..7d3ef6d380 100644 --- a/Octokit.Tests.Conventions/TypeExtensions.cs +++ b/Octokit.Tests.Conventions/TypeExtensions.cs @@ -35,20 +35,20 @@ public static MethodInfo[] GetMethodsOrdered(this Type type) public static TypeInfo GetTypeInfo(this Type type) { var typeInfo = new TypeInfo { Type = type, TypeCategory = TypeCategory.Other }; - if(type.IsClientInterface()) + if (type.IsClientInterface()) { typeInfo.TypeCategory = TypeCategory.ClientInterface; } - else if(type.IsTask()) + else if (type.IsTask()) { - if(!type.IsGenericType) + if (!type.IsGenericType) { typeInfo.TypeCategory = TypeCategory.Task; } else { var taskResultType = type.GetGenericArgument(); - if(taskResultType.IsList()) + if (taskResultType.IsList()) { typeInfo.TypeCategory = TypeCategory.ReadOnlyList; typeInfo.Type = taskResultType.GetGenericArgument(); @@ -78,7 +78,7 @@ public static Type GetObservableClientInterface(this Type type) var observableClient = typeof(IObservableEventsClient); var observableClientName = observableClient.Namespace + "." + ObservablePrefix + type.Name.Substring(RealNameIndex); var observableInterface = observableClient.Assembly.GetType(observableClientName); - if(observableInterface == null) + if (observableInterface == null) { throw new InterfaceNotFoundException(observableClientName); } diff --git a/Octokit.Tests.Integration/Clients/AuthorizationClientTests.cs b/Octokit.Tests.Integration/Clients/AuthorizationClientTests.cs index 213326e124..5a3b741d48 100644 --- a/Octokit.Tests.Integration/Clients/AuthorizationClientTests.cs +++ b/Octokit.Tests.Integration/Clients/AuthorizationClientTests.cs @@ -199,9 +199,9 @@ public async Task CanRevokeAllApplicationAuthentications() var applicationClient = Helper.GetAuthenticatedApplicationClient(); await applicationClient.Authorization.RevokeAllApplicationAuthentications(Helper.ClientId); - Assert.ThrowsAsync(async () => + Assert.ThrowsAsync(async () => await applicationClient.Authorization.CheckApplicationAuthentication(Helper.ClientId, token1.Token)); - Assert.ThrowsAsync(async () => + Assert.ThrowsAsync(async () => await applicationClient.Authorization.CheckApplicationAuthentication(Helper.ClientId, token2.Token)); Assert.ThrowsAsync(() => github.Authorization.Get(token1.Id)); diff --git a/Octokit.Tests.Integration/Clients/CommitsClientTests.cs b/Octokit.Tests.Integration/Clients/CommitsClientTests.cs index 2e781c87c3..96559fb33b 100644 --- a/Octokit.Tests.Integration/Clients/CommitsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/CommitsClientTests.cs @@ -14,7 +14,7 @@ public async Task CanCreateAndRetrieveCommit() { var github = Helper.GetAuthenticatedClient(); var fixture = github.GitDatabase.Commit; - + using (var context = await github.CreateRepositoryContext("public-repo")) { var owner = context.Repository.Owner.Login; diff --git a/Octokit.Tests.Integration/Clients/DeploymentStatusClientTests.cs b/Octokit.Tests.Integration/Clients/DeploymentStatusClientTests.cs index 302c83508f..223457bddd 100644 --- a/Octokit.Tests.Integration/Clients/DeploymentStatusClientTests.cs +++ b/Octokit.Tests.Integration/Clients/DeploymentStatusClientTests.cs @@ -37,11 +37,11 @@ public DeploymentStatusClientTests() var treeResult = github.GitDatabase.Tree.Create(_context.RepositoryOwner, _context.RepositoryName, newTree).Result; var newCommit = new NewCommit("test-commit", treeResult.Sha); - + var commit = github.GitDatabase.Commit.Create(_context.RepositoryOwner, _context.RepositoryName, newCommit).Result; var newDeployment = new NewDeployment(commit.Sha) { AutoMerge = false }; - _deployment = _deploymentsClient.Create(_context.RepositoryOwner, _context.RepositoryName, newDeployment).Result; + _deployment = _deploymentsClient.Create(_context.RepositoryOwner, _context.RepositoryName, newDeployment).Result; } [IntegrationTest] diff --git a/Octokit.Tests.Integration/Clients/DeploymentsClientTests.cs b/Octokit.Tests.Integration/Clients/DeploymentsClientTests.cs index 46945a6ffd..fc22f8d1fe 100644 --- a/Octokit.Tests.Integration/Clients/DeploymentsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/DeploymentsClientTests.cs @@ -39,7 +39,7 @@ public DeploymentsClientTests() var newCommit = new NewCommit("test-commit", treeResult.Sha); _commit = github.GitDatabase.Commit.Create(_context.RepositoryOwner, _context.RepositoryName, newCommit).Result; } - + [IntegrationTest] public async Task CanCreateDeployment() { diff --git a/Octokit.Tests.Integration/Clients/EventsClientTests.cs b/Octokit.Tests.Integration/Clients/EventsClientTests.cs index 2802bbff72..10805a7677 100644 --- a/Octokit.Tests.Integration/Clients/EventsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/EventsClientTests.cs @@ -21,11 +21,11 @@ public async Task ReturnsACollection() public class EventPayloads { - readonly IEnumerable _events; + readonly IEnumerable _events; public EventPayloads() { var github = Helper.GetAuthenticatedClient(); - _events = github.Activity.Events.GetAllUserPerformed("shiftkey").Result; + _events = github.Activity.Events.GetAllUserPerformed("shiftkey").Result; } [IntegrationTest] diff --git a/Octokit.Tests.Integration/Clients/FollowersClientTests.cs b/Octokit.Tests.Integration/Clients/FollowersClientTests.cs index 99d382be6f..6ced87945f 100644 --- a/Octokit.Tests.Integration/Clients/FollowersClientTests.cs +++ b/Octokit.Tests.Integration/Clients/FollowersClientTests.cs @@ -35,7 +35,7 @@ public async Task ReturnsUsersTheUserIsFollowing() Assert.NotNull(following); Assert.NotEmpty(following); } - + [IntegrationTest] public async Task ReturnsUsersFollowingTheUser() { diff --git a/Octokit.Tests.Integration/Clients/GistsClientTests.cs b/Octokit.Tests.Integration/Clients/GistsClientTests.cs index 56ef19f1f6..c99c53c02b 100644 --- a/Octokit.Tests.Integration/Clients/GistsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/GistsClientTests.cs @@ -79,7 +79,7 @@ public async Task CanForkAGist() await _fixture.Delete(forkedGist.Id); } - [IntegrationTest(Skip="OH GOD THIS TEST IS INSANE AND I DON'T KNOW WHY I DID THIS")] + [IntegrationTest(Skip = "OH GOD THIS TEST IS INSANE AND I DON'T KNOW WHY I DID THIS")] public async Task CanListGists() { // Time is tricky between local and remote, be lenient diff --git a/Octokit.Tests.Integration/Clients/GitHubClientTests.cs b/Octokit.Tests.Integration/Clients/GitHubClientTests.cs index 5cc9ce9027..424e2b2643 100644 --- a/Octokit.Tests.Integration/Clients/GitHubClientTests.cs +++ b/Octokit.Tests.Integration/Clients/GitHubClientTests.cs @@ -23,7 +23,7 @@ public async Task CanRetrieveLastApiInfoWithEtag() using (var context = await github.CreateRepositoryContext(new NewRepository(repoName))) { var createdRepository = context.Repository; - + var result = github.GetLastApiInfo(); Assert.True(result.Links.Count == 0); @@ -75,6 +75,5 @@ public async Task CanRetrieveLastApiInfoAcceptedOauth() Assert.True(result.RateLimit.Remaining > -1); Assert.NotNull(result.RateLimit.Reset); } - } } diff --git a/Octokit.Tests.Integration/Clients/IssuesClientTests.cs b/Octokit.Tests.Integration/Clients/IssuesClientTests.cs index 2193a1c090..f930d32285 100644 --- a/Octokit.Tests.Integration/Clients/IssuesClientTests.cs +++ b/Octokit.Tests.Integration/Clients/IssuesClientTests.cs @@ -86,11 +86,11 @@ await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, cl new IssueUpdate { State = ItemState.Closed }); var issues = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, - new RepositoryIssueRequest {SortDirection = SortDirection.Ascending}); + new RepositoryIssueRequest { SortDirection = SortDirection.Ascending }); Assert.Equal(3, issues.Count); Assert.Equal("A test issue1", issues[0].Title); - Assert.Equal("A test issue2", issues[1].Title); + Assert.Equal("A test issue2", issues[1].Title); Assert.Equal("A test issue3", issues[2].Title); } @@ -165,7 +165,7 @@ public async Task CanFilterByAssigned() Assert.Equal(2, allIssues.Count); - var assignedIssues = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, + var assignedIssues = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, new RepositoryIssueRequest { Assignee = _context.RepositoryOwner }); Assert.Equal(1, assignedIssues.Count); diff --git a/Octokit.Tests.Integration/Clients/IssuesEventsClientTests.cs b/Octokit.Tests.Integration/Clients/IssuesEventsClientTests.cs index 3d6fea88e3..68c3c2f6bb 100644 --- a/Octokit.Tests.Integration/Clients/IssuesEventsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/IssuesEventsClientTests.cs @@ -29,7 +29,7 @@ public async Task CanListEventInfoForAnIssue() { var newIssue = new NewIssue("a test issue") { Body = "A new unassigned issue" }; var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue); - + var issueEventInfo = await _issuesEventsClientClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number); Assert.Empty(issueEventInfo); @@ -37,7 +37,7 @@ public async Task CanListEventInfoForAnIssue() .Result; Assert.NotNull(closed); issueEventInfo = await _issuesEventsClientClient.GetAllForIssue(_context.RepositoryOwner, _context.RepositoryName, issue.Number); - + Assert.Equal(1, issueEventInfo.Count); Assert.Equal(EventInfoState.Closed, issueEventInfo[0].Event); } @@ -53,7 +53,7 @@ public async Task CanListIssueEventsForARepository() Thread.Sleep(1000); var issue2 = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue2); Thread.Sleep(1000); - + // close and open issue1 var closed1 = _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue1.Number, new IssueUpdate { State = ItemState.Closed }) .Result; @@ -66,7 +66,7 @@ public async Task CanListIssueEventsForARepository() var closed2 = _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, issue2.Number, new IssueUpdate { State = ItemState.Closed }) .Result; Assert.NotNull(closed2); - + var issueEvents = await _issuesEventsClientClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName); Assert.Equal(3, issueEvents.Count); diff --git a/Octokit.Tests.Integration/Clients/IssuesLabelsClientTests.cs b/Octokit.Tests.Integration/Clients/IssuesLabelsClientTests.cs index 16900b98e7..e6e2e8a6e8 100644 --- a/Octokit.Tests.Integration/Clients/IssuesLabelsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/IssuesLabelsClientTests.cs @@ -15,7 +15,7 @@ public IssuesLabelsClientTests() { var github = Helper.GetAuthenticatedClient(); - _issuesLabelsClient= github.Issue.Labels; + _issuesLabelsClient = github.Issue.Labels; _issuesClient = github.Issue; var repoName = Helper.MakeNameWithTimestamp("public-repo"); diff --git a/Octokit.Tests.Integration/Clients/MergingClientTests.cs b/Octokit.Tests.Integration/Clients/MergingClientTests.cs index c746afb075..c3f393f099 100644 --- a/Octokit.Tests.Integration/Clients/MergingClientTests.cs +++ b/Octokit.Tests.Integration/Clients/MergingClientTests.cs @@ -11,9 +11,9 @@ public class MergingClientTests : IDisposable private readonly IGitHubClient _github; private readonly IMergingClient _fixture; private readonly RepositoryContext _context; - + const string branchName = "my-branch"; - + public MergingClientTests() { _github = new GitHubClient(new ProductHeaderValue("OctokitTests")) diff --git a/Octokit.Tests.Integration/Clients/MilestonesClientTests.cs b/Octokit.Tests.Integration/Clients/MilestonesClientTests.cs index b4cc1a1a0e..f5a58f4a32 100644 --- a/Octokit.Tests.Integration/Clients/MilestonesClientTests.cs +++ b/Octokit.Tests.Integration/Clients/MilestonesClientTests.cs @@ -37,7 +37,7 @@ public async Task CanRetrieveOneMilestone() public async Task CanListEmptyMilestones() { var milestones = await _milestonesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName); - + Assert.Empty(milestones); } diff --git a/Octokit.Tests.Integration/Clients/MiscellaneousClientTests.cs b/Octokit.Tests.Integration/Clients/MiscellaneousClientTests.cs index bff700dc03..b13fd3a9fe 100644 --- a/Octokit.Tests.Integration/Clients/MiscellaneousClientTests.cs +++ b/Octokit.Tests.Integration/Clients/MiscellaneousClientTests.cs @@ -100,7 +100,6 @@ public async Task CanRetrieveResourceRateLimits() Assert.True(result.Rate.Remaining <= result.Rate.Limit); Assert.True(result.Resources.Search.ResetAsUtcEpochSeconds > 0); Assert.NotNull(result.Resources.Search.Reset); - } } diff --git a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs index 45011f52c2..53d891e6b4 100644 --- a/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/PullRequestReviewCommentsClientTests.cs @@ -149,7 +149,7 @@ public async Task CanGetForRepositoryAscendingSort() var pullRequest = await CreatePullRequest(_context); const int position = 1; - var commentsToCreate = new [] { "Comment One", "Comment Two", "Comment Three" }; + var commentsToCreate = new[] { "Comment One", "Comment Two", "Comment Three" }; await CreateComments(commentsToCreate, position, _context.RepositoryName, pullRequest.Sha, pullRequest.Number); @@ -164,7 +164,7 @@ public async Task CanGetForRepositoryDescendingSort() var pullRequest = await CreatePullRequest(_context); const int position = 1; - var commentsToCreate = new [] { "Comment One", "Comment Two", "Comment Three", "Comment Four" }; + var commentsToCreate = new[] { "Comment One", "Comment Two", "Comment Three", "Comment Four" }; await CreateComments(commentsToCreate, position, _context.RepositoryName, pullRequest.Sha, pullRequest.Number); diff --git a/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs index 003d9bcb63..8e0c438428 100644 --- a/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs @@ -308,9 +308,9 @@ public async Task CanBrowseFiles() { var expectedFiles = new List { - new PullRequestFile(null, "Octokit.Tests.Integration/Clients/ReferencesClientTests.cs", null, 8, 3, 11, null, null, null, null), - new PullRequestFile(null, "Octokit/Clients/ApiPagination.cs", null, 21, 6, 27, null, null, null, null), - new PullRequestFile(null, "Octokit/Helpers/IApiPagination.cs", null, 1, 1, 2, null, null, null, null), + new PullRequestFile(null, "Octokit.Tests.Integration/Clients/ReferencesClientTests.cs", null, 8, 3, 11, null, null, null, null), + new PullRequestFile(null, "Octokit/Clients/ApiPagination.cs", null, 21, 6, 27, null, null, null, null), + new PullRequestFile(null, "Octokit/Helpers/IApiPagination.cs", null, 1, 1, 2, null, null, null, null), new PullRequestFile(null, "Octokit/Http/ApiConnection.cs", null, 1, 1, 2, null, null, null, null) }; diff --git a/Octokit.Tests.Integration/Clients/ReleasesClientTests.cs b/Octokit.Tests.Integration/Clients/ReleasesClientTests.cs index 920f9ad550..3b6d3de2ac 100644 --- a/Octokit.Tests.Integration/Clients/ReleasesClientTests.cs +++ b/Octokit.Tests.Integration/Clients/ReleasesClientTests.cs @@ -65,7 +65,6 @@ public TheEditMethod() _releaseClient = _github.Release; _context = _github.CreateRepositoryContext("public-repo").Result; - } [IntegrationTest] @@ -191,7 +190,7 @@ public async Task CanDownloadAnAsset() var response = await _github.Connection.Get(new Uri(asset.Url), new Dictionary(), "application/octet-stream"); - Assert.Contains("This is a plain text file.", Encoding.ASCII.GetString((byte[]) response.Body)); + Assert.Contains("This is a plain text file.", Encoding.ASCII.GetString((byte[])response.Body)); } [IntegrationTest] public async Task CanDownloadBinaryAsset() @@ -217,9 +216,9 @@ public async Task CanDownloadBinaryAsset() var response = await _github.Connection.Get(new Uri(asset.Url), new Dictionary(), "application/octet-stream"); var textContent = String.Empty; - - using (var zipstream = new MemoryStream((byte[]) response.Body)) - using(var archive = new ZipArchive(zipstream)) + + using (var zipstream = new MemoryStream((byte[])response.Body)) + using (var archive = new ZipArchive(zipstream)) { var enttry = archive.Entries[0]; var data = new byte[enttry.Length]; @@ -227,7 +226,7 @@ public async Task CanDownloadBinaryAsset() textContent = Encoding.ASCII.GetString(data); } - Assert.Contains("This is a plain text file.",textContent ); + Assert.Contains("This is a plain text file.", textContent); } diff --git a/Octokit.Tests.Integration/Clients/UserEmailsClientTests.cs b/Octokit.Tests.Integration/Clients/UserEmailsClientTests.cs index 2784393e0e..f0af752c69 100644 --- a/Octokit.Tests.Integration/Clients/UserEmailsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/UserEmailsClientTests.cs @@ -17,7 +17,7 @@ public async Task CanGetEmail() const string testEmailAddress = "hahaha-not-a-real-email@foo.com"; - [IntegrationTest(Skip="this isn't passing in CI - i hate past me right now")] + [IntegrationTest(Skip = "this isn't passing in CI - i hate past me right now")] public async Task CanAddAndDeleteEmail() { var github = Helper.GetAuthenticatedClient(); diff --git a/Octokit.Tests.Integration/Helper.cs b/Octokit.Tests.Integration/Helper.cs index d0abd3bd41..ea86d9dd89 100644 --- a/Octokit.Tests.Integration/Helper.cs +++ b/Octokit.Tests.Integration/Helper.cs @@ -34,7 +34,7 @@ public static class Helper return null; return new Credentials(applicationClientId, applicationClientSecret); - }); + }); static Helper() { @@ -47,7 +47,7 @@ static Helper() public static string UserName { get; private set; } public static string Organization { get; private set; } - public static Credentials Credentials { get { return _credentialsThunk.Value; }} + public static Credentials Credentials { get { return _credentialsThunk.Value; } } public static Credentials ApplicationCredentials { get { return _oauthApplicationCredentials.Value; } } diff --git a/Octokit.Tests.Integration/Helpers/OrganizationTestAttribute.cs b/Octokit.Tests.Integration/Helpers/OrganizationTestAttribute.cs index 6741dfbfaa..9798ecb55b 100644 --- a/Octokit.Tests.Integration/Helpers/OrganizationTestAttribute.cs +++ b/Octokit.Tests.Integration/Helpers/OrganizationTestAttribute.cs @@ -10,7 +10,7 @@ public class OrganizationTestDiscoverer : IXunitTestCaseDiscoverer { readonly IMessageSink diagnosticMessageSink; - public OrganizationTestDiscoverer(IMessageSink diagnosticMessageSink) + public OrganizationTestDiscoverer(IMessageSink diagnosticMessageSink) { this.diagnosticMessageSink = diagnosticMessageSink; } diff --git a/Octokit.Tests.Integration/Helpers/PersonalAccessTokenTestAttribute.cs b/Octokit.Tests.Integration/Helpers/PersonalAccessTokenTestAttribute.cs index 0fd107ec66..fabd5b9023 100644 --- a/Octokit.Tests.Integration/Helpers/PersonalAccessTokenTestAttribute.cs +++ b/Octokit.Tests.Integration/Helpers/PersonalAccessTokenTestAttribute.cs @@ -18,7 +18,7 @@ public PersonalAccessTokenTestDiscoverer(IMessageSink diagnosticMessageSink) public IEnumerable Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute) { return Helper.IsUsingToken - ? new[] { new XunitTestCase(diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod) } + ? new[] { new XunitTestCase(diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), testMethod) } : Enumerable.Empty(); } } diff --git a/Octokit.Tests.Integration/Helpers/RepositorySetupHelper.cs b/Octokit.Tests.Integration/Helpers/RepositorySetupHelper.cs index 1a9147af18..4559693f5e 100644 --- a/Octokit.Tests.Integration/Helpers/RepositorySetupHelper.cs +++ b/Octokit.Tests.Integration/Helpers/RepositorySetupHelper.cs @@ -60,6 +60,5 @@ public static async Task CreateTheWorld(this IGitHubClient client, Re // create branch return await client.GitDatabase.Reference.Create(repository.Owner.Login, repository.Name, new NewReference("refs/heads/my-branch", featureBranchCommit.Sha)); } - } } diff --git a/Octokit.Tests.Integration/fixtures/RepositoriesHooksCollection.cs b/Octokit.Tests.Integration/fixtures/RepositoriesHooksCollection.cs index d87ccfa5d1..0d4006f5e7 100644 --- a/Octokit.Tests.Integration/fixtures/RepositoriesHooksCollection.cs +++ b/Octokit.Tests.Integration/fixtures/RepositoriesHooksCollection.cs @@ -5,6 +5,6 @@ namespace Octokit.Tests.Integration.fixtures [CollectionDefinition(Name)] public class RepositoriesHooksCollection : ICollectionFixture { - public const string Name = "Repositories Hooks Collection"; + public const string Name = "Repositories Hooks Collection"; } } diff --git a/Octokit.Tests/Authentication/TokenAuthenticatorTests.cs b/Octokit.Tests/Authentication/TokenAuthenticatorTests.cs index 621523074a..eaca870b75 100644 --- a/Octokit.Tests/Authentication/TokenAuthenticatorTests.cs +++ b/Octokit.Tests/Authentication/TokenAuthenticatorTests.cs @@ -36,7 +36,7 @@ public void EnsuresArgumentsNotNull() { var authenticator = new TokenAuthenticator(); Assert.Throws(() => authenticator.Authenticate(null, Credentials.Anonymous)); - Assert.Throws(() => + Assert.Throws(() => authenticator.Authenticate(Substitute.For(), null)); } } diff --git a/Octokit.Tests/Clients/AuthorizationsClientTests.cs b/Octokit.Tests/Clients/AuthorizationsClientTests.cs index 2c2b0baebe..d6b492b70e 100644 --- a/Octokit.Tests/Clients/AuthorizationsClientTests.cs +++ b/Octokit.Tests/Clients/AuthorizationsClientTests.cs @@ -123,7 +123,7 @@ public async Task WrapsTwoFactorFailureWithTwoFactorException() client.Put(Args.Uri, Args.Object, Args.String) .ThrowsAsync( new AuthorizationException( - new Response(HttpStatusCode.Unauthorized , null, new Dictionary(), "application/json"))); + new Response(HttpStatusCode.Unauthorized, null, new Dictionary(), "application/json"))); var authEndpoint = new AuthorizationsClient(client); await Assert.ThrowsAsync(() => @@ -137,7 +137,7 @@ public async Task UsesCallbackToRetrieveTwoFactorCode() var data = new NewAuthorization { Note = "note" }; var client = Substitute.For(); client.GetOrCreateApplicationAuthentication("clientId", "secret", Arg.Any()) - .Returns(_ => {throw new TwoFactorRequiredException();}); + .Returns(_ => { throw new TwoFactorRequiredException(); }); client.GetOrCreateApplicationAuthentication("clientId", "secret", Arg.Any(), @@ -161,7 +161,7 @@ public async Task UsesCallbackToRetrieveTwoFactorCode() [Fact] public async Task RetriesWhenResendRequested() { - var challengeResults = new Queue(new [] + var challengeResults = new Queue(new[] { TwoFactorChallengeResult.RequestResendCode, new TwoFactorChallengeResult("two-factor-code") @@ -197,7 +197,7 @@ public async Task ThrowsTwoFactorChallengeFailedExceptionWhenProvidedCodeIsIncor var challengeResults = new Queue(new[] { TwoFactorChallengeResult.RequestResendCode, - new TwoFactorChallengeResult("wrong-code") + new TwoFactorChallengeResult("wrong-code") }); var data = new NewAuthorization(); var client = Substitute.For(); @@ -239,7 +239,7 @@ public async Task GetsOrCreatesAuthenticationWithFingerprintAtCorrectUrl() client.Put(Arg.Do(u => calledUri = u), Arg.Do(body => calledBody = body)); authEndpoint.GetOrCreateApplicationAuthentication("clientId", "secret", data); - + Assert.NotNull(calledUri); Assert.Equal(calledUri.ToString(), "authorizations/clients/clientId"); @@ -261,7 +261,7 @@ public async Task ChecksApplicationAuthenticateAtCorrectUrl() client.Received().Get( Arg.Is(u => u.ToString() == "applications/clientId/tokens/accessToken"), null); - } + } [Fact] public async Task EnsuresArgumentsNotNull() diff --git a/Octokit.Tests/Clients/CommitStatusClientTests.cs b/Octokit.Tests/Clients/CommitStatusClientTests.cs index 6b0dc5489e..45fb5f5bec 100644 --- a/Octokit.Tests/Clients/CommitStatusClientTests.cs +++ b/Octokit.Tests/Clients/CommitStatusClientTests.cs @@ -85,9 +85,9 @@ public void PostsToTheCorrectUrl() var connection = Substitute.For(); var client = new CommitStatusClient(connection); - client.Create("owner", "repo", "sha", new NewCommitStatus { State = CommitState.Success }); + client.Create("owner", "repo", "sha", new NewCommitStatus { State = CommitState.Success }); - connection.Received().Post(Arg.Is(u => + connection.Received().Post(Arg.Is(u => u.ToString() == "repos/owner/repo/statuses/sha"), Arg.Is(s => s.State == CommitState.Success)); } diff --git a/Octokit.Tests/Clients/CommitsClientTests.cs b/Octokit.Tests/Clients/CommitsClientTests.cs index 62a30f1019..299c5441d7 100644 --- a/Octokit.Tests/Clients/CommitsClientTests.cs +++ b/Octokit.Tests/Clients/CommitsClientTests.cs @@ -59,12 +59,12 @@ public async Task EnsuresNonNullArguments() { var client = new CommitsClient(Substitute.For()); - var newCommit = new NewCommit("message", "tree", new[]{"parent1", "parent2"}); + var newCommit = new NewCommit("message", "tree", new[] { "parent1", "parent2" }); await Assert.ThrowsAsync(() => client.Create(null, "name", newCommit)); await Assert.ThrowsAsync(() => client.Create("owner", null, newCommit)); await Assert.ThrowsAsync(() => client.Create("owner", "name", null)); await Assert.ThrowsAsync(() => client.Create("", "name", newCommit)); - await Assert.ThrowsAsync(() => client.Create("owner", "", newCommit)); + await Assert.ThrowsAsync(() => client.Create("owner", "", newCommit)); } } diff --git a/Octokit.Tests/Clients/DeploymentStatusClientTests.cs b/Octokit.Tests/Clients/DeploymentStatusClientTests.cs index ff54910b21..bbf306d416 100644 --- a/Octokit.Tests/Clients/DeploymentStatusClientTests.cs +++ b/Octokit.Tests/Clients/DeploymentStatusClientTests.cs @@ -69,7 +69,7 @@ public async Task EnsuresNonNullArguments() public async Task EnsuresNonEmptyArguments() { var client = new DeploymentStatusClient(Substitute.For()); - + await Assert.ThrowsAsync(() => client.GetAll("", "name", 1)); await Assert.ThrowsAsync(() => client.GetAll("owner", "", 1)); } @@ -83,7 +83,7 @@ public async Task EnsuresNonEmptyArguments() public async Task EnsureNonWhitespaceArguments(string whitespace) { var client = new DeploymentStatusClient(Substitute.For()); - + await Assert.ThrowsAsync(() => client.Create(whitespace, "repo", 1, newDeploymentStatus)); await Assert.ThrowsAsync(() => client.Create("owner", whitespace, 1, newDeploymentStatus)); } diff --git a/Octokit.Tests/Clients/EventsClientTests.cs b/Octokit.Tests/Clients/EventsClientTests.cs index 3abf31c39b..e2cab605dd 100644 --- a/Octokit.Tests/Clients/EventsClientTests.cs +++ b/Octokit.Tests/Clients/EventsClientTests.cs @@ -238,7 +238,7 @@ public async Task EnsuresArgumentsNotNull() {"WatchEvent", typeof(StarredEventPayload)}, {"unknown", typeof(ActivityPayload)} }; - + [Fact] public async Task DeserializesPayloadToCorrectType() { @@ -252,7 +252,7 @@ public async Task DeserializesPayloadToCorrectType() }, sender = new { - id = 1337 + id = 1337 } }}}; diff --git a/Octokit.Tests/Clients/FollowersClientTests.cs b/Octokit.Tests/Clients/FollowersClientTests.cs index 6dc0cf1f1f..f9201f6d8d 100644 --- a/Octokit.Tests/Clients/FollowersClientTests.cs +++ b/Octokit.Tests/Clients/FollowersClientTests.cs @@ -112,7 +112,7 @@ public class TheIsFollowingForCurrentMethod public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool expected) { var response = Task.Factory.StartNew>(() => - new ApiResponse(new Response(status , null, new Dictionary(), "application/json"))); + new ApiResponse(new Response(status, null, new Dictionary(), "application/json"))); var connection = Substitute.For(); connection.Get(Arg.Is(u => u.ToString() == "user/following/alfhenrik"), null, null).Returns(response); @@ -129,7 +129,7 @@ public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool public async Task ThrowsExceptionForInvalidStatusCode() { var response = Task.Factory.StartNew>(() => - new ApiResponse(new Response(HttpStatusCode.Conflict , null, new Dictionary(), "application/json"))); + new ApiResponse(new Response(HttpStatusCode.Conflict, null, new Dictionary(), "application/json"))); var connection = Substitute.For(); connection.Get(Arg.Is(u => u.ToString() == "user/following/alfhenrik"), null, null).Returns(response); @@ -159,7 +159,7 @@ public class TheIsFollowingMethod public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool expected) { var response = Task.Factory.StartNew>(() => - new ApiResponse(new Response(status , null, new Dictionary(), "application/json"))); + new ApiResponse(new Response(status, null, new Dictionary(), "application/json"))); var connection = Substitute.For(); connection.Get(Arg.Is(u => u.ToString() == "users/alfhenrik/following/alfhenrik-test"), null, null).Returns(response); @@ -176,7 +176,7 @@ public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool public async Task ThrowsExceptionForInvalidStatusCode() { var response = Task.Factory.StartNew>(() => - new ApiResponse(new Response(HttpStatusCode.Conflict , null, new Dictionary(), "application/json"))); + new ApiResponse(new Response(HttpStatusCode.Conflict, null, new Dictionary(), "application/json"))); var connection = Substitute.For(); connection.Get(Arg.Is(u => u.ToString() == "users/alfhenrik/following/alfhenrik-test"), null, null).Returns(response); @@ -198,7 +198,6 @@ public async Task EnsuresNonNullArguments() await Assert.ThrowsAsync(() => client.IsFollowing("", "alfhenrik-text")); await Assert.ThrowsAsync(() => client.IsFollowing("alfhenrik", "")); } - } public class TheFollowMethod @@ -208,7 +207,7 @@ public class TheFollowMethod public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool expected) { var response = Task.Factory.StartNew>(() => - new ApiResponse(new Response(status , null, new Dictionary(), "application/json"))); + new ApiResponse(new Response(status, null, new Dictionary(), "application/json"))); var connection = Substitute.For(); connection.Put(Arg.Is(u => u.ToString() == "user/following/alfhenrik"), Args.Object).Returns(response); @@ -225,7 +224,7 @@ public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool public async Task ThrowsExceptionForInvalidStatusCode() { var response = Task.Factory.StartNew>(() => - new ApiResponse(new Response(HttpStatusCode.Conflict , null, new Dictionary(), "application/json"))); + new ApiResponse(new Response(HttpStatusCode.Conflict, null, new Dictionary(), "application/json"))); var connection = Substitute.For(); connection.Put(Arg.Is(u => u.ToString() == "user/following/alfhenrik"), new { }).Returns(response); diff --git a/Octokit.Tests/Clients/GistsClientTests.cs b/Octokit.Tests/Clients/GistsClientTests.cs index fa627076c4..3c8b5d7f00 100644 --- a/Octokit.Tests/Clients/GistsClientTests.cs +++ b/Octokit.Tests/Clients/GistsClientTests.cs @@ -45,8 +45,8 @@ public void RequestsCorrectGetAllWithSinceUrl() DateTimeOffset since = DateTimeOffset.Now; client.GetAll(since); - connection.Received().GetAll(Arg.Is(u => u.ToString() == "gists"), - Arg.Is>(x => x.ContainsKey("since"))); + connection.Received().GetAll(Arg.Is(u => u.ToString() == "gists"), + Arg.Is>(x => x.ContainsKey("since"))); } [Fact] @@ -54,7 +54,7 @@ public void RequestsCorrectGetAllPublicUrl() { var connection = Substitute.For(); var client = new GistsClient(connection); - + client.GetAllPublic(); connection.Received().GetAll(Arg.Is(u => u.ToString() == "gists/public")); @@ -65,7 +65,7 @@ public void RequestsCorrectGetAllPublicWithSinceUrl() { var connection = Substitute.For(); var client = new GistsClient(connection); - + DateTimeOffset since = DateTimeOffset.Now; client.GetAllPublic(since); @@ -173,7 +173,7 @@ public void PostsToTheCorrectUrl() newGist.Public = true; newGist.Files.Add("myGistTestFile.cs", "new GistsClient(connection).Create();"); - + client.Create(newGist); connection.Received().Post(Arg.Is(u => u.ToString() == "gists"), Arg.Any()); @@ -233,7 +233,7 @@ public void RequestsCorrectUnstarUrl() public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool expected) { var response = Task.Factory.StartNew>(() => - new ApiResponse(new Response(status , null, new Dictionary(), "application/json"))); + new ApiResponse(new Response(status, null, new Dictionary(), "application/json"))); var connection = Substitute.For(); connection.Get(Arg.Is(u => u.ToString() == "gists/1/star"), null, null).Returns(response); @@ -250,7 +250,7 @@ public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool public async Task ThrowsExceptionForInvalidStatusCode() { var response = Task.Factory.StartNew>(() => - new ApiResponse(new Response(HttpStatusCode.Conflict , null, new Dictionary(), "application/json"))); + new ApiResponse(new Response(HttpStatusCode.Conflict, null, new Dictionary(), "application/json"))); var connection = Substitute.For(); connection.Get(Arg.Is(u => u.ToString() == "gists/1/star"), null, null).Returns(response); @@ -273,7 +273,7 @@ public void RequestsCorrectUrl() client.Fork("1"); - connection.Received().Post(Arg.Is(u => u.ToString() == "gists/1/forks"), + connection.Received().Post(Arg.Is(u => u.ToString() == "gists/1/forks"), Arg.Any()); } } @@ -288,8 +288,8 @@ public void PostsToTheCorrectUrl() var updateGist = new GistUpdate(); updateGist.Description = "my newly updated gist"; - var gistFileUpdate = new GistFileUpdate - { + var gistFileUpdate = new GistFileUpdate + { NewFileName = "myNewGistTestFile.cs", Content = "new GistsClient(connection).Edit();" }; diff --git a/Octokit.Tests/Clients/GitDatabaseClientTests.cs b/Octokit.Tests/Clients/GitDatabaseClientTests.cs index 7c4179817f..d66c5ffef9 100644 --- a/Octokit.Tests/Clients/GitDatabaseClientTests.cs +++ b/Octokit.Tests/Clients/GitDatabaseClientTests.cs @@ -36,5 +36,5 @@ public void SetReferencesClient() var gitDatabaseClient = new GitDatabaseClient(apiConnection); Assert.NotNull(gitDatabaseClient.Reference); } - } + } } diff --git a/Octokit.Tests/Clients/IssueCommentsClientTests.cs b/Octokit.Tests/Clients/IssueCommentsClientTests.cs index 0ea7cf0642..b64eb2d804 100644 --- a/Octokit.Tests/Clients/IssueCommentsClientTests.cs +++ b/Octokit.Tests/Clients/IssueCommentsClientTests.cs @@ -34,7 +34,6 @@ public async Task EnsuresNonNullArguments() await Assert.ThrowsAsync(() => client.Get("owner", null, 1)); await Assert.ThrowsAsync(() => client.Get("owner", "", 1)); } - } public class TheGetForRepositoryMethod @@ -183,7 +182,7 @@ public void EnsuresArgument() [Fact] public void CanDeserializeIssueComment() { - const string issueResponseJson = + const string issueResponseJson = "{\"id\": 1," + "\"url\": \"https://api.github.com/repos/octocat/Hello-World/issues/comments/1\"," + "\"html_url\": \"https://github.com/octocat/Hello-World/issues/1347#issuecomment-1\"," + diff --git a/Octokit.Tests/Clients/IssuesClientTests.cs b/Octokit.Tests/Clients/IssuesClientTests.cs index a5cd3c19d0..e477b0fb4a 100644 --- a/Octokit.Tests/Clients/IssuesClientTests.cs +++ b/Octokit.Tests/Clients/IssuesClientTests.cs @@ -33,7 +33,6 @@ public async Task EnsuresNonNullArguments() await Assert.ThrowsAsync(() => client.Get(null, "name", 1)); await Assert.ThrowsAsync(() => client.Get("owner", null, 1)); } - } public class TheGetAllForCurrentMethod diff --git a/Octokit.Tests/Clients/IssuesEventsClientTests.cs b/Octokit.Tests/Clients/IssuesEventsClientTests.cs index 4c4a749127..61c5509730 100644 --- a/Octokit.Tests/Clients/IssuesEventsClientTests.cs +++ b/Octokit.Tests/Clients/IssuesEventsClientTests.cs @@ -76,7 +76,6 @@ public async Task EnsuresNonNullArguments() await Assert.ThrowsAsync(() => client.Get(null, "name", 1)); await Assert.ThrowsAsync(() => client.Get("owner", null, 1)); } - } } } \ No newline at end of file diff --git a/Octokit.Tests/Clients/MergingClientTests.cs b/Octokit.Tests/Clients/MergingClientTests.cs index 2d115279f8..7d5751ec0f 100644 --- a/Octokit.Tests/Clients/MergingClientTests.cs +++ b/Octokit.Tests/Clients/MergingClientTests.cs @@ -33,13 +33,13 @@ public async Task EnsuresNonNullArguments() { var client = new MergingClient(Substitute.For()); - var newMerge = new NewMerge("baseBranch", "shaToMerge") {CommitMessage = "some mergingMessage"}; + var newMerge = new NewMerge("baseBranch", "shaToMerge") { CommitMessage = "some mergingMessage" }; await Assert.ThrowsAsync(() => client.Create(null, "name", newMerge)); await Assert.ThrowsAsync(() => client.Create("owner", null, newMerge)); await Assert.ThrowsAsync(() => client.Create("owner", "name", null)); await Assert.ThrowsAsync(() => client.Create("", "name", newMerge)); - await Assert.ThrowsAsync(() => client.Create("owner", "", newMerge)); - await Assert.ThrowsAsync(() => client.Create("owner", "", null)); + await Assert.ThrowsAsync(() => client.Create("owner", "", newMerge)); + await Assert.ThrowsAsync(() => client.Create("owner", "", null)); } } diff --git a/Octokit.Tests/Clients/MiscellaneousClientTests.cs b/Octokit.Tests/Clients/MiscellaneousClientTests.cs index 72a9b6427f..1d73f720d0 100644 --- a/Octokit.Tests/Clients/MiscellaneousClientTests.cs +++ b/Octokit.Tests/Clients/MiscellaneousClientTests.cs @@ -39,7 +39,7 @@ public async Task RequestsTheEmojiEndpoint() IApiResponse response = new ApiResponse(new Response(), "Test"); var connection = Substitute.For(); var forTest = new NewArbitraryMarkdown("testMarkdown", "gfm", "testContext"); - connection.Post(Args.Uri,forTest, "text/html", "text/plain") + connection.Post(Args.Uri, forTest, "text/html", "text/plain") .Returns(Task.FromResult(response)); var client = new MiscellaneousClient(connection); diff --git a/Octokit.Tests/Clients/OrganizationMembersClientTests.cs b/Octokit.Tests/Clients/OrganizationMembersClientTests.cs index 3bc42e51c4..38f1cba790 100644 --- a/Octokit.Tests/Clients/OrganizationMembersClientTests.cs +++ b/Octokit.Tests/Clients/OrganizationMembersClientTests.cs @@ -101,7 +101,7 @@ public class TheCheckMemberMethod public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool expected) { var response = Task.Factory.StartNew>(() => - new ApiResponse(new Response(status , null, new Dictionary(), "application/json"))); + new ApiResponse(new Response(status, null, new Dictionary(), "application/json"))); var connection = Substitute.For(); connection.Get(Arg.Is(u => u.ToString() == "orgs/org/members/username"), null, null).Returns(response); @@ -118,7 +118,7 @@ public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool public async Task ThrowsExceptionForInvalidStatusCode() { var response = Task.Factory.StartNew>(() => - new ApiResponse(new Response(HttpStatusCode.Conflict , null, new Dictionary(), "application/json"))); + new ApiResponse(new Response(HttpStatusCode.Conflict, null, new Dictionary(), "application/json"))); var connection = Substitute.For(); connection.Get(Arg.Is(u => u.ToString() == "orgs/org/members/username"), null, null).Returns(response); @@ -149,7 +149,7 @@ public class TheCheckMemberPublicMethod public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool expected) { var response = Task.Factory.StartNew>(() => - new ApiResponse(new Response(status , null, new Dictionary(), "application/json"))); + new ApiResponse(new Response(status, null, new Dictionary(), "application/json"))); var connection = Substitute.For(); connection.Get(Arg.Is(u => u.ToString() == "orgs/org/public_members/username"), null, null).Returns(response); @@ -166,7 +166,7 @@ public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool public async Task ThrowsExceptionForInvalidStatusCode() { var response = Task.Factory.StartNew>(() => - new ApiResponse(new Response(HttpStatusCode.Conflict , null, new Dictionary(), "application/json"))); + new ApiResponse(new Response(HttpStatusCode.Conflict, null, new Dictionary(), "application/json"))); var connection = Substitute.For(); connection.Get(Arg.Is(u => u.ToString() == "orgs/org/public_members/username"), null, null).Returns(response); @@ -221,7 +221,7 @@ public class ThePublicizeMethod public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool expected) { var response = Task.Factory.StartNew>(() => - new ApiResponse(new Response(status , null, new Dictionary(), "application/json"))); + new ApiResponse(new Response(status, null, new Dictionary(), "application/json"))); var connection = Substitute.For(); connection.Put(Arg.Is(u => u.ToString() == "orgs/org/public_members/username"), Args.Object).Returns(response); @@ -238,7 +238,7 @@ public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool public async Task ThrowsExceptionForInvalidStatusCode() { var response = Task.Factory.StartNew>(() => - new ApiResponse(new Response(HttpStatusCode.Conflict , null, new Dictionary(), "application/json"))); + new ApiResponse(new Response(HttpStatusCode.Conflict, null, new Dictionary(), "application/json"))); var connection = Substitute.For(); connection.Put(Arg.Is(u => u.ToString() == "orgs/org/public_members/username"), new { }).Returns(response); @@ -271,7 +271,7 @@ public void PostsToCorrectUrl() client.Conceal("org", "username"); - connection.Received().Delete(Arg.Is(u=>u.ToString() == "orgs/org/public_members/username")); + connection.Received().Delete(Arg.Is(u => u.ToString() == "orgs/org/public_members/username")); } [Fact] diff --git a/Octokit.Tests/Clients/PullRequestsClientTests.cs b/Octokit.Tests/Clients/PullRequestsClientTests.cs index f2261d5c2e..5998d0958f 100644 --- a/Octokit.Tests/Clients/PullRequestsClientTests.cs +++ b/Octokit.Tests/Clients/PullRequestsClientTests.cs @@ -54,7 +54,7 @@ public void SendsAppropriateParameters() var connection = Substitute.For(); var client = new PullRequestsClient(connection); - client.GetAllForRepository("fake", "repo", new PullRequestRequest { Head = "user:ref-head", Base = "fake_base_branch"}); + client.GetAllForRepository("fake", "repo", new PullRequestRequest { Head = "user:ref-head", Base = "fake_base_branch" }); connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/pulls"), Arg.Is>(d => d.Count == 5 @@ -134,7 +134,7 @@ await Assert.ThrowsAsync(() => } } - public class TheMergeMethod + public class TheMergeMethod { [Fact] public void PutsToCorrectUrl() @@ -164,7 +164,7 @@ await Assert.ThrowsAsync(() => } } - public class TheMergedMethod + public class TheMergedMethod { [Fact] public void RequestsCorrectUrl() @@ -193,7 +193,7 @@ public async Task EnsuresArgumentsNotNull() } } - public class TheCommitsMethod + public class TheCommitsMethod { [Fact] public async Task RequestsCorrectUrl() @@ -202,7 +202,7 @@ public async Task RequestsCorrectUrl() var client = new PullRequestsClient(connection); await client.Commits("fake", "repo", 42); - + connection.Received() .GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/pulls/42/commits")); } diff --git a/Octokit.Tests/Clients/RepoCollaboratorsClientTests.cs b/Octokit.Tests/Clients/RepoCollaboratorsClientTests.cs index 79d23181f7..7c7ddfbc3d 100644 --- a/Octokit.Tests/Clients/RepoCollaboratorsClientTests.cs +++ b/Octokit.Tests/Clients/RepoCollaboratorsClientTests.cs @@ -41,7 +41,7 @@ public async Task EnsuresNonNullArguments() { var client = new RepoCollaboratorsClient(Substitute.For()); - await Assert.ThrowsAsync(() => client.GetAll(null,"test")); + await Assert.ThrowsAsync(() => client.GetAll(null, "test")); await Assert.ThrowsAsync(() => client.GetAll("", "test")); await Assert.ThrowsAsync(() => client.GetAll("owner", null)); await Assert.ThrowsAsync(() => client.GetAll("owner", "")); @@ -56,7 +56,7 @@ public class TheGetMethod public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool expected) { var response = Task.Factory.StartNew>(() => - new ApiResponse(new Response(status , null, new Dictionary(), "application/json"))); + new ApiResponse(new Response(status, null, new Dictionary(), "application/json"))); var connection = Substitute.For(); connection.Get(Arg.Is(u => u.ToString() == "repos/owner/test/collaborators/user1"), null, null).Returns(response); @@ -73,7 +73,7 @@ public async Task RequestsCorrectValueForStatusCode(HttpStatusCode status, bool public async Task ThrowsExceptionForInvalidStatusCode() { var response = Task.Factory.StartNew>(() => - new ApiResponse(new Response(HttpStatusCode.Conflict , null, new Dictionary(), "application/json"))); + new ApiResponse(new Response(HttpStatusCode.Conflict, null, new Dictionary(), "application/json"))); var connection = Substitute.For(); connection.Get(Arg.Is(u => u.ToString() == "repos/foo/bar/assignees/cody"), null, null).Returns(response); @@ -115,7 +115,7 @@ public async Task EnsuresNonNullArguments() { var client = new RepoCollaboratorsClient(Substitute.For()); - await Assert.ThrowsAsync(() => client.Add(null, "test","user1")); + await Assert.ThrowsAsync(() => client.Add(null, "test", "user1")); await Assert.ThrowsAsync(() => client.Add("", "test", "user1")); await Assert.ThrowsAsync(() => client.Add("owner", null, "user1")); await Assert.ThrowsAsync(() => client.Add("owner", "", "user1")); diff --git a/Octokit.Tests/Clients/RepositoriesClientTests.cs b/Octokit.Tests/Clients/RepositoriesClientTests.cs index 5c5d8bae13..35b8a0bf77 100644 --- a/Octokit.Tests/Clients/RepositoriesClientTests.cs +++ b/Octokit.Tests/Clients/RepositoriesClientTests.cs @@ -270,7 +270,7 @@ public void RequestsTheCorrectUrlAndReturnsRepositories() connection.Received() .GetAll(Arg.Is(u => u.ToString() == "/repositories")); - } + } } @@ -331,7 +331,7 @@ public void CanFilterByType() connection.Received() .GetAll( Arg.Is(u => u.ToString() == "user/repos"), - Arg.Is>(d => d["type"] == "all")); + Arg.Is>(d => d["type"] == "all")); } [Fact] diff --git a/Octokit.Tests/Clients/RepositoryCommentsClientTests.cs b/Octokit.Tests/Clients/RepositoryCommentsClientTests.cs index 81a49c3509..56e32e7c79 100644 --- a/Octokit.Tests/Clients/RepositoryCommentsClientTests.cs +++ b/Octokit.Tests/Clients/RepositoryCommentsClientTests.cs @@ -34,7 +34,6 @@ public async Task EnsuresNonNullArguments() await Assert.ThrowsAsync(() => client.Get("owner", null, 1)); await Assert.ThrowsAsync(() => client.Get("owner", "", 1)); } - } public class TheGetForRepositoryMethod @@ -97,7 +96,7 @@ public class TheCreateMethod public void PostsToCorrectUrl() { NewCommitComment newComment = new NewCommitComment("body"); - + var connection = Substitute.For(); var client = new RepositoryCommentsClient(connection); @@ -188,7 +187,7 @@ public void EnsuresArgument() [Fact] public void CanDeserializeCommitComment() { - const string commitCommentResponseJson = + const string commitCommentResponseJson = "{\"html_url\": \"https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e#commitcomment-1\"," + "\"url\": \"https://api.github.com/repos/octocat/Hello-World/comments/1\"," + "\"id\": 1," + @@ -218,7 +217,7 @@ public void CanDeserializeCommitComment() var response = jsonPipeline.DeserializeResponse(httpResponse); Assert.NotNull(response.Body); - Assert.Equal(commitCommentResponseJson, response.HttpResponse.Body); + Assert.Equal(commitCommentResponseJson, response.HttpResponse.Body); Assert.Equal(1, response.Body.Id); } } diff --git a/Octokit.Tests/Clients/RepositoryHooksClientTest.cs b/Octokit.Tests/Clients/RepositoryHooksClientTest.cs index 53a4a5c32b..2d31c4ed36 100644 --- a/Octokit.Tests/Clients/RepositoryHooksClientTest.cs +++ b/Octokit.Tests/Clients/RepositoryHooksClientTest.cs @@ -61,7 +61,7 @@ public void RequestsCorrectUrl() { var connection = Substitute.For(); var client = new RepositoriesClient(connection); - var hook = new NewRepositoryHook("name", new Dictionary { {"config", "" }}); + var hook = new NewRepositoryHook("name", new Dictionary { { "config", "" } }); client.Hooks.Create("fake", "repo", hook); diff --git a/Octokit.Tests/Clients/SearchClientTests.cs b/Octokit.Tests/Clients/SearchClientTests.cs index 5c5e2d2c65..1d9421e94c 100644 --- a/Octokit.Tests/Clients/SearchClientTests.cs +++ b/Octokit.Tests/Clients/SearchClientTests.cs @@ -349,7 +349,7 @@ public void RequestsTheCorrectUrl() var connection = Substitute.For(); var client = new SearchClient(connection); client.SearchRepo(new SearchRepositoriesRequest("something")); - connection.Received().Get(Arg.Is(u => u.ToString() == "search/repositories"), + connection.Received().Get(Arg.Is(u => u.ToString() == "search/repositories"), Arg.Any>()); } @@ -655,12 +655,12 @@ public void TestingTheSortParameter() var client = new SearchClient(connection); var request = new SearchRepositoriesRequest("github"); request.SortField = RepoSearchSort.Stars; - + client.SearchRepo(request); - + connection.Received().Get( Arg.Is(u => u.ToString() == "search/repositories"), - Arg.Is>(d => + Arg.Is>(d => d["q"] == "github" && d["sort"] == "stars")); } diff --git a/Octokit.Tests/Clients/StarredClientTests.cs b/Octokit.Tests/Clients/StarredClientTests.cs index 6927e19fbe..e8ee43f9e7 100644 --- a/Octokit.Tests/Clients/StarredClientTests.cs +++ b/Octokit.Tests/Clients/StarredClientTests.cs @@ -64,7 +64,7 @@ public class TheCheckStarredMethod public async Task ReturnsCorrectResultBasedOnStatus(HttpStatusCode status, bool expected) { var response = Task.Factory.StartNew>(() => - new ApiResponse(new Response(status , null, new Dictionary(), "application/json"))); + new ApiResponse(new Response(status, null, new Dictionary(), "application/json"))); var connection = Substitute.For(); connection.Get(Arg.Is(u => u.ToString() == "user/starred/yes/no"), null, null) .Returns(response); @@ -87,7 +87,7 @@ public class TheStarRepoMethod public async Task ReturnsCorrectResultBasedOnStatus(HttpStatusCode status, bool expected) { var response = Task.Factory.StartNew>(() => - new ApiResponse(new Response(status , null, new Dictionary(), "application/json"))); + new ApiResponse(new Response(status, null, new Dictionary(), "application/json"))); var connection = Substitute.For(); connection.Put(Arg.Is(u => u.ToString() == "user/starred/yes/no"), diff --git a/Octokit.Tests/Clients/StatisticsClientTests.cs b/Octokit.Tests/Clients/StatisticsClientTests.cs index bcf4d57813..097ab7a6b1 100644 --- a/Octokit.Tests/Clients/StatisticsClientTests.cs +++ b/Octokit.Tests/Clients/StatisticsClientTests.cs @@ -31,7 +31,7 @@ public async Task RetrievesContributorsForCorrectUrl() .Returns(Task.FromResult(contributors)); var statisticsClient = new StatisticsClient(client); - var result = await statisticsClient.GetContributors("username","repositoryName"); + var result = await statisticsClient.GetContributors("username", "repositoryName"); Assert.Equal(1, result.Count); } @@ -40,7 +40,7 @@ public async Task RetrievesContributorsForCorrectUrl() public async Task ThrowsIfGivenNullOwner() { var statisticsClient = new StatisticsClient(Substitute.For()); - await Assert.ThrowsAsync(() => statisticsClient.GetContributors(null,"repositoryName")); + await Assert.ThrowsAsync(() => statisticsClient.GetContributors(null, "repositoryName")); } [Fact] @@ -105,14 +105,14 @@ public async Task RequestsCorrectUrl() }); var client = Substitute.For(); client.GetQueuedOperation(expectedEndPoint, Args.CancellationToken) - .Returns(Task.FromResult(data)); + .Returns(Task.FromResult(data)); var statisticsClient = new StatisticsClient(client); var codeFrequency = await statisticsClient.GetCodeFrequency("username", "repositoryName"); Assert.Equal(2, codeFrequency.AdditionsAndDeletionsByWeek.Count); Assert.Equal(firstTimestamp.FromUnixTime(), codeFrequency.AdditionsAndDeletionsByWeek[0].Timestamp); - Assert.Equal(10, codeFrequency.AdditionsAndDeletionsByWeek[0].Additions); + Assert.Equal(10, codeFrequency.AdditionsAndDeletionsByWeek[0].Additions); Assert.Equal(52, codeFrequency.AdditionsAndDeletionsByWeek[0].Deletions); Assert.Equal(secondTimestamp.FromUnixTime(), codeFrequency.AdditionsAndDeletionsByWeek[1].Timestamp); Assert.Equal(0, codeFrequency.AdditionsAndDeletionsByWeek[1].Additions); diff --git a/Octokit.Tests/Clients/TagsClientTests.cs b/Octokit.Tests/Clients/TagsClientTests.cs index 43724514d5..27fddd90aa 100644 --- a/Octokit.Tests/Clients/TagsClientTests.cs +++ b/Octokit.Tests/Clients/TagsClientTests.cs @@ -42,9 +42,9 @@ public void PostsToTheCorrectUrl() var connection = Substitute.For(); var client = new TagsClient(connection); - client.Create("owner", "repo", new NewTag{Type = TaggedType.Tree}); + client.Create("owner", "repo", new NewTag { Type = TaggedType.Tree }); - connection.Received().Post(Arg.Is(u => u.ToString() == "repos/owner/repo/git/tags"), + connection.Received().Post(Arg.Is(u => u.ToString() == "repos/owner/repo/git/tags"), Arg.Is(nt => nt.Type == TaggedType.Tree)); } @@ -98,6 +98,6 @@ public void PerformsNewTagSerialization() "}"; Assert.Equal(expectedResult, json); - } + } } } diff --git a/Octokit.Tests/Clients/TeamsClientTests.cs b/Octokit.Tests/Clients/TeamsClientTests.cs index 3ca76d5f8a..380887ff2a 100644 --- a/Octokit.Tests/Clients/TeamsClientTests.cs +++ b/Octokit.Tests/Clients/TeamsClientTests.cs @@ -235,7 +235,6 @@ public async Task EnsuresNonNullOrEmptyLogin() await Assert.ThrowsAsync(() => client.RemoveMembership(1, null)); await Assert.ThrowsAsync(() => client.RemoveMembership(1, "")); } - } public class TheGetAllRepositoriesMethod diff --git a/Octokit.Tests/Clients/WatchedClientTests.cs b/Octokit.Tests/Clients/WatchedClientTests.cs index f52a732a01..aabcadf347 100644 --- a/Octokit.Tests/Clients/WatchedClientTests.cs +++ b/Octokit.Tests/Clients/WatchedClientTests.cs @@ -75,7 +75,7 @@ public async Task ReturnsTrueOnValidResult() [Fact] public async Task ReturnsFalseOnNotFoundException() { - var endpoint = new Uri("repos/fight/club/subscription", UriKind.Relative); + var endpoint = new Uri("repos/fight/club/subscription", UriKind.Relative); var connection = Substitute.For(); var response = new Response(HttpStatusCode.NotFound, null, new Dictionary(), "application/json"); diff --git a/Octokit.Tests/Exceptions/ApiExceptionTests.cs b/Octokit.Tests/Exceptions/ApiExceptionTests.cs index 124f554058..e383d7d941 100644 --- a/Octokit.Tests/Exceptions/ApiExceptionTests.cs +++ b/Octokit.Tests/Exceptions/ApiExceptionTests.cs @@ -26,9 +26,9 @@ public void SetsDefaultExceptionMessage() public void SetsSpecifiedExceptionMessageAndInnerException() { var inner = new InvalidOperationException(); - + var exception = new ApiException("Shit broke", inner); - + Assert.Equal("Shit broke", exception.Message); Assert.Same(inner, exception.InnerException); } diff --git a/Octokit.Tests/Exceptions/ApiValidationExceptionTests.cs b/Octokit.Tests/Exceptions/ApiValidationExceptionTests.cs index e3c4b6b8a7..14d9aa9e78 100644 --- a/Octokit.Tests/Exceptions/ApiValidationExceptionTests.cs +++ b/Octokit.Tests/Exceptions/ApiValidationExceptionTests.cs @@ -18,8 +18,8 @@ public void CreatesGitHubErrorFromJsonResponse() var response = new Response( (HttpStatusCode)422, @"{""errors"":[{""code"":""custom"",""field"":""key"",""message"":""key is " + - @"already in use"",""resource"":""PublicKey""}],""message"":""Validation Failed""}", - new Dictionary(), + @"already in use"",""resource"":""PublicKey""}],""message"":""Validation Failed""}", + new Dictionary(), "application/json" ); @@ -49,7 +49,7 @@ public void CanPopulateObjectFromSerializedData() @"already in use"",""resource"":""PublicKey""}],""message"":""Validation Failed""}", new Dictionary(), "application/json"); - + var exception = new ApiValidationException(response); using (var stream = new MemoryStream()) diff --git a/Octokit.Tests/Exceptions/ForbiddenExceptionTests.cs b/Octokit.Tests/Exceptions/ForbiddenExceptionTests.cs index b4a86c1ca0..bfc3773b2e 100644 --- a/Octokit.Tests/Exceptions/ForbiddenExceptionTests.cs +++ b/Octokit.Tests/Exceptions/ForbiddenExceptionTests.cs @@ -27,7 +27,7 @@ public void IdentifiesMaxLoginAttepmtsExceededReason() [Fact] public void HasDefaultMessage() { - var response = new Response(HttpStatusCode.Forbidden , null, new Dictionary(), "application/json"); + var response = new Response(HttpStatusCode.Forbidden, null, new Dictionary(), "application/json"); var forbiddenException = new ForbiddenException(response); Assert.Equal("Request Forbidden", forbiddenException.Message); diff --git a/Octokit.Tests/Exceptions/RateLimitExceededExceptionTests.cs b/Octokit.Tests/Exceptions/RateLimitExceededExceptionTests.cs index d3b56f1813..66d6e672e7 100644 --- a/Octokit.Tests/Exceptions/RateLimitExceededExceptionTests.cs +++ b/Octokit.Tests/Exceptions/RateLimitExceededExceptionTests.cs @@ -47,7 +47,7 @@ public void HandlesInvalidHeaderValues() {"X-RateLimit-Reset", "XXXX"} }; var response = new Response(HttpStatusCode.Forbidden, null, headers, "application/json"); - + var exception = new RateLimitExceededException(response); Assert.Equal(HttpStatusCode.Forbidden, exception.StatusCode); diff --git a/Octokit.Tests/Exceptions/RepositoryExistsExceptionTests.cs b/Octokit.Tests/Exceptions/RepositoryExistsExceptionTests.cs index 8d4530dbcb..4a83eb587a 100644 --- a/Octokit.Tests/Exceptions/RepositoryExistsExceptionTests.cs +++ b/Octokit.Tests/Exceptions/RepositoryExistsExceptionTests.cs @@ -9,7 +9,7 @@ public class RepositoryExistsExceptionTests public void WhenOrganizationIsNullShouldThrowArgumentNullException() { Assert.Throws(() => new RepositoryExistsException( - null, + null, "some-repo", GitHubClient.GitHubDotComUrl, new ApiValidationException())); diff --git a/Octokit.Tests/GitHubClientTests.cs b/Octokit.Tests/GitHubClientTests.cs index d3f8cb797d..d3ed7a8f4f 100644 --- a/Octokit.Tests/GitHubClientTests.cs +++ b/Octokit.Tests/GitHubClientTests.cs @@ -151,7 +151,7 @@ public async Task ReturnsObjectIfNotNew() }, new List { - "user", + "user", "public_repo", "repo", "gist" @@ -170,6 +170,5 @@ public async Task ReturnsObjectIfNotNew() var temp = connection.Received(1).GetLastApiInfo(); } } - } } diff --git a/Octokit.Tests/Helpers/Arg.cs b/Octokit.Tests/Helpers/Arg.cs index eb9dd1fc43..391255fa4b 100644 --- a/Octokit.Tests/Helpers/Arg.cs +++ b/Octokit.Tests/Helpers/Arg.cs @@ -57,7 +57,7 @@ public static OrganizationUpdate OrganizationUpdate { get { return Arg.Any(); } } - + public static CancellationToken CancellationToken { get { return Arg.Any(); } diff --git a/Octokit.Tests/Helpers/StringExtensionsTests.cs b/Octokit.Tests/Helpers/StringExtensionsTests.cs index 51068460bc..8a3fc36f37 100644 --- a/Octokit.Tests/Helpers/StringExtensionsTests.cs +++ b/Octokit.Tests/Helpers/StringExtensionsTests.cs @@ -61,7 +61,7 @@ public class TheExpandUriTemplateMethod [InlineData("https://host.com/path?name=example name.txt&label=labeltext", "https://host.com/path{?name,label,other}")] public void ExpandsUriTemplates(string expected, string template) { - Assert.Equal(expected, template.ExpandUriTemplate(new { name = "example name.txt",label="labeltext" }).ToString()); + Assert.Equal(expected, template.ExpandUriTemplate(new { name = "example name.txt", label = "labeltext" }).ToString()); } } } diff --git a/Octokit.Tests/Helpers/UnixTimestampExtensionsTests.cs b/Octokit.Tests/Helpers/UnixTimestampExtensionsTests.cs index 1f1b379839..09c542c3c1 100644 --- a/Octokit.Tests/Helpers/UnixTimestampExtensionsTests.cs +++ b/Octokit.Tests/Helpers/UnixTimestampExtensionsTests.cs @@ -27,7 +27,7 @@ public class TheFromUnixTimeMethod public void ReturnsDateFromUnixEpochCorrectly() { var epoch = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero); - + var result = ((long)0).FromUnixTime(); Assert.Equal(epoch, result); @@ -37,9 +37,9 @@ public void ReturnsDateFromUnixEpochCorrectly() public void ReturnsDateFromRandomTimeCorrectly() { var expected = new DateTimeOffset(1975, 1, 23, 1, 1, 2, TimeSpan.Zero); - + var result = ((long)159670862).FromUnixTime(); - + Assert.Equal(expected, result); } } diff --git a/Octokit.Tests/Helpers/UriExtensionsTests.cs b/Octokit.Tests/Helpers/UriExtensionsTests.cs index 981ecd4094..1a1835ce96 100644 --- a/Octokit.Tests/Helpers/UriExtensionsTests.cs +++ b/Octokit.Tests/Helpers/UriExtensionsTests.cs @@ -66,7 +66,7 @@ public void CombinesExistingParametersWithNewParameters() { var uri = new Uri("https://api.github.com/repositories/1/milestones?state=closed&sort=due_date&direction=asc&page=2"); - var parameters = new Dictionary { { "state", "open" }, { "sort", "other"} }; + var parameters = new Dictionary { { "state", "open" }, { "sort", "other" } }; var actual = uri.ApplyParameters(parameters); diff --git a/Octokit.Tests/Http/ApiConnectionTests.cs b/Octokit.Tests/Http/ApiConnectionTests.cs index 1e767bd800..f0dd7b6dd6 100644 --- a/Octokit.Tests/Http/ApiConnectionTests.cs +++ b/Octokit.Tests/Http/ApiConnectionTests.cs @@ -103,10 +103,10 @@ public async Task MakesGetRequestForAllItems() public async Task EnsuresArgumentNotNull() { var client = new ApiConnection(Substitute.For()); - + // One argument await Assert.ThrowsAsync(() => client.GetAll(null)); - + // Two argument await Assert.ThrowsAsync(async () => await client.GetAll(null, new Dictionary())); @@ -351,7 +351,7 @@ public async Task WhenGetReturnsNoContentThenReturnsEmptyCollection() { var queuedOperationUrl = new Uri("anything", UriKind.Relative); - var result = new [] { new object() }; + var result = new[] { new object() }; const HttpStatusCode statusCode = HttpStatusCode.NoContent; var httpResponse = new Response(statusCode, null, new Dictionary(), "application/json"); IApiResponse> response = new ApiResponse>( @@ -370,7 +370,7 @@ public async Task GetIsRepeatedUntilHttpStatusCodeOkIsReturned() { var queuedOperationUrl = new Uri("anything", UriKind.Relative); - var result = new [] { new object() }; + var result = new[] { new object() }; IApiResponse> firstResponse = new ApiResponse>( new Response(HttpStatusCode.Accepted, null, new Dictionary(), "application/json"), result); IApiResponse> completedResponse = new ApiResponse>( @@ -378,7 +378,7 @@ public async Task GetIsRepeatedUntilHttpStatusCodeOkIsReturned() var connection = Substitute.For(); connection.GetResponse>(queuedOperationUrl, Args.CancellationToken) .Returns(x => Task.FromResult(firstResponse), - x => Task.FromResult(firstResponse), + x => Task.FromResult(firstResponse), x => Task.FromResult(completedResponse)); var apiConnection = new ApiConnection(connection); @@ -392,7 +392,7 @@ public async Task CanCancelQueuedOperation() { var queuedOperationUrl = new Uri("anything", UriKind.Relative); - var result = new [] { new object() }; + var result = new[] { new object() }; IApiResponse> accepted = new ApiResponse>( new Response(HttpStatusCode.Accepted, null, new Dictionary(), "application/json"), result); var connection = Substitute.For(); diff --git a/Octokit.Tests/Http/ApiInfoTests.cs b/Octokit.Tests/Http/ApiInfoTests.cs index 5971c58f31..d9c213c771 100644 --- a/Octokit.Tests/Http/ApiInfoTests.cs +++ b/Octokit.Tests/Http/ApiInfoTests.cs @@ -40,7 +40,7 @@ public void CanClone() }, new List { - "user", + "user", "public_repo", "repo", "gist" @@ -95,6 +95,5 @@ public void CanClone() Assert.NotSame(original.RateLimit.Reset, clone.RateLimit.Reset); } } - } } diff --git a/Octokit.Tests/Http/ConnectionTests.cs b/Octokit.Tests/Http/ConnectionTests.cs index 05c4eae1ca..1fe74eba3a 100644 --- a/Octokit.Tests/Http/ConnectionTests.cs +++ b/Octokit.Tests/Http/ConnectionTests.cs @@ -74,7 +74,7 @@ public async Task ParsesApiInfoOnResponse() { "X-Accepted-OAuth-Scopes", "user" }, }; IResponse response = new Response(headers); - + httpClient.Send(Args.Request, Args.CancellationToken).Returns(Task.FromResult(response)); var connection = new Connection(new ProductHeaderValue("OctokitTests"), _exampleUri, @@ -93,7 +93,7 @@ public async Task ThrowsAuthorizationExceptionExceptionForUnauthorizedResponse() var httpClient = Substitute.For(); IResponse response = new Response(HttpStatusCode.Unauthorized, null, new Dictionary(), "application/json"); httpClient.Send(Args.Request, Args.CancellationToken).Returns(Task.FromResult(response)); - var connection = new Connection(new ProductHeaderValue("OctokitTests"), + var connection = new Connection(new ProductHeaderValue("OctokitTests"), _exampleUri, Substitute.For(), httpClient, @@ -155,7 +155,7 @@ public async Task ThrowsTwoFactorExceptionExceptionWhenChallenged( Assert.Equal(expectedFactorType, exception.TwoFactorType); } - + [Fact] public async Task ThrowsApiValidationExceptionFor422Response() { @@ -564,9 +564,9 @@ public void EnsuresNonNullArguments() { // 1 arg Assert.Throws(() => new Connection(null)); - + // 2 args - Assert.Throws(() => new Connection(null, new Uri("https://example.com"))); + Assert.Throws(() => new Connection(null, new Uri("https://example.com"))); Assert.Throws(() => new Connection(new ProductHeaderValue("test"), (Uri)null)); // 3 args @@ -634,7 +634,7 @@ public async Task ReturnsNullIfNew() Assert.Null(result); } - + [Fact] public async Task ReturnsObjectIfNotNew() { @@ -664,7 +664,7 @@ public async Task ReturnsObjectIfNotNew() }, new List { - "user", + "user", "public_repo", "repo", "gist" diff --git a/Octokit.Tests/Http/HttpClientAdapterTests.cs b/Octokit.Tests/Http/HttpClientAdapterTests.cs index 32cf42acc0..a834bcc22d 100644 --- a/Octokit.Tests/Http/HttpClientAdapterTests.cs +++ b/Octokit.Tests/Http/HttpClientAdapterTests.cs @@ -33,7 +33,7 @@ public void AddsHeadersToRequestMessage() } }; var tester = new HttpClientAdapterTester(); - + var requestMessage = tester.BuildRequestMessageTester(request); Assert.Equal(2, requestMessage.Headers.Count()); @@ -93,7 +93,7 @@ public void SetsHttpContentBody() BaseAddress = GitHubClient.GitHubApiUrl, Endpoint = _endpoint, Method = HttpMethod.Post, - Body = new FormUrlEncodedContent(new Dictionary {{"foo", "bar"}}) + Body = new FormUrlEncodedContent(new Dictionary { { "foo", "bar" } }) }; var tester = new HttpClientAdapterTester(); @@ -119,7 +119,8 @@ public class TheBuildResponseMethod [InlineData(HttpStatusCode.NotFound)] public async Task BuildsResponseFromResponseMessage(HttpStatusCode httpStatusCode) { - var responseMessage = new HttpResponseMessage { + var responseMessage = new HttpResponseMessage + { StatusCode = httpStatusCode, Content = new ByteArrayContent(Encoding.UTF8.GetBytes("{}")), Headers = @@ -131,7 +132,7 @@ public async Task BuildsResponseFromResponseMessage(HttpStatusCode httpStatusCod var tester = new HttpClientAdapterTester(); var response = await tester.BuildResponseTester(responseMessage); - + var firstHeader = response.Headers.First(); Assert.Equal("peanut", firstHeader.Key); Assert.Equal("butter", firstHeader.Value); @@ -149,7 +150,7 @@ public async Task BuildsByteArrayResponseFromResponseMessage() var responseMessage = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, - Content = new ByteArrayContent(new byte[] { 0, 1, 1, 0, 1}), + Content = new ByteArrayContent(new byte[] { 0, 1, 1, 0, 1 }), }; responseMessage.Content.Headers.ContentType = new MediaTypeHeaderValue("image/png"); var tester = new HttpClientAdapterTester(); diff --git a/Octokit.Tests/Http/JsonHttpPipelineTests.cs b/Octokit.Tests/Http/JsonHttpPipelineTests.cs index 88a67be08f..704665a487 100644 --- a/Octokit.Tests/Http/JsonHttpPipelineTests.cs +++ b/Octokit.Tests/Http/JsonHttpPipelineTests.cs @@ -142,9 +142,9 @@ public void DeserializesSingleObjectResponseIntoCollectionWithOneItem() const string data = "{\"name\":\"Haack\"}"; var jsonPipeline = new JsonHttpPipeline(); var httpResponse = new Response( - HttpStatusCode.OK, + HttpStatusCode.OK, data, - new Dictionary(), + new Dictionary(), "application/json"); var response = jsonPipeline.DeserializeResponse>(httpResponse); diff --git a/Octokit.Tests/Http/RateLimitTests.cs b/Octokit.Tests/Http/RateLimitTests.cs index 9473d05e63..2cc9c2fe73 100644 --- a/Octokit.Tests/Http/RateLimitTests.cs +++ b/Octokit.Tests/Http/RateLimitTests.cs @@ -19,7 +19,7 @@ public void Foo() [Fact] public void ParsesRateLimitsFromHeaders() { - var headers = new Dictionary + var headers = new Dictionary { { "X-RateLimit-Limit", "100" }, { "X-RateLimit-Remaining", "42" }, @@ -40,7 +40,7 @@ public void ParsesRateLimitsFromHeaders() [Fact] public void HandlesInvalidHeaderValues() { - var headers = new Dictionary + var headers = new Dictionary { { "X-RateLimit-Limit", "1234scoobysnacks1234" }, { "X-RateLimit-Remaining", "xanadu" }, @@ -78,7 +78,7 @@ public void HandlesMissingHeaderValues() [Fact] public void CanPopulateObjectFromSerializedData() { - var headers = new Dictionary + var headers = new Dictionary { { "X-RateLimit-Limit", "100" }, { "X-RateLimit-Remaining", "42" }, @@ -92,7 +92,7 @@ public void CanPopulateObjectFromSerializedData() var formatter = new BinaryFormatter(); formatter.Serialize(stream, rateLimit); stream.Position = 0; - var deserialized = (RateLimit) formatter.Deserialize(stream); + var deserialized = (RateLimit)formatter.Deserialize(stream); Assert.Equal(100, deserialized.Limit); Assert.Equal(42, deserialized.Remaining); @@ -109,7 +109,6 @@ public void EnsuresHeadersNotNull() { Assert.Throws(() => new RateLimit(null)); } - } public class TheMethods diff --git a/Octokit.Tests/Http/RedirectHandlerTests.cs b/Octokit.Tests/Http/RedirectHandlerTests.cs index ebd6fa56ad..8f5b65d3c3 100644 --- a/Octokit.Tests/Http/RedirectHandlerTests.cs +++ b/Octokit.Tests/Http/RedirectHandlerTests.cs @@ -104,7 +104,7 @@ public async Task RedirectWithDifferentHostShouldLoseAuthHeader(HttpStatusCode s [InlineData(HttpStatusCode.MovedPermanently)] // 301 [InlineData(HttpStatusCode.Found)] // 302 [InlineData(HttpStatusCode.TemporaryRedirect)] // 307 - public async Task Status301ShouldRedirectPOSTWithBody(HttpStatusCode statusCode) + public async Task Status301ShouldRedirectPOSTWithBody(HttpStatusCode statusCode) { var redirectResponse = new HttpResponseMessage(statusCode); redirectResponse.Headers.Location = new Uri("http://example.org/bar"); diff --git a/Octokit.Tests/Models/DeploymentTests.cs b/Octokit.Tests/Models/DeploymentTests.cs index 6e25d6782a..d60c9b117d 100644 --- a/Octokit.Tests/Models/DeploymentTests.cs +++ b/Octokit.Tests/Models/DeploymentTests.cs @@ -42,7 +42,7 @@ public void CanDeserialize() }"; var actual = new SimpleJsonSerializer().Deserialize(json); - + Assert.Equal(1, actual.Id); Assert.Equal("topic-branch", actual.Sha); Assert.Equal("https://api.github.com/repos/octocat/example/deployments/1", actual.Url); diff --git a/Octokit.Tests/Models/ReadOnlyPagedCollectionTests.cs b/Octokit.Tests/Models/ReadOnlyPagedCollectionTests.cs index 2618e60ca5..6fa1e4c26b 100644 --- a/Octokit.Tests/Models/ReadOnlyPagedCollectionTests.cs +++ b/Octokit.Tests/Models/ReadOnlyPagedCollectionTests.cs @@ -16,8 +16,8 @@ public async Task ReturnsTheNextPage() { var nextPageUrl = new Uri("https://example.com/page/2"); var nextPageResponse = Task.Factory.StartNew>>(() => - new ApiResponse>(new Response(), new List {new object(), new object()})); - var links = new Dictionary {{"next", nextPageUrl}}; + new ApiResponse>(new Response(), new List { new object(), new object() })); + var links = new Dictionary { { "next", nextPageUrl } }; var scopes = new List(); var httpResponse = Substitute.For(); httpResponse.ApiInfo.Returns(new ApiInfo(links, scopes, scopes, "etag", new RateLimit(new Dictionary()))); diff --git a/Octokit.Tests/Models/RepositoryUpdateTests.cs b/Octokit.Tests/Models/RepositoryUpdateTests.cs index d21544bf30..d7890ce76b 100644 --- a/Octokit.Tests/Models/RepositoryUpdateTests.cs +++ b/Octokit.Tests/Models/RepositoryUpdateTests.cs @@ -31,9 +31,9 @@ public void CanSerialize() HasWiki = true, HasDownloads = true }; - + var json = new SimpleJsonSerializer().Serialize(update); - + Assert.Equal(expected, json); } } diff --git a/Octokit.Tests/Models/SearchCodeRequestTests.cs b/Octokit.Tests/Models/SearchCodeRequestTests.cs index 831b6b3f67..3dbcac0a65 100644 --- a/Octokit.Tests/Models/SearchCodeRequestTests.cs +++ b/Octokit.Tests/Models/SearchCodeRequestTests.cs @@ -11,7 +11,7 @@ public class TheMergedQualifiersMethod public void ReturnsAReadOnlyDictionary() { var request = new SearchCodeRequest("test"); - + var result = request.MergedQualifiers(); // If I can cast this to a writeable collection, then that defeats the purpose of a read only. diff --git a/Octokit.Tests/Models/SearchRepositoryRequestTests.cs b/Octokit.Tests/Models/SearchRepositoryRequestTests.cs index 86557d8609..7066bf22ee 100644 --- a/Octokit.Tests/Models/SearchRepositoryRequestTests.cs +++ b/Octokit.Tests/Models/SearchRepositoryRequestTests.cs @@ -11,7 +11,7 @@ public class TheMergedQualifiersMethod public void ReturnsAReadOnlyDictionary() { var request = new SearchCodeRequest("test"); - + var result = request.MergedQualifiers(); // If I can cast this to a writeable collection, then that defeats the purpose of a read only. diff --git a/Octokit.Tests/Reactive/AuthorizationExtensionsTests.cs b/Octokit.Tests/Reactive/AuthorizationExtensionsTests.cs index 1b11b791e8..4812828bd0 100644 --- a/Octokit.Tests/Reactive/AuthorizationExtensionsTests.cs +++ b/Octokit.Tests/Reactive/AuthorizationExtensionsTests.cs @@ -31,7 +31,7 @@ public async Task UsesCallbackToRetrievTwoFactorCode() var result = await client.GetOrCreateApplicationAuthentication( "clientId", "secret", - new NewAuthorization { Note = "Was it this one?"}, + new NewAuthorization { Note = "Was it this one?" }, _ => Observable.Return(twoFactorChallengeResult)); Assert.Equal("OAUTHSECRET", result.Token); @@ -84,7 +84,7 @@ public void ThrowsTwoFactorChallengeFailedExceptionWhenProvidedCodeIsIncorrect() var challengeResults = new Queue(new[] { TwoFactorChallengeResult.RequestResendCode, - new TwoFactorChallengeResult("wrong-code") + new TwoFactorChallengeResult("wrong-code") }); var twoFactorFailedException = new TwoFactorChallengeFailedException(); var data = new NewAuthorization(); diff --git a/Octokit.Tests/Reactive/ObservableCommitsClientTests.cs b/Octokit.Tests/Reactive/ObservableCommitsClientTests.cs index 0636cebc77..78a1994c70 100644 --- a/Octokit.Tests/Reactive/ObservableCommitsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableCommitsClientTests.cs @@ -33,9 +33,9 @@ public async Task EnsureNonNullArguments() await Assert.ThrowsAsync(() => client.Get("owner", "name", null).ToTask()); await Assert.ThrowsAsync(() => client.Get("", "name", "reference").ToTask()); await Assert.ThrowsAsync(() => client.Get("owner", "", "reference").ToTask()); - await Assert.ThrowsAsync(() => client.Get("owner", "name", "").ToTask()); + await Assert.ThrowsAsync(() => client.Get("owner", "name", "").ToTask()); } - + [Fact] public async Task RequestsCorrectUrl() { @@ -62,7 +62,7 @@ public async Task EnsureNonNullArguments() await Assert.ThrowsAsync(() => client.Create("", "name", newCommit).ToTask()); await Assert.ThrowsAsync(() => client.Create("owner", "", newCommit).ToTask()); } - + [Fact] public async Task RequestsCorrectUrl() { diff --git a/Octokit.Tests/Reactive/ObservableDeploymentsClientTests.cs b/Octokit.Tests/Reactive/ObservableDeploymentsClientTests.cs index 54a949f0f4..9005cc7e02 100644 --- a/Octokit.Tests/Reactive/ObservableDeploymentsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableDeploymentsClientTests.cs @@ -131,5 +131,5 @@ public void EnsuresArguments() Assert.Throws(() => new ObservableDeploymentsClient(null)); } } - } + } } \ No newline at end of file diff --git a/Octokit.Tests/Reactive/ObservableIssueCommentsClientTests.cs b/Octokit.Tests/Reactive/ObservableIssueCommentsClientTests.cs index 2c6cb302b2..9655239701 100644 --- a/Octokit.Tests/Reactive/ObservableIssueCommentsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableIssueCommentsClientTests.cs @@ -35,7 +35,6 @@ public async Task EnsuresNonNullArguments() await Assert.ThrowsAsync(() => client.Get("owner", null, 1).ToTask()); await Assert.ThrowsAsync(() => client.Get("owner", "", 1).ToTask()); } - } public class TheGetForRepositoryMethod @@ -50,7 +49,7 @@ public void RequestsCorrectUrl() gitHubClient.Connection.Received(1).Get>( new Uri("repos/fake/repo/issues/comments", UriKind.Relative), null, null); - } + } [Fact] public async Task EnsuresArgumentsNotNull() diff --git a/Octokit.Tests/Reactive/ObservableMilestonesClientTests.cs b/Octokit.Tests/Reactive/ObservableMilestonesClientTests.cs index fd4823ed01..1c9b26907f 100644 --- a/Octokit.Tests/Reactive/ObservableMilestonesClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableMilestonesClientTests.cs @@ -45,7 +45,7 @@ public async Task ReturnsEveryPageOfMilestones() { var firstPageUrl = new Uri("repos/fake/repo/milestones", UriKind.Relative); var secondPageUrl = new Uri("https://example.com/page/2"); - var firstPageLinks = new Dictionary {{"next", secondPageUrl}}; + var firstPageLinks = new Dictionary { { "next", secondPageUrl } }; var firstPageResponse = new ApiResponse> ( CreateResponseWithApiInfo(firstPageLinks), @@ -57,7 +57,7 @@ public async Task ReturnsEveryPageOfMilestones() } ); var thirdPageUrl = new Uri("https://example.com/page/3"); - var secondPageLinks = new Dictionary {{"next", thirdPageUrl}}; + var secondPageLinks = new Dictionary { { "next", thirdPageUrl } }; var secondPageResponse = new ApiResponse> ( CreateResponseWithApiInfo(secondPageLinks), @@ -98,7 +98,7 @@ public async Task SendsAppropriateParameters() { var firstPageUrl = new Uri("repos/fake/repo/milestones", UriKind.Relative); var secondPageUrl = new Uri("https://example.com/page/2"); - var firstPageLinks = new Dictionary {{"next", secondPageUrl}}; + var firstPageLinks = new Dictionary { { "next", secondPageUrl } }; var firstPageResponse = new ApiResponse> ( CreateResponseWithApiInfo(firstPageLinks), @@ -110,7 +110,7 @@ public async Task SendsAppropriateParameters() } ); var thirdPageUrl = new Uri("https://example.com/page/3"); - var secondPageLinks = new Dictionary {{"next", thirdPageUrl}}; + var secondPageLinks = new Dictionary { { "next", thirdPageUrl } }; var secondPageResponse = new ApiResponse> ( CreateResponseWithApiInfo(secondPageLinks), diff --git a/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs b/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs index 600653c40f..236777c944 100644 --- a/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservablePullRequestReviewCommentsClientTests.cs @@ -193,7 +193,7 @@ public async Task RequestsCorrectUrlWithoutSelectedSortingArguments() }); var lastPageResponse = new ApiResponse> ( - new Response(), + new Response(), new List { new PullRequestReviewComment(7), diff --git a/Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs b/Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs index f0ea85b1b9..fc5100f1b9 100644 --- a/Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableRepositoriesClientTests.cs @@ -26,7 +26,7 @@ public async Task IsALukeWarmObservable() var gitHubClient = new GitHubClient(connection); var client = new ObservableRepositoriesClient(gitHubClient); var observable = client.Get("stark", "ned"); - + connection.Received(1).Get(Args.Uri, null, null); var result = await observable; @@ -47,7 +47,7 @@ public async Task ReturnsEveryPageOfRepositories() { var firstPageUrl = new Uri("user/repos", UriKind.Relative); var secondPageUrl = new Uri("https://example.com/page/2"); - var firstPageLinks = new Dictionary {{"next", secondPageUrl}}; + var firstPageLinks = new Dictionary { { "next", secondPageUrl } }; var firstPageResponse = new ApiResponse>( CreateResponseWithApiInfo(firstPageLinks), new List @@ -57,7 +57,7 @@ public async Task ReturnsEveryPageOfRepositories() new Repository(3) }); var thirdPageUrl = new Uri("https://example.com/page/3"); - var secondPageLinks = new Dictionary {{"next", thirdPageUrl}}; + var secondPageLinks = new Dictionary { { "next", thirdPageUrl } }; var secondPageResponse = new ApiResponse> ( CreateResponseWithApiInfo(secondPageLinks), @@ -122,7 +122,7 @@ public async Task StopsMakingNewRequestsWhenTakeIsFulfilled() var thirdPageLinks = new Dictionary { { "next", fourthPageUrl } }; var thirdPageResponse = new ApiResponse> ( - + CreateResponseWithApiInfo(thirdPageLinks), new List { @@ -174,7 +174,7 @@ public async Task ReturnsEveryPageOfRepositories() new Repository(365), new Repository(366) }); - + var thirdPageUrl = new Uri("https://example.com/page/3"); var secondPageLinks = new Dictionary { { "next", thirdPageUrl } }; IApiResponse> secondPageResponse = new ApiResponse> diff --git a/Octokit.Tests/Reactive/ObservableStatisticsClientTests.cs b/Octokit.Tests/Reactive/ObservableStatisticsClientTests.cs index 62091a7870..94d9479176 100644 --- a/Octokit.Tests/Reactive/ObservableStatisticsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableStatisticsClientTests.cs @@ -26,7 +26,7 @@ public void GetsFromClientIssueMilestone() [Fact] public async Task ThrowsIfGivenNullRepositoryName() - { + { var statisticsClient = new ObservableStatisticsClient(Substitute.For()); await Assert.ThrowsAsync(() => statisticsClient.GetContributors("owner", null).ToTask()); } diff --git a/Octokit.Tests/Reactive/ObservableTreesClientTests.cs b/Octokit.Tests/Reactive/ObservableTreesClientTests.cs index cef264fccf..2674708fb2 100644 --- a/Octokit.Tests/Reactive/ObservableTreesClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableTreesClientTests.cs @@ -37,7 +37,7 @@ public async Task EnsuresNonNullArguments() await Assert.ThrowsAsync(() => client.Get("owner", "name", "").ToTask()); } } - + public class TheGetRecursiveMethod { [Fact] @@ -64,7 +64,7 @@ public async Task EnsuresNonNullArguments() await Assert.ThrowsAsync(() => client.GetRecursive("owner", "name", "").ToTask()); } } - + public class TheCreateMethod { [Fact] diff --git a/Octokit.Tests/SimpleJsonSerializerTests.cs b/Octokit.Tests/SimpleJsonSerializerTests.cs index 18756d5cc0..bd3a375bfd 100644 --- a/Octokit.Tests/SimpleJsonSerializerTests.cs +++ b/Octokit.Tests/SimpleJsonSerializerTests.cs @@ -80,14 +80,14 @@ public void HandlesBase64EncodedStrings() } } - + public class TheDeserializeMethod { [Fact] public void DeserializesEventInfosWithUnderscoresInName() { const string json = "{\"event\":\"head_ref_deleted\"}"; - new SimpleJsonSerializer().Deserialize(json); + new SimpleJsonSerializer().Deserialize(json); } [Fact] diff --git a/Octokit/Authentication/TokenAuthenticator.cs b/Octokit/Authentication/TokenAuthenticator.cs index 34dfeb8144..2116208ddf 100644 --- a/Octokit/Authentication/TokenAuthenticator.cs +++ b/Octokit/Authentication/TokenAuthenticator.cs @@ -22,12 +22,12 @@ public void Authenticate(IRequest request, Credentials credentials) var token = credentials.GetToken(); if (credentials.Login != null) { - throw new InvalidOperationException("The Login is not null for a token authentication request. You " + + throw new InvalidOperationException("The Login is not null for a token authentication request. You " + "probably did something wrong."); } if (token != null) { - request.Headers["Authorization"] = string.Format(CultureInfo.InvariantCulture, "Token {0}", token); + request.Headers["Authorization"] = string.Format(CultureInfo.InvariantCulture, "Token {0}", token); } } } diff --git a/Octokit/Clients/ApiClient.cs b/Octokit/Clients/ApiClient.cs index 1358c10fac..a10a2ee467 100644 --- a/Octokit/Clients/ApiClient.cs +++ b/Octokit/Clients/ApiClient.cs @@ -23,7 +23,7 @@ protected ApiClient(IApiConnection apiConnection) /// /// The API client's connection /// - protected IApiConnection ApiConnection {get; private set;} + protected IApiConnection ApiConnection { get; private set; } /// /// Returns the underlying used by the . This is useful diff --git a/Octokit/Clients/AuthorizationsClient.cs b/Octokit/Clients/AuthorizationsClient.cs index aff6ca2bc2..128586537d 100644 --- a/Octokit/Clients/AuthorizationsClient.cs +++ b/Octokit/Clients/AuthorizationsClient.cs @@ -143,7 +143,7 @@ public Task Create( var endpoint = ApiUrls.Authorizations(); return ApiConnection.Post(endpoint, requestData, null, null, twoFactorAuthenticationCode); } - + /// /// Creates a new authorization for the specified OAuth application if an authorization for that application doesn’t already /// exist for the user; otherwise, returns the user’s existing authorization for that application. diff --git a/Octokit/Clients/CommitsClient.cs b/Octokit/Clients/CommitsClient.cs index 4776760f61..ea5588ea09 100644 --- a/Octokit/Clients/CommitsClient.cs +++ b/Octokit/Clients/CommitsClient.cs @@ -14,7 +14,7 @@ public class CommitsClient : ApiClient, ICommitsClient /// Instantiates a new GitHub Git Commits API client. /// /// An API connection - public CommitsClient(IApiConnection apiConnection) : + public CommitsClient(IApiConnection apiConnection) : base(apiConnection) { } diff --git a/Octokit/Clients/FollowersClient.cs b/Octokit/Clients/FollowersClient.cs index 9d85c4dcc7..5a6dcd4414 100644 --- a/Octokit/Clients/FollowersClient.cs +++ b/Octokit/Clients/FollowersClient.cs @@ -16,8 +16,8 @@ public class FollowersClient : ApiClient, IFollowersClient /// Initializes a new GitHub User Followers API client. /// /// An API connection - public FollowersClient(IApiConnection apiConnection) : base(apiConnection) - { + public FollowersClient(IApiConnection apiConnection) : base(apiConnection) + { } /// diff --git a/Octokit/Clients/GistsClient.cs b/Octokit/Clients/GistsClient.cs index b31126f83c..878076562f 100644 --- a/Octokit/Clients/GistsClient.cs +++ b/Octokit/Clients/GistsClient.cs @@ -16,7 +16,7 @@ public class GistsClient : ApiClient, IGistsClient /// Instantiates a new GitHub Gists API client. /// /// An API connection - public GistsClient(IApiConnection apiConnection) : + public GistsClient(IApiConnection apiConnection) : base(apiConnection) { Comment = new GistCommentsClient(apiConnection); @@ -51,15 +51,16 @@ public Task Create(NewGist newGist) // Allowing the serializer to handle Dictionary // will fail to match. var filesAsJsonObject = new JsonObject(); - foreach(var kvp in newGist.Files) + foreach (var kvp in newGist.Files) { filesAsJsonObject.Add(kvp.Key, new { Content = kvp.Value }); } - var gist = new { + var gist = new + { Description = newGist.Description, Public = newGist.Public, - Files = filesAsJsonObject + Files = filesAsJsonObject }; return ApiConnection.Post(ApiUrls.Gist(), gist); diff --git a/Octokit/Clients/GitDatabaseClient.cs b/Octokit/Clients/GitDatabaseClient.cs index 4265df77bb..be3333c402 100644 --- a/Octokit/Clients/GitDatabaseClient.cs +++ b/Octokit/Clients/GitDatabaseClient.cs @@ -12,7 +12,7 @@ public class GitDatabaseClient : ApiClient, IGitDatabaseClient /// Instantiates a new GitHub Git API client. /// /// An API connection - public GitDatabaseClient(IApiConnection apiConnection) + public GitDatabaseClient(IApiConnection apiConnection) : base(apiConnection) { Blob = new BlobsClient(apiConnection); diff --git a/Octokit/Clients/IAuthorizationsClient.cs b/Octokit/Clients/IAuthorizationsClient.cs index 05ae8bea91..198d3802d5 100644 --- a/Octokit/Clients/IAuthorizationsClient.cs +++ b/Octokit/Clients/IAuthorizationsClient.cs @@ -26,10 +26,10 @@ public interface IAuthorizationsClient /// /// Thrown when a general API error occurs. /// A list of s. - [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", + [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "It's an API call, so it's not a property.")] Task> GetAll(); - + /// /// Gets a specific for the authenticated user. /// @@ -96,7 +96,7 @@ Task Create( string clientSecret, NewAuthorization newAuthorization, string twoFactorAuthenticationCode); - + /// /// Creates a new authorization for the specified OAuth application if an authorization for that application doesn’t already /// exist for the user; otherwise, returns the user’s existing authorization for that application. @@ -120,7 +120,7 @@ Task GetOrCreateApplicationAuthentication( string clientId, string clientSecret, NewAuthorization newAuthorization); - + /// /// Creates a new authorization for the specified OAuth application if an authorization for that application doesn’t already /// exist for the user; otherwise, returns the user’s existing authorization for that application. diff --git a/Octokit/Clients/IDeploymentsClient.cs b/Octokit/Clients/IDeploymentsClient.cs index 66115d4809..97a8b245e0 100644 --- a/Octokit/Clients/IDeploymentsClient.cs +++ b/Octokit/Clients/IDeploymentsClient.cs @@ -23,7 +23,7 @@ public interface IDeploymentsClient /// The name of the repository /// All the s for the specified repository. Task> GetAll(string owner, string name); - + /// /// Creates a new deployment for the specified repository. /// Users with push access can create a deployment for a given ref. diff --git a/Octokit/Clients/IGistCommentsClient.cs b/Octokit/Clients/IGistCommentsClient.cs index 3bcd814ada..bf91680cbc 100644 --- a/Octokit/Clients/IGistCommentsClient.cs +++ b/Octokit/Clients/IGistCommentsClient.cs @@ -19,7 +19,7 @@ public interface IGistCommentsClient /// The id of the gist /// The id of the comment /// Task{GistComment}. - [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get", + [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get", Justification = "Method makes a network request")] Task Get(string gistId, int commentId); diff --git a/Octokit/Clients/IOrganizationMembersClient.cs b/Octokit/Clients/IOrganizationMembersClient.cs index 29609af772..1db3ffb895 100644 --- a/Octokit/Clients/IOrganizationMembersClient.cs +++ b/Octokit/Clients/IOrganizationMembersClient.cs @@ -85,7 +85,7 @@ public interface IOrganizationMembersClient /// The login for the user /// Task CheckMember(string org, string user); - + /// /// Check is a user is publicly a member of the organization. /// @@ -111,7 +111,7 @@ public interface IOrganizationMembersClient /// The login for the user /// Task Delete(string org, string user); - + /// /// Make the authenticated user's organization membership public. /// @@ -124,7 +124,7 @@ public interface IOrganizationMembersClient /// The login for the user /// Task Publicize(string org, string user); - + /// /// Make the authenticated user's organization membership private. /// diff --git a/Octokit/Clients/IRepositoryDeployKeysClient.cs b/Octokit/Clients/IRepositoryDeployKeysClient.cs index 76b9505b59..adbcbe43da 100644 --- a/Octokit/Clients/IRepositoryDeployKeysClient.cs +++ b/Octokit/Clients/IRepositoryDeployKeysClient.cs @@ -45,7 +45,7 @@ public interface IRepositoryDeployKeysClient /// The deploy key to create for the repository. /// Task Create(string owner, string name, NewDeployKey newDeployKey); - + /// /// Deletes a deploy key from a repository. /// diff --git a/Octokit/Clients/IWatchedClient.cs b/Octokit/Clients/IWatchedClient.cs index 8db8f28842..32aa275686 100644 --- a/Octokit/Clients/IWatchedClient.cs +++ b/Octokit/Clients/IWatchedClient.cs @@ -65,7 +65,7 @@ public interface IWatchedClient /// The owner of the repository to unstar /// The name of the repository to unstar /// A bool representing the success of the operation - [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId="Unwatch", + [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Unwatch", Justification = "Unwatch is consistent with the GitHub website")] Task UnwatchRepo(string owner, string name); } diff --git a/Octokit/Clients/MergingClient.cs b/Octokit/Clients/MergingClient.cs index 3b08548ddb..416403f508 100644 --- a/Octokit/Clients/MergingClient.cs +++ b/Octokit/Clients/MergingClient.cs @@ -33,7 +33,7 @@ public Task Create(string owner, string name, NewMerge merge) Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(merge, "merge"); - + return ApiConnection.Post(ApiUrls.CreateMerge(owner, name), merge); } } diff --git a/Octokit/Clients/OrganizationMembersClient.cs b/Octokit/Clients/OrganizationMembersClient.cs index d8fe75cfd4..3ef7180d2c 100644 --- a/Octokit/Clients/OrganizationMembersClient.cs +++ b/Octokit/Clients/OrganizationMembersClient.cs @@ -145,7 +145,7 @@ public async Task CheckMember(string org, string user) var response = await Connection.Get(ApiUrls.CheckMember(org, user), null, null) .ConfigureAwait(false); var statusCode = response.HttpResponse.StatusCode; - if (statusCode != HttpStatusCode.NotFound + if (statusCode != HttpStatusCode.NotFound && statusCode != HttpStatusCode.NoContent && statusCode != HttpStatusCode.Found) { diff --git a/Octokit/Clients/PullRequestsClient.cs b/Octokit/Clients/PullRequestsClient.cs index 3cce9f3086..e1f2bc9907 100644 --- a/Octokit/Clients/PullRequestsClient.cs +++ b/Octokit/Clients/PullRequestsClient.cs @@ -109,7 +109,7 @@ public Task Update(string owner, string name, int number, PullReque /// The pull request number /// A instance describing a pull request merge /// An result which indicates the merge result - public Task Merge(string owner, string name, int number, MergePullRequest mergePullRequest) + public Task Merge(string owner, string name, int number, MergePullRequest mergePullRequest) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); @@ -126,7 +126,7 @@ public Task Merge(string owner, string name, int number, Merge /// The name of the repository /// The pull request number /// True if the operation has been merged, false otherwise - public async Task Merged(string owner, string name, int number) + public async Task Merged(string owner, string name, int number) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); diff --git a/Octokit/Clients/ReferencesClient.cs b/Octokit/Clients/ReferencesClient.cs index 3ccacf930f..14c605243d 100644 --- a/Octokit/Clients/ReferencesClient.cs +++ b/Octokit/Clients/ReferencesClient.cs @@ -15,7 +15,7 @@ public class ReferencesClient : ApiClient, IReferencesClient /// Instantiates a new GitHub References API client /// /// An API connection - public ReferencesClient(IApiConnection apiConnection) : + public ReferencesClient(IApiConnection apiConnection) : base(apiConnection) { } diff --git a/Octokit/Clients/RepositoriesClient.cs b/Octokit/Clients/RepositoriesClient.cs index fbc4e76c6d..9d6c609742 100644 --- a/Octokit/Clients/RepositoriesClient.cs +++ b/Octokit/Clients/RepositoriesClient.cs @@ -48,7 +48,7 @@ public RepositoriesClient(IApiConnection apiConnection) : base(apiConnection) public Task Create(NewRepository newRepository) { Ensure.ArgumentNotNull(newRepository, "newRepository"); - + return Create(ApiUrls.Repositories(), null, newRepository); } @@ -81,7 +81,7 @@ async Task Create(Uri url, string organizationLogin, NewRepository n catch (ApiValidationException e) { string errorMessage = e.ApiError.FirstErrorMessageSafe(); - + if (String.Equals( "name already exists on this account", errorMessage, @@ -116,7 +116,7 @@ async Task Create(Uri url, string organizationLogin, NewRepository n { throw new PrivateRepositoryQuotaExceededException(e); } - + if (errorMessage != null && errorMessage.EndsWith("is an unknown gitignore template.", StringComparison.OrdinalIgnoreCase)) { throw new InvalidGitIgnoreTemplateException(e); diff --git a/Octokit/Clients/RepositoryContentsClient.cs b/Octokit/Clients/RepositoryContentsClient.cs index f2a2e4c885..65dde713f7 100644 --- a/Octokit/Clients/RepositoryContentsClient.cs +++ b/Octokit/Clients/RepositoryContentsClient.cs @@ -84,7 +84,7 @@ public async Task GetReadme(string owner, string name) var endpoint = ApiUrls.RepositoryReadme(owner, name); var readmeInfo = await ApiConnection.Get(endpoint, null).ConfigureAwait(false); - + return new Readme(readmeInfo, ApiConnection); } diff --git a/Octokit/Clients/RepositoryDeployKeysClient.cs b/Octokit/Clients/RepositoryDeployKeysClient.cs index 276f6eadfc..9a4487411e 100644 --- a/Octokit/Clients/RepositoryDeployKeysClient.cs +++ b/Octokit/Clients/RepositoryDeployKeysClient.cs @@ -20,7 +20,7 @@ public class RepositoryDeployKeysClient : ApiClient, IRepositoryDeployKeysClient /// The API connection. public RepositoryDeployKeysClient(IApiConnection apiConnection) : base(apiConnection) - { + { } /// diff --git a/Octokit/Clients/SearchClient.cs b/Octokit/Clients/SearchClient.cs index b2bb758f32..7712d5971a 100644 --- a/Octokit/Clients/SearchClient.cs +++ b/Octokit/Clients/SearchClient.cs @@ -17,7 +17,6 @@ public class SearchClient : ApiClient, ISearchClient public SearchClient(IApiConnection apiConnection) : base(apiConnection) { - } /// diff --git a/Octokit/Clients/StatisticsClient.cs b/Octokit/Clients/StatisticsClient.cs index 72107cf9c8..35d81dfd11 100644 --- a/Octokit/Clients/StatisticsClient.cs +++ b/Octokit/Clients/StatisticsClient.cs @@ -72,7 +72,7 @@ public async Task GetCommitActivity(string owner, string reposit Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName"); var endpoint = "/repos/{0}/{1}/stats/commit_activity".FormatUri(owner, repositoryName); - var activity = await ApiConnection.GetQueuedOperation(endpoint,cancellationToken); + var activity = await ApiConnection.GetQueuedOperation(endpoint, cancellationToken); return new CommitActivity(activity); } @@ -100,7 +100,7 @@ public async Task GetCodeFrequency(string owner, string repositor Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName"); var endpoint = "/repos/{0}/{1}/stats/code_frequency".FormatUri(owner, repositoryName); - var rawFrequencies = await ApiConnection.GetQueuedOperation(endpoint,cancellationToken); + var rawFrequencies = await ApiConnection.GetQueuedOperation(endpoint, cancellationToken); return new CodeFrequency(rawFrequencies); } @@ -128,7 +128,7 @@ public async Task GetParticipation(string owner, string repositor Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName"); var endpoint = "/repos/{0}/{1}/stats/participation".FormatUri(owner, repositoryName); - var result = await ApiConnection.GetQueuedOperation(endpoint,cancellationToken); + var result = await ApiConnection.GetQueuedOperation(endpoint, cancellationToken); return result.FirstOrDefault(); } @@ -140,7 +140,7 @@ public async Task GetParticipation(string owner, string repositor /// Returns commit counts per hour in each day public Task GetPunchCard(string owner, string repositoryName) { - return GetPunchCard(owner, repositoryName,CancellationToken.None); + return GetPunchCard(owner, repositoryName, CancellationToken.None); } /// diff --git a/Octokit/Clients/TagsClient.cs b/Octokit/Clients/TagsClient.cs index 4756bc414e..7bc7c7f076 100644 --- a/Octokit/Clients/TagsClient.cs +++ b/Octokit/Clients/TagsClient.cs @@ -14,7 +14,7 @@ public class TagsClient : ApiClient, ITagsClient /// Instantiates a new GitHub Git Tags API client. /// /// An API connection - public TagsClient(IApiConnection apiConnection) + public TagsClient(IApiConnection apiConnection) : base(apiConnection) { } diff --git a/Octokit/Clients/WatchedClient.cs b/Octokit/Clients/WatchedClient.cs index b22c101350..fbc23c972f 100644 --- a/Octokit/Clients/WatchedClient.cs +++ b/Octokit/Clients/WatchedClient.cs @@ -12,7 +12,7 @@ namespace Octokit /// public class WatchedClient : ApiClient, IWatchedClient { - /// + /// /// Instantiates a new GitHub Activity Watching API client. /// /// An API connection diff --git a/Octokit/Exceptions/ForbiddenException.cs b/Octokit/Exceptions/ForbiddenException.cs index 8293423815..bcd827041c 100644 --- a/Octokit/Exceptions/ForbiddenException.cs +++ b/Octokit/Exceptions/ForbiddenException.cs @@ -40,7 +40,7 @@ public override string Message { get { return ApiErrorMessageSafe ?? "Request Forbidden"; } } - + #if !NETFX_CORE /// /// Constructs an instance of ForbiddenException diff --git a/Octokit/Exceptions/InvalidGitignoreTemplateException.cs b/Octokit/Exceptions/InvalidGitignoreTemplateException.cs index 6d26621dff..f8016962fa 100644 --- a/Octokit/Exceptions/InvalidGitignoreTemplateException.cs +++ b/Octokit/Exceptions/InvalidGitignoreTemplateException.cs @@ -21,15 +21,17 @@ public class InvalidGitIgnoreTemplateException : ApiValidationException /// /// Constructs an instance of ApiValidationException /// - public InvalidGitIgnoreTemplateException() - : base() { } + public InvalidGitIgnoreTemplateException() + : base() + { } /// /// Constructs an instance of ApiValidationException /// /// The inner validation exception. public InvalidGitIgnoreTemplateException(ApiValidationException innerException) - : base(innerException) { } + : base(innerException) + { } public override string Message { @@ -52,7 +54,8 @@ public override string Message /// contextual information about the source or destination. /// protected InvalidGitIgnoreTemplateException(SerializationInfo info, StreamingContext context) - : base(info, context) { } + : base(info, context) + { } #endif } } \ No newline at end of file diff --git a/Octokit/Exceptions/RepositoryExistsException.cs b/Octokit/Exceptions/RepositoryExistsException.cs index b843b33a4d..77d803eacd 100644 --- a/Octokit/Exceptions/RepositoryExistsException.cs +++ b/Octokit/Exceptions/RepositoryExistsException.cs @@ -42,7 +42,7 @@ public RepositoryExistsException( ? baseAddress : GitHubClient.GitHubDotComUrl; ExistingRepositoryWebUrl = new Uri(webBaseAddress, new Uri(organization + "/" + name, UriKind.Relative)); - + _message = string.Format(CultureInfo.InvariantCulture, "There is already a repository named '{0}' in the organization '{1}'.", name, organization); } @@ -110,10 +110,10 @@ protected RepositoryExistsException(SerializationInfo info, StreamingContext con : base(info, context) { if (info == null) return; - _message = info.GetString("Message"); + _message = info.GetString("Message"); RepositoryName = info.GetString("RepositoryName"); Organization = info.GetString("Organization"); - OwnerIsOrganization = info.GetBoolean("OwnerIsOrganization"); + OwnerIsOrganization = info.GetBoolean("OwnerIsOrganization"); ExistingRepositoryWebUrl = (Uri)(info.GetValue("ExistingRepositoryWebUrl", typeof(Uri))); } diff --git a/Octokit/Exceptions/RepositoryFormatException.cs b/Octokit/Exceptions/RepositoryFormatException.cs index 67674f8772..506fcb950f 100644 --- a/Octokit/Exceptions/RepositoryFormatException.cs +++ b/Octokit/Exceptions/RepositoryFormatException.cs @@ -22,7 +22,6 @@ public RepositoryFormatException(IEnumerable invalidRepositories) CultureInfo.InvariantCulture, "The list of repositories must be formatted as 'owner/name' - these values don't match this rule: {0}", parameterList); - } public override string Message @@ -33,7 +32,7 @@ public override string Message } } - #if !NETFX_CORE +#if !NETFX_CORE /// /// Constructs an instance of LoginAttemptsExceededException /// diff --git a/Octokit/Exceptions/TwoFactorAuthorizationException.cs b/Octokit/Exceptions/TwoFactorAuthorizationException.cs index c8f16cb231..4279c801d6 100644 --- a/Octokit/Exceptions/TwoFactorAuthorizationException.cs +++ b/Octokit/Exceptions/TwoFactorAuthorizationException.cs @@ -77,7 +77,7 @@ protected TwoFactorAuthorizationException(SerializationInfo info, StreamingConte : base(info, context) { if (info == null) return; - TwoFactorType = (TwoFactorType) (info.GetInt32("TwoFactorType")); + TwoFactorType = (TwoFactorType)(info.GetInt32("TwoFactorType")); } public override void GetObjectData(SerializationInfo info, StreamingContext context) diff --git a/Octokit/Helpers/ApiExtensions.cs b/Octokit/Helpers/ApiExtensions.cs index a1920aa06f..877a6a64c7 100644 --- a/Octokit/Helpers/ApiExtensions.cs +++ b/Octokit/Helpers/ApiExtensions.cs @@ -70,7 +70,7 @@ public static Task> GetHtml(this IConnection connection, Ur { Ensure.ArgumentNotNull(connection, "connection"); Ensure.ArgumentNotNull(uri, "uri"); - + return connection.GetHtml(uri, null); } diff --git a/Octokit/Helpers/ApiUrls.cs b/Octokit/Helpers/ApiUrls.cs index afbcaacd82..b1d628f09b 100644 --- a/Octokit/Helpers/ApiUrls.cs +++ b/Octokit/Helpers/ApiUrls.cs @@ -32,7 +32,7 @@ public static Uri AllPublicRepositories() /// Returns the that returns all public repositories in /// response to a GET request. /// - /// The integer ID of the last Repository that you’ve seen. + /// The integer ID of the last Repository that you’ve seen. public static Uri AllPublicRepositories(long since) { return "/repositories?since={0}".FormatUri(since); @@ -610,7 +610,7 @@ public static Uri RepositoryHookPing(string owner, string repositoryName, int ho { return "repos/{0}/{1}/hooks/{2}/pings".FormatUri(owner, repositoryName, hookId); } - + /// /// Returns the that lists the commit statuses for the specified reference. /// @@ -870,7 +870,7 @@ public static Uri PullRequests(string owner, string name) /// The owner of the repository /// The name of the repository /// /// The pull request number - public static Uri MergePullRequest(string owner, string name, int number) + public static Uri MergePullRequest(string owner, string name, int number) { return "repos/{0}/{1}/pulls/{2}/merge".FormatUri(owner, name, number); } @@ -881,7 +881,7 @@ public static Uri MergePullRequest(string owner, string name, int number) /// The owner of the repository /// The name of the repository /// /// The pull request number - public static Uri PullRequestCommits(string owner, string name, int number) + public static Uri PullRequestCommits(string owner, string name, int number) { return "repos/{0}/{1}/pulls/{2}/commits".FormatUri(owner, name, number); } @@ -1102,7 +1102,7 @@ public static Uri Blob(string owner, string name, string reference) return blob.FormatUri(owner, name, reference); } - /// + /// /// Returns the for the specified tree. /// /// The owner of the repository diff --git a/Octokit/Helpers/CollectionExtensions.cs b/Octokit/Helpers/CollectionExtensions.cs index 3481918c1d..336d337aa9 100644 --- a/Octokit/Helpers/CollectionExtensions.cs +++ b/Octokit/Helpers/CollectionExtensions.cs @@ -37,7 +37,7 @@ public static IDictionary Clone(this IReadOnlyDictionary(); - + foreach (var item in input) { output.Add(new String(item.Key.ToCharArray()), new Uri(item.Value.ToString())); diff --git a/Octokit/Helpers/PropertyOrField.cs b/Octokit/Helpers/PropertyOrField.cs index c0acd6d2f4..78ac9a492b 100644 --- a/Octokit/Helpers/PropertyOrField.cs +++ b/Octokit/Helpers/PropertyOrField.cs @@ -106,7 +106,7 @@ public ReflectionUtils.GetDelegate GetDelegate if (Base64Encoded) { - return delegate(object source) + return delegate (object source) { var value = getDelegate(source); var stringValue = value as string; @@ -136,7 +136,7 @@ public ReflectionUtils.SetDelegate SetDelegate } if (Base64Encoded) { - return delegate(object source, object value) + return delegate (object source, object value) { var stringValue = value as string; if (stringValue == null) @@ -145,7 +145,6 @@ public ReflectionUtils.SetDelegate SetDelegate } setDelegate(source, stringValue.FromBase64String()); }; - } return setDelegate; } @@ -163,7 +162,7 @@ public Type Type { return _fieldInfo.FieldType; } - throw new InvalidOperationException("Property and Field cannot both be null"); + throw new InvalidOperationException("Property and Field cannot both be null"); } } diff --git a/Octokit/Helpers/StringExtensions.cs b/Octokit/Helpers/StringExtensions.cs index f347b33c68..71df432664 100644 --- a/Octokit/Helpers/StringExtensions.cs +++ b/Octokit/Helpers/StringExtensions.cs @@ -111,9 +111,9 @@ static IEnumerable SplitUpperCase(this string source) // the rule: // Username may only contain alphanumeric characters or single hyphens // and cannot begin or end with a hyphen - static readonly Regex nameWithOwner = new Regex("[a-z0-9.-]{1,}/[a-z0-9.-]{1,}", + static readonly Regex nameWithOwner = new Regex("[a-z0-9.-]{1,}/[a-z0-9.-]{1,}", #if (!PORTABLE && !NETFX_CORE) - RegexOptions.Compiled | + RegexOptions.Compiled | #endif RegexOptions.IgnoreCase); diff --git a/Octokit/Helpers/UnixTimeStampExtensions.cs b/Octokit/Helpers/UnixTimeStampExtensions.cs index 60a74b8d97..7888a91f12 100644 --- a/Octokit/Helpers/UnixTimeStampExtensions.cs +++ b/Octokit/Helpers/UnixTimeStampExtensions.cs @@ -6,7 +6,7 @@ namespace Octokit.Helpers /// Extensions for converting between different time representations /// public static class UnixTimestampExtensions - { + { static readonly DateTimeOffset epoch = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero); /// diff --git a/Octokit/Helpers/UriExtensions.cs b/Octokit/Helpers/UriExtensions.cs index 572ceb937d..145ebe885c 100644 --- a/Octokit/Helpers/UriExtensions.cs +++ b/Octokit/Helpers/UriExtensions.cs @@ -23,7 +23,7 @@ public static Uri ApplyParameters(this Uri uri, IDictionary para // to prevent values being persisted across requests // use a temporary dictionary which combines new and existing parameters - IDictionary p = new Dictionary(parameters); + IDictionary p = new Dictionary(parameters); string queryString; if (uri.IsAbsoluteUri) diff --git a/Octokit/Http/ApiConnection.cs b/Octokit/Http/ApiConnection.cs index a23ecbbfe3..fb31b68d3e 100644 --- a/Octokit/Http/ApiConnection.cs +++ b/Octokit/Http/ApiConnection.cs @@ -446,7 +446,7 @@ public async Task> GetQueuedOperation(Uri uri, CancellationT case HttpStatusCode.Accepted: continue; case HttpStatusCode.NoContent: - return new ReadOnlyCollection(new T[] {}); + return new ReadOnlyCollection(new T[] { }); case HttpStatusCode.OK: return response.Body; } diff --git a/Octokit/Http/ApiInfo.cs b/Octokit/Http/ApiInfo.cs index 9a47f70de8..b053b3fca0 100644 --- a/Octokit/Http/ApiInfo.cs +++ b/Octokit/Http/ApiInfo.cs @@ -69,7 +69,5 @@ public ApiInfo Clone() new String(this.Etag.ToCharArray()), this.RateLimit.Clone()); } - - } } diff --git a/Octokit/Http/Connection.cs b/Octokit/Http/Connection.cs index 4c777cdd94..181fb60085 100644 --- a/Octokit/Http/Connection.cs +++ b/Octokit/Http/Connection.cs @@ -263,7 +263,6 @@ public Task> Post(Uri uri, object body, string accepts, strin Ensure.ArgumentNotNullOrEmptyString(twoFactorAuthenticationCode, "twoFactorAuthenticationCode"); return SendData(uri, HttpMethod.Post, body, accepts, contentType, CancellationToken.None, twoFactorAuthenticationCode); - } public Task> Post(Uri uri, object body, string accepts, string contentType, TimeSpan timeout) @@ -525,7 +524,7 @@ async Task> GetHtml(IRequest request) return new ApiResponse(response, response.Body as string); } - async Task> Run(IRequest request, CancellationToken cancellationToken) + async Task> Run(IRequest request, CancellationToken cancellationToken) { _jsonPipeline.SerializeRequest(request); var response = await RunRequest(request, cancellationToken).ConfigureAwait(false); diff --git a/Octokit/Http/Credentials.cs b/Octokit/Http/Credentials.cs index 895876f978..37261bac22 100644 --- a/Octokit/Http/Credentials.cs +++ b/Octokit/Http/Credentials.cs @@ -46,7 +46,7 @@ public string Password public AuthenticationType AuthenticationType { - get; + get; private set; } } diff --git a/Octokit/Http/HttpClientAdapter.cs b/Octokit/Http/HttpClientAdapter.cs index ab8683c7ac..af02007e38 100644 --- a/Octokit/Http/HttpClientAdapter.cs +++ b/Octokit/Http/HttpClientAdapter.cs @@ -201,36 +201,37 @@ protected override async Task SendAsync(HttpRequestMessage || response.StatusCode == HttpStatusCode.SeeOther || response.StatusCode == HttpStatusCode.TemporaryRedirect || (int)response.StatusCode == 308) - { - var newRequest = CopyRequest(response.RequestMessage); + { + var newRequest = CopyRequest(response.RequestMessage); - if (response.StatusCode == HttpStatusCode.SeeOther) + if (response.StatusCode == HttpStatusCode.SeeOther) + { + newRequest.Content = null; + newRequest.Method = HttpMethod.Get; + } + else + { + if (request.Content != null && request.Content.Headers.ContentLength != 0) + { + var stream = await request.Content.ReadAsStreamAsync(); + if (stream.CanSeek) { - newRequest.Content = null; - newRequest.Method = HttpMethod.Get; + stream.Position = 0; } else { - if (request.Content != null && request.Content.Headers.ContentLength != 0) { - var stream = await request.Content.ReadAsStreamAsync(); - if (stream.CanSeek) - { - stream.Position = 0; - } - else - { - throw new Exception("Cannot redirect a request with an unbuffered body"); - } - newRequest.Content = new StreamContent(stream); - } + throw new Exception("Cannot redirect a request with an unbuffered body"); } - newRequest.RequestUri = response.Headers.Location; - if (String.Compare(newRequest.RequestUri.Host, request.RequestUri.Host, StringComparison.OrdinalIgnoreCase) != 0) - { - newRequest.Headers.Authorization = null; - } - response = await this.SendAsync(newRequest, cancellationToken); + newRequest.Content = new StreamContent(stream); } + } + newRequest.RequestUri = response.Headers.Location; + if (String.Compare(newRequest.RequestUri.Host, request.RequestUri.Host, StringComparison.OrdinalIgnoreCase) != 0) + { + newRequest.Headers.Authorization = null; + } + response = await this.SendAsync(newRequest, cancellationToken); + } return response; } diff --git a/Octokit/Http/IApiConnection.cs b/Octokit/Http/IApiConnection.cs index b3f5befeb2..6393d43780 100644 --- a/Octokit/Http/IApiConnection.cs +++ b/Octokit/Http/IApiConnection.cs @@ -60,7 +60,7 @@ public interface IApiConnection /// of the The API resources in the list. /// Thrown when an API error occurs. Task> GetAll(Uri uri); - + /// /// Gets all API resources in the list at the specified URI. /// @@ -109,7 +109,7 @@ public interface IApiConnection /// Accept header to use for the API request /// The created API resource. /// Thrown when an API error occurs. - Task Post(Uri uri, object data, string accepts); + Task Post(Uri uri, object data, string accepts); /// /// Creates a new API resource in the list at the specified URI. diff --git a/Octokit/Http/ICredentialStore.cs b/Octokit/Http/ICredentialStore.cs index 19e99b504f..836451ec77 100644 --- a/Octokit/Http/ICredentialStore.cs +++ b/Octokit/Http/ICredentialStore.cs @@ -12,7 +12,7 @@ public interface ICredentialStore /// Retrieve the credentials from the underlying store /// /// A continuation containing credentials - [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification="Nope")] + [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Nope")] Task GetCredentials(); } } diff --git a/Octokit/Http/IResponse.cs b/Octokit/Http/IResponse.cs index bc9c8e3040..fc10d83630 100644 --- a/Octokit/Http/IResponse.cs +++ b/Octokit/Http/IResponse.cs @@ -28,7 +28,7 @@ public interface IResponse /// Raw response body. Typically a string, but when requesting images, it will be a byte array. /// object Body { get; } - + /// /// Information about the API. /// diff --git a/Octokit/Http/JsonHttpPipeline.cs b/Octokit/Http/JsonHttpPipeline.cs index 864136e4af..34612b5644 100644 --- a/Octokit/Http/JsonHttpPipeline.cs +++ b/Octokit/Http/JsonHttpPipeline.cs @@ -34,7 +34,7 @@ public void SerializeRequest(IRequest request) { request.Headers["Accept"] = v3ApiVersion; } - + if (request.Method == HttpMethod.Get || request.Body == null) return; if (request.Body is string || request.Body is Stream || request.Body is HttpContent) return; diff --git a/Octokit/Http/RateLimit.cs b/Octokit/Http/RateLimit.cs index d2e93eda15..aa23befc63 100644 --- a/Octokit/Http/RateLimit.cs +++ b/Octokit/Http/RateLimit.cs @@ -18,14 +18,14 @@ public class RateLimit : ISerializable #endif { - public RateLimit() {} + public RateLimit() { } public RateLimit(IDictionary responseHeaders) { Ensure.ArgumentNotNull(responseHeaders, "responseHeaders"); - Limit = (int) GetHeaderValueAsInt32Safe(responseHeaders, "X-RateLimit-Limit"); - Remaining = (int) GetHeaderValueAsInt32Safe(responseHeaders, "X-RateLimit-Remaining"); + Limit = (int)GetHeaderValueAsInt32Safe(responseHeaders, "X-RateLimit-Limit"); + Remaining = (int)GetHeaderValueAsInt32Safe(responseHeaders, "X-RateLimit-Remaining"); ResetAsUtcEpochSeconds = GetHeaderValueAsInt32Safe(responseHeaders, "X-RateLimit-Reset"); } @@ -113,6 +113,5 @@ public RateLimit Clone() ResetAsUtcEpochSeconds = this.ResetAsUtcEpochSeconds }; } - } } diff --git a/Octokit/Http/SimpleJsonSerializer.cs b/Octokit/Http/SimpleJsonSerializer.cs index d31c3dd599..a6750e8c3c 100644 --- a/Octokit/Http/SimpleJsonSerializer.cs +++ b/Octokit/Http/SimpleJsonSerializer.cs @@ -37,7 +37,7 @@ protected override string MapClrMemberToJsonFieldName(MemberInfo member) foreach (var property in propertiesAndFields.Where(p => p.SerializeNull)) { var key = type.FullName + "-" + property.JsonFieldName; - + _membersWhichShouldPublishNull.Add(key); } diff --git a/Octokit/Models/Request/BodyWrapper.cs b/Octokit/Models/Request/BodyWrapper.cs index a6e32ffac1..4e322ed01f 100644 --- a/Octokit/Models/Request/BodyWrapper.cs +++ b/Octokit/Models/Request/BodyWrapper.cs @@ -20,6 +20,6 @@ public BodyWrapper(string body) /// /// The body. /// - public string Body { get; private set; } + public string Body { get; private set; } } } \ No newline at end of file diff --git a/Octokit/Models/Request/CreateFileRequest.cs b/Octokit/Models/Request/CreateFileRequest.cs index f5a98d398d..57007337f7 100644 --- a/Octokit/Models/Request/CreateFileRequest.cs +++ b/Octokit/Models/Request/CreateFileRequest.cs @@ -17,7 +17,7 @@ public abstract class ContentRequest protected ContentRequest(string message) { Ensure.ArgumentNotNullOrEmptyString(message, "message"); - + Message = message; } diff --git a/Octokit/Models/Request/EditRepositoryHook.cs b/Octokit/Models/Request/EditRepositoryHook.cs index 974dc1f11e..95ad47d3bb 100644 --- a/Octokit/Models/Request/EditRepositoryHook.cs +++ b/Octokit/Models/Request/EditRepositoryHook.cs @@ -62,8 +62,8 @@ internal string DebuggerDisplay get { return String.Format(CultureInfo.InvariantCulture, - "Repository Hook: Replacing Events: {0}, Adding Events: {1}, Removing Events: {2}", Events == null ? "no" : string.Join(", ", Events), - AddEvents == null ? "no" : string.Join(", ", AddEvents), + "Repository Hook: Replacing Events: {0}, Adding Events: {1}, Removing Events: {2}", Events == null ? "no" : string.Join(", ", Events), + AddEvents == null ? "no" : string.Join(", ", AddEvents), RemoveEvents == null ? "no" : string.Join(", ", RemoveEvents)); } } diff --git a/Octokit/Models/Request/IssueUpdate.cs b/Octokit/Models/Request/IssueUpdate.cs index a54e7bcf7d..4ac362da4f 100644 --- a/Octokit/Models/Request/IssueUpdate.cs +++ b/Octokit/Models/Request/IssueUpdate.cs @@ -58,7 +58,7 @@ internal string DebuggerDisplay { get { - return String.Format(CultureInfo.InvariantCulture, "Title: {0}",Title); + return String.Format(CultureInfo.InvariantCulture, "Title: {0}", Title); } } diff --git a/Octokit/Models/Request/NewArbitraryMarkDown.cs b/Octokit/Models/Request/NewArbitraryMarkDown.cs index 75e18f56ac..4a034444be 100644 --- a/Octokit/Models/Request/NewArbitraryMarkDown.cs +++ b/Octokit/Models/Request/NewArbitraryMarkDown.cs @@ -38,9 +38,9 @@ public NewArbitraryMarkdown(string text, string mode, string context) /// /// The Markdown text to render /// - + public NewArbitraryMarkdown(string text) - :this(text,_markdown,null) + : this(text, _markdown, null) { } @@ -51,7 +51,7 @@ public NewArbitraryMarkdown(string text) /// The rendering mode. Can be either markdown by default or gfm public NewArbitraryMarkdown(string text, string mode) : this(text, mode, null) - { + { } /// @@ -79,7 +79,7 @@ public NewArbitraryMarkdown(string text, string mode) public string Context { get; private set; } [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA2204:Literals should be spelled correctly", MessageId = "gfm")] - static string GetMode(string mode) + static string GetMode(string mode) { if (mode != _markdown && mode != _gfm) { diff --git a/Octokit/Models/Request/NewCommit.cs b/Octokit/Models/Request/NewCommit.cs index 937eb2a4a5..1795fb3ae2 100644 --- a/Octokit/Models/Request/NewCommit.cs +++ b/Octokit/Models/Request/NewCommit.cs @@ -38,7 +38,7 @@ public NewCommit(string message, string tree, IEnumerable parents) /// The message to associate with the commit /// The tree associated with the commit public NewCommit(string message, string tree) - : this(message,tree, Enumerable.Empty()) + : this(message, tree, Enumerable.Empty()) { } @@ -49,7 +49,7 @@ public NewCommit(string message, string tree) /// The tree associated with the commit /// The commit to use as a parent public NewCommit(string message, string tree, string parent) - : this(message, tree, new [] { parent }) + : this(message, tree, new[] { parent }) { } diff --git a/Octokit/Models/Request/NewGist.cs b/Octokit/Models/Request/NewGist.cs index 95282cb8e2..350e0c6c3e 100644 --- a/Octokit/Models/Request/NewGist.cs +++ b/Octokit/Models/Request/NewGist.cs @@ -25,7 +25,7 @@ public NewGist() /// Indicates whether the gist is public /// public bool Public { get; set; } - + /// /// Files that make up this gist using the key as Filename /// and value as Content diff --git a/Octokit/Models/Request/NewIssue.cs b/Octokit/Models/Request/NewIssue.cs index 6ac217e5f6..ea8181202f 100644 --- a/Octokit/Models/Request/NewIssue.cs +++ b/Octokit/Models/Request/NewIssue.cs @@ -25,7 +25,7 @@ public NewIssue(string title) /// Title of the milestone (required) /// public string Title { get; private set; } - + /// /// Details about the issue. /// @@ -61,7 +61,7 @@ internal string DebuggerDisplay get { var labels = Labels ?? new Collection(); - return String.Format(CultureInfo.InvariantCulture, "Title: {0} Labels: {1}", Title, string.Join(",",labels)); + return String.Format(CultureInfo.InvariantCulture, "Title: {0} Labels: {1}", Title, string.Join(",", labels)); } } } diff --git a/Octokit/Models/Request/NewMerge.cs b/Octokit/Models/Request/NewMerge.cs index 11ba43998b..cbd55f0502 100644 --- a/Octokit/Models/Request/NewMerge.cs +++ b/Octokit/Models/Request/NewMerge.cs @@ -28,7 +28,7 @@ public NewMerge(string @base, string head) { Ensure.ArgumentNotNullOrEmptyString(@base, "baseBranch"); Ensure.ArgumentNotNullOrEmptyString(head, "head"); - + Base = @base; Head = head; } diff --git a/Octokit/Models/Request/NewMilestone.cs b/Octokit/Models/Request/NewMilestone.cs index ed3a0cf397..89462c52fc 100644 --- a/Octokit/Models/Request/NewMilestone.cs +++ b/Octokit/Models/Request/NewMilestone.cs @@ -17,7 +17,7 @@ public class NewMilestone public NewMilestone(string title) { Ensure.ArgumentNotNull(title, "title"); - + Title = title; State = ItemState.Open; } diff --git a/Octokit/Models/Request/NewPullRequest.cs b/Octokit/Models/Request/NewPullRequest.cs index d84399bc9a..3cd2170654 100644 --- a/Octokit/Models/Request/NewPullRequest.cs +++ b/Octokit/Models/Request/NewPullRequest.cs @@ -30,7 +30,7 @@ public NewPullRequest(string title, string head, string baseRef) /// /// Title of the pull request (required) /// - public string Title { get; private set; } + public string Title { get; private set; } /// /// The branch (or git ref) you want your changes pulled into (required). diff --git a/Octokit/Models/Request/NewReference.cs b/Octokit/Models/Request/NewReference.cs index 8d551ed3ba..241e4d2fde 100644 --- a/Octokit/Models/Request/NewReference.cs +++ b/Octokit/Models/Request/NewReference.cs @@ -70,7 +70,7 @@ internal string DebuggerDisplay { get { - return String.Format(CultureInfo.InvariantCulture, "Ref: {0} Sha: {1}", Ref,Sha); + return String.Format(CultureInfo.InvariantCulture, "Ref: {0} Sha: {1}", Ref, Sha); } } } diff --git a/Octokit/Models/Request/PublicRepositoryRequest.cs b/Octokit/Models/Request/PublicRepositoryRequest.cs index 9b8ebcb495..e07525f0bf 100644 --- a/Octokit/Models/Request/PublicRepositoryRequest.cs +++ b/Octokit/Models/Request/PublicRepositoryRequest.cs @@ -17,7 +17,7 @@ public class PublicRepositoryRequest : RequestParameters public PublicRepositoryRequest(int since) { Ensure.ArgumentNotNull(since, "since"); - + Since = since; } diff --git a/Octokit/Models/Request/PullRequestRequest.cs b/Octokit/Models/Request/PullRequestRequest.cs index 9bbdd7dd2e..0de166d916 100644 --- a/Octokit/Models/Request/PullRequestRequest.cs +++ b/Octokit/Models/Request/PullRequestRequest.cs @@ -36,13 +36,13 @@ public PullRequestRequest() /// /// What property to sort pull requests by. /// - [Parameter(Key="sort")] + [Parameter(Key = "sort")] public PullRequestSort SortProperty { get; set; } /// /// What direction to sort the pull requests. /// - [Parameter(Key="direction")] + [Parameter(Key = "direction")] public SortDirection SortDirection { get; set; } internal string DebuggerDisplay @@ -71,7 +71,7 @@ public enum PullRequestSort /// /// Sort by age (filtering by pulls updated in the last month) /// - [Parameter(Value= "long-running")] + [Parameter(Value = "long-running")] LongRunning } } diff --git a/Octokit/Models/Request/ReleaseAssetUpdate.cs b/Octokit/Models/Request/ReleaseAssetUpdate.cs index 638c5f8c75..b9d9466eae 100644 --- a/Octokit/Models/Request/ReleaseAssetUpdate.cs +++ b/Octokit/Models/Request/ReleaseAssetUpdate.cs @@ -26,7 +26,7 @@ public ReleaseAssetUpdate(string name) /// This field is required. /// public string Name { get; private set; } - + /// /// An alternate description of the asset. /// Used in place of the filename. diff --git a/Octokit/Models/Request/RequestParameters.cs b/Octokit/Models/Request/RequestParameters.cs index 43fc7c8f71..52f1a4cd62 100644 --- a/Octokit/Models/Request/RequestParameters.cs +++ b/Octokit/Models/Request/RequestParameters.cs @@ -76,7 +76,7 @@ static Func GetValueFunc(Type propertyType) { if (value == null) return null; string attributeValue; - + return enumToAttributeDictionary.TryGetValue(value.ToString(), out attributeValue) ? attributeValue ?? value.ToString().ToLowerInvariant() : value.ToString().ToLowerInvariant(); diff --git a/Octokit/Models/Request/SearchIssuesRequest.cs b/Octokit/Models/Request/SearchIssuesRequest.cs index c9bb7d0542..bfeda8e7d7 100644 --- a/Octokit/Models/Request/SearchIssuesRequest.cs +++ b/Octokit/Models/Request/SearchIssuesRequest.cs @@ -210,13 +210,13 @@ public override IReadOnlyList MergedQualifiers() if (In != null) { - parameters.Add(String.Format(CultureInfo.InvariantCulture, "in:{0}", + parameters.Add(String.Format(CultureInfo.InvariantCulture, "in:{0}", String.Join(",", In.Select(i => i.ToParameter())))); } if (Type != null) { - parameters.Add(String.Format(CultureInfo.InvariantCulture, "type:{0}", + parameters.Add(String.Format(CultureInfo.InvariantCulture, "type:{0}", Type.ToParameter())); } diff --git a/Octokit/Models/Request/SearchRepositoriesRequest.cs b/Octokit/Models/Request/SearchRepositoriesRequest.cs index 36da458028..ee1cbecc22 100644 --- a/Octokit/Models/Request/SearchRepositoriesRequest.cs +++ b/Octokit/Models/Request/SearchRepositoriesRequest.cs @@ -374,7 +374,7 @@ public static DateRange GreaterThanOrEquals(DateTime date) public static DateRange Between(DateTime from, DateTime to) { return new DateRange(from, to); - } + } public override string ToString() { diff --git a/Octokit/Models/Response/Account.cs b/Octokit/Models/Response/Account.cs index 91d71c3771..5cca475c1a 100644 --- a/Octokit/Models/Response/Account.cs +++ b/Octokit/Models/Response/Account.cs @@ -40,7 +40,7 @@ protected Account(string avatarUrl, string bio, string blog, int collaborators, /// /// URL of the account's avatar. /// - public string AvatarUrl { get; protected set; } + public string AvatarUrl { get; protected set; } /// /// The account's bio. diff --git a/Octokit/Models/Response/ActivityPayloads/IssueCommentPayload.cs b/Octokit/Models/Response/ActivityPayloads/IssueCommentPayload.cs index 581add5c96..0b2989df36 100644 --- a/Octokit/Models/Response/ActivityPayloads/IssueCommentPayload.cs +++ b/Octokit/Models/Response/ActivityPayloads/IssueCommentPayload.cs @@ -9,6 +9,5 @@ public class IssueCommentPayload : ActivityPayload public string Action { get; protected set; } public Issue Issue { get; protected set; } public IssueComment Comment { get; protected set; } - } } diff --git a/Octokit/Models/Response/ActivityPayloads/PushEventPayload.cs b/Octokit/Models/Response/ActivityPayloads/PushEventPayload.cs index ad6cdf7364..f1ebefd70b 100644 --- a/Octokit/Models/Response/ActivityPayloads/PushEventPayload.cs +++ b/Octokit/Models/Response/ActivityPayloads/PushEventPayload.cs @@ -9,6 +9,6 @@ public class PushEventPayload : ActivityPayload public string Head { get; protected set; } public string Ref { get; protected set; } public int Size { get; protected set; } - public IReadOnlyList Commits { get; protected set; } + public IReadOnlyList Commits { get; protected set; } } } diff --git a/Octokit/Models/Response/AdditionsAndDeletions.cs b/Octokit/Models/Response/AdditionsAndDeletions.cs index 1595a9a209..c16de4dbf0 100644 --- a/Octokit/Models/Response/AdditionsAndDeletions.cs +++ b/Octokit/Models/Response/AdditionsAndDeletions.cs @@ -58,7 +58,7 @@ internal string DebuggerDisplay get { return String.Format(CultureInfo.InvariantCulture, - "{0}: Additions: {1} Deletions: {2}", Timestamp.ToString("d",CultureInfo.InvariantCulture),Additions,Deletions); + "{0}: Additions: {1} Deletions: {2}", Timestamp.ToString("d", CultureInfo.InvariantCulture), Additions, Deletions); } } } diff --git a/Octokit/Models/Response/Author.cs b/Octokit/Models/Response/Author.cs index af0bb7c479..ac1cd29f16 100644 --- a/Octokit/Models/Response/Author.cs +++ b/Octokit/Models/Response/Author.cs @@ -68,7 +68,7 @@ internal string DebuggerDisplay get { return String.Format(CultureInfo.InvariantCulture, - "Author: Id: {0} Login: {1}",Id, Login); + "Author: Id: {0} Login: {1}", Id, Login); } } } diff --git a/Octokit/Models/Response/CommitActivity.cs b/Octokit/Models/Response/CommitActivity.cs index 4cb7b8e5eb..42cff834bd 100644 --- a/Octokit/Models/Response/CommitActivity.cs +++ b/Octokit/Models/Response/CommitActivity.cs @@ -29,7 +29,7 @@ internal string DebuggerDisplay get { return String.Format(CultureInfo.InvariantCulture, - "Weeks of activity: {0}",Activity.Count()); + "Weeks of activity: {0}", Activity.Count()); } } } diff --git a/Octokit/Models/Response/CommitComment.cs b/Octokit/Models/Response/CommitComment.cs index 8504ca16e7..a1c28d0e0c 100644 --- a/Octokit/Models/Response/CommitComment.cs +++ b/Octokit/Models/Response/CommitComment.cs @@ -4,7 +4,7 @@ namespace Octokit { - [DebuggerDisplay("{DebuggerDisplay,nq}")] + [DebuggerDisplay("{DebuggerDisplay,nq}")] public class CommitComment { public CommitComment() { } diff --git a/Octokit/Models/Response/DeployKey.cs b/Octokit/Models/Response/DeployKey.cs index 4da6b286e4..2ab2cd19bd 100644 --- a/Octokit/Models/Response/DeployKey.cs +++ b/Octokit/Models/Response/DeployKey.cs @@ -17,7 +17,7 @@ public DeployKey(int id, string key, string url, string title) Title = title; } - public int Id { get; protected set; } + public int Id { get; protected set; } public string Key { get; protected set; } public string Url { get; protected set; } public string Title { get; protected set; } diff --git a/Octokit/Models/Response/Deployment.cs b/Octokit/Models/Response/Deployment.cs index cf9b035777..13ac7f56e1 100644 --- a/Octokit/Models/Response/Deployment.cs +++ b/Octokit/Models/Response/Deployment.cs @@ -7,7 +7,7 @@ namespace Octokit { [SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces", - Justification="People can use fully qualified names if they want to use both.")] + Justification = "People can use fully qualified names if they want to use both.")] [DebuggerDisplay("{DebuggerDisplay,nq}")] public class Deployment { diff --git a/Octokit/Models/Response/EmailAddress.cs b/Octokit/Models/Response/EmailAddress.cs index fc6716c821..11d4140a4a 100644 --- a/Octokit/Models/Response/EmailAddress.cs +++ b/Octokit/Models/Response/EmailAddress.cs @@ -36,7 +36,7 @@ public EmailAddress(string email, bool verified, bool primary) public bool Primary { get; protected set; } [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", - Justification="Used by DebuggerDisplayAttribute")] + Justification = "Used by DebuggerDisplayAttribute")] internal string DebuggerDisplay { get diff --git a/Octokit/Models/Response/GitIgnoreTemplate.cs b/Octokit/Models/Response/GitIgnoreTemplate.cs index a8eaa03ca0..947cacc967 100644 --- a/Octokit/Models/Response/GitIgnoreTemplate.cs +++ b/Octokit/Models/Response/GitIgnoreTemplate.cs @@ -30,6 +30,5 @@ internal string DebuggerDisplay return String.Format(CultureInfo.InvariantCulture, "GitIgnore: {0}", Name); } } - } } diff --git a/Octokit/Models/Response/Issue.cs b/Octokit/Models/Response/Issue.cs index 585e8d3843..111eaca682 100644 --- a/Octokit/Models/Response/Issue.cs +++ b/Octokit/Models/Response/Issue.cs @@ -75,7 +75,7 @@ public Issue(Uri url, Uri htmlUrl, Uri commentsUrl, Uri eventsUrl, int number, I /// The user that created the issue. /// public User User { get; protected set; } - + /// /// The set of labels applied to the issue /// @@ -97,7 +97,7 @@ public Issue(Uri url, Uri htmlUrl, Uri commentsUrl, Uri eventsUrl, int number, I public int Comments { get; protected set; } public PullRequest PullRequest { get; protected set; } - + /// /// The date the issue was closed if closed. /// diff --git a/Octokit/Models/Response/LicenseMetadata.cs b/Octokit/Models/Response/LicenseMetadata.cs index 5c00da3bec..cd1022b86e 100644 --- a/Octokit/Models/Response/LicenseMetadata.cs +++ b/Octokit/Models/Response/LicenseMetadata.cs @@ -26,7 +26,7 @@ public LicenseMetadata() /// The /// public string Key { get; protected set; } - + /// /// Friendly name of the license. /// diff --git a/Octokit/Models/Response/Merge.cs b/Octokit/Models/Response/Merge.cs index a958d4b522..02ce9826d1 100644 --- a/Octokit/Models/Response/Merge.cs +++ b/Octokit/Models/Response/Merge.cs @@ -27,7 +27,7 @@ public Merge(Author author, Author committer, Commit commit, IEnumerable Parents { get; protected set; } - public string CommentsUrl { get; protected set; } + public string CommentsUrl { get; protected set; } public int CommentCount { get; protected set; } public string HtmlUrl { get; protected set; } } diff --git a/Octokit/Models/Response/MiscellaneousRateLimit.cs b/Octokit/Models/Response/MiscellaneousRateLimit.cs index d21254cea0..b97968fedd 100644 --- a/Octokit/Models/Response/MiscellaneousRateLimit.cs +++ b/Octokit/Models/Response/MiscellaneousRateLimit.cs @@ -7,7 +7,7 @@ namespace Octokit [DebuggerDisplay("{DebuggerDisplay,nq}")] public class MiscellaneousRateLimit { - public MiscellaneousRateLimit() {} + public MiscellaneousRateLimit() { } public MiscellaneousRateLimit(ResourceRateLimit resources, RateLimit rate) { diff --git a/Octokit/Models/Response/PunchCardPoint.cs b/Octokit/Models/Response/PunchCardPoint.cs index 6958c07979..51efc92cad 100644 --- a/Octokit/Models/Response/PunchCardPoint.cs +++ b/Octokit/Models/Response/PunchCardPoint.cs @@ -38,7 +38,7 @@ internal string DebuggerDisplay get { return String.Format(CultureInfo.InvariantCulture, - "Day: {0} Hour: {1} Commit Count:{2}", DayOfWeek,HourOfTheDay,CommitCount); + "Day: {0} Hour: {1} Commit Count:{2}", DayOfWeek, HourOfTheDay, CommitCount); } } } diff --git a/Octokit/Models/Response/ResourceRateLimit.cs b/Octokit/Models/Response/ResourceRateLimit.cs index a83a39a5dd..f2b937c44d 100644 --- a/Octokit/Models/Response/ResourceRateLimit.cs +++ b/Octokit/Models/Response/ResourceRateLimit.cs @@ -7,7 +7,7 @@ namespace Octokit [DebuggerDisplay("{DebuggerDisplay,nq}")] public class ResourceRateLimit { - public ResourceRateLimit() {} + public ResourceRateLimit() { } public ResourceRateLimit(RateLimit core, RateLimit search) { @@ -36,5 +36,4 @@ internal string DebuggerDisplay } } } - } diff --git a/Octokit/Models/Response/TagObject.cs b/Octokit/Models/Response/TagObject.cs index bfee7fca42..5260023a88 100644 --- a/Octokit/Models/Response/TagObject.cs +++ b/Octokit/Models/Response/TagObject.cs @@ -14,7 +14,7 @@ public TagObject(string url, string label, string @ref, string sha, User user, R Type = type; } - [SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods", + [SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods", Justification = "Name defined by web api and required for deserialisation")] public TaggedType Type { get; protected set; } } diff --git a/Octokit/SimpleJson.cs b/Octokit/SimpleJson.cs index 697c18c20a..a9e57e7dc2 100644 --- a/Octokit/SimpleJson.cs +++ b/Octokit/SimpleJson.cs @@ -1,5 +1,4 @@ //----------------------------------------------------------------------- -// // Copyright (c) 2011, The Outercurve Foundation. // // Licensed under the MIT License (the "License"); @@ -524,7 +523,7 @@ static class SimpleJson static SimpleJson() { EscapeTable = new char[93]; - EscapeTable['"'] = '"'; + EscapeTable['"'] = '"'; EscapeTable['\\'] = '\\'; EscapeTable['\b'] = 'b'; EscapeTable['\f'] = 'f'; @@ -558,7 +557,7 @@ public static object DeserializeObject(string json) /// /// Returns true if successfull otherwise false. /// - [SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate", Justification="Need to support .NET 2")] + [SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate", Justification = "Need to support .NET 2")] public static bool TryDeserializeObject(string json, out object obj) { bool success = true; @@ -623,7 +622,7 @@ public static string EscapeToJavascriptString(string jsonString) StringBuilder sb = new StringBuilder(); char c; - for (int i = 0; i < jsonString.Length; ) + for (int i = 0; i < jsonString.Length;) { c = jsonString[i++]; @@ -1224,7 +1223,7 @@ public static DataContractJsonSerializerStrategy DataContractJsonSerializerStrat #endif } - + [GeneratedCode("simple-json", "1.0.0")] #if SIMPLE_JSON_INTERNAL internal @@ -1233,7 +1232,7 @@ public static DataContractJsonSerializerStrategy DataContractJsonSerializerStrat #endif interface IJsonSerializerStrategy { - [SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate", Justification="Need to support .NET 2")] + [SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate", Justification = "Need to support .NET 2")] bool TrySerializeNonPrimitiveObject(object input, out object output); object DeserializeObject(object value, Type type); } @@ -1337,12 +1336,12 @@ public virtual object DeserializeObject(object value, Type type) if (type == null) throw new ArgumentNullException("type"); string str = value as string; - if (type == typeof (Guid) && string.IsNullOrEmpty(str)) + if (type == typeof(Guid) && string.IsNullOrEmpty(str)) return default(Guid); if (value == null) return null; - + object obj = null; if (str != null) @@ -1357,7 +1356,7 @@ public virtual object DeserializeObject(object value, Type type) return new Guid(str); if (type == typeof(Uri)) { - bool isValid = Uri.IsWellFormedUriString(str, UriKind.RelativeOrAbsolute); + bool isValid = Uri.IsWellFormedUriString(str, UriKind.RelativeOrAbsolute); Uri result; if (isValid && Uri.TryCreate(str, UriKind.RelativeOrAbsolute, out result)) @@ -1365,8 +1364,8 @@ public virtual object DeserializeObject(object value, Type type) return null; } - - if (type == typeof(string)) + + if (type == typeof(string)) return str; return Convert.ChangeType(str, type, CultureInfo.InvariantCulture); @@ -1386,7 +1385,7 @@ public virtual object DeserializeObject(object value, Type type) } else if (value is bool) return value; - + bool valueIsLong = value is long; bool valueIsDouble = value is double; if ((valueIsLong && type == typeof(long)) || (valueIsDouble && type == typeof(double))) @@ -1490,7 +1489,7 @@ protected virtual object SerializeEnum(Enum p) return Convert.ToDouble(p, CultureInfo.InvariantCulture); } - [SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate", Justification="Need to support .NET 2")] + [SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate", Justification = "Need to support .NET 2")] protected virtual bool TrySerializeKnownTypes(object input, out object output) { bool returnValue = true; @@ -1515,7 +1514,7 @@ protected virtual bool TrySerializeKnownTypes(object input, out object output) } return returnValue; } - [SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate", Justification="Need to support .NET 2")] + [SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate", Justification = "Need to support .NET 2")] protected virtual bool TrySerializeUnknownTypes(object input, out object output) { if (input == null) throw new ArgumentNullException("input"); @@ -1617,7 +1616,7 @@ private static bool CanAdd(MemberInfo info, out string jsonKey) namespace Reflection { // This class is meant to be copied into other libraries. So we want to exclude it from Code Analysis rules - // that might be in place in the target project. + // that might be in place in the target project. [GeneratedCode("reflection-utils", "1.0.0")] #if SIMPLE_JSON_REFLECTION_UTILS_PUBLIC public @@ -1670,7 +1669,7 @@ public static Type GetGenericListElementType(Type type) foreach (Type implementedInterface in interfaces) { if (IsTypeGeneric(implementedInterface) && - implementedInterface.GetGenericTypeDefinition() == typeof (IList<>)) + implementedInterface.GetGenericTypeDefinition() == typeof(IList<>)) { return GetGenericTypeArguments(implementedInterface)[0]; } @@ -1680,7 +1679,6 @@ public static Type GetGenericListElementType(Type type) public static Attribute GetAttribute(Type objectType, Type attributeType) { - #if SIMPLE_JSON_TYPEINFO if (objectType == null || attributeType == null || !objectType.GetTypeInfo().IsDefined(attributeType)) return null; @@ -1857,7 +1855,7 @@ public static ConstructorDelegate GetContructor(Type type, params Type[] argsTyp public static ConstructorDelegate GetConstructorByReflection(ConstructorInfo constructorInfo) { - return delegate(object[] args) { return constructorInfo.Invoke(args); }; + return delegate (object[] args) { return constructorInfo.Invoke(args); }; } public static ConstructorDelegate GetConstructorByReflection(Type type, params Type[] argsType) @@ -1884,7 +1882,7 @@ public static ConstructorDelegate GetConstructorByExpression(ConstructorInfo con NewExpression newExp = Expression.New(constructorInfo, argsExp); Expression> lambda = Expression.Lambda>(newExp, param); Func compiledLambda = lambda.Compile(); - return delegate(object[] args) { return compiledLambda(args); }; + return delegate (object[] args) { return compiledLambda(args); }; } public static ConstructorDelegate GetConstructorByExpression(Type type, params Type[] argsType) @@ -1916,12 +1914,12 @@ public static GetDelegate GetGetMethod(FieldInfo fieldInfo) public static GetDelegate GetGetMethodByReflection(PropertyInfo propertyInfo) { MethodInfo methodInfo = GetGetterMethodInfo(propertyInfo); - return delegate(object source) { return methodInfo.Invoke(source, EmptyObjects); }; + return delegate (object source) { return methodInfo.Invoke(source, EmptyObjects); }; } public static GetDelegate GetGetMethodByReflection(FieldInfo fieldInfo) { - return delegate(object source) { return fieldInfo.GetValue(source); }; + return delegate (object source) { return fieldInfo.GetValue(source); }; } #if !SIMPLE_JSON_NO_LINQ_EXPRESSION @@ -1932,7 +1930,7 @@ public static GetDelegate GetGetMethodByExpression(PropertyInfo propertyInfo) ParameterExpression instance = Expression.Parameter(typeof(object), "instance"); UnaryExpression instanceCast = (!IsValueType(propertyInfo.DeclaringType)) ? Expression.TypeAs(instance, propertyInfo.DeclaringType) : Expression.Convert(instance, propertyInfo.DeclaringType); Func compiled = Expression.Lambda>(Expression.TypeAs(Expression.Call(instanceCast, getMethodInfo), typeof(object)), instance).Compile(); - return delegate(object source) { return compiled(source); }; + return delegate (object source) { return compiled(source); }; } public static GetDelegate GetGetMethodByExpression(FieldInfo fieldInfo) @@ -1940,7 +1938,7 @@ public static GetDelegate GetGetMethodByExpression(FieldInfo fieldInfo) ParameterExpression instance = Expression.Parameter(typeof(object), "instance"); MemberExpression member = Expression.Field(Expression.Convert(instance, fieldInfo.DeclaringType), fieldInfo); GetDelegate compiled = Expression.Lambda(Expression.Convert(member, typeof(object)), instance).Compile(); - return delegate(object source) { return compiled(source); }; + return delegate (object source) { return compiled(source); }; } #endif @@ -1966,12 +1964,12 @@ public static SetDelegate GetSetMethod(FieldInfo fieldInfo) public static SetDelegate GetSetMethodByReflection(PropertyInfo propertyInfo) { MethodInfo methodInfo = GetSetterMethodInfo(propertyInfo); - return delegate(object source, object value) { methodInfo.Invoke(source, new object[] { value }); }; + return delegate (object source, object value) { methodInfo.Invoke(source, new object[] { value }); }; } public static SetDelegate GetSetMethodByReflection(FieldInfo fieldInfo) { - return delegate(object source, object value) { fieldInfo.SetValue(source, value); }; + return delegate (object source, object value) { fieldInfo.SetValue(source, value); }; } #if !SIMPLE_JSON_NO_LINQ_EXPRESSION @@ -1984,7 +1982,7 @@ public static SetDelegate GetSetMethodByExpression(PropertyInfo propertyInfo) UnaryExpression instanceCast = (!IsValueType(propertyInfo.DeclaringType)) ? Expression.TypeAs(instance, propertyInfo.DeclaringType) : Expression.Convert(instance, propertyInfo.DeclaringType); UnaryExpression valueCast = (!IsValueType(propertyInfo.PropertyType)) ? Expression.TypeAs(value, propertyInfo.PropertyType) : Expression.Convert(value, propertyInfo.PropertyType); Action compiled = Expression.Lambda>(Expression.Call(instanceCast, setMethodInfo, valueCast), new ParameterExpression[] { instance, value }).Compile(); - return delegate(object source, object val) { compiled(source, val); }; + return delegate (object source, object val) { compiled(source, val); }; } public static SetDelegate GetSetMethodByExpression(FieldInfo fieldInfo) @@ -1993,7 +1991,7 @@ public static SetDelegate GetSetMethodByExpression(FieldInfo fieldInfo) ParameterExpression value = Expression.Parameter(typeof(object), "value"); Action compiled = Expression.Lambda>( Assign(Expression.Field(Expression.Convert(instance, fieldInfo.DeclaringType), fieldInfo), Expression.Convert(value, fieldInfo.FieldType)), instance, value).Compile(); - return delegate(object source, object val) { compiled(source, val); }; + return delegate (object source, object val) { compiled(source, val); }; } public static BinaryExpression Assign(Expression left, Expression right) @@ -2143,7 +2141,6 @@ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() return _dictionary.GetEnumerator(); } } - } } } diff --git a/SolutionInfo.cs b/SolutionInfo.cs index ba2f342f8d..e2fd9c8e58 100644 --- a/SolutionInfo.cs +++ b/SolutionInfo.cs @@ -6,8 +6,10 @@ [assembly: AssemblyVersionAttribute("0.17.0")] [assembly: AssemblyFileVersionAttribute("0.17.0")] [assembly: ComVisibleAttribute(false)] -namespace System { - internal static class AssemblyVersionInformation { +namespace System +{ + internal static class AssemblyVersionInformation + { internal const string Version = "0.17.0"; } }