diff --git a/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs b/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs index b22e0b5eee..88c263121c 100644 --- a/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs +++ b/Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs @@ -7,42 +7,42 @@ namespace Octokit.Reactive.Clients { public class ObservableAuthorizationsClient : IObservableAuthorizationsClient { - readonly IAuthorizationsClient client; + readonly IAuthorizationsClient _client; public ObservableAuthorizationsClient(IAuthorizationsClient client) { Ensure.ArgumentNotNull(client, "client"); - this.client = client; + _client = client; } - public IObservable> GetAll() + public IObservable> GetAll() { - return client.GetAll().ToObservable(); + return _client.GetAll().ToObservable(); } public IObservable Get(int id) { - return client.Get(id).ToObservable(); + return _client.Get(id).ToObservable(); } public IObservable Update(int id, AuthorizationUpdate authorization) { Ensure.ArgumentNotNull(authorization, "authorization"); - return client.Update(id, authorization).ToObservable(); + return _client.Update(id, authorization).ToObservable(); } public IObservable Create(AuthorizationUpdate authorization) { Ensure.ArgumentNotNull(authorization, "authorization"); - return client.Create(authorization).ToObservable(); + return _client.Create(authorization).ToObservable(); } public IObservable Delete(int id) { - return client.Delete(id).ToObservable(); + return _client.Delete(id).ToObservable(); } } } diff --git a/Octokit.Reactive/Clients/ObservableAutoCompleteClient.cs b/Octokit.Reactive/Clients/ObservableAutoCompleteClient.cs index 0cf25d9d64..b5928e7067 100644 --- a/Octokit.Reactive/Clients/ObservableAutoCompleteClient.cs +++ b/Octokit.Reactive/Clients/ObservableAutoCompleteClient.cs @@ -6,18 +6,18 @@ namespace Octokit.Reactive.Clients { public class ObservableAutoCompleteClient : IObservableAutoCompleteClient { - readonly IAutoCompleteClient client; + readonly IAutoCompleteClient _client; public ObservableAutoCompleteClient(IAutoCompleteClient client) { Ensure.ArgumentNotNull(client, "client"); - this.client = client; + _client = client; } public IObservable> GetEmojis() { - return client.GetEmojis().ToObservable(); + return _client.GetEmojis().ToObservable(); } } } diff --git a/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs b/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs index 3c81cc64ea..0f20b6cc73 100644 --- a/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs +++ b/Octokit.Reactive/Clients/ObservableOrganizationsClient.cs @@ -6,32 +6,32 @@ namespace Octokit.Reactive.Clients { public class ObservableOrganizationsClient : IObservableOrganizationsClient { - readonly IOrganizationsClient client; + readonly IOrganizationsClient _client; public ObservableOrganizationsClient(IOrganizationsClient client) { Ensure.ArgumentNotNull(client, "client"); - this.client = client; + _client = client; } public IObservable Get(string org) { Ensure.ArgumentNotNullOrEmptyString(org, "org"); - return client.Get(org).ToObservable(); + return _client.Get(org).ToObservable(); } - public IObservable> GetAllForCurrent() + public IObservable> GetAllForCurrent() { - return client.GetAllForCurrent().ToObservable(); + return _client.GetAllForCurrent().ToObservable(); } - public IObservable> GetAll(string user) + public IObservable> GetAll(string user) { Ensure.ArgumentNotNullOrEmptyString(user, "user"); - return client.GetAll(user).ToObservable(); + return _client.GetAll(user).ToObservable(); } } } diff --git a/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs b/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs index ffa040595c..6084e1c73a 100644 --- a/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs +++ b/Octokit.Reactive/Clients/ObservableRepositoriesClient.cs @@ -6,13 +6,13 @@ namespace Octokit.Reactive.Clients { public class ObservableRepositoriesClient : IObservableRepositoriesClient { - readonly IRepositoriesClient client; + readonly IRepositoriesClient _client; public ObservableRepositoriesClient(IRepositoriesClient client) { Ensure.ArgumentNotNull(client, "client"); - this.client = client; + _client = client; } public IObservable Get(string owner, string name) @@ -20,26 +20,26 @@ public IObservable Get(string owner, string name) Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); - return client.Get(owner, name).ToObservable(); + return _client.Get(owner, name).ToObservable(); } - public IObservable> GetAllForCurrent() + public IObservable> GetAllForCurrent() { - return client.GetAllForCurrent().ToObservable(); + return _client.GetAllForCurrent().ToObservable(); } - public IObservable> GetAllForUser(string login) + public IObservable> GetAllForUser(string login) { Ensure.ArgumentNotNullOrEmptyString(login, "login"); - return client.GetAllForUser(login).ToObservable(); + return _client.GetAllForUser(login).ToObservable(); } - public IObservable> GetAllForOrg(string organization) + public IObservable> GetAllForOrg(string organization) { Ensure.ArgumentNotNullOrEmptyString(organization, "organization"); - return client.GetAllForOrg(organization).ToObservable(); + return _client.GetAllForOrg(organization).ToObservable(); } public IObservable GetReadme(string owner, string name) @@ -47,7 +47,7 @@ public IObservable GetReadme(string owner, string name) Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); - return client.GetReadme(owner, name).ToObservable(); + return _client.GetReadme(owner, name).ToObservable(); } } } diff --git a/Octokit.Reactive/Clients/ObservableSshKeysClient.cs b/Octokit.Reactive/Clients/ObservableSshKeysClient.cs index e5f0528de1..a5fcbe64c1 100644 --- a/Octokit.Reactive/Clients/ObservableSshKeysClient.cs +++ b/Octokit.Reactive/Clients/ObservableSshKeysClient.cs @@ -7,49 +7,49 @@ namespace Octokit.Reactive.Clients { public class ObservableSshKeysClient : IObservableSshKeysClient { - readonly ISshKeysClient client; + readonly ISshKeysClient _client; public ObservableSshKeysClient(ISshKeysClient client) { Ensure.ArgumentNotNull(client, "client"); - this.client = client; + _client = client; } public IObservable Get(int id) { - return client.Get(id).ToObservable(); + return _client.Get(id).ToObservable(); } - public IObservable> GetAll(string user) + public IObservable> GetAll(string user) { Ensure.ArgumentNotNullOrEmptyString(user, "user"); - return client.GetAll(user).ToObservable(); + return _client.GetAll(user).ToObservable(); } - public IObservable> GetAllForCurrent() + public IObservable> GetAllForCurrent() { - return client.GetAllForCurrent().ToObservable(); + return _client.GetAllForCurrent().ToObservable(); } public IObservable Create(SshKeyUpdate key) { Ensure.ArgumentNotNull(key, "key"); - return client.Create(key).ToObservable(); + return _client.Create(key).ToObservable(); } public IObservable Update(int id, SshKeyUpdate key) { Ensure.ArgumentNotNull(key, "key"); - return client.Update(id, key).ToObservable(); + return _client.Update(id, key).ToObservable(); } public IObservable Delete(int id) { - return client.Delete(id).ToObservable(); + return _client.Delete(id).ToObservable(); } } } diff --git a/Octokit.Reactive/Clients/ObservableUsersClient.cs b/Octokit.Reactive/Clients/ObservableUsersClient.cs index e14c2f6c02..700fdbb117 100644 --- a/Octokit.Reactive/Clients/ObservableUsersClient.cs +++ b/Octokit.Reactive/Clients/ObservableUsersClient.cs @@ -11,7 +11,7 @@ public ObservableUsersClient(IUsersClient client) { Ensure.ArgumentNotNull(client, "client"); - this._client = client; + _client = client; } public IObservable Get(string login) diff --git a/Octokit.Reactive/IObservableAuthorizationsClient.cs b/Octokit.Reactive/IObservableAuthorizationsClient.cs index 157ce2c7f6..1d46eb9f6e 100644 --- a/Octokit.Reactive/IObservableAuthorizationsClient.cs +++ b/Octokit.Reactive/IObservableAuthorizationsClient.cs @@ -9,7 +9,7 @@ public interface IObservableAuthorizationsClient { [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "It's an API call, so it's not a property.")] - IObservable> GetAll(); + IObservable> GetAll(); [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get", Justification = "It's fiiiine. It's fine. Trust us.")] IObservable Get(int id); diff --git a/Octokit.Reactive/IObservableOrganizationsClient.cs b/Octokit.Reactive/IObservableOrganizationsClient.cs index 748fac9092..459fbce8ba 100644 --- a/Octokit.Reactive/IObservableOrganizationsClient.cs +++ b/Octokit.Reactive/IObservableOrganizationsClient.cs @@ -21,13 +21,13 @@ public interface IObservableOrganizationsClient /// [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Method makes a network request")] - IObservable> GetAllForCurrent(); + IObservable> GetAllForCurrent(); /// /// Returns all the organizations for the specified user /// /// /// - IObservable> GetAll(string user); + IObservable> GetAll(string user); } } diff --git a/Octokit.Reactive/IObservableRepositoriesClient.cs b/Octokit.Reactive/IObservableRepositoriesClient.cs index 7be823b1ea..bc8a1a3247 100644 --- a/Octokit.Reactive/IObservableRepositoriesClient.cs +++ b/Octokit.Reactive/IObservableRepositoriesClient.cs @@ -25,7 +25,7 @@ public interface IObservableRepositoriesClient /// A of . [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Makes a network request")] - IObservable> GetAllForCurrent(); + IObservable> GetAllForCurrent(); /// /// Retrieves every that belongs to the specified user. @@ -36,7 +36,7 @@ public interface IObservableRepositoriesClient /// A of . [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Makes a network request")] - IObservable> GetAllForUser(string login); + IObservable> GetAllForUser(string login); /// /// Retrieves every that belongs to the specified organization. @@ -47,7 +47,7 @@ public interface IObservableRepositoriesClient /// A of . [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Makes a network request")] - IObservable> GetAllForOrg(string organization); + IObservable> GetAllForOrg(string organization); /// /// Returns the HTML rendered README. diff --git a/Octokit.Reactive/IObservableSshKeysClient.cs b/Octokit.Reactive/IObservableSshKeysClient.cs index 7052686ea9..140be8c284 100644 --- a/Octokit.Reactive/IObservableSshKeysClient.cs +++ b/Octokit.Reactive/IObservableSshKeysClient.cs @@ -20,7 +20,7 @@ public interface IObservableSshKeysClient /// /// The login of the user. /// A of . - IObservable> GetAll(string user); + IObservable> GetAll(string user); /// /// Retrieves the for the specified id. @@ -29,7 +29,7 @@ public interface IObservableSshKeysClient /// A of . [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Makes a network request")] - IObservable> GetAllForCurrent(); + IObservable> GetAllForCurrent(); /// /// Update the specified . diff --git a/Octokit.msbuild b/Octokit.msbuild index fc9fcfdb4a..f6bd6b8f04 100644 --- a/Octokit.msbuild +++ b/Octokit.msbuild @@ -18,7 +18,7 @@ - + @@ -31,5 +31,5 @@ - + diff --git a/Octokit/ApiExtensions.cs b/Octokit/ApiExtensions.cs index d813a20381..1d84bef845 100644 --- a/Octokit/ApiExtensions.cs +++ b/Octokit/ApiExtensions.cs @@ -1,8 +1,7 @@ using System; -using System.Globalization; -using System.Linq; +#if NET_45 using System.Collections.Generic; -using System.Reflection; +#endif using System.Threading.Tasks; using Octokit.Http; @@ -18,7 +17,7 @@ public static Task Get(this IApiConnection connection, Uri endpoint) return connection.Get(endpoint, null); } - public static Task> GetAll(this IApiConnection connection, Uri endpoint) + public static Task> GetAll(this IApiConnection connection, Uri endpoint) { Ensure.ArgumentNotNull(connection, "connection"); Ensure.ArgumentNotNull(endpoint, "endpoint"); diff --git a/Octokit/Clients/ApiPagination.cs b/Octokit/Clients/ApiPagination.cs index 997d9a1305..bd78158d1f 100644 --- a/Octokit/Clients/ApiPagination.cs +++ b/Octokit/Clients/ApiPagination.cs @@ -14,7 +14,7 @@ namespace Octokit.Clients /// public class ApiPagination : IApiPagination { - public async Task> GetAllPages(Func>> getFirstPage) + public async Task> GetAllPages(Func>> getFirstPage) { Ensure.ArgumentNotNull(getFirstPage, "getFirstPage"); diff --git a/Octokit/Clients/AuthorizationsClient.cs b/Octokit/Clients/AuthorizationsClient.cs index 1dbfded95a..742c517948 100644 --- a/Octokit/Clients/AuthorizationsClient.cs +++ b/Octokit/Clients/AuthorizationsClient.cs @@ -17,7 +17,7 @@ public AuthorizationsClient(IApiConnection client) : base(client) /// Get all s for the authenticated user. This method requires basic auth. /// /// An - public async Task> GetAll() + public async Task> GetAll() { return await Client.GetAll(authorizationsEndpoint); } diff --git a/Octokit/Clients/AutoCompleteClient.cs b/Octokit/Clients/AutoCompleteClient.cs index 01e13cd2cf..0b5430a7f7 100644 --- a/Octokit/Clients/AutoCompleteClient.cs +++ b/Octokit/Clients/AutoCompleteClient.cs @@ -12,18 +12,19 @@ namespace Octokit.Clients /// public class AutoCompleteClient : IAutoCompleteClient { - readonly IConnection connection; + readonly IConnection _connection; public AutoCompleteClient(IConnection connection) { Ensure.ArgumentNotNull(connection, "connection"); - this.connection = connection; + + _connection = connection; } public async Task> GetEmojis() { var endpoint = new Uri("/emojis", UriKind.Relative); - var response = await connection.GetAsync>(endpoint, null); + var response = await _connection.GetAsync>(endpoint, null); return new ReadOnlyDictionary( response.BodyAsObject.ToDictionary(kvp => kvp.Key, kvp => new Uri(kvp.Value))); } diff --git a/Octokit/Clients/OrganizationsClient.cs b/Octokit/Clients/OrganizationsClient.cs index dc5f8f712a..ef07c5f4b6 100644 --- a/Octokit/Clients/OrganizationsClient.cs +++ b/Octokit/Clients/OrganizationsClient.cs @@ -19,14 +19,14 @@ public async Task Get(string org) return await Client.Get(endpoint); } - public async Task> GetAllForCurrent() + public async Task> GetAllForCurrent() { var endpoint = new Uri("/user/orgs", UriKind.Relative); return await Client.GetAll(endpoint); } - public async Task> GetAll(string user) + public async Task> GetAll(string user) { Ensure.ArgumentNotNullOrEmptyString(user, "user"); diff --git a/Octokit/Clients/ReleasesClient.cs b/Octokit/Clients/ReleasesClient.cs index 7f8c5f0171..884865a88c 100644 --- a/Octokit/Clients/ReleasesClient.cs +++ b/Octokit/Clients/ReleasesClient.cs @@ -10,7 +10,7 @@ public ReleasesClient(IApiConnection client) : base(client) { } - public async Task> GetAll(string owner, string name) + public async Task> GetAll(string owner, string name) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "repository"); diff --git a/Octokit/Clients/RepositoriesClient.cs b/Octokit/Clients/RepositoriesClient.cs index e09e0dbb70..7cf0025c4e 100644 --- a/Octokit/Clients/RepositoriesClient.cs +++ b/Octokit/Clients/RepositoriesClient.cs @@ -20,13 +20,13 @@ public async Task Get(string owner, string name) return await Client.Get(endpoint); } - public async Task> GetAllForCurrent() + public async Task> GetAllForCurrent() { var endpoint = new Uri("user/repos", UriKind.Relative); return await Client.GetAll(endpoint); } - public async Task> GetAllForUser(string login) + public async Task> GetAllForUser(string login) { Ensure.ArgumentNotNullOrEmptyString(login, "login"); @@ -35,7 +35,7 @@ public async Task> GetAllForUser(string login) return await Client.GetAll(endpoint); } - public async Task> GetAllForOrg(string organization) + public async Task> GetAllForOrg(string organization) { Ensure.ArgumentNotNullOrEmptyString(organization, "organization"); diff --git a/Octokit/Clients/SshKeysClient.cs b/Octokit/Clients/SshKeysClient.cs index 195f07dfed..8a706f3251 100644 --- a/Octokit/Clients/SshKeysClient.cs +++ b/Octokit/Clients/SshKeysClient.cs @@ -18,7 +18,7 @@ public async Task Get(int id) return await Client.Get(endpoint); } - public async Task> GetAll(string user) + public async Task> GetAll(string user) { Ensure.ArgumentNotNullOrEmptyString(user, "user"); @@ -27,7 +27,7 @@ public async Task> GetAll(string user) return await Client.GetAll(endpoint); } - public async Task> GetAllForCurrent() + public async Task> GetAllForCurrent() { var endpoint = new Uri("/user/keys", UriKind.Relative); diff --git a/Octokit/Helpers/Net45CompatibilityShim.cs b/Octokit/Helpers/Net45CompatibilityShim.cs index 476cdb4dca..7037a88cf3 100644 --- a/Octokit/Helpers/Net45CompatibilityShim.cs +++ b/Octokit/Helpers/Net45CompatibilityShim.cs @@ -34,7 +34,7 @@ public class ReadOnlyCollection : IReadOnlyList { readonly List _source; - public ReadOnlyCollection(IEnumerable source) + public ReadOnlyCollection(IList source) { _source = new List(source); } diff --git a/Octokit/Http/ApiConnection.cs b/Octokit/Http/ApiConnection.cs index 2492b07c88..390110d7f9 100644 --- a/Octokit/Http/ApiConnection.cs +++ b/Octokit/Http/ApiConnection.cs @@ -8,7 +8,7 @@ namespace Octokit.Http { public class ApiConnection : IApiConnection { - readonly IApiPagination pagination; + readonly IApiPagination _pagination; public ApiConnection(IConnection connection) : this(connection, new ApiPagination()) { @@ -20,7 +20,7 @@ protected ApiConnection(IConnection connection, IApiPagination pagination) Ensure.ArgumentNotNull(pagination, "pagination"); Connection = connection; - this.pagination = pagination; + _pagination = pagination; } protected IConnection Connection { get; private set; } @@ -48,11 +48,11 @@ public async Task GetHtml(Uri endpoint, IDictionary para return response.Body; } - public async Task> GetAll(Uri endpoint, IDictionary parameters) + public async Task> GetAll(Uri endpoint, IDictionary parameters) { Ensure.ArgumentNotNull(endpoint, "endpoint"); - return await pagination.GetAllPages(async () => await GetPage(endpoint, parameters)); + return await _pagination.GetAllPages(async () => await GetPage(endpoint, parameters)); } public async Task Create(Uri endpoint, object data) diff --git a/Octokit/Http/ApiInfo.cs b/Octokit/Http/ApiInfo.cs index ab0f065c16..406cba19e8 100644 --- a/Octokit/Http/ApiInfo.cs +++ b/Octokit/Http/ApiInfo.cs @@ -1,6 +1,8 @@ using System; using System.Collections.Generic; +#if NET_45 using System.Collections.ObjectModel; +#endif namespace Octokit.Http { @@ -30,12 +32,12 @@ public ApiInfo(IDictionary links, /// /// Oauth scopes that were included in the token used to make the request. /// - public IReadOnlyCollection OauthScopes { get; private set; } + public IReadOnlyList OauthScopes { get; private set; } /// /// Oauth scopes accepted for this particular call. /// - public IReadOnlyCollection AcceptedOauthScopes { get; private set; } + public IReadOnlyList AcceptedOauthScopes { get; private set; } /// /// Etag diff --git a/Octokit/Http/ApiInfoParser.cs b/Octokit/Http/ApiInfoParser.cs index c457fe1927..38e89157f9 100644 --- a/Octokit/Http/ApiInfoParser.cs +++ b/Octokit/Http/ApiInfoParser.cs @@ -16,8 +16,8 @@ public class ApiInfoParser #endif - readonly Regex linkRelRegex = new Regex("rel=\"(next|prev|first|last)\"", regexOptions); - readonly Regex linkUriRegex = new Regex("<(.+)>", regexOptions); + readonly Regex _linkRelRegex = new Regex("rel=\"(next|prev|first|last)\"", regexOptions); + readonly Regex _linkUriRegex = new Regex("<(.+)>", regexOptions); public void ParseApiHttpHeaders(IResponse response) { @@ -69,10 +69,10 @@ ApiInfo ParseHeaders(IResponse response) var links = response.Headers["Link"].Split(','); foreach (var link in links) { - var relMatch = linkRelRegex.Match(link); + var relMatch = _linkRelRegex.Match(link); if (!relMatch.Success || relMatch.Groups.Count != 2) break; - var uriMatch = linkUriRegex.Match(link); + var uriMatch = _linkUriRegex.Match(link); if (!uriMatch.Success || uriMatch.Groups.Count != 2) break; httpLinks.Add(relMatch.Groups[1].Value, new Uri(uriMatch.Groups[1].Value)); diff --git a/Octokit/Http/Connection.cs b/Octokit/Http/Connection.cs index e76c9fe5a0..007b3e8b7e 100644 --- a/Octokit/Http/Connection.cs +++ b/Octokit/Http/Connection.cs @@ -16,10 +16,10 @@ public class Connection : IConnection static readonly Uri defaultGitHubApiUrl = new Uri("https://api.github.com/"); static readonly ICredentialStore anonymousCredentials = new InMemoryCredentialStore(Credentials.Anonymous); - readonly Authenticator authenticator; - readonly IHttpClient httpClient; - readonly JsonHttpPipeline jsonPipeline; - readonly ApiInfoParser apiInfoParser; + readonly Authenticator _authenticator; + readonly IHttpClient _httpClient; + readonly JsonHttpPipeline _jsonPipeline; + readonly ApiInfoParser _apiInfoParser; public Connection(string userAgent) : this(userAgent, defaultGitHubApiUrl, anonymousCredentials) { @@ -64,10 +64,10 @@ public Connection(string userAgent, UserAgent = userAgent; BaseAddress = baseAddress; - authenticator = new Authenticator(credentialStore); - this.httpClient = httpClient; - jsonPipeline = new JsonHttpPipeline(); - apiInfoParser = new ApiInfoParser(); + _authenticator = new Authenticator(credentialStore); + _httpClient = httpClient; + _jsonPipeline = new JsonHttpPipeline(); + _apiInfoParser = new ApiInfoParser(); } public async Task> GetAsync(Uri endpoint, IDictionary parameters) @@ -131,7 +131,7 @@ public async Task> PostRawAsync(Uri endpoint, Stream body, IDict request.Headers[header.Key] = header.Value; } var response = await RunRequest(request); - jsonPipeline.DeserializeResponse(response); + _jsonPipeline.DeserializeResponse(response); return response; } @@ -172,7 +172,7 @@ await Run(new Request public ICredentialStore CredentialStore { - get { return authenticator.CredentialStore; } + get { return _authenticator.CredentialStore; } } public Credentials Credentials @@ -182,7 +182,7 @@ public Credentials Credentials set { Ensure.ArgumentNotNull(value, "value"); - authenticator.CredentialStore = new InMemoryCredentialStore(value); + _authenticator.CredentialStore = new InMemoryCredentialStore(value); } } @@ -194,9 +194,9 @@ async Task> GetHtml(IRequest request) async Task> Run(IRequest request) { - jsonPipeline.SerializeRequest(request); + _jsonPipeline.SerializeRequest(request); var response = await RunRequest(request); - jsonPipeline.DeserializeResponse(response); + _jsonPipeline.DeserializeResponse(response); return response; } @@ -204,9 +204,9 @@ async Task> Run(IRequest request) async Task> RunRequest(IRequest request) { request.Headers.Add("User-Agent", UserAgent); - authenticator.Apply(request); - var response = await httpClient.Send(request); - apiInfoParser.ParseApiHttpHeaders(response); + _authenticator.Apply(request); + var response = await _httpClient.Send(request); + _apiInfoParser.ParseApiHttpHeaders(response); HandleErrors(response); return response; } diff --git a/Octokit/Http/IApiConnection.cs b/Octokit/Http/IApiConnection.cs index 6dc81290d9..d1b0359352 100644 --- a/Octokit/Http/IApiConnection.cs +++ b/Octokit/Http/IApiConnection.cs @@ -17,7 +17,7 @@ public interface IApiConnection Task Get(Uri endpoint, IDictionary parameters); Task GetItem(Uri endpoint, IDictionary parameters); Task GetHtml(Uri endpoint, IDictionary parameters); - Task> GetAll(Uri endpoint, IDictionary parameters); + Task> GetAll(Uri endpoint, IDictionary parameters); Task Create(Uri endpoint, object data); Task Update(Uri endpoint, object data); Task Delete(Uri endpoint); diff --git a/Octokit/Http/InMemoryCredentialStore.cs b/Octokit/Http/InMemoryCredentialStore.cs index 78a433c5ec..622a31961f 100644 --- a/Octokit/Http/InMemoryCredentialStore.cs +++ b/Octokit/Http/InMemoryCredentialStore.cs @@ -1,21 +1,19 @@ -using System.Threading.Tasks; - -namespace Octokit.Http +namespace Octokit.Http { public class InMemoryCredentialStore : ICredentialStore { - readonly Credentials credentials; + readonly Credentials _credentials; public InMemoryCredentialStore(Credentials credentials) { Ensure.ArgumentNotNull(credentials, "credentials"); - this.credentials = credentials; + _credentials = credentials; } public Credentials GetCredentials() { - return credentials; + return _credentials; } } } \ No newline at end of file diff --git a/Octokit/Http/ReadOnlyPagedCollection.cs b/Octokit/Http/ReadOnlyPagedCollection.cs index 37e23ff4bd..e631767bd6 100644 --- a/Octokit/Http/ReadOnlyPagedCollection.cs +++ b/Octokit/Http/ReadOnlyPagedCollection.cs @@ -6,8 +6,8 @@ namespace Octokit.Http { public class ReadOnlyPagedCollection : ReadOnlyCollection, IReadOnlyPagedCollection { - readonly IConnection connection; - readonly ApiInfo info; + readonly IConnection _connection; + readonly ApiInfo _info; public ReadOnlyPagedCollection(IResponse> response, IConnection connection) : base(response != null ? response.BodyAsObject : null) @@ -15,17 +15,17 @@ public ReadOnlyPagedCollection(IResponse> response, IConnection connecti Ensure.ArgumentNotNull(response, "response"); Ensure.ArgumentNotNull(connection, "connection"); - this.connection = connection; - info = response.ApiInfo; + _connection = connection; + _info = response.ApiInfo; } public async Task> GetNextPage() { - var nextPageUrl = info.GetNextPageUrl(); + var nextPageUrl = _info.GetNextPageUrl(); if (nextPageUrl == null) return null; - var response = await connection.GetAsync>(nextPageUrl, null); - return new ReadOnlyPagedCollection(response, connection); + var response = await _connection.GetAsync>(nextPageUrl, null); + return new ReadOnlyPagedCollection(response, _connection); } } } diff --git a/Octokit/IApiPagination.cs b/Octokit/IApiPagination.cs index a6aae0e7fd..6f3ddb2117 100644 --- a/Octokit/IApiPagination.cs +++ b/Octokit/IApiPagination.cs @@ -6,6 +6,6 @@ namespace Octokit { public interface IApiPagination { - Task> GetAllPages(Func>> getFirstPage); + Task> GetAllPages(Func>> getFirstPage); } } \ No newline at end of file diff --git a/Octokit/IAuthorizationsClient.cs b/Octokit/IAuthorizationsClient.cs index f4371da288..68c4929ed9 100644 --- a/Octokit/IAuthorizationsClient.cs +++ b/Octokit/IAuthorizationsClient.cs @@ -8,7 +8,7 @@ public interface IAuthorizationsClient { [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "It's an API call, so it's not a property.")] - Task> GetAll(); + Task> GetAll(); [SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get", Justification = "It's fiiiine. It's fine. Trust us.")] Task Get(int id); diff --git a/Octokit/IOrganizationsClient.cs b/Octokit/IOrganizationsClient.cs index dd20d41fff..e78d74d452 100644 --- a/Octokit/IOrganizationsClient.cs +++ b/Octokit/IOrganizationsClient.cs @@ -21,13 +21,13 @@ public interface IOrganizationsClient /// [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Method makes a network request")] - Task> GetAllForCurrent(); + Task> GetAllForCurrent(); /// /// Returns all the organizations for the specified user /// /// /// - Task> GetAll(string user); + Task> GetAll(string user); } } diff --git a/Octokit/IReadOnlyPagedCollection.cs b/Octokit/IReadOnlyPagedCollection.cs index f1a217d766..a0c47873f7 100644 --- a/Octokit/IReadOnlyPagedCollection.cs +++ b/Octokit/IReadOnlyPagedCollection.cs @@ -5,10 +5,10 @@ namespace Octokit { /// - /// Reflects a collection of datat returned from an API that can be paged. + /// Reflects a collection of data returned from an API that can be paged. /// /// - public interface IReadOnlyPagedCollection : IReadOnlyCollection + public interface IReadOnlyPagedCollection : IReadOnlyList { /// /// Returns the next page of items. diff --git a/Octokit/IReleasesClient.cs b/Octokit/IReleasesClient.cs index 6be68490b3..5314a5838b 100644 --- a/Octokit/IReleasesClient.cs +++ b/Octokit/IReleasesClient.cs @@ -11,7 +11,7 @@ public interface IReleasesClient /// The owner of the repository. /// The name of the repository. /// A of . - Task> GetAll(string owner, string name); + Task> GetAll(string owner, string name); /// /// Create a for the specified repository. diff --git a/Octokit/IRepositoriesClient.cs b/Octokit/IRepositoriesClient.cs index 4120013123..47c7a44d79 100644 --- a/Octokit/IRepositoriesClient.cs +++ b/Octokit/IRepositoriesClient.cs @@ -26,7 +26,7 @@ public interface IRepositoriesClient /// A of . [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Makes a network request")] - Task> GetAllForCurrent(); + Task> GetAllForCurrent(); /// /// Retrieves every that belongs to the specified user. @@ -37,7 +37,7 @@ public interface IRepositoriesClient /// A of . [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Makes a network request")] - Task> GetAllForUser(string login); + Task> GetAllForUser(string login); /// /// Retrieves every that belongs to the specified organization. @@ -48,7 +48,7 @@ public interface IRepositoriesClient /// A of . [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Makes a network request")] - Task> GetAllForOrg(string organization); + Task> GetAllForOrg(string organization); /// /// Returns the HTML rendered README. diff --git a/Octokit/ISshKeysClient.cs b/Octokit/ISshKeysClient.cs index ec4eb68eb7..2302612497 100644 --- a/Octokit/ISshKeysClient.cs +++ b/Octokit/ISshKeysClient.cs @@ -19,7 +19,7 @@ public interface ISshKeysClient /// /// The login of the user. /// A of . - Task> GetAll(string user); + Task> GetAll(string user); /// /// Retrieves the for the specified id. @@ -28,7 +28,7 @@ public interface ISshKeysClient /// A of . [SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "Makes a network request")] - Task> GetAllForCurrent(); + Task> GetAllForCurrent(); /// /// Update the specified . diff --git a/Octokit/Octokit.csproj b/Octokit/Octokit.csproj index 1672bee82a..b020b53e9a 100644 --- a/Octokit/Octokit.csproj +++ b/Octokit/Octokit.csproj @@ -18,7 +18,7 @@ full false bin\Debug\ - TRACE;DEBUG;CODE_ANALYSIS;SIMPLE_JSON_OBJARRAYINTERNAL;SIMPLE_JSON_INTERNAL + TRACE;DEBUG;CODE_ANALYSIS;CODE_ANALYSIS;SIMPLE_JSON_OBJARRAYINTERNAL;SIMPLE_JSON_INTERNAL prompt 4 true @@ -31,7 +31,7 @@ pdbonly true bin\Release\ - TRACE + TRACE;CODE_ANALYSIS;CODE_ANALYSIS;SIMPLE_JSON_OBJARRAYINTERNAL;SIMPLE_JSON_INTERNAL prompt 4 false diff --git a/Octokit/OctokitRT.csproj b/Octokit/OctokitRT.csproj index 1b1519f0c1..c5a4e8c382 100644 --- a/Octokit/OctokitRT.csproj +++ b/Octokit/OctokitRT.csproj @@ -28,7 +28,7 @@ pdbonly true bin\WinRT\Release\ - TRACE;NETFX_CORE;CODE_ANALYSIS;SIMPLE_JSON_OBJARRAYINTERNAL + TRACE;NETFX_CORE;CODE_ANALYSIS;SIMPLE_JSON_OBJARRAYINTERNAL;SIMPLE_JSON_INTERNAL;NET_45 prompt 4 diff --git a/script/cibuild.ps1 b/script/cibuild.ps1 index 15b5081530..bb26e07e6f 100644 --- a/script/cibuild.ps1 +++ b/script/cibuild.ps1 @@ -84,14 +84,14 @@ if ($LastExitCode -ne 0) { Die-WithOutput $exitCode $output } -function Run-XUnit([string]$project, [int]$timeoutDuration) { - $dll = "$project\bin\Release\$project.dll" +function Run-XUnit([string]$project, [int]$timeoutDuration, [string]$projectFolder = $project) { + $dll = "$projectFolder\bin\Release\$project.dll" $xunitDirectory = Join-Path $rootDirectory tools\xunit $consoleRunner = Join-Path $xunitDirectory xunit.console.clr4.x86.exe $xml = Join-Path $rootDirectory "nunit-$project.xml" - $output=(& $consoleRunner $dll /nunit $xml /silent /noshadow) + $output=(& $consoleRunner $dll /nunit $xml /silent /noshadow) $result = New-Object System.Object $result | Add-Member -Type NoteProperty -Name Output -Value $output @@ -112,6 +112,17 @@ if ($result.ExitCode -eq 0) { } Write-Output "" +Write-Output "Running OctokitRT.Tests..." +$result = Run-XUnit OctokitRT.Tests 120 Octokit.Tests +if ($result.ExitCode -eq 0) { + # Print out the test result summary. + Write-Output $result.Output[-1] +} else { + $exitCode = $result.ExitCode + Write-Output $result.Output +} +Write-Output "" + Write-Output "Running Octokit.Tests.Integration..." $result = Run-XUnit Octokit.Tests.Integration 180 if ($result.ExitCode -eq 0) {