From 5d924de796d4f626e5fcf1fb83ed95b6f50bdd43 Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Wed, 23 Mar 2016 12:19:35 +0700 Subject: [PATCH 01/20] Unused "using" directive was removed. Redundant collection list initializers were removed. --- Octokit.Tests/Clients/RepositoryContentsClientTests.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Octokit.Tests/Clients/RepositoryContentsClientTests.cs b/Octokit.Tests/Clients/RepositoryContentsClientTests.cs index 5dea73d8..2f700c3b 100644 --- a/Octokit.Tests/Clients/RepositoryContentsClientTests.cs +++ b/Octokit.Tests/Clients/RepositoryContentsClientTests.cs @@ -2,7 +2,6 @@ using System.Text; using System.Threading.Tasks; using NSubstitute; -using Octokit.Tests.Helpers; using Xunit; using System.Collections.Generic; @@ -61,7 +60,7 @@ namespace Octokit.Tests.Clients [Fact] public async Task ReturnsContentsByRef() { - List result = new List() { new RepositoryContent() { } }; + List result = new List { new RepositoryContent() }; var connection = Substitute.For(); connection.GetAll(Args.Uri).Returns(Task.FromResult(result.AsReadOnly() as IReadOnlyList)); @@ -77,7 +76,7 @@ namespace Octokit.Tests.Clients [Fact] public async Task ReturnsContents() { - List result = new List() { new RepositoryContent() { } }; + List result = new List { new RepositoryContent() }; var connection = Substitute.For(); connection.GetAll(Args.Uri).Returns(Task.FromResult(result.AsReadOnly() as IReadOnlyList)); From 79c38b48225b2bf1b9d146eeb88c6a03019617e5 Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Wed, 23 Mar 2016 12:23:30 +0700 Subject: [PATCH 02/20] Redundant member initializer was removed. Unused "using" directives were removed. --- Octokit.Tests/Http/RedirectHandlerTests.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Octokit.Tests/Http/RedirectHandlerTests.cs b/Octokit.Tests/Http/RedirectHandlerTests.cs index 845067e2..14e46e96 100644 --- a/Octokit.Tests/Http/RedirectHandlerTests.cs +++ b/Octokit.Tests/Http/RedirectHandlerTests.cs @@ -1,10 +1,7 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Net; using System.Net.Http; using System.Net.Http.Headers; -using System.Text; using System.Threading; using System.Threading.Tasks; using Octokit.Internal; @@ -181,7 +178,7 @@ namespace Octokit.Tests.Http { readonly HttpResponseMessage _response1; readonly HttpResponseMessage _response2; - private bool _Response1Sent = false; + private bool _Response1Sent; public MockRedirectHandler(HttpResponseMessage response1, HttpResponseMessage response2 = null) { From cab67c4ac859e6c69798e4b8748a9cb09ab09907 Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Wed, 23 Mar 2016 12:24:14 +0700 Subject: [PATCH 03/20] Redundant explicit array type specification was removed. --- .../Reactive/ObservableUserAdministrationClientTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Octokit.Tests/Reactive/ObservableUserAdministrationClientTests.cs b/Octokit.Tests/Reactive/ObservableUserAdministrationClientTests.cs index 682a09b6..d6a1fab9 100644 --- a/Octokit.Tests/Reactive/ObservableUserAdministrationClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableUserAdministrationClientTests.cs @@ -50,7 +50,7 @@ namespace Octokit.Tests.Reactive var gitHubClient = Substitute.For(); var client = new ObservableUserAdministrationClient(gitHubClient); - client.CreateImpersonationToken("auser", new NewImpersonationToken(new string[] { "public_repo" })); + client.CreateImpersonationToken("auser", new NewImpersonationToken(new[] { "public_repo" })); gitHubClient.User.Administration.Received().CreateImpersonationToken( "auser", From 0fa854fe744cb773166984751cb3b559908a0e8b Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Wed, 23 Mar 2016 12:25:53 +0700 Subject: [PATCH 04/20] Redundant empty constructor was removed. Unsued "using" directive was removed. --- Octokit.Tests.Integration/Clients/CommitsClientTests.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Octokit.Tests.Integration/Clients/CommitsClientTests.cs b/Octokit.Tests.Integration/Clients/CommitsClientTests.cs index fa493b85..aa46429f 100644 --- a/Octokit.Tests.Integration/Clients/CommitsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/CommitsClientTests.cs @@ -1,5 +1,4 @@ -using System; -using System.Threading.Tasks; +using System.Threading.Tasks; using Octokit; using Octokit.Tests.Integration.Helpers; using Octokit.Tests.Integration; @@ -7,8 +6,6 @@ using Xunit; public class CommitsClientTests { - public CommitsClientTests() { } - [IntegrationTest] public async Task CanCreateAndRetrieveCommit() { From f475be87c8618939791b8d3688a3c0ccc8e94649 Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Wed, 23 Mar 2016 12:28:53 +0700 Subject: [PATCH 05/20] Redundant type qualifiers were removed. Unused "using" directives were removed. --- Octokit.Tests/Clients/StarredClientTests.cs | 3 +-- ...ableEnterpriseSearchIndexingClientTests.cs | 23 +++++++++---------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Octokit.Tests/Clients/StarredClientTests.cs b/Octokit.Tests/Clients/StarredClientTests.cs index e8ee43f9..97add0e4 100644 --- a/Octokit.Tests/Clients/StarredClientTests.cs +++ b/Octokit.Tests/Clients/StarredClientTests.cs @@ -5,7 +5,6 @@ using System.Net; using System.Threading.Tasks; using NSubstitute; using Xunit; -using Xunit.Extensions; namespace Octokit.Tests.Clients { @@ -111,7 +110,7 @@ namespace Octokit.Tests.Clients [InlineData(HttpStatusCode.OK, false)] public async Task ReturnsCorrectResultBasedOnStatus(HttpStatusCode status, bool expected) { - var response = Task.Factory.StartNew(() => status); + var response = Task.Factory.StartNew(() => status); var connection = Substitute.For(); connection.Delete(Arg.Is(u => u.ToString() == "user/starred/yes/no")) diff --git a/Octokit.Tests/Reactive/Enterprise/ObservableEnterpriseSearchIndexingClientTests.cs b/Octokit.Tests/Reactive/Enterprise/ObservableEnterpriseSearchIndexingClientTests.cs index e185081f..02f29b0c 100644 --- a/Octokit.Tests/Reactive/Enterprise/ObservableEnterpriseSearchIndexingClientTests.cs +++ b/Octokit.Tests/Reactive/Enterprise/ObservableEnterpriseSearchIndexingClientTests.cs @@ -1,5 +1,4 @@ -using System; -using NSubstitute; +using NSubstitute; using Octokit.Reactive; using Xunit; @@ -17,12 +16,12 @@ namespace Octokit.Tests client.Queue("org"); github.Enterprise.SearchIndexing.Received(1). - Queue(Arg.Is("org")); + Queue(Arg.Is("org")); client.Queue("org", "repo"); github.Enterprise.SearchIndexing.Received(1). - Queue(Arg.Is("org"), - Arg.Is("repo")); + Queue(Arg.Is("org"), + Arg.Is("repo")); } } @@ -36,7 +35,7 @@ namespace Octokit.Tests client.QueueAll("org"); github.Enterprise.SearchIndexing.Received(1). - QueueAll(Arg.Is("org")); + QueueAll(Arg.Is("org")); } } @@ -50,12 +49,12 @@ namespace Octokit.Tests client.QueueAllCode("org"); github.Enterprise.SearchIndexing.Received(1). - QueueAllCode(Arg.Is("org")); + QueueAllCode(Arg.Is("org")); client.QueueAllCode("org", "repo"); github.Enterprise.SearchIndexing.Received(1). - QueueAllCode(Arg.Is("org"), - Arg.Is("repo")); + QueueAllCode(Arg.Is("org"), + Arg.Is("repo")); } } @@ -69,12 +68,12 @@ namespace Octokit.Tests client.QueueAllIssues("org"); github.Enterprise.SearchIndexing.Received(1). - QueueAllIssues(Arg.Is("org")); + QueueAllIssues(Arg.Is("org")); client.QueueAllIssues("org", "repo"); github.Enterprise.SearchIndexing.Received(1). - QueueAllIssues(Arg.Is("org"), - Arg.Is("repo")); + QueueAllIssues(Arg.Is("org"), + Arg.Is("repo")); } } } From 66c45752b78256fe89e35eff9f2e4835ddd56722 Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Wed, 23 Mar 2016 12:44:51 +0700 Subject: [PATCH 06/20] Redundant explicit array creation in argument of 'params' parameter was removed. --- Octokit/SimpleJson.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Octokit/SimpleJson.cs b/Octokit/SimpleJson.cs index 78baee56..579687ad 100644 --- a/Octokit/SimpleJson.cs +++ b/Octokit/SimpleJson.cs @@ -1457,7 +1457,7 @@ namespace Octokit { var ctorType = typeof(IDictionary<,>).MakeGenericType(keyType, valueType); var genericReadonlyType = typeof(ReadOnlyDictionary<,>).MakeGenericType(keyType, valueType); - var ctor = ReflectionUtils.GetContructor(genericReadonlyType, new Type[] { ctorType }); + var ctor = ReflectionUtils.GetContructor(genericReadonlyType, new [] { ctorType }); Debug.Assert(ctor != null); obj = ctor.Invoke(new[] { obj }); } @@ -2011,7 +2011,7 @@ namespace Octokit ParameterExpression value = Expression.Parameter(typeof(object), "value"); 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(); + Action compiled = Expression.Lambda>(Expression.Call(instanceCast, setMethodInfo, valueCast), instance, value).Compile(); return delegate (object source, object val) { compiled(source, val); }; } From 165e27c418f5b2128536949157a780c5857d75cf Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Wed, 23 Mar 2016 12:54:57 +0700 Subject: [PATCH 07/20] Empty constructor was removed. --- Octokit.Tests.Integration/Clients/BranchesClientTests.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Octokit.Tests.Integration/Clients/BranchesClientTests.cs b/Octokit.Tests.Integration/Clients/BranchesClientTests.cs index bbc7cbe4..70217181 100644 --- a/Octokit.Tests.Integration/Clients/BranchesClientTests.cs +++ b/Octokit.Tests.Integration/Clients/BranchesClientTests.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading.Tasks; using Octokit; using Octokit.Tests.Integration; @@ -10,8 +9,6 @@ public class BranchesClientTests { public class TheGetBranchesMethod { - public TheGetBranchesMethod() { } - [IntegrationTest] public async Task ReturnsBranches() { From 11d5ac510dbb96ac757259c44b26141de3d6dcc2 Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Wed, 23 Mar 2016 12:59:29 +0700 Subject: [PATCH 08/20] Redundant namespace qualifiers were removed. --- Octokit.Reactive/IObservableGitHubClient.cs | 2 +- Octokit/Clients/IRepositoriesClient.cs | 6 +++--- Octokit/Clients/RepositoriesClient.cs | 2 +- Octokit/IGitHubClient.cs | 2 +- Octokit/Models/Request/SearchIssuesRequest.cs | 2 +- Octokit/SimpleJson.cs | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Octokit.Reactive/IObservableGitHubClient.cs b/Octokit.Reactive/IObservableGitHubClient.cs index ddc42663..6f424072 100644 --- a/Octokit.Reactive/IObservableGitHubClient.cs +++ b/Octokit.Reactive/IObservableGitHubClient.cs @@ -19,7 +19,7 @@ namespace Octokit.Reactive IObservableReleasesClient Release { get; } IObservableSshKeysClient SshKey { get; } IObservableUsersClient User { get; } - [System.Obsolete("Notifications are now available under the Activities client. This will be removed in a future update.")] + [Obsolete("Notifications are now available under the Activities client. This will be removed in a future update.")] IObservableNotificationsClient Notification { get; } IObservableGitDatabaseClient Git { get; } [Obsolete("Use Git instead")] diff --git a/Octokit/Clients/IRepositoriesClient.cs b/Octokit/Clients/IRepositoriesClient.cs index b5db4ad6..098e03d0 100644 --- a/Octokit/Clients/IRepositoriesClient.cs +++ b/Octokit/Clients/IRepositoriesClient.cs @@ -29,7 +29,7 @@ namespace Octokit /// /// See the Repository Comments API documentation for more information. /// - [System.Obsolete("Comment information is now available under the Comment property. This will be removed in a future update.")] + [Obsolete("Comment information is now available under the Comment property. This will be removed in a future update.")] IRepositoryCommentsClient RepositoryComments { get; } /// @@ -226,7 +226,7 @@ namespace Octokit /// /// See the Collaborators API documentation for more details /// - [System.Obsolete("Collaborator information is now available under the Collaborator property. This will be removed in a future update.")] + [Obsolete("Collaborator information is now available under the Collaborator property. This will be removed in a future update.")] IRepoCollaboratorsClient RepoCollaborators { get; } /// @@ -259,7 +259,7 @@ namespace Octokit /// /// See the Commits API documentation for more details /// - [System.Obsolete("Commit information is now available under the Commit property. This will be removed in a future update.")] + [Obsolete("Commit information is now available under the Commit property. This will be removed in a future update.")] IRepositoryCommitsClient Commits { get; } /// diff --git a/Octokit/Clients/RepositoriesClient.cs b/Octokit/Clients/RepositoriesClient.cs index 590637d0..9f14ac78 100644 --- a/Octokit/Clients/RepositoriesClient.cs +++ b/Octokit/Clients/RepositoriesClient.cs @@ -348,7 +348,7 @@ namespace Octokit /// /// See the Collaborators API documentation for more details /// - [System.Obsolete("Collaborator information is now available under the Collaborator property. This will be removed in a future update.")] + [Obsolete("Collaborator information is now available under the Collaborator property. This will be removed in a future update.")] public IRepoCollaboratorsClient RepoCollaborators { get; private set; } /// diff --git a/Octokit/IGitHubClient.cs b/Octokit/IGitHubClient.cs index d39eeb03..29dd910c 100644 --- a/Octokit/IGitHubClient.cs +++ b/Octokit/IGitHubClient.cs @@ -119,7 +119,7 @@ namespace Octokit /// /// Refer to the API documentation for more information: https://developer.github.com/v3/activity/notifications/ /// - [System.Obsolete("Notifications are now available under the Activities client. This will be removed in a future update.")] + [Obsolete("Notifications are now available under the Activities client. This will be removed in a future update.")] INotificationsClient Notification { get; } /// diff --git a/Octokit/Models/Request/SearchIssuesRequest.cs b/Octokit/Models/Request/SearchIssuesRequest.cs index 77057c2f..68699d77 100644 --- a/Octokit/Models/Request/SearchIssuesRequest.cs +++ b/Octokit/Models/Request/SearchIssuesRequest.cs @@ -203,7 +203,7 @@ namespace Octokit [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public RepositoryCollection Repos { get; set; } - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] + [SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] public override IReadOnlyList MergedQualifiers() { var parameters = new List(); diff --git a/Octokit/SimpleJson.cs b/Octokit/SimpleJson.cs index 579687ad..80fe3454 100644 --- a/Octokit/SimpleJson.cs +++ b/Octokit/SimpleJson.cs @@ -1762,7 +1762,7 @@ namespace Octokit if (typeof(IDictionary<,>).GetTypeInfo().IsAssignableFrom(type.GetTypeInfo())) return true; #else - if (typeof(System.Collections.IDictionary).IsAssignableFrom(type)) + if (typeof(IDictionary).IsAssignableFrom(type)) return true; #endif if (!GetTypeInfo(type).IsGenericType) @@ -2166,7 +2166,7 @@ namespace Octokit return _dictionary.GetEnumerator(); } - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + IEnumerator IEnumerable.GetEnumerator() { return _dictionary.GetEnumerator(); } From 3c5febfc534dd46b951545908194cc875974bc27 Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Wed, 23 Mar 2016 13:01:44 +0700 Subject: [PATCH 09/20] Redundant explicit array creation in argument of 'params' parameter was removed. --- Octokit/SimpleJson.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Octokit/SimpleJson.cs b/Octokit/SimpleJson.cs index 80fe3454..8f325b99 100644 --- a/Octokit/SimpleJson.cs +++ b/Octokit/SimpleJson.cs @@ -1457,9 +1457,9 @@ namespace Octokit { var ctorType = typeof(IDictionary<,>).MakeGenericType(keyType, valueType); var genericReadonlyType = typeof(ReadOnlyDictionary<,>).MakeGenericType(keyType, valueType); - var ctor = ReflectionUtils.GetContructor(genericReadonlyType, new [] { ctorType }); + var ctor = ReflectionUtils.GetContructor(genericReadonlyType, ctorType); Debug.Assert(ctor != null); - obj = ctor.Invoke(new[] { obj }); + obj = ctor.Invoke(obj); } #endif } From 7774c9923816663139d689d63c7ec2ecf15342fd Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Wed, 23 Mar 2016 22:17:35 +0700 Subject: [PATCH 10/20] Replace membersInBoth.Count() == 0 to membersInBoth.Any(). --- .../Clients/OrganizationMembersClientTests.cs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs b/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs index 301dbce2..adebb962 100644 --- a/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs +++ b/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs @@ -1,10 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; +using System.Linq; using System.Threading.Tasks; -using Octokit; -using Octokit.Tests.Integration; -using Octokit.Tests.Integration.Helpers; using Xunit; namespace Octokit.Tests.Integration.Clients @@ -47,7 +42,7 @@ namespace Octokit.Tests.Integration.Clients // There shouldnt be any members that are in both groups if the role filter works correctly var membersInBoth = adminMembers.Select(a => a.Id).Intersect(normalMembers.Select(n => n.Id)); - Assert.True(membersInBoth.Count() == 0); + Assert.True(!membersInBoth.Any()); } [IntegrationTest(Skip = "TwoFactor filter can't be used unless the requester is an organization owner")] From 592e7158200f7bdea3d2074a0d8b8c384a51d9df Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Wed, 23 Mar 2016 22:23:36 +0700 Subject: [PATCH 11/20] Use collection's count property instead of LINQ Count(). --- Octokit.Tests/Clients/UserAdministrationClientTests.cs | 4 +--- Octokit/Models/Response/CodeFrequency.cs | 2 +- Octokit/Models/Response/CommitActivity.cs | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Octokit.Tests/Clients/UserAdministrationClientTests.cs b/Octokit.Tests/Clients/UserAdministrationClientTests.cs index 4712b24b..5e700df3 100644 --- a/Octokit.Tests/Clients/UserAdministrationClientTests.cs +++ b/Octokit.Tests/Clients/UserAdministrationClientTests.cs @@ -1,9 +1,7 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using NSubstitute; -using Octokit.Tests.Helpers; using Xunit; namespace Octokit.Tests.Clients @@ -141,7 +139,7 @@ namespace Octokit.Tests.Clients connection.Received().Post( Arg.Any(), Arg.Is(a => - a.Scopes.Count() == scopes.Count() && + a.Scopes.Count() == scopes.Length && a.Scopes.ToList().All(s => scopes.Contains(s)) && scopes.ToList().All(s => a.Scopes.Contains(s)))); } diff --git a/Octokit/Models/Response/CodeFrequency.cs b/Octokit/Models/Response/CodeFrequency.cs index b72361b6..bd8572c5 100644 --- a/Octokit/Models/Response/CodeFrequency.cs +++ b/Octokit/Models/Response/CodeFrequency.cs @@ -42,7 +42,7 @@ namespace Octokit get { return string.Format(CultureInfo.InvariantCulture, - "Number of weeks: {0}", AdditionsAndDeletionsByWeek.Count()); + "Number of weeks: {0}", AdditionsAndDeletionsByWeek.Count); } } } diff --git a/Octokit/Models/Response/CommitActivity.cs b/Octokit/Models/Response/CommitActivity.cs index aafef951..0916bcb9 100644 --- a/Octokit/Models/Response/CommitActivity.cs +++ b/Octokit/Models/Response/CommitActivity.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; @@ -29,7 +28,7 @@ namespace Octokit get { return string.Format(CultureInfo.InvariantCulture, - "Weeks of activity: {0}", Activity.Count()); + "Weeks of activity: {0}", Activity.Count); } } } From 7e4e874f19e38118b79f557b5e4661d169651d3b Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Wed, 23 Mar 2016 22:30:24 +0700 Subject: [PATCH 12/20] Misspelling Attepmts -> Attempts was fixed. --- Octokit.Tests/Exceptions/ForbiddenExceptionTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Octokit.Tests/Exceptions/ForbiddenExceptionTests.cs b/Octokit.Tests/Exceptions/ForbiddenExceptionTests.cs index bfc3773b..909cbd9a 100644 --- a/Octokit.Tests/Exceptions/ForbiddenExceptionTests.cs +++ b/Octokit.Tests/Exceptions/ForbiddenExceptionTests.cs @@ -10,7 +10,7 @@ namespace Octokit.Tests.Exceptions public class TheConstructor { [Fact] - public void IdentifiesMaxLoginAttepmtsExceededReason() + public void IdentifiesMaxLoginAttemptsExceededReason() { const string responseBody = "{\"message\":\"YOU SHALL NOT PASS!\"," + "\"documentation_url\":\"http://developer.github.com/v3\"}"; From 72d6e80884c89c2e093e64a2edc9edb185a5f8b6 Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Wed, 23 Mar 2016 22:31:16 +0700 Subject: [PATCH 13/20] Misspelling Retriev -> Retrieve was fixed. --- Octokit.Tests/Reactive/AuthorizationExtensionsTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Octokit.Tests/Reactive/AuthorizationExtensionsTests.cs b/Octokit.Tests/Reactive/AuthorizationExtensionsTests.cs index 4812828b..77871409 100644 --- a/Octokit.Tests/Reactive/AuthorizationExtensionsTests.cs +++ b/Octokit.Tests/Reactive/AuthorizationExtensionsTests.cs @@ -12,7 +12,7 @@ namespace Octokit.Tests.Reactive public class TheGetOrCreateApplicationAuthenticationMethod { [Fact] - public async Task UsesCallbackToRetrievTwoFactorCode() + public async Task UsesCallbackToRetrieveTwoFactorCode() { var firstResponse = new TwoFactorRequiredException(TwoFactorType.AuthenticatorApp); var twoFactorChallengeResult = new TwoFactorChallengeResult("two-factor-code"); From 39bb148cf313f389570a1d37d8439afce98cb7d2 Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Wed, 23 Mar 2016 22:32:06 +0700 Subject: [PATCH 14/20] Misspelling Nulll -> Null was fixed. --- Octokit.Tests/Reactive/ObservableCommitsClientTests.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Octokit.Tests/Reactive/ObservableCommitsClientTests.cs b/Octokit.Tests/Reactive/ObservableCommitsClientTests.cs index 335918c8..a662a70a 100644 --- a/Octokit.Tests/Reactive/ObservableCommitsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableCommitsClientTests.cs @@ -1,11 +1,8 @@ using System; -using System.Collections.Generic; -using System.Reactive.Linq; using System.Reactive.Threading.Tasks; using System.Threading.Tasks; using NSubstitute; using Octokit.Reactive; -using Octokit.Tests.Helpers; using Xunit; namespace Octokit.Tests.Reactive @@ -15,7 +12,7 @@ namespace Octokit.Tests.Reactive public class TheCtorMethod { [Fact] - public void EnsuresArgumentIsNotNulll() + public void EnsuresArgumentIsNotNull() { Assert.Throws(() => new ObservableCommitsClient(null)); } From 304add5b5584c53b1e9a0b9dad97e8ce240c408c Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Wed, 23 Mar 2016 22:33:11 +0700 Subject: [PATCH 15/20] Misspelling outh-> OAuth was fixed. --- Octokit.Tests/Authentication/CredentialsTests.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Octokit.Tests/Authentication/CredentialsTests.cs b/Octokit.Tests/Authentication/CredentialsTests.cs index 2890fbbf..c4b8855c 100644 --- a/Octokit.Tests/Authentication/CredentialsTests.cs +++ b/Octokit.Tests/Authentication/CredentialsTests.cs @@ -1,5 +1,4 @@ using System; -using Octokit.Internal; using Xunit; namespace Octokit.Tests.Authentication @@ -23,7 +22,7 @@ namespace Octokit.Tests.Authentication } [Fact] - public void ReturnsOuthWhenProvidedToken() + public void ReturnsOAuthWhenProvidedToken() { var credentials = new Credentials("token"); Assert.Equal(AuthenticationType.Oauth, credentials.AuthenticationType); From a62a5f6378a8becf80ae588cb9195b0c13001e15 Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Wed, 23 Mar 2016 22:34:01 +0700 Subject: [PATCH 16/20] Misspelling TheRenderArbitrryMarkdownMethod-> TheRenderArbitraryMarkdownMethod was fixed. --- Octokit.Tests/Clients/MiscellaneousClientTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Octokit.Tests/Clients/MiscellaneousClientTests.cs b/Octokit.Tests/Clients/MiscellaneousClientTests.cs index 1d73f720..7b9a0f2b 100644 --- a/Octokit.Tests/Clients/MiscellaneousClientTests.cs +++ b/Octokit.Tests/Clients/MiscellaneousClientTests.cs @@ -31,7 +31,7 @@ namespace Octokit.Tests.Clients "text/plain"); } } - public class TheRenderArbitrryMarkdownMethod + public class TheRenderArbitraryMarkdownMethod { [Fact] public async Task RequestsTheEmojiEndpoint() From 3ff8f5e809f3cc551792b0283b4c1abb347c88ad Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Wed, 23 Mar 2016 22:36:58 +0700 Subject: [PATCH 17/20] Misspelling expctedUri-> expectedUri was fixed. --- Octokit.Tests.Integration/Clients/IssuesClientTests.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Octokit.Tests.Integration/Clients/IssuesClientTests.cs b/Octokit.Tests.Integration/Clients/IssuesClientTests.cs index 73284093..bad72f76 100644 --- a/Octokit.Tests.Integration/Clients/IssuesClientTests.cs +++ b/Octokit.Tests.Integration/Clients/IssuesClientTests.cs @@ -4,7 +4,6 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using Octokit; -using Octokit.Tests.Helpers; using Octokit.Tests.Integration; using Xunit; using Octokit.Tests.Integration.Helpers; @@ -348,7 +347,7 @@ public class IssuesClientTests : IDisposable [IntegrationTest] public async Task CanAccessUrls() { - var expctedUri = "https://api.github.com/repos/{0}/{1}/issues/{2}/{3}"; + var expectedUri = "https://api.github.com/repos/{0}/{1}/issues/{2}/{3}"; var newIssue = new NewIssue("A test issue") { @@ -358,9 +357,9 @@ public class IssuesClientTests : IDisposable var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue); Assert.NotNull(issue.CommentsUrl); - Assert.Equal(new Uri(string.Format(expctedUri, _context.RepositoryOwner, _context.RepositoryName, issue.Number, "comments")), issue.CommentsUrl); + Assert.Equal(new Uri(string.Format(expectedUri, _context.RepositoryOwner, _context.RepositoryName, issue.Number, "comments")), issue.CommentsUrl); Assert.NotNull(issue.EventsUrl); - Assert.Equal(new Uri(string.Format(expctedUri, _context.RepositoryOwner, _context.RepositoryName, issue.Number, "events")), issue.EventsUrl); + Assert.Equal(new Uri(string.Format(expectedUri, _context.RepositoryOwner, _context.RepositoryName, issue.Number, "events")), issue.EventsUrl); } public void Dispose() From eaf293c9cb394fc7ae887936d0425e4026452973 Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Thu, 24 Mar 2016 00:21:37 +0700 Subject: [PATCH 18/20] Some cosmetic changes in OrganizationMembersClientTests. --- .../Clients/OrganizationMembersClientTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs b/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs index adebb962..f495c2b3 100644 --- a/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs +++ b/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs @@ -42,7 +42,7 @@ namespace Octokit.Tests.Integration.Clients // There shouldnt be any members that are in both groups if the role filter works correctly var membersInBoth = adminMembers.Select(a => a.Id).Intersect(normalMembers.Select(n => n.Id)); - Assert.True(!membersInBoth.Any()); + Assert.NotEmpty(membersInBoth); } [IntegrationTest(Skip = "TwoFactor filter can't be used unless the requester is an organization owner")] From 2140a86fffa90faa9e48106635eac118d2b35b8b Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Thu, 24 Mar 2016 01:03:31 +0700 Subject: [PATCH 19/20] Revert changes in SimpleJson.cs. --- Octokit/SimpleJson.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Octokit/SimpleJson.cs b/Octokit/SimpleJson.cs index 8f325b99..78baee56 100644 --- a/Octokit/SimpleJson.cs +++ b/Octokit/SimpleJson.cs @@ -1457,9 +1457,9 @@ namespace Octokit { var ctorType = typeof(IDictionary<,>).MakeGenericType(keyType, valueType); var genericReadonlyType = typeof(ReadOnlyDictionary<,>).MakeGenericType(keyType, valueType); - var ctor = ReflectionUtils.GetContructor(genericReadonlyType, ctorType); + var ctor = ReflectionUtils.GetContructor(genericReadonlyType, new Type[] { ctorType }); Debug.Assert(ctor != null); - obj = ctor.Invoke(obj); + obj = ctor.Invoke(new[] { obj }); } #endif } @@ -1762,7 +1762,7 @@ namespace Octokit if (typeof(IDictionary<,>).GetTypeInfo().IsAssignableFrom(type.GetTypeInfo())) return true; #else - if (typeof(IDictionary).IsAssignableFrom(type)) + if (typeof(System.Collections.IDictionary).IsAssignableFrom(type)) return true; #endif if (!GetTypeInfo(type).IsGenericType) @@ -2011,7 +2011,7 @@ namespace Octokit ParameterExpression value = Expression.Parameter(typeof(object), "value"); 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), instance, value).Compile(); + Action compiled = Expression.Lambda>(Expression.Call(instanceCast, setMethodInfo, valueCast), new ParameterExpression[] { instance, value }).Compile(); return delegate (object source, object val) { compiled(source, val); }; } @@ -2166,7 +2166,7 @@ namespace Octokit return _dictionary.GetEnumerator(); } - IEnumerator IEnumerable.GetEnumerator() + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return _dictionary.GetEnumerator(); } From 1cc94b99f663582d6f5051377a5faa481a330202 Mon Sep 17 00:00:00 2001 From: "aedampir@gmail.com" Date: Thu, 24 Mar 2016 12:22:44 +0700 Subject: [PATCH 20/20] Assert.NotEmpty to Assert.Empty --- .../Clients/OrganizationMembersClientTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs b/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs index f495c2b3..d0cb22b9 100644 --- a/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs +++ b/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs @@ -42,7 +42,7 @@ namespace Octokit.Tests.Integration.Clients // There shouldnt be any members that are in both groups if the role filter works correctly var membersInBoth = adminMembers.Select(a => a.Id).Intersect(normalMembers.Select(n => n.Id)); - Assert.NotEmpty(membersInBoth); + Assert.Empty(membersInBoth); } [IntegrationTest(Skip = "TwoFactor filter can't be used unless the requester is an organization owner")]